geographiclib-1.21/0002755000175000017500000000000011757437426014076 5ustar frankiefrankiegeographiclib-1.21/m4/0002755000175000017500000000000011757437425014415 5ustar frankiefrankiegeographiclib-1.21/m4/libtool.m40000644000175000017500000104515511745620414016321 0ustar frankiefrankie# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, # Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, # Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool 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 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2010 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES # -------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test "$lt_cv_ld_force_load" = "yes"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script which will find a shell with a builtin # printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[123]]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; haiku*) version_type=linux need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ F* | *Sun*Fortran*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; freebsd1*) _LT_TAGVAR(ld_shlibs, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], [[If ld is used when linking, flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd[[12]]*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS geographiclib-1.21/m4/ltversion.m40000644000175000017500000000125611745620414016673 0ustar frankiefrankie# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 3293 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4]) m4_define([LT_PACKAGE_REVISION], [1.3293]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4' macro_revision='1.3293' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) geographiclib-1.21/m4/lt~obsolete.m40000644000175000017500000001375611745620414017230 0ustar frankiefrankie# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) geographiclib-1.21/m4/ltoptions.m40000644000175000017500000002725611745620414016711 0ustar frankiefrankie# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, # Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [pic_mode="$withval"], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) geographiclib-1.21/m4/ltsugar.m40000644000175000017500000001042411745620414016324 0ustar frankiefrankie# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) geographiclib-1.21/doc/0002755000175000017500000000000011757437426014643 5ustar frankiefrankiegeographiclib-1.21/doc/html/0002755000175000017500000000000011757437426015607 5ustar frankiefrankiegeographiclib-1.21/doc/html/NormalGravity_8hpp_source.html0000644000175000017500000012425111745620414023601 0ustar frankiefrankie GeographicLib: NormalGravity.hpp Source File
NormalGravity.hpp
Go to the documentation of this file.
00001 /**
00002  * \file NormalGravity.hpp
00003  * \brief Header for GeographicLib::NormalGravity class
00004  *
00005  * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under
00006  * the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_NORMALGRAVITY_HPP)
00011 #define GEOGRAPHICLIB_NORMALGRAVITY_HPP \
00012   "$Id: e4b65c9c5787d8ee14f476cbb518fd5007006344 $"
00013 
00014 #include <GeographicLib/Constants.hpp>
00015 #include <GeographicLib/Geocentric.hpp>
00016 
00017 namespace GeographicLib {
00018 
00019   /**
00020    * \brief The normal gravity of the earth
00021    *
00022    * "Normal" gravity refers to an idealization of the earth which is modeled
00023    * as an rotating ellipsoid.  The eccentricity of the ellipsoid, the rotation
00024    * speed, and the distribution of mass within the ellipsoid are such that the
00025    * surface of the ellipsoid is a surface of constant potential (gravitational
00026    * plus centrifugal).  The acceleration due to gravity is therefore
00027    * perpendicular to the surface of the ellipsoid.
00028    *
00029    * There is a closed solution to this problem which is implemented here.
00030    * Series "approximations" are only used to evaluate certain combinations of
00031    * elementary functions where use of the closed expression results in a loss
00032    * of accuracy for small arguments due to cancellation of the two leading
00033    * terms.  However these series include sufficient terms to give full machine
00034    * precision.
00035    *
00036    * Definitions:
00037    * - <i>V</i><sub>0</sub>, the gravitational contribution to the normal
00038    *   potential;
00039    * - \e Phi, the rotational contribution to the normal potential;
00040    * - \e U = <i>V</i><sub>0</sub> + \e Phi, the total
00041    *   potential;
00042    * - <b>Gamma</b> = <b>grad</b> <i>V</i><sub>0</sub>, the acceleration due to
00043    *   mass of the earth;
00044    * - <b>f</b> = <b>grad</b> \e Phi, the centrifugal acceleration;
00045    * - <b>gamma</b> = <b>grad</b> \e U = <b>Gamma</b> + <b>f</b>, the normal
00046    *   acceleration;
00047    * - \e X, \e Y, \e Z, geocentric coordinates;
00048    * - \e x, \e y, \e z, local cartesian coordinates used to denote the east,
00049    *   north and up directions.
00050    *
00051    * References:
00052    * - W. A. Heiskanen and H. Moritz, Physical Geodesy (Freeman, San
00053    *   Francisco, 1967), Secs. 1-19, 2-7, 2-8 (2-9, 2-10), 6-2 (6-3).
00054    * - H. Moritz, Geodetic Reference System 1980, J. Geod. 54(3), 395-405
00055    *   (1980) http://dx.doi.org/10.1007/BF02521480
00056    *
00057    * Example of use:
00058    * \include example-NormalGravity.cpp
00059    **********************************************************************/
00060 
00061   class GEOGRAPHIC_EXPORT NormalGravity {
00062   private:
00063     static const int maxit_ = 10;
00064     typedef Math::real real;
00065     friend class GravityModel;
00066     real _a, _GM, _omega, _f, _J2, _omega2, _aomega2;
00067     real _e2, _ep2, _b, _E, _U0, _gammae, _gammap, _q0, _m, _k, _fstar;
00068     Geocentric _earth;
00069     static Math::real qf(real ep2) throw();
00070     static Math::real qpf(real ep2) throw();
00071     Math::real Jn(int n) const throw();
00072   public:
00073 
00074     /** \name Setting up the normal gravity
00075      **********************************************************************/
00076     ///@{
00077     /**
00078      * Constructor for the normal gravity.
00079      *
00080      * @param[in] a equatorial radius (meters).
00081      * @param[in] GM mass constant of the ellipsoid
00082      *   (meters<sup>3</sup>/seconds<sup>2</sup>); this is the product of \e G
00083      *   the gravitational constant and \e M the mass of the earth (usually
00084      *   including the mass of the earth's atmosphere).
00085      * @param[in] omega the angular velocity (rad s<sup>-1</sup>).
00086      * @param[in] f the flattening of the ellipsoid.
00087      * @param[in] J2 dynamical form factor.
00088      *
00089      * Exactly one of \e f and \e J2 should be positive and this will be used
00090      * to define the ellipsoid.  The shape of the ellipsoid can be given in one
00091      * of two ways:
00092      * - geometrically, the ellipsoid is defined by the flattening \e f =
00093      *   (\e a - \e b) / \e a, where \e a and \e b are the equatorial radius
00094      *   and the polar semi-axis.
00095      * - physically, the ellipsoid is defined by the dynamical form factor
00096      *   <i>J</i><sub>2</sub> = (\e C - \e A) / <i>Ma</i><sup>2</sup>, where \e
00097      *   A and \e C are the equatorial and polar moments of inertia and \e M is
00098      *   the mass of the earth.
00099      **********************************************************************/
00100     NormalGravity(real a, real GM, real omega, real f, real J2);
00101 
00102     /**
00103      * A default constructor for the normal gravity.  This sets up an
00104      * uninitialized object and is used by GravityModel which constructs this
00105      * object before it has read in the parameters for the reference ellipsoid.
00106      **********************************************************************/
00107     NormalGravity() : _a(-1) {}
00108     ///@}
00109 
00110     /** \name Compute the gravity
00111      **********************************************************************/
00112     ///@{
00113     /**
00114      * Evaluate the gravity on the surface of the ellipsoid.
00115      *
00116      * @param[in] lat the geographic latitude (degrees).
00117      * @return \e gamma the acceleration due to gravity, positive downwards
00118      *   (m s<sup>-2</sup>).
00119      *
00120      * Due to the axial symmetry of the ellipsoid, the result is independent of
00121      * the value of the longitude.  This acceleration is perpendicular to the
00122      * surface of the ellipsoid.  It includes the effects of the earth's
00123      * rotation.
00124      **********************************************************************/
00125     Math::real SurfaceGravity(real lat) const throw();
00126 
00127     /**
00128      * Evaluate the gravity at an arbitrary point above (or below) the
00129      * ellipsoid.
00130      *
00131      * @param[in] lat the geographic latitude (degrees).
00132      * @param[in] h the height above the ellipsoid (meters).
00133      * @param[out] gammay the northerly component of the acceleration
00134      *   (m s<sup>-2</sup>).
00135      * @param[out] gammaz the upward component of the acceleration
00136      *   (m s<sup>-2</sup>); this is usually negative.
00137      * @return \e U the corresponding normal potential.
00138      *
00139      * Due to the axial symmetry of the ellipsoid, the result is independent of
00140      * the value of the longitude and the easterly component of the
00141      * acceleration vanishes, \e gammax = 0.  The function includes the effects
00142      * of the earth's rotation.  When \e h = 0, this function gives \e gammay =
00143      * 0 and the returned value matches that of NormalGravity::SurfaceGravity.
00144      **********************************************************************/
00145     Math::real Gravity(real lat, real h, real& gammay, real& gammaz)
00146       const throw();
00147 
00148     /**
00149      * Evaluate the components of the acceleration due to gravity and the
00150      * centrifugal acceleration in geocentric coordinates.
00151      *
00152      * @param[in] X geocentric coordinate of point (meters).
00153      * @param[in] Y geocentric coordinate of point (meters).
00154      * @param[in] Z geocentric coordinate of point (meters).
00155      * @param[out] gammaX the \e X component of the acceleration
00156      *   (m s<sup>-2</sup>).
00157      * @param[out] gammaY the \e Y component of the acceleration
00158      *   (m s<sup>-2</sup>).
00159      * @param[out] gammaZ the \e Z component of the acceleration
00160      *   (m s<sup>-2</sup>).
00161      * @return \e U = <i>V</i><sub>0</sub> + \e Phi the sum of the
00162      *   gravitational and centrifugal potentials
00163      *   (m<sup>2</sup> s<sup>-2</sup>).
00164      *
00165      * The acceleration given by <b>gamma</b> = <b>grad</b> \e U = <b>grad</b>
00166      * <i>V</i><sub>0</sub> + <b>grad</b> \e Phi = <b>Gamma</b> + <b>f</b>.
00167      **********************************************************************/
00168     Math::real U(real X, real Y, real Z,
00169                  real& gammaX, real& gammaY, real& gammaZ) const throw();
00170 
00171     /**
00172      * Evaluate the components of the acceleration due to gravity alone in
00173      * geocentric coordinates.
00174      *
00175      * @param[in] X geocentric coordinate of point (meters).
00176      * @param[in] Y geocentric coordinate of point (meters).
00177      * @param[in] Z geocentric coordinate of point (meters).
00178      * @param[out] GammaX the \e X component of the acceleration due to gravity
00179      *   (m s<sup>-2</sup>).
00180      * @param[out] GammaY the \e Y component of the acceleration due to gravity
00181      *   (m s<sup>-2</sup>).
00182      * @param[out] GammaZ the \e Z component of the acceleration due to gravity
00183      *   (m s<sup>-2</sup>).
00184      * @return <i>V</i><sub>0</sub> the gravitational potential
00185      *   (m<sup>2</sup> s<sup>-2</sup>).
00186      *
00187      * This function excludes the centrifugal acceleration and is appropriate
00188      * to use for space applications.  In terrestrial applications, the
00189      * function NormalGravity::U (which includes this effect) should usually be
00190      * used.
00191      **********************************************************************/
00192     Math::real V0(real X, real Y, real Z,
00193                   real& GammaX, real& GammaY, real& GammaZ) const throw();
00194 
00195     /**
00196      * Evaluate the centrifugal acceleration in geocentric coordinates.
00197      *
00198      * @param[in] X geocentric coordinate of point (meters).
00199      * @param[in] Y geocentric coordinate of point (meters).
00200      * @param[out] fX the \e X component of the centrifugal acceleration
00201      *   (m s<sup>-2</sup>).
00202      * @param[out] fY the \e Y component of the centrifugal acceleration
00203      *   (m s<sup>-2</sup>).
00204      * @return \e Phi the centrifugal potential (m<sup>2</sup> s<sup>-2</sup>).
00205      *
00206      * \e Phi is independent of \e Z, thus \e fZ = 0.  This function
00207      * NormalGravity::U sums the results of NormalGravity::V0 and
00208      * NormalGravity::Phi.
00209      **********************************************************************/
00210     Math::real Phi(real X, real Y, real& fX, real& fY) const throw();
00211     ///@}
00212 
00213     /** \name Inspector functions
00214      **********************************************************************/
00215     ///@{
00216     /**
00217      * @return true if the object has been initialized.
00218      **********************************************************************/
00219     bool Init() const throw() { return _a > 0; }
00220 
00221     /**
00222      * @return \e a the equatorial radius of the ellipsoid (meters).  This is
00223      *   the value used in the constructor.
00224      **********************************************************************/
00225     Math::real MajorRadius() const throw()
00226     { return Init() ? _a : Math::NaN<real>(); }
00227 
00228     /**
00229      * @return \e GM the mass constant of the ellipsoid
00230      *   (m<sup>3</sup> s<sup>-2</sup>).  This is the value used in the
00231      *   constructor.
00232      **********************************************************************/
00233     Math::real MassConstant() const throw()
00234     { return Init() ? _GM : Math::NaN<real>(); }
00235 
00236     /**
00237      * @return \e J<sub>n</sub> the dynamical form factors of the ellipsoid.
00238      *
00239      * If \e n = 2 (the default), this is the value of <i>J</i><sub>2</sub>
00240      * used in the constructor.  Otherwise it is the zonal coefficient of the
00241      * Legendre harmonic sum of the normal gravitational potential.  Note that
00242      * \e J<sub>n</sub> = 0 if \e is odd.  In most gravity applications, fully
00243      * normalized Legendre functions are used and the corresponding coefficient
00244      * is <i>C</i><sub><i>n</i>0</sub> = -\e J<sub>n</sub> / sqrt(2 \e n + 1).
00245      **********************************************************************/
00246     Math::real DynamicalFormFactor(int n = 2) const throw()
00247     { return Init() ? ( n == 2 ? _J2 : Jn(n)) : Math::NaN<real>(); }
00248 
00249     /**
00250      * @return \e omega the angular velocity of the ellipsoid
00251      *   (rad s<sup>-1</sup>).  This is the value used in the constructor.
00252      **********************************************************************/
00253     Math::real AngularVelocity() const throw()
00254     { return Init() ? _omega : Math::NaN<real>(); }
00255 
00256     /**
00257      * @return <i>f</i> the flattening of the ellipsoid (\e a - \e b)/\e a.
00258      **********************************************************************/
00259     Math::real Flattening() const throw()
00260     { return Init() ? _f : Math::NaN<real>(); }
00261 
00262     /**
00263      * @return <i>gamma</i><sub>e</sub> the normal gravity at equator
00264      *   (m s<sup>-2</sup>).
00265      **********************************************************************/
00266     Math::real EquatorialGravity() const throw()
00267     { return Init() ? _gammae : Math::NaN<real>(); }
00268 
00269     /**
00270      * @return <i>gamma</i><sub>p</sub> the normal gravity at poles
00271      *   (m s<sup>-2</sup>).
00272      **********************************************************************/
00273     Math::real PolarGravity() const throw()
00274     { return Init() ? _gammap : Math::NaN<real>(); }
00275 
00276     /**
00277      * @return <i>f*</i> the gravity flattening
00278      *   (<i>gamma</i><sub>p</sub> - <i>gamma</i><sub>e</sub>) /
00279      *   <i>gamma</i><sub>e</sub>.
00280      **********************************************************************/
00281     Math::real GravityFlattening() const throw()
00282     { return Init() ? _fstar : Math::NaN<real>(); }
00283 
00284     /**
00285      * @return <i>U</i><sub>0</sub> the constant normal potential for the
00286      *   surface of the ellipsoid (m<sup>2</sup> s<sup>-2</sup>).
00287      **********************************************************************/
00288     Math::real SurfacePotential() const throw()
00289     { return Init() ? _U0 : Math::NaN<real>(); }
00290 
00291     /**
00292      * @return the Geocentric object used by this instance.
00293      **********************************************************************/
00294     const Geocentric& Earth() const throw() { return _earth; }
00295     ///@}
00296 
00297     /**
00298      * A global instantiation of NormalGravity for the WGS84 ellipsoid.
00299      **********************************************************************/
00300     static const NormalGravity WGS84;
00301 
00302     /**
00303      * A global instantiation of NormalGravity for the GRS80 ellipsoid.
00304      **********************************************************************/
00305     static const NormalGravity GRS80;
00306   };
00307 
00308 } // namespace GeographicLib
00309 
00310 #endif  // GEOGRAPHICLIB_NORMALGRAVITY_HPP
geographiclib-1.21/doc/html/old.html0000644000175000017500000012152411745620414017242 0ustar frankiefrankie GeographicLib: Old versions
Old versions
Back to Geocentric coordinates. Up to Contents.

List of versions in reverse chronological order together with a brief list of changes. (Note: Old versions of the library use a year-month style of numbering. Now, the library uses a major and minor version number.) Recent versions of GeographicLib are available at http://sourceforge.net/projects/geographiclib/files/distrib/. Older versions are in http://sourceforge.net/projects/geographiclib/files/distrib/archive/.

  • Version 1.21 (released 2012-04-25)
    • Support colon-separated DMS output:
    • GeoidEval does not print the gradient of the geoid height by default (because it's subject to large errors); give the -g option to get the gradient printed.
    • Work around optimization BUG in GeographicLib::Geodesic::Inverse with tdm mingw g++ version 4.6.1.
    • autoconf fixed to ensure that that out-of-sources builds work; document this as the preferred method of using autoconf.
    • cmake tweaks:
      • simplify the configuration of doxygen;
      • allow the Matlab compiler to be specified with the MATLAB_COMPILER option.
  • Version 1.20 (released 2012-03-23)
    • cmake tweaks:
      • improve find_package's matching of compiler versions;
      • CMAKE_INSTALL_PREFIX set from CMAKE_PREFIX_PATH if available;
      • add "x64" to the package name for the 64-bit binary installer;
      • fix cmake warning with Visual Studio Express.
    • Fix GeographicLib::SphericalEngine to deal with aggessive iterator checking by Visual Studio.
    • Fix transcription BUG is Geodesic.js.
  • Version 1.18 (released 2012-02-18)
    • Improve documentation on configuration with cmake.
    • cmake's find_package ensures that the compiler versions match on Windows.
    • Improve documentation on compiling Matlab interface.
    • Binary installer for Windows installs under C:/pkg-vc10 by default.
  • Version 1.14 (released 2011-09-30)
    • Ensure that geographiclib-config.cmake is relocatable.
    • Allow more unicode symbols to be used in GeographicLib::DMS::Decode.
    • Modify GeoidEval so that it can be used to convert the height datum for LIDAR data.
    • Modest speed-up of Geodesic::Inverse.
    • Changes in python interface:
    • Supply a minimal Qt qmake project file for library src/Geographic.pro.
  • Version 1.13 (released 2011-08-13)
    • Changes to I/O:
    • Slight improvement in starting guess for solution of geographic latitude in terms of conformal latitude in TransverseMercator, TransverseMercatorExact, and LambertConformalConic.
    • For most classes, get rid of const member variables so that the default copy assignment works.
    • Put GeographicLib::Math and GeographicLib::Accumulator in their own header files.
    • Remove unused "fast" GeographicLib::Accumulator method.
    • Reorganize the Python interface.
    • Withdraw some deprecated routines.
    • cmake changes:
      • include FindGeographic.cmake in distribution;
      • building with cmake creates and installs geographiclib-config.cmake;
      • better support for building a shared library under Windows.
  • Version 1.12 (released 2011-07-21)
    • Change license to MIT/X11.
    • Add GeographicLib::PolygonArea class and equivalent Matlab function.
    • Provide Javascript and Python implementations of geodesic routines.
    • Fix Windows installer to include runtime dlls for Matlab.
    • Fix (innocuous) unassigned variable in Geodesic::GenInverse.
    • Geodesic routines in Matlab return a12 as first column of aux return value (incompatible change).
    • A couple of code changes to enable compilation with Visual Studio 2003.
  • Version 1.11 (released 2011-06-27)
    • Changes to Planimeter:
      • add -l flag to Planimeter for polyline calculations;
      • trim precision of area to 3 decimal places;
      • FIX BUG with pole crossing edges (due to compiler optimization).
    • Geod no longer reports the reduced length by default; however the -f flag still reports this and in addition gives the geodesic scales and the geodesic area.
    • FIX BUGS (compiler-specific) in inverse geodesic calculations.
    • FIX BUG: accommodate tellg() returning -1 at end of string.
    • Change way flattening of the ellipsoid is specified:
      • constructors take f argument which is taken to be the flattening if f < 1 and the inverse flattening otherwise (this is a compatible change for spheres and oblate ellipsoids, but it is an INCOMPATIBLE change for prolate ellipsoids);
      • the -e arguments to the Utility programs are handled similarly; in addition, simple fractions, e.g., 1/297, can be used for the flattening;
      • introduce GeographicLib::Constants::WGS84_f() for the WGS84 flattening (and deprecate Constants::WGS84_r() for the inverse flattening);
      • most classes have a Flattening() member function;
      • InverseFlattening() has been deprecated (and now returns inf for a sphere, instead of 0).
  • Version 1.10 (released 2011-06-11)
    • Improvements to Matlab/Octave interface:
      • add {geocentric,localcartesian}{forward,reverse};
      • make geographiclibinterface more general;
      • install the source for the interface;
      • cmake compiles the interface if ENABLE_MATLAB=ON;
      • include compiled interface with Windows binary installer.
    • Fix various configuration issues
      • autoconf did not install Config.h;
      • cmake installed in man/man1 instead of share/man/man1;
      • cmake did not set the rpath on the tools.
  • Version 1.7 (released 2010-12-21)
    • FIX BUG in scale returned by GeographicLib::LambertConformalConic::Reverse.
    • Add GeographicLib::AlbersEqualArea projection.
    • Library created by Visual Studio is Geographic.lib instead of GeographicLib.lib (compatible with makefiles).
    • Make classes NaN aware.
    • Use cell arrays for MGRS strings in Matlab.
    • Add solution/project files for Visual Studio 2010 (32-bit only).
    • Use C++11 static_assert and math functions, if available.
  • Version 1.6 (released 2010-11-23)
  • Version 1.4 (released 2010-09-12)
    • Changes to GeographicLib::Geodesic and GeographicLib::GeodesicLine:
      • FIX BUG in Geodesic::Inverse with prolate ellipsoids;
      • add area computations to Geodesic::Direct and Geodesic::Inverse;
      • add geodesic areas to geodesic test set;
      • make GeodesicLine constructor public;
      • change longitude series in Geodesic into Helmert-like form;
      • ensure that equatorial geodesics have cos(alpha0) = 0 identically;
      • generalize interface for Geodesic and GeodesicLine;
      • split GeodesicLine and Geodesic into different files;
      • signal convergence failure in Geodesic::Inverse with NaNs;
      • deprecate one function in Geodesic and two functions in GeodesicLine;
      • deprecate -n option for Geod.
      WARNING: These changes may break binary compatibility with previous versions of GeographicLib. However, the library is source compatible (with the proviso that GeographicLib/GeodesicLine.hpp may now need to be included).
    • Add the Planimeter utility for computing the areas of geodesic polygons.
    • Improve iterative solution of GeographicLib::Gnomonic::Reverse.
    • Add GeographicLib::Geoid::ConvertHeight.
    • Add -msltohae, -haetomsl, and -z options to GeoidEval.
    • Constructors check that minor radius is positive.
    • Add overloaded Forward and Reverse functions to the projection classes which don't return the convergence (or azimuth) and scale.
    • Document function parameters and return values consistently.
  • Version 1.3 (released 2010-07-21)
  • Version 1.1 (released 2010-02-09)
    • FIX BUG (introduced in 2009-03) in EllipticFunction::E(sn,cn,dn).
    • Increase accuracy of scale calculation in TransverseMercator and TransverseMercatorExact.
    • Code and documentation changes for consistency with arXiv:1002.1417
  • Version 1.0 (released 2010-01-07)
    • Add autoconf configuration files.
    • BUG FIX: Improve initial guess for Newton's method in PolarStereographic::Reverse. (Previously this failed to converge when the co-latitude exceeded about 130 deg.)
    • Constructors for TransverseMercator, TransverseMercatorExact, PolarStereographic, Geocentric, and Geodesic now check for obvious problems with their arguments and throw an exception if necessary.
    • Most classes now include inspector functions such as MajorRadius() so that you can determine how instances were constructed.
    • Add GeographicLib::LambertConformalConic class.
    • Add GeographicLib::PolarStereographic::SetScale to allow the latitude of true scale to be specified.
    • Add solution and project files for Visual Studio 2008.
    • Add GeographicLib::GeographicErr for exceptions.
    • GeographicLib::Geoid changes:
      • BUG FIX: fix typo in GeographicLib::Geoid::Cache which could cause a segmentation fault in some cases when the cached area spanned the prime meridian.
      • Include sufficient edge data to allow heights to be returned for cached area without disk reads;
      • Add inspector functions to query the extent of the cache.
  • Version 2009-11
  • Version 2009-10
    • Change web site to http://geographiclib.sourceforge.net
    • Several house-cleaning changes:
      • Change from the a flat directory structure to a more easily maintained one.
      • Introduce Math class for common mathematical functions (in Constants.hpp).
      • Use Math::real as the type for all real quantities. By default this is typedef'ed to double; and the library should be installed this way.
      • Eliminate const reference members of AzimuthalEquidistant, CassiniSoldner and LocalCartesian so that they may be copied.
      • Make several constructors explicit. Disallow some constructors. Disallow copy constructor/assignment for Geoid.
      • Document least squares formulas in Geoid.cpp.
      • Use unsigned long long for files positions of geoid files in Geoid.
      • Introduce optional mgrslimits argument in UTMUPS::Forward and UTMUPS::Reverse to enforce stricter MGRS limits on eastings and northings.
      • Add 64-bit targets in Visual Studio project files.
  • Version 2009-07
    • Speed up the series inversion code in tmseries.mac and geod.mac.
    • Reference Borkowski in section on Geocentric coordinates.
  • Version 2009-04
    • Use compile-time constants to select the order of series in GeographicLib::TransverseMercator.
    • 2x unroll of Clenshaw summation to avoid data shuffling.
    • Simplification of GeographicLib::EllipticFunction::E.
    • Use STATIC_ASSERT for compile-time checking of constants.
    • Improvements to GeographicLib::Geodesic:
      • compile-time option to change order of series used,
      • post Maxima code for generating the series,
      • tune the order of series for double,
      • improvements in the selection of starting points for Newton's method,
      • accept and return spherical arc lengths,
      • works with both oblate and prolate ellipsoids,
      • add -a, -e, -b options to the Geod utility.
  • Version 2009-02
    • Fix documentation of constructors (flattening -> inverse flattening).
    • Use std versions of math functions.
    • Add GeographicLib::ECEF and GeographicLib::LocalCartesian classes and the ECEFConvert utility.
    • Gather the documentation on the Utility programs onto one page.
  • Version 2009-01
    • First proper release of library.
    • More robust GeographicLib::TransverseMercatorExact:
      • Introduce extendp version of constructor,
      • Test against extended test data,
      • Optimize starting positions for Newton's method,
      • Fix behavior near all singularities,
      • Fix order dependence in C++ start-up code,
      • Improved method of computing scale and convergence.
    • Documentation on transverse Mercator projection.
    • Add GeographicLib::MGRS, GeographicLib::UTMUPS, etc.
  • Version 2008-09
    • Ad hoc posting of information on the transverse Mercator projection.
Back to Geocentric coordinates. Up to Contents.
geographiclib-1.21/doc/html/classGeographicLib_1_1Geoid.html0000644000175000017500000015474011745620415023630 0ustar frankiefrankie GeographicLib: GeographicLib::Geoid Class Reference
GeographicLib::Geoid Class Reference

Looking up the height of the geoid. More...

#include <GeographicLib/Geoid.hpp>

List of all members.

Public Types

enum  convertflag { ELLIPSOIDTOGEOID = -1, NONE = 0, GEOIDTOELLIPSOID = 1 }

Public Member Functions

Setting up the geoid
 Geoid (const std::string &name, const std::string &path="", bool cubic=true, bool threadsafe=false)
void CacheArea (real south, real west, real north, real east) const
void CacheAll () const
void CacheClear () const throw ()
Compute geoid heights
Math::real operator() (real lat, real lon) const
Math::real operator() (real lat, real lon, real &gradn, real &grade) const
Math::real ConvertHeight (real lat, real lon, real h, convertflag d) const
Inspector functions
const std::string & Description () const throw ()
const std::string & DateTime () const throw ()
const std::string & GeoidFile () const throw ()
const std::string & GeoidName () const throw ()
const std::string & GeoidDirectory () const throw ()
const std::string Interpolation () const
Math::real MaxError () const throw ()
Math::real RMSError () const throw ()
Math::real Offset () const throw ()
Math::real Scale () const throw ()
bool ThreadSafe () const throw ()
bool Cache () const throw ()
Math::real CacheWest () const throw ()
Math::real CacheEast () const throw ()
Math::real CacheNorth () const throw ()
Math::real CacheSouth () const throw ()
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()

Static Public Member Functions

static std::string DefaultGeoidPath ()
static std::string DefaultGeoidName ()

Detailed Description

Looking up the height of the geoid.

This class evaluated the height of one of the standard geoids, EGM84, EGM96, or EGM2008 by bilinear or cubic interpolation into a rectangular grid of data. These geoid models are documented in

The geoids are defined in terms of spherical harmonics. However in order to provide a quick and flexible method of evaluating the geoid heights, this class evaluates the height by interpolation into a grid of precomputed values.

See Geoid height for details of how to install the data sets, the data format, estimates of the interpolation errors, and how to use caching.

In addition to returning the geoid height, the gradient of the geoid can be calculated. The gradient is defined as the rate of change of the geoid as a function of position on the ellipsoid. This uses the parameters for the WGS84 ellipsoid. The gradient defined in terms of the interpolated heights. As a result of the way that the geoid data is stored, the calculation of gradients can result in large quantization errors. This is particularly acute for fine grids, at high latitudes, and for the easterly gradient.

This class is typically not thread safe in that a single instantiation cannot be safely used by multiple threads because of the way the object reads the data set and because it maintains a single-cell cache. If multiple threads need to calculate geoid heights they should all construct thread-local instantiations. Alternatively, set the optional threadsafe parameter to true in the constructor. This causes the constructor to read all the data into memory and to turn off the single-cell caching which results in a Geoid object which is thread safe.

Example of use:

// Example of using the GeographicLib::Geoid class
// $Id: 2ba4534ebb4c4853dc111932fe44b4bf85ac8149 $

#include <iostream>
#include <exception>
#include <GeographicLib/Geoid.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    Geoid egm96("egm96-5");
    // Convert height above egm96 to height above the ellipsoid
    double lat = 42, lon = -75, height_above_geoid = 20;
    double
      geoid_height = egm96(lat, lon),
      height_above_ellipsoid = (height_above_geoid +
                                Geoid::GEOIDTOELLIPSOID * geoid_height);
    cout << height_above_ellipsoid << "\n";
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

GeoidEval is a command-line utility providing access to the functionality of Geoid.


Member Enumeration Documentation

Flags indicating conversions between heights above the geoid and heights above the ellipsoid.

Enumerator:
ELLIPSOIDTOGEOID 

The multiplier for converting from heights above the geoid to heights above the ellipsoid.

NONE 

No conversion.

GEOIDTOELLIPSOID 

The multiplier for converting from heights above the ellipsoid to heights above the geoid.

Definition at line 185 of file Geoid.hpp.


Constructor & Destructor Documentation

GeographicLib::Geoid::Geoid ( const std::string &  name,
const std::string &  path = "",
bool  cubic = true,
bool  threadsafe = false 
) [explicit]

Construct a geoid.

Parameters:
[in]namethe name of the geoid.
[in]path(optional) directory for data file.
[in]cubic(optional) interpolation method; false means bilinear, true (the default) means cubic.
[in]threadsafe(optional), if true, construct a thread safe object. The default is false

The data file is formed by appending ".pgm" to the name. If path is specified (and is non-empty), then the file is loaded from directory, path. Otherwise the path is given by DefaultGeoidPath(). This may throw an exception because the file does not exist, is unreadable, or is corrupt. If the threadsafe parameter is true, the data set is read into memory (which this may also cause an exception to be thrown), the data file is closed, and single-cell caching is turned off; this results in a Geoid object which is thread safe.

Definition at line 208 of file Geoid.cpp.

References STATIC_ASSERT, DefaultGeoidPath(), and CacheAll().


Member Function Documentation

void GeographicLib::Geoid::CacheArea ( real  south,
real  west,
real  north,
real  east 
) const

Set up a cache.

Parameters:
[in]southlatitude (degrees) of the south edge of the cached area.
[in]westlongitude (degrees) of the west edge of the cached area.
[in]northlatitude (degrees) of the north edge of the cached area.
[in]eastlongitude (degrees) of the east edge of the cached area.

Cache the data for the specified "rectangular" area bounded by the parallels south and north and the meridians west and east. east is always interpreted as being east of west, if necessary by adding 360o to its value. This may throw an error because of insufficient memory or because of an error reading the data from the file. In this case, you can catch the error and either do nothing (you will have no cache in this case) or try again with a smaller area. south and north should be in the range [-90, 90]; west and east should be in the range [-180, 360]. An exception is thrown if this routine is called on a thread safe Geoid.

Definition at line 448 of file Geoid.cpp.

References CacheClear().

Referenced by main().

void GeographicLib::Geoid::CacheAll ( ) const [inline]

Cache all the data. On most computers, this is fast for data sets with grid resolution of 5' or coarser. For a 1' grid, the required RAM is 450MB; a 2.5' grid needs 72MB; and a 5' grid needs 18MB. This may throw an error because of insufficient memory or because of an error reading the data from the file. In this case, you can catch the error and either do nothing (you will have no cache in this case) or try using Geoid::CacheArea on a specific area. An exception is thrown if this routine is called on a thread safe Geoid.

Definition at line 258 of file Geoid.hpp.

Referenced by Geoid(), and main().

void GeographicLib::Geoid::CacheClear ( ) const throw ()

Clear the cache. This never throws an error. (This does nothing with a thread safe Geoid.)

Definition at line 435 of file Geoid.cpp.

Referenced by CacheArea().

Math::real GeographicLib::Geoid::operator() ( real  lat,
real  lon 
) const [inline]

Compute the geoid height at a point

Parameters:
[in]latlatitude of the point (degrees).
[in]lonlongitude of the point (degrees).
Returns:
geoid height (meters).

The latitude should be in [-90, 90] and longitude should be in [-180,360]. This may throw an error because of an error reading data from disk. However, it will not throw if (lat, lon) is within a successfully cached area.

Definition at line 284 of file Geoid.hpp.

Math::real GeographicLib::Geoid::operator() ( real  lat,
real  lon,
real &  gradn,
real &  grade 
) const [inline]

Compute the geoid height and gradient at a point

Parameters:
[in]latlatitude of the point (degrees).
[in]lonlongitude of the point (degrees).
[out]gradnnortherly gradient (dimensionless).
[out]gradeeasterly gradient (dimensionless).
Returns:
geoid height (meters).

The latitude should be in [-90, 90] and longitude should be in [-180, 360]. This may throw an error because of an error reading data from disk. However, it will not throw if (lat, lon) is within a successfully cached area. As a result of the way that the geoid data is stored, the calculation of gradients can result in large quantization errors. This is particularly acute for fine grids, at high latitudes, and for the easterly gradient. If you need to compute the direction of the acceleration due to gravity accurately, you should use GravityModel::Gravity.

Definition at line 308 of file Geoid.hpp.

Math::real GeographicLib::Geoid::ConvertHeight ( real  lat,
real  lon,
real  h,
convertflag  d 
) const [inline]

Convert a height above the geoid to a height above the ellipsoid and vice versa.

Parameters:
[in]latlatitude of the point (degrees).
[in]lonlongitude of the point (degrees).
[in]hheight of the point (degrees).
[in]da Geoid::convertflag specifying the direction of the conversion; Geoid::GEOIDTOELLIPSOID means convert a height above the geoid to a height above the ellipsoid; Geoid::ELLIPSOIDTOGEOID means convert a height above the ellipsoid to a height above the geoid.
Returns:
converted height (meters).

Definition at line 325 of file Geoid.hpp.

const std::string& GeographicLib::Geoid::Description ( ) const throw () [inline]
Returns:
geoid description, if available, in the data file; if absent, return "NONE".

Definition at line 340 of file Geoid.hpp.

Referenced by main().

const std::string& GeographicLib::Geoid::DateTime ( ) const throw () [inline]
Returns:
date of the data file; if absent, return "UNKNOWN".

Definition at line 345 of file Geoid.hpp.

Referenced by main().

const std::string& GeographicLib::Geoid::GeoidFile ( ) const throw () [inline]
Returns:
full file name used to load the geoid data.

Definition at line 350 of file Geoid.hpp.

Referenced by main().

const std::string& GeographicLib::Geoid::GeoidName ( ) const throw () [inline]
Returns:
"name" used to load the geoid data (from the first argument of the constructor).

Definition at line 356 of file Geoid.hpp.

const std::string& GeographicLib::Geoid::GeoidDirectory ( ) const throw () [inline]
Returns:
directory used to load the geoid data.

Definition at line 361 of file Geoid.hpp.

const std::string GeographicLib::Geoid::Interpolation ( ) const [inline]
Returns:
interpolation method ("cubic" or "bilinear").

Definition at line 366 of file Geoid.hpp.

Referenced by main().

Math::real GeographicLib::Geoid::MaxError ( ) const throw () [inline]
Returns:
estimate of the maximum interpolation and quantization error (meters).

This relies on the value being stored in the data file. If the value is absent, return -1.

Definition at line 376 of file Geoid.hpp.

Referenced by main().

Math::real GeographicLib::Geoid::RMSError ( ) const throw () [inline]
Returns:
estimate of the RMS interpolation and quantization error (meters).

This relies on the value being stored in the data file. If the value is absent, return -1.

Definition at line 385 of file Geoid.hpp.

Referenced by main().

Math::real GeographicLib::Geoid::Offset ( ) const throw () [inline]
Returns:
offset (meters).

This in used in converting from the pixel values in the data file to geoid heights.

Definition at line 393 of file Geoid.hpp.

Referenced by main().

Math::real GeographicLib::Geoid::Scale ( ) const throw () [inline]
Returns:
scale (meters).

This in used in converting from the pixel values in the data file to geoid heights.

Definition at line 401 of file Geoid.hpp.

Referenced by main().

bool GeographicLib::Geoid::ThreadSafe ( ) const throw () [inline]
Returns:
true if the object is constructed to be thread safe.

Definition at line 406 of file Geoid.hpp.

bool GeographicLib::Geoid::Cache ( ) const throw () [inline]
Returns:
true if a data cache is active.

Definition at line 411 of file Geoid.hpp.

Referenced by main().

Math::real GeographicLib::Geoid::CacheWest ( ) const throw () [inline]
Returns:
west edge of the cached area; the cache includes this edge.

Definition at line 416 of file Geoid.hpp.

Referenced by main().

Math::real GeographicLib::Geoid::CacheEast ( ) const throw () [inline]
Returns:
east edge of the cached area; the cache excludes this edge.

Definition at line 425 of file Geoid.hpp.

Referenced by main().

Math::real GeographicLib::Geoid::CacheNorth ( ) const throw () [inline]
Returns:
north edge of the cached area; the cache includes this edge.

Definition at line 435 of file Geoid.hpp.

Referenced by main().

Math::real GeographicLib::Geoid::CacheSouth ( ) const throw () [inline]
Returns:
south edge of the cached area; the cache excludes this edge unless it's the south pole.

Definition at line 443 of file Geoid.hpp.

Referenced by main().

Math::real GeographicLib::Geoid::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the WGS84 ellipsoid (meters).

(The WGS84 value is returned because the supported geoid models are all based on this ellipsoid.)

Definition at line 453 of file Geoid.hpp.

Math::real GeographicLib::Geoid::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the WGS84 ellipsoid.

(The WGS84 value is returned because the supported geoid models are all based on this ellipsoid.)

Definition at line 462 of file Geoid.hpp.

std::string GeographicLib::Geoid::DefaultGeoidPath ( ) [static]
Returns:
the default path for geoid data files.

This is the value of the environment variable GEOID_PATH, if set; otherwise, it is $GEOGRAPHICLIB_DATA/geoids if the environment variable GEOGRAPHICLIB_DATA is set; otherwise, it is a compile-time default (/usr/local/share/GeographicLib/geoids on non-Windows systems and C:/Documents and Settings/All Users/Application Data/GeographicLib/geoids on Windows systems).

Definition at line 529 of file Geoid.cpp.

References GEOGRAPHICLIB_DATA.

Referenced by Geoid(), and main().

std::string GeographicLib::Geoid::DefaultGeoidName ( ) [static]
Returns:
the default name for the geoid.

This is the value of the environment variable GEOID_NAME, if set, otherwise, it is "egm96-5". The Geoid class does not use this function; it is just provided as a convenience for a calling program when constructing a Geoid object.

Definition at line 542 of file Geoid.cpp.

References GEOID_DEFAULT_NAME.

Referenced by main().


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/organization.html0000644000175000017500000004344411745620414021174 0ustar frankiefrankie GeographicLib: Code organization
Code organization
Back to Utility programs. Forward to Other interfaces (Javascript, Python, Matlab, Octave). Up to Contents.

Here is a brief description of the relationship between the various components of GeographicLib. All of these are defined in the GeographicLib namespace.

GeographicLib::TransverseMercator, GeographicLib::PolarStereographic, GeographicLib::LambertConformalConic, and GeographicLib::AlbersEqualArea provide the basic projections. The constructors for these classes specify the ellipsoid and the forward and reverse projections are implemented as const member functions. TransverseMercator uses Krüger's series which have been extended to sixth order in the square of the eccentricity. PolarStereographic, LambertConformalConic, and AlbersEqualArea use the exact formulas for the projections (e.g., from Snyder).

GeographicLib::TransverseMercator::UTM and GeographicLib::PolarStereographic::UPS are const static instantiations specific for the WGS84 ellipsoid with the UTM and UPS scale factors. (These do not add the standard false eastings or false northings for UTM and UPS.) Similarly GeographicLib::LambertConformalConic::Mercator is a const static instantiation of this projection for a WGS84 ellipsoid and a standard parallel of 0 (which gives the Mercator projection). GeographicLib::AlbersEqualArea::CylindricalEqualArea, AzimuthalEqualAreaNorth, and AzimuthalEqualAreaSouth, likewise provide special cases of the equal area projection.

GeographicLib::UTMUPS uses TransverseMercator::UTM and PolarStereographic::UPS to perform the UTM and UPS projections. The class offers a uniform interface to UTM and UPS by treating UPS as UTM zone 0. This class stores no internal state and the forward and reverse projections are provided via static member functions. The forward projection offers the ability to override the standard UTM/UPS choice and the UTM zone.

GeographicLib::MGRS transforms between UTM/UPS coordinates and MGRS. UPS coordinates are handled as UTM zone 0. This class stores no internal state and the forward (UTM/UPS to MGRS) and reverse (MGRS to UTM/UPS) conversions are provided via static member functions.

GeographicLib::GeoCoords holds a single geographic location which may be specified as latitude and longitude, UTM or UPS, or MGRS. Member functions are provided to convert between coordinate systems and to provide formatted representations of them. GeoConvert is a simple command line utility to provide access to the GeoCoords class.

GeographicLib::TransverseMercatorExact is a drop in replacement for TransverseMercator which uses the exact formulas, based on elliptic functions, for the projection as given by Lee. TransverseMercatorProj is a simple command line utility to test to the TransverseMercator and TransverseMercatorExact.

GeographicLib::Geodesic and GeographicLib::GeodesicLine perform geodesic calculations. The constructor for GeographicLib::Geodesic specifies the ellipsoid and the direct and inverse calculations are implemented as const member functions. GeographicLib::Geocentric::WGS84 is a const static instantiation of Geodesic specific for the WGS84 ellipsoid. In order to perform a series of direct geodesic calculations on a single line, the GeographicLib::GeodesicLine class can be used. This packages all the information needed to specify a geodesic. A const member function returns the coordinates a specified distance from the starting point. Geod is a simple command line utility to perform geodesic calculations. GeographicLib::PolygonArea is a class which compute the area of geodesic polygons using the Geodesic class and Geod is a command line utility for the same purpose. GeographicLib::AzimuthalEquidistant, GeographicLib::CassiniSoldner, and GeographicLib::Gnomonic are projections based on the Geodesic class. GeodesicProj is a command line utility to exercise these projections.

GeographicLib::Geocentric and GeographicLib::LocalCartesian convert between geodetic and geocentric or a local cartesian system. The constructor for specifies the ellipsoid and the forward and reverse projections are implemented as const member functions. GeographicLib::Geocentric::WGS84 is a const static instantiation of Geocentric specific for the WGS84 ellipsoid. CartConvert is a simple command line utility to provide access to these classes.

GeographicLib::Geoid evaluates geoid heights by interpolation. This is provided by the operator() member function. GeoidEval is a simple command line utility to provide access to this class. This class requires installation of data files for the various geoid models; see Installing the geoid datasets for details.

GeographicLib::GravityModel evaluates the earth's gravitational field using a particular gravity model. Various member functions return the gravitational field, the gravity disturbance, the gravity anomaly, and the geoid height Gravity is a simple command line utility to provide access to this class. If the field several points on a circle of latitude are sought then use GeographicLib::GravityModel::Circle to return a GeographicLib::GravityCircle object whose member functions performs the calculations efficiently. (This is particularly important for high degree models such as EGM2008.) These classes requires installation of data files for the various gravity models; see Installing the gravity models for details.

GeographicLib::MagneticModel evaluates the earth's magnetic field using a particular magnetic model. The field is provided by the operator() member function. MagneticField is a simple command line utility to provide access to this class. If the field several points on a circle of latitude are sought then use GeographicLib::MagneticModel::Circle to return a GeographicLib::MagneticCircle object whose operator() member function performs the calculation efficiently. (This is particularly important for high degree models such as emm2010.) These classes requires installation of data files for the various magnetic models; see Installing the magnetic field models for details.

GeographicLib::Constants, GeographicLib::Math, GeographicLib::Utility, GeographicLib::DMS, are general utility class which are used internally by the library; in addition GeographicLib::EllipticFunction is used by GeographicLib::TransverseMercatorExact, GeographicLib::Accumulator is used by GeographicLib::PolygonArea, and GeographicLib::SphericalEngine, GeographicLib::CircularEngine, GeographicLib::SphericalHarmonic, GeographicLib::SphericalHarmonic1, and GeographicLib::SphericalHarmonic2 facilitate the summation of spherical harmonic series which is needed by and GeographicLib::MagneticModel and GeographicLib::MagneticCircle. One important definition is GeographicLib::Math::real which is the type used for real numbers. This allows the library to be easily switched to using floats, doubles, or long doubles. However all the testing has been with real set to double and the library should be installed in this way.

In general, the constructors for the classes in GeographicLib check their arguments and throw GeographicLib::GeographicErr exceptions with a explanatory message if these are illegal. The member functions, e.g., the projections implemented by TransverseMercator and PolarStereographic, the solutions to the geodesic problem, etc., typically do not check their arguments; the calling program should ensure that the arguments are legitimate. However, the functions implemented by UTMUPS, MGRS, and GeoCoords do check their arguments and may throw GeographicLib::GeographicErr exceptions. Similarly Geoid may throw exceptions on file errors. If a function does throw an exception, then the function arguments used for return values will not have been altered.

GeographicLib attempts to act sensibly with NaNs. NaNs in constructors typically throw errors (an exception is GeodesicLine). However, calling the class functions with NaNs as arguments is not an error; NaNs are returned as appropriate. "INV" is treated as an invalid zone designation by UTMUPS. "INVALID" is the corresponding invalid MGRS string. NaNs allow the projection of polylines which are separated by NaNs; in this format they can be easily plotted in Matlab.

A note about portability. For the most part, the code uses standard C++ and should be able to be deployed on any system with a modern C++ compiler. System dependencies come into

  • GeographicLib::Math -- GeographicLib needs to define functions such as atanh for systems that lack them. The system dependence will disappear with the adoption of C++11 because the needed functions are part of that standard.
  • use of long double -- the type is used only for testing. On systems which lack this data type the cmake and autoconf configuration methods should detect its absence and omit the code that depends on it.
  • GeographicLib::Geoid, GeographicLib::GravityModel, and GeographicLib::MagneticModel -- these class uses system-dependent default paths for looking up the respective datasets. It also relies on getenv to find the value of the environment variables.
  • GeographicLib::Utility::readarray reads numerical data from binary files. This assumes that floating point numbers are in IEEE format. It attempts to handled the "endianness" of the target platform using the WORDS_BIGENDIAN macro (which sets the compile-time constant GeographicLib::Math::bigendian).
Back to Utility programs. Forward to Other interfaces (Javascript, Python, Matlab, Octave). Up to Contents.
geographiclib-1.21/doc/html/MagneticField.1.html0000644000175000017500000003072711745620415021323 0ustar frankiefrankie MagneticField -- compute the earth's magnetic field


NAME

MagneticField -- compute the earth's magnetic field


SYNOPSIS

MagneticField [ -n name ] [ -d dir ] [ -t time | -c time lat h ] [ -r ] [ -T tguard ] [ -H hguard ] [ -p prec ] [ -v ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

MagneticField reads in times and positions on standard input and prints out the geomagnetic field on standard output and, optionally, its rate of change.

The input line is of the form time lat lon h. time is a date of the form 2012-07-03 or a fractional year such as 2012.5. lat and lon are the latitude and longitude expressed as decimal degrees or degrees, minutes, and seconds; see GeoConvert(1) for details. h is the height above the ellipsoid in meters; this is optional and defaults to zero. Alternatively, time can be given on the command line as the argument to the -t option, in which case it should not be included on the input lines. Finally, the magnetic field can be computed at various points on a circle of latitude (constant time, lat, and h) via the -c option; in this case only the longitude should be given on the input lines.

The output consists of the following 7 items:

  the declination (the direction of the horizontal component of
    the magnetic field measured clockwise from north) in degrees,
  the inclination (the direction of the magnetic field measured
    down from the horizontal) in degrees,
  the horizontal field in nanotesla (nT),
  the north component of the field in nT,
  the east component of the field in nT,
  the vertical component of the field in nT (down is positive),
  the total field in nT.

If the -r option is given, a second line is printed giving the rates of change of these quantities in degrees/yr and nT/yr.

The WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.


OPTIONS

-n

use magnetic field model name instead of the default wmm2010. See MODELS.

-d

read magnetic models from dir instead of the default. See MODELS.

-t

evaluate the field at time instead of reading the time from the input lines.

-c

evaluate the field on a circle of latitude given by time, lat, h instead of reading these quantities from the input lines. In this case, MagneticField can calculate the field considerably more quickly.

-r

toggle whether to report the rates of change of the field.

-T

signal an error if time lies tguard years (default 50 yr) beyond the range for the model.

-H

signal an error if h lies hguard meters (default 500000 m) beyond the range for the model.

-p

set the output precision to prec (default 1). Fields are printed with precision with prec decimal places; angles use prec + 1 places.

-v

print information about the magnetic model on standard error before processing the input.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage, the default magnetic path and name, and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


MODELS

MagneticField computes the geomagnetic field using one of the following models

    wmm2010, the World Magnetic Model 2010, which approximates the
      main magnetic field for the period 2010–2015.  See
      http://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml
    igrf11, the International Geomagnetic Reference Field (11th
      generation) which approximates the main magnetic field for
      the period 1900–2015.  See
      http://ngdc.noaa.gov/IAGA/vmod/igrf.html
    emm2010, the Enhanced Magnetic Model 2010, which approximates the
      main and crustal magnetic fields for the period 2010–2015.  See
      http://ngdc.noaa.gov/geomag/EMM/index.html

These models approximate the magnetic field due to the earth's core and (in the case of emm2010) its crust. They neglect magnetic fields due to the ionosphere, the magnetosphere, nearby magnetized materials, electrical machinery, etc.

By default, the wmm2010 magnetic model is used. This may changed by setting the environment variable MAGNETIC_NAME or with the -n option.

The magnetic models will be loaded from a directory specified at compile time. This may changed by setting the environment variables MAGNETIC_PATH or GEOGRAPHICLIB_DATA, or with the -d option. The -h option prints the default magnetic path and name. Use the -v option to ascertain the full path name of the data file.

Instructions for downloading and installing magnetic models are available at http://geographiclib.sf.net/html/magnetic.html#magneticinst.


ENVIRONMENT

MAGNETIC_NAME

Override the compile-time default magnetic name of wmm2010. The -h option reports the value of MAGNETIC_NAME, if defined, otherwise it reports the compile-time value. If the -n name option is used, then name takes precedence.

MAGNETIC_PATH

Override the compile-time default magnetic path. This is typically /usr/local/share/GeographicLib/magnetic on Unix-like systems and C:/Documents and Settings/All Users/Application Data/GeographicLib/magnetic on Windows systems. The -h option reports the value of MAGNETIC_PATH, if defined, otherwise it reports the compile-time value. If the -d dir option is used, then dir takes precedence.

GEOGRAPHICLIB_DATA

Another way of overriding the compile-time default magnetic path. If it is set (and if MAGNETIC_PATH is not set), then $GEOGRAPHICLIB_DATA/magnetic is used.


ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes MagneticField to return an exit code of 1. However, an error does not cause MagneticField to terminate; following lines will be converted. If time or h are outside the recommended ranges for the model (but inside the ranges increase by tguard and hguard), a warning is printed on standard error and the field (which may be inaccurate) is returned in the normal way.


EXAMPLES

The magnetic field from WMM2010 in Timbuktu on 2012-01-01

    echo 2012-01-01 16:46:33N 3:00:34W 300 | MagneticField -r
    => -2.55 12.43 33771.0 33737.6 -1500.5 7446.0 34582.1
       0.10 -0.07 34.3 36.8 54.4 -35.3 25.9

The first two numbers returned are the declination and inclination of the field. The second line gives the annual change.


SEE ALSO

GeoConvert(1).


AUTHOR

MagneticField was written by Charles Karney.


HISTORY

MagneticField was added to GeographicLib, http://geographiclib.sf.net, in version 1.15.

geographiclib-1.21/doc/html/TransverseMercatorProj.1.html0000644000175000017500000002067711745620414023316 0ustar frankiefrankie TransverseMercatorProj -- perform transverse Mercator projection


NAME

TransverseMercatorProj -- perform transverse Mercator projection


SYNOPSIS

TransverseMercatorProj [ -s | -t ] [ -l lon0 ] [ -k k1 ] [ -r ] [ -e a f ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

Perform the transverse Mercator projections. Convert geodetic coordinates to transverse Mercator coordinates. The central meridian is given by lon0. The longitude of origin is the equator. The scale on the central meridian is k0. By default an implementation of the exact transverse Mercator projection is used.

Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) latitude and longitude (decimal degrees or degrees, minutes, seconds). For each set of geodetic coordinates, the corresponding projected easting, x, and northing, y, (meters) are printed on standard output together with the meridian convergence gamma (degrees) and scale k. The meridian convergence is the bearing of the y axis measured clockwise from true north.


OPTIONS

-s

use the sixth-order Krueger series approximation to the transverse Mercator projection instead of the exact projection.

-t

use exact algorithm with the EXTENDED DOMAIN.

-l

specify the longitude of origin lon0 (degrees, default 0).

-k

specify the scale k0 on the central meridian (default 0.9996).

-r

perform the reverse projection. x and y are given on standard input and each line of standard output gives latitude, longitude, gamma, and k.

-e

specify the ellipsoid via a f; the equatorial radius is a and the flattening is f. Setting f = 0 results in a sphere. Specify f < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563. If the exact algorithm is used, f must be positive.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


EXTENDED DOMAIN

The exact transverse Mercator projection has a branch point on the equator at longitudes (relative to lon0) of +/- (1 - e) 90, where e is the eccentricity of the ellipsoid. The standard convention for handling this branch point is to map positive (negative) latitudes into positive (negative) northings y; i.e., a branch cut is placed on the equator. With the extended domain, the northern sheet of the projection is extended into the south hemisphere by pushing the branch cut south from the branch points. See the reference below for details.


EXAMPLES

   echo 0 90 | TransverseMercatorProj
   => 25953592.84 9997964.94 90 18.40
   echo 260e5 100e5 | TransverseMercatorProj -r
   => -0.02 90.00 90.01 18.48


ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes TransverseMercatorProj to return an exit code of 1. However, an error does not cause TransverseMercatorProj to terminate; following lines will be converted.


AUTHOR

TransverseMercatorProj was written by Charles Karney.


SEE ALSO

The algorithms for the transverse Mercator projection are described in C. F. F. Karney, Transverse Mercator with an accuracy of a few nanometers, J. Geod 85(8), 475-485 (Aug. 2011); DOI http://dx.doi.org/10.1007/s00190-011-0445-3; preprint http://arxiv.org/abs/1002.1417. The explanation of the extended domain of the projection with the -t option is given in Section 5 of this paper.


HISTORY

TransverseMercatorProj was added to GeographicLib, http://geographiclib.sf.net, in 2009-01. Prior to version 1.9 it was called TransverseMercatorTest (and its interface was slightly different).

geographiclib-1.21/doc/html/SphericalHarmonic2_8hpp_source.html0000644000175000017500000011215011745620414024453 0ustar frankiefrankie GeographicLib: SphericalHarmonic2.hpp Source File
SphericalHarmonic2.hpp
Go to the documentation of this file.
00001 /**
00002  * \file SphericalHarmonic2.hpp
00003  * \brief Header for GeographicLib::SphericalHarmonic2 class
00004  *
00005  * Copyright (c) Charles Karney (2011, 2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_SPHERICALHARMONIC2_HPP)
00011 #define GEOGRAPHICLIB_SPHERICALHARMONIC2_HPP \
00012   "$Id: ce4cda614c1966dea65610bc73bc4db562677fa8 $"
00013 
00014 #include <vector>
00015 #include <GeographicLib/Constants.hpp>
00016 #include <GeographicLib/SphericalEngine.hpp>
00017 #include <GeographicLib/CircularEngine.hpp>
00018 
00019 namespace GeographicLib {
00020 
00021   /**
00022    * \brief Spherical Harmonic series with two corrections to the coefficients.
00023    *
00024    * This classes is similar to SphericalHarmonic, except that the coefficients
00025    * \e C<sub>\e nm</sub> are replaced by \e C<sub>\e nm</sub> + \e tau'
00026    * C'<sub>\e nm</sub> + \e tau'' C''<sub>\e nm</sub> (and similarly for \e
00027    * S<sub>\e nm</sub>).
00028    *
00029    * Example of use:
00030    * \include example-SphericalHarmonic2.cpp
00031    **********************************************************************/
00032 
00033   class GEOGRAPHIC_EXPORT SphericalHarmonic2 {
00034   public:
00035     /**
00036      * Supported normalizations for associate Legendre polynomials.
00037      **********************************************************************/
00038     enum normalization {
00039       /**
00040        * Fully normalized associated Legendre polynomials.  See
00041        * SphericalHarmonic::FULL for documentation.
00042        *
00043        * @hideinitializer
00044        **********************************************************************/
00045       FULL = SphericalEngine::FULL,
00046       /**
00047        * Schmidt semi-normalized associated Legendre polynomials.  See
00048        * SphericalHarmonic::SCHMIDT for documentation.
00049        *
00050        * @hideinitializer
00051        **********************************************************************/
00052       SCHMIDT = SphericalEngine::SCHMIDT,
00053       /// \cond SKIP
00054       // These are deprecated...
00055       full = FULL,
00056       schmidt = SCHMIDT,
00057       /// \endcond
00058     };
00059 
00060   private:
00061     typedef Math::real real;
00062     SphericalEngine::coeff _c[3];
00063     real _a;
00064     unsigned _norm;
00065 
00066   public:
00067     /**
00068      * Constructor with a full set of coefficients specified.
00069      *
00070      * @param[in] C the coefficients \e C<sub>\e nm</sub>.
00071      * @param[in] S the coefficients \e S<sub>\e nm</sub>.
00072      * @param[in] N the maximum degree and order of the sum
00073      * @param[in] C1 the coefficients \e C'<sub>\e nm</sub>.
00074      * @param[in] S1 the coefficients \e S'<sub>\e nm</sub>.
00075      * @param[in] N1 the maximum degree and order of the first correction
00076      *   coefficients \e C'<sub>\e nm</sub> and \e S'<sub>\e nm</sub>.
00077      * @param[in] C2 the coefficients \e C''<sub>\e nm</sub>.
00078      * @param[in] S2 the coefficients \e S''<sub>\e nm</sub>.
00079      * @param[in] N2 the maximum degree and order of the second correction
00080      *   coefficients \e C'<sub>\e nm</sub> and \e S'<sub>\e nm</sub>.
00081      * @param[in] a the reference radius appearing in the definition of the
00082      *   sum.
00083      * @param[in] norm the normalization for the associated Legendre
00084      *   polynomials, either SphericalHarmonic2::FULL (the default) or
00085      *   SphericalHarmonic2::SCHMIDT.
00086      *
00087      * See SphericalHarmonic for the way the coefficients should be stored.  \e
00088      * N1 and \e N2 should satisfy \e N1 <= \e N and \e N2 <= \e N.
00089      *
00090      * The class stores <i>pointers</i> to the first elements of \e C, \e S, \e
00091      * C', \e S', \e C'', and \e S''.  These arrays should not be altered or
00092      * destroyed during the lifetime of a SphericalHarmonic object.
00093      **********************************************************************/
00094     SphericalHarmonic2(const std::vector<real>& C,
00095                        const std::vector<real>& S,
00096                        int N,
00097                        const std::vector<real>& C1,
00098                        const std::vector<real>& S1,
00099                        int N1,
00100                        const std::vector<real>& C2,
00101                        const std::vector<real>& S2,
00102                        int N2,
00103                        real a, unsigned norm = FULL)
00104       : _a(a)
00105       , _norm(norm) {
00106       if (!(N1 <= N && N2 <= N))
00107         throw GeographicErr("N1 and N2 cannot be larger that N");
00108       _c[0] = SphericalEngine::coeff(C, S, N);
00109       _c[1] = SphericalEngine::coeff(C1, S1, N1);
00110       _c[2] = SphericalEngine::coeff(C2, S2, N2);
00111     }
00112 
00113     /**
00114      * Constructor with a subset of coefficients specified.
00115      *
00116      * @param[in] C the coefficients \e C<sub>\e nm</sub>.
00117      * @param[in] S the coefficients \e S<sub>\e nm</sub>.
00118      * @param[in] N the degree used to determine the layout of \e C and \e S.
00119      * @param[in] nmx the maximum degree used in the sum.  The sum over \e n is
00120      *   from 0 thru \e nmx.
00121      * @param[in] mmx the maximum order used in the sum.  The sum over \e m is
00122      *   from 0 thru min(\e n, \e mmx).
00123      * @param[in] C1 the coefficients \e C'<sub>\e nm</sub>.
00124      * @param[in] S1 the coefficients \e S'<sub>\e nm</sub>.
00125      * @param[in] N1 the degree used to determine the layout of \e C' and \e
00126      *   S'.
00127      * @param[in] nmx1 the maximum degree used for \e C' and \e S'.
00128      * @param[in] mmx1 the maximum order used for \e C' and \e S'.
00129      * @param[in] C2 the coefficients \e C''<sub>\e nm</sub>.
00130      * @param[in] S2 the coefficients \e S''<sub>\e nm</sub>.
00131      * @param[in] N2 the degree used to determine the layout of \e C'' and \e
00132      *   S''.
00133      * @param[in] nmx2 the maximum degree used for \e C'' and \e S''.
00134      * @param[in] mmx2 the maximum order used for \e C'' and \e S''.
00135      * @param[in] a the reference radius appearing in the definition of the
00136      *   sum.
00137      * @param[in] norm the normalization for the associated Legendre
00138      *   polynomials, either SphericalHarmonic2::FULL (the default) or
00139      *   SphericalHarmonic2::SCHMIDT.
00140      *
00141      * The class stores <i>pointers</i> to the first elements of \e C, \e S, \e
00142      * C', \e S', \e C'', and \e S''.  These arrays should not be altered or
00143      * destroyed during the lifetime of a SphericalHarmonic object.
00144      **********************************************************************/
00145     SphericalHarmonic2(const std::vector<real>& C,
00146                        const std::vector<real>& S,
00147                        int N, int nmx, int mmx,
00148                        const std::vector<real>& C1,
00149                        const std::vector<real>& S1,
00150                        int N1, int nmx1, int mmx1,
00151                        const std::vector<real>& C2,
00152                        const std::vector<real>& S2,
00153                        int N2, int nmx2, int mmx2,
00154                        real a, unsigned norm = FULL)
00155       : _a(a)
00156       , _norm(norm) {
00157       if (!(nmx1 <= nmx && nmx2 <= nmx))
00158         throw GeographicErr("nmx1 and nmx2 cannot be larger that nmx");
00159       if (!(mmx1 <= mmx && mmx2 <= mmx))
00160         throw GeographicErr("mmx1 and mmx2cannot be larger that mmx");
00161       _c[0] = SphericalEngine::coeff(C, S, N, nmx, mmx);
00162       _c[1] = SphericalEngine::coeff(C1, S1, N1, nmx1, mmx1);
00163       _c[2] = SphericalEngine::coeff(C2, S2, N2, nmx2, mmx2);
00164     }
00165 
00166     /**
00167      * A default constructor so that the object can be created when the
00168      * constructor for another object is initialized.  This default object can
00169      * then be reset with the default copy assignment operator.
00170      **********************************************************************/
00171     SphericalHarmonic2() {}
00172 
00173     /**
00174      * Compute a spherical harmonic sum with two correction terms.
00175      *
00176      * @param[in] tau1 multiplier for correction coefficients \e C' and \e S'.
00177      * @param[in] tau2 multiplier for correction coefficients \e C'' and \e S''.
00178      * @param[in] x cartesian coordinate.
00179      * @param[in] y cartesian coordinate.
00180      * @param[in] z cartesian coordinate.
00181      * @return \e V the spherical harmonic sum.
00182      *
00183      * This routine requires constant memory and thus never throws an
00184      * exception.
00185      **********************************************************************/
00186     Math::real operator()(real tau1, real tau2, real x, real y, real z)
00187       const throw() {
00188       real f[] = {1, tau1, tau2};
00189       real v = 0;
00190       real dummy;
00191       switch (_norm) {
00192       case FULL:
00193         v = SphericalEngine::Value<false, SphericalEngine::FULL, 3>
00194           (_c, f, x, y, z, _a, dummy, dummy, dummy);
00195         break;
00196       case SCHMIDT:
00197         v = SphericalEngine::Value<false, SphericalEngine::SCHMIDT, 3>
00198           (_c, f, x, y, z, _a, dummy, dummy, dummy);
00199         break;
00200       }
00201       return v;
00202     }
00203 
00204     /**
00205      * Compute a spherical harmonic sum with two correction terms and its
00206      * gradient.
00207      *
00208      * @param[in] tau1 multiplier for correction coefficients \e C' and \e S'.
00209      * @param[in] tau2 multiplier for correction coefficients \e C'' and \e S''.
00210      * @param[in] x cartesian coordinate.
00211      * @param[in] y cartesian coordinate.
00212      * @param[in] z cartesian coordinate.
00213      * @param[out] gradx \e x component of the gradient
00214      * @param[out] grady \e y component of the gradient
00215      * @param[out] gradz \e z component of the gradient
00216      * @return \e V the spherical harmonic sum.
00217      *
00218      * This is the same as the previous function, except that the components of
00219      * the gradients of the sum in the \e x, \e y, and \e z directions are
00220      * computed.  This routine requires constant memory and thus never throws
00221      * an exception.
00222      **********************************************************************/
00223     Math::real operator()(real tau1, real tau2, real x, real y, real z,
00224                           real& gradx, real& grady, real& gradz) const throw() {
00225       real f[] = {1, tau1, tau2};
00226       real v = 0;
00227       switch (_norm) {
00228       case FULL:
00229         v = SphericalEngine::Value<true, SphericalEngine::FULL, 3>
00230           (_c, f, x, y, z, _a, gradx, grady, gradz);
00231         break;
00232       case SCHMIDT:
00233         v = SphericalEngine::Value<true, SphericalEngine::SCHMIDT, 3>
00234           (_c, f, x, y, z, _a, gradx, grady, gradz);
00235         break;
00236       }
00237       return v;
00238     }
00239 
00240     /**
00241      * Create a CircularEngine to allow the efficient evaluation of several
00242      * points on a circle of latitude at fixed values of \e tau1 and \e tau2.
00243      *
00244      * @param[in] tau1 multiplier for correction coefficients \e C' and \e S'.
00245      * @param[in] tau2 multiplier for correction coefficients \e C'' and \e S''.
00246      * @param[in] p the radius of the circle.
00247      * @param[in] z the height of the circle above the equatorial plane.
00248      * @param[in] gradp if true the returned object will be able to compute the
00249      *   gradient of the sum.
00250      * @return the CircularEngine object.
00251      *
00252      * SphericalHarmonic2::operator()() exchanges the order of the sums in the
00253      * definition, i.e., sum(n = 0..N)[sum(m = 0..n)[...]] becomes sum(m =
00254      * 0..N)[sum(n = m..N)[...]].  SphericalHarmonic2::Circle performs the
00255      * inner sum over degree \e n (which entails about <i>N</i><sup>2</sup>
00256      * operations).  Calling CircularEngine::operator()() on the returned
00257      * object performs the outer sum over the order \e m (about \e N
00258      * operations).  This routine may throw a bad_alloc exception in the
00259      * CircularEngine constructor.
00260      *
00261      * See SphericalHarmonic::Circle for an example of its use.
00262      **********************************************************************/
00263     CircularEngine Circle(real tau1, real tau2, real p, real z, bool gradp)
00264       const {
00265       real f[] = {1, tau1, tau2};
00266       switch (_norm) {
00267       case FULL:
00268         return gradp ?
00269           SphericalEngine::Circle<true, SphericalEngine::FULL, 3>
00270           (_c, f, p, z, _a) :
00271           SphericalEngine::Circle<false, SphericalEngine::FULL, 3>
00272           (_c, f, p, z, _a);
00273         break;
00274       case SCHMIDT:
00275       default:                  // To avoid compiler warnings
00276         return gradp ?
00277           SphericalEngine::Circle<true, SphericalEngine::SCHMIDT, 3>
00278           (_c, f, p, z, _a) :
00279           SphericalEngine::Circle<false, SphericalEngine::SCHMIDT, 3>
00280           (_c, f, p, z, _a);
00281         break;
00282       }
00283     }
00284 
00285     /**
00286      * @return the zeroth SphericalEngine::coeff object.
00287      **********************************************************************/
00288     const SphericalEngine::coeff& Coefficients() const throw()
00289     { return _c[0]; }
00290     /**
00291      * @return the first SphericalEngine::coeff object.
00292      **********************************************************************/
00293     const SphericalEngine::coeff& Coefficients1() const throw()
00294     { return _c[1]; }
00295     /**
00296      * @return the second SphericalEngine::coeff object.
00297      **********************************************************************/
00298     const SphericalEngine::coeff& Coefficients2() const throw()
00299     { return _c[2]; }
00300   };
00301 
00302 } // namespace GeographicLib
00303 
00304 #endif  // GEOGRAPHICLIB_SPHERICALHARMONIC2_HPP
geographiclib-1.21/doc/html/classGeographicLib_1_1UTMUPS-members.html0000644000175000017500000002137511745620415025263 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::UTMUPS Member List
This is the complete list of members for GeographicLib::UTMUPS, including all inherited members.
DecodeZone(const std::string &zonestr, int &zone, bool &northp)GeographicLib::UTMUPS [static]
EncodeZone(int zone, bool northp)GeographicLib::UTMUPS [static]
Flattening()GeographicLib::UTMUPS [inline, static]
Forward(real lat, real lon, int &zone, bool &northp, real &x, real &y, real &gamma, real &k, int setzone=STANDARD, bool mgrslimits=false)GeographicLib::UTMUPS [static]
Forward(real lat, real lon, int &zone, bool &northp, real &x, real &y, int setzone=STANDARD, bool mgrslimits=false)GeographicLib::UTMUPS [inline, static]
INVALID enum valueGeographicLib::UTMUPS
MajorRadius()GeographicLib::UTMUPS [inline, static]
MATCH enum valueGeographicLib::UTMUPS
MAXPSEUDOZONE enum valueGeographicLib::UTMUPS
MAXUTMZONE enum valueGeographicLib::UTMUPS
MAXZONE enum valueGeographicLib::UTMUPS
MINPSEUDOZONE enum valueGeographicLib::UTMUPS
MINUTMZONE enum valueGeographicLib::UTMUPS
MINZONE enum valueGeographicLib::UTMUPS
Reverse(int zone, bool northp, real x, real y, real &lat, real &lon, real &gamma, real &k, bool mgrslimits=false)GeographicLib::UTMUPS [static]
Reverse(int zone, bool northp, real x, real y, real &lat, real &lon, bool mgrslimits=false)GeographicLib::UTMUPS [inline, static]
STANDARD enum valueGeographicLib::UTMUPS
StandardZone(real lat, real lon, int setzone=STANDARD)GeographicLib::UTMUPS [static]
UPS enum valueGeographicLib::UTMUPS
UTM enum valueGeographicLib::UTMUPS
UTMShift()GeographicLib::UTMUPS [static]
zonespec enum nameGeographicLib::UTMUPS
geographiclib-1.21/doc/html/classGeographicLib_1_1Accumulator-members.html0000644000175000017500000001374711745620414026510 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::Accumulator Member List
This is the complete list of members for GeographicLib::Accumulator, including all inherited members.
Accumulator(T y=T(0))GeographicLib::Accumulator [inline]
operator!=(T y) const GeographicLib::Accumulator [inline]
operator()() const GeographicLib::Accumulator [inline]
operator()(T y) const GeographicLib::Accumulator [inline]
operator*=(int n)GeographicLib::Accumulator [inline]
operator+=(T y)GeographicLib::Accumulator [inline]
operator-=(T y)GeographicLib::Accumulator [inline]
operator<(T y) const GeographicLib::Accumulator [inline]
operator<=(T y) const GeographicLib::Accumulator [inline]
operator=(T y)GeographicLib::Accumulator [inline]
operator==(T y) const GeographicLib::Accumulator [inline]
operator>(T y) const GeographicLib::Accumulator [inline]
operator>=(T y) const GeographicLib::Accumulator [inline]
geographiclib-1.21/doc/html/Geocentric_8cpp_source.html0000644000175000017500000005472311745620415023067 0ustar frankiefrankie GeographicLib: Geocentric.cpp Source File
Geocentric.cpp
Go to the documentation of this file.
00001 /**
00002  * \file Geocentric.cpp
00003  * \brief Implementation for GeographicLib::Geocentric class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/Geocentric.hpp>
00011 
00012 #define GEOGRAPHICLIB_GEOCENTRIC_CPP \
00013   "$Id: b5135e8042dbbbcddfd5894c66b729bf5c43cab9 $"
00014 
00015 RCSID_DECL(GEOGRAPHICLIB_GEOCENTRIC_CPP)
00016 RCSID_DECL(GEOGRAPHICLIB_GEOCENTRIC_HPP)
00017 
00018 namespace GeographicLib {
00019 
00020   using namespace std;
00021 
00022   Geocentric::Geocentric(real a, real f)
00023     : _a(a)
00024     , _f(f <= 1 ? f : 1/f)
00025     , _e2(_f * (2 - _f))
00026     , _e2m(Math::sq(1 - _f))          // 1 - _e2
00027     , _e2a(abs(_e2))
00028     , _e4a(Math::sq(_e2))
00029     , _maxrad(2 * _a / numeric_limits<real>::epsilon())
00030   {
00031     if (!(Math::isfinite(_a) && _a > 0))
00032       throw GeographicErr("Major radius is not positive");
00033     if (!(Math::isfinite(_f) && _f < 1))
00034       throw GeographicErr("Minor radius is not positive");
00035   }
00036 
00037   const Geocentric Geocentric::WGS84(Constants::WGS84_a<real>(),
00038                                      Constants::WGS84_f<real>());
00039 
00040   void Geocentric::IntForward(real lat, real lon, real h,
00041                               real& X, real& Y, real& Z,
00042                               real M[dim2_]) const throw() {
00043     lon = lon >= 180 ? lon - 360 : (lon < -180 ? lon + 360 : lon);
00044     real
00045       phi = lat * Math::degree<real>(),
00046       lam = lon * Math::degree<real>(),
00047       sphi = sin(phi),
00048       cphi = abs(lat) == 90 ? 0 : cos(phi),
00049       n = _a/sqrt(1 - _e2 * Math::sq(sphi)),
00050       slam = lon == -180 ? 0 : sin(lam),
00051       clam = abs(lon) == 90 ? 0 : cos(lam);
00052     Z = ( _e2m * n + h) * sphi;
00053     X = (n + h) * cphi;
00054     Y = X * slam;
00055     X *= clam;
00056     if (M)
00057       Rotation(sphi, cphi, slam, clam, M);
00058   }
00059 
00060   void Geocentric::IntReverse(real X, real Y, real Z,
00061                               real& lat, real& lon, real& h,
00062                               real M[dim2_]) const throw() {
00063     real
00064       R = Math::hypot(X, Y),
00065       slam = R ? Y / R : 0,
00066       clam = R ? X / R : 1;
00067     h = Math::hypot(R, Z);      // Distance to center of earth
00068     real sphi, cphi;
00069     if (h > _maxrad) {
00070       // We really far away (> 12 million light years); treat the earth as a
00071       // point and h, above, is an acceptable approximation to the height.
00072       // This avoids overflow, e.g., in the computation of disc below.  It's
00073       // possible that h has overflowed to inf; but that's OK.
00074       //
00075       // Treat the case X, Y finite, but R overflows to +inf by scaling by 2.
00076       R = Math::hypot(X/2, Y/2);
00077       slam = R ? (Y/2) / R : 0;
00078       clam = R ? (X/2) / R : 1;
00079       real H = Math::hypot(Z/2, R);
00080       sphi = (Z/2) / H;
00081       cphi = R / H;
00082     } else if (_e4a == 0) {
00083       // Treat the spherical case.  Dealing with underflow in the general case
00084       // with _e2 = 0 is difficult.  Origin maps to N pole same as with
00085       // ellipsoid.
00086       real H = Math::hypot(h == 0 ? 1 : Z, R);
00087       sphi = (h == 0 ? 1 : Z) / H;
00088       cphi = R / H;
00089       h -= _a;
00090     } else {
00091       // Treat prolate spheroids by swapping R and Z here and by switching
00092       // the arguments to phi = atan2(...) at the end.
00093       real
00094         p = Math::sq(R / _a),
00095         q = _e2m * Math::sq(Z / _a),
00096         r = (p + q - _e4a) / 6;
00097       if (_f < 0) swap(p, q);
00098       if ( !(_e4a * q == 0 && r <= 0) ) {
00099         real
00100           // Avoid possible division by zero when r = 0 by multiplying
00101           // equations for s and t by r^3 and r, resp.
00102           S = _e4a * p * q / 4, // S = r^3 * s
00103           r2 = Math::sq(r),
00104           r3 = r * r2,
00105           disc = S * (2 * r3 + S);
00106         real u = r;
00107         if (disc >= 0) {
00108           real T3 = S + r3;
00109           // Pick the sign on the sqrt to maximize abs(T3).  This minimizes
00110           // loss of precision due to cancellation.  The result is unchanged
00111           // because of the way the T is used in definition of u.
00112           T3 += T3 < 0 ? -sqrt(disc) : sqrt(disc); // T3 = (r * t)^3
00113           // N.B. cbrt always returns the real root.  cbrt(-8) = -2.
00114           real T = Math::cbrt(T3); // T = r * t
00115           // T can be zero; but then r2 / T -> 0.
00116           u += T + (T != 0 ? r2 / T : 0);
00117         } else {
00118           // T is complex, but the way u is defined the result is real.
00119           real ang = atan2(sqrt(-disc), -(S + r3));
00120           // There are three possible cube roots.  We choose the root which
00121           // avoids cancellation.  Note that disc < 0 implies that r < 0.
00122           u += 2 * r * cos(ang / 3);
00123         }
00124         real
00125           v = sqrt(Math::sq(u) + _e4a * q), // guaranteed positive
00126           // Avoid loss of accuracy when u < 0.  Underflow doesn't occur in
00127           // e4 * q / (v - u) because u ~ e^4 when q is small and u < 0.
00128           uv = u < 0 ? _e4a * q / (v - u) : u + v, // u+v, guaranteed positive
00129           // Need to guard against w going negative due to roundoff in uv - q.
00130           w = max(real(0), _e2a * (uv - q) / (2 * v)),
00131           // Rearrange expression for k to avoid loss of accuracy due to
00132           // subtraction.  Division by 0 not possible because uv > 0, w >= 0.
00133           k = uv / (sqrt(uv + Math::sq(w)) + w),
00134           k1 = _f >= 0 ? k : k - _e2,
00135           k2 = _f >= 0 ? k + _e2 : k,
00136           d = k1 * R / k2,
00137           H = Math::hypot(Z/k1, R/k2);
00138         sphi = (Z/k1) / H;
00139         cphi = (R/k2) / H;
00140         h = (1 - _e2m/k1) * Math::hypot(d, Z);
00141       } else {                  // e4 * q == 0 && r <= 0
00142         // This leads to k = 0 (oblate, equatorial plane) and k + e^2 = 0
00143         // (prolate, rotation axis) and the generation of 0/0 in the general
00144         // formulas for phi and h.  using the general formula and division by 0
00145         // in formula for h.  So handle this case by taking the limits:
00146         // f > 0: z -> 0, k      ->   e2 * sqrt(q)/sqrt(e4 - p)
00147         // f < 0: R -> 0, k + e2 -> - e2 * sqrt(q)/sqrt(e4 - p)
00148         real
00149           zz = sqrt((_f >= 0 ? _e4a - p : p) / _e2m),
00150           xx = sqrt( _f <  0 ? _e4a - p : p        ),
00151           H = Math::hypot(zz, xx);
00152         sphi = zz / H;
00153         cphi = xx / H;
00154         if (Z < 0) sphi = -sphi; // for tiny negative Z (not for prolate)
00155         h = - _a * (_f >= 0 ? _e2m : 1) * H / _e2a;
00156       }
00157     }
00158     lat = atan2(sphi, cphi) / Math::degree<real>();
00159     // Negative signs return lon in [-180, 180).
00160     lon = -atan2(-slam, clam) / Math::degree<real>();
00161     if (M)
00162       Rotation(sphi, cphi, slam, clam, M);
00163   }
00164 
00165   void Geocentric::Rotation(real sphi, real cphi, real slam, real clam,
00166                             real M[dim2_]) throw() {
00167     // This rotation matrix is given by the following quaternion operations
00168     // qrot(lam, [0,0,1]) * qrot(phi, [0,-1,0]) * [1,1,1,1]/2
00169     // or
00170     // qrot(pi/2 + lam, [0,0,1]) * qrot(-pi/2 + phi , [-1,0,0])
00171     // where
00172     // qrot(t,v) = [cos(t/2), sin(t/2)*v[1], sin(t/2)*v[2], sin(t/2)*v[3]]
00173 
00174     // Local X axis (east) in geocentric coords
00175     M[0] = -slam;        M[3] =  clam;        M[6] = 0;
00176     // Local Y axis (north) in geocentric coords
00177     M[1] = -clam * sphi; M[4] = -slam * sphi; M[7] = cphi;
00178     // Local Z axis (up) in geocentric coords
00179     M[2] =  clam * cphi; M[5] =  slam * cphi; M[8] = sphi;
00180   }
00181 
00182 } // namespace GeographicLib
geographiclib-1.21/doc/html/classes.html0000644000175000017500000003103611745620415020120 0ustar frankiefrankie GeographicLib: Class Index
Class Index
A | C | D | E | G | L | M | N | O | P | S | T | U
  A  
  E  
GravityModel (GeographicLib)   
  O  
  T  
  L  
Accumulator (GeographicLib)   EllipticFunction (GeographicLib)   OSGB (GeographicLib)   TransverseMercator (GeographicLib)   
AlbersEqualArea (GeographicLib)   
  G  
LambertConformalConic (GeographicLib)   
  P  
TransverseMercatorExact (GeographicLib)   
AzimuthalEquidistant (GeographicLib)   LocalCartesian (GeographicLib)   
  U  
  C  
Geocentric (GeographicLib)   
  M  
PolarStereographic (GeographicLib)   
GeoCoords (GeographicLib)   PolygonArea (GeographicLib)   Utility (GeographicLib)   
CassiniSoldner (GeographicLib)   Geodesic (GeographicLib)   MagneticCircle (GeographicLib)   
  S  
UTMUPS (GeographicLib)   
CircularEngine (GeographicLib)   GeodesicLine (GeographicLib)   MagneticModel (GeographicLib)   
SphericalEngine::coeff (GeographicLib)   GeographicErr (GeographicLib)   Math (GeographicLib)   SphericalEngine (GeographicLib)   
Constants (GeographicLib)   Geoid (GeographicLib)   MGRS (GeographicLib)   SphericalHarmonic (GeographicLib)   
  D  
Gnomonic (GeographicLib)   
  N  
SphericalHarmonic1 (GeographicLib)   
GravityCircle (GeographicLib)   SphericalHarmonic2 (GeographicLib)   
DMS (GeographicLib)   NormalGravity (GeographicLib)   
A | C | D | E | G | L | M | N | O | P | S | T | U
geographiclib-1.21/doc/html/SphericalHarmonic_8hpp.html0000644000175000017500000001346011745620414023015 0ustar frankiefrankie GeographicLib: SphericalHarmonic.hpp File Reference
SphericalHarmonic.hpp File Reference

Header for GeographicLib::SphericalHarmonic class. More...

Go to the source code of this file.

Classes

class  GeographicLib::SphericalHarmonic
 Spherical Harmonic series. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_SPHERICALHARMONIC_HPP   "$Id: 6fa804c46efd01670cfb7835dd022791b60d2942 $"

Detailed Description

Header for GeographicLib::SphericalHarmonic class.

Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file SphericalHarmonic.hpp.


Define Documentation

#define GEOGRAPHICLIB_SPHERICALHARMONIC_HPP   "$Id: 6fa804c46efd01670cfb7835dd022791b60d2942 $"

Definition at line 11 of file SphericalHarmonic.hpp.

geographiclib-1.21/doc/html/functions_type.html0000644000175000017500000000524711745620414021540 0ustar frankiefrankie GeographicLib: Class Members - Typedefs geographiclib-1.21/doc/html/MagneticCircle_8hpp.html0000644000175000017500000001313211745620415022270 0ustar frankiefrankie GeographicLib: MagneticCircle.hpp File Reference
MagneticCircle.hpp File Reference

Header for GeographicLib::MagneticCircle class. More...

#include <string>
#include <vector>
#include <GeographicLib/Constants.hpp>
#include <GeographicLib/CircularEngine.hpp>

Go to the source code of this file.

Classes

class  GeographicLib::MagneticCircle
 Geomagnetic field on a circle of latitude. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_MAGNETICCIRCLE_HPP   "$Id: 5b3adc58d894f36ca4206864eb565541f24ff492 $"

Detailed Description

Header for GeographicLib::MagneticCircle class.

Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file MagneticCircle.hpp.


Define Documentation

#define GEOGRAPHICLIB_MAGNETICCIRCLE_HPP   "$Id: 5b3adc58d894f36ca4206864eb565541f24ff492 $"

Definition at line 11 of file MagneticCircle.hpp.

geographiclib-1.21/doc/html/classGeographicLib_1_1Math-members.html0000644000175000017500000001716011745620414025113 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::Math Member List
This is the complete list of members for GeographicLib::Math, including all inherited members.
asinh(T x)GeographicLib::Math [inline, static]
atanh(T x)GeographicLib::Math [inline, static]
bigendianGeographicLib::Math [static]
cbrt(T x)GeographicLib::Math [inline, static]
degree()GeographicLib::Math [inline, static]
degree()GeographicLib::Math [inline, static]
expm1(T x)GeographicLib::Math [inline, static]
extended typedefGeographicLib::Math
hypot(T x, T y)GeographicLib::Math [inline, static]
infinity()GeographicLib::Math [inline, static]
infinity()GeographicLib::Math [inline, static]
isfinite(T x)GeographicLib::Math [inline, static]
isnan(T x)GeographicLib::Math [inline, static]
log1p(T x)GeographicLib::Math [inline, static]
NaN()GeographicLib::Math [inline, static]
NaN()GeographicLib::Math [inline, static]
pi()GeographicLib::Math [inline, static]
pi()GeographicLib::Math [inline, static]
real typedefGeographicLib::Math
sq(T x)GeographicLib::Math [inline, static]
swab(T x)GeographicLib::Math [inline, static]
geographiclib-1.21/doc/html/Geoid_8cpp_source.html0000644000175000017500000015405011745620414022025 0ustar frankiefrankie GeographicLib: Geoid.cpp Source File
Geoid.cpp
Go to the documentation of this file.
00001 /**
00002  * \file Geoid.cpp
00003  * \brief Implementation for GeographicLib::Geoid class
00004  *
00005  * Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/Geoid.hpp>
00011 #include <sstream>
00012 #include <cstdlib>
00013 #include <algorithm>
00014 #include <GeographicLib/Utility.hpp>
00015 
00016 #define GEOGRAPHICLIB_GEOID_CPP \
00017   "$Id: 5c3c23dd877485af9c9e298ddb28c5aac12b5e6a $"
00018 
00019 RCSID_DECL(GEOGRAPHICLIB_GEOID_CPP)
00020 RCSID_DECL(GEOGRAPHICLIB_GEOID_HPP)
00021 
00022 #if !defined(GEOGRAPHICLIB_DATA)
00023 #  if defined(_MSC_VER)
00024 #    define GEOGRAPHICLIB_DATA \
00025   "C:/Documents and Settings/All Users/Application Data/GeographicLib"
00026 #  else
00027 #    define GEOGRAPHICLIB_DATA "/usr/local/share/GeographicLib"
00028 #  endif
00029 #endif
00030 
00031 #if !defined(GEOID_DEFAULT_NAME)
00032 #  define GEOID_DEFAULT_NAME "egm96-5"
00033 #endif
00034 
00035 #if defined(_MSC_VER)
00036 // Squelch warnings about unsafe use of getenv
00037 #pragma warning (disable: 4996)
00038 #endif
00039 
00040 namespace GeographicLib {
00041 
00042   using namespace std;
00043 
00044   // This is the transfer matrix for a 3rd order fit with a 12-point stencil
00045   // with weights
00046   //
00047   //   \x -1  0  1  2
00048   //   y
00049   //  -1   .  1  1  .
00050   //   0   1  2  2  1
00051   //   1   1  2  2  1
00052   //   2   .  1  1  .
00053   //
00054   // A algorithm for n-dimensional polynomial fits is described in
00055   //   F. H. Lesh,
00056   //   Multi-dimensional least-squares polynomial curve fitting,
00057   //   CACM 2, 29-30 (1959).
00058   //
00059   // Here's the Maxima code to generate this matrix:
00060   //
00061   // /* The stencil and the weights */
00062   // xarr:[
00063   //     0, 1,
00064   // -1, 0, 1, 2,
00065   // -1, 0, 1, 2,
00066   //     0, 1]$
00067   // yarr:[
00068   //   -1,-1,
00069   // 0, 0, 0, 0,
00070   // 1, 1, 1, 1,
00071   //    2, 2]$
00072   // warr:[
00073   //    1, 1,
00074   // 1, 2, 2, 1,
00075   // 1, 2, 2, 1,
00076   //    1, 1]$
00077   //
00078   // /* [x exponent, y exponent] for cubic fit */
00079   // pows:[
00080   // [0,0],
00081   // [1,0],[0,1],
00082   // [2,0],[1,1],[0,2],
00083   // [3,0],[2,1],[1,2],[0,3]]$
00084   //
00085   // basisvec(x,y,pows):=map(lambda([ex],(if ex[1]=0 then 1 else x^ex[1])*
00086   //     (if ex[2]=0 then 1 else y^ex[2])),pows)$
00087   // addterm(x,y,f,w,pows):=block([a,b,bb:basisvec(x,y,pows)],
00088   //   a:w*(transpose(bb).bb),
00089   //   b:(w*f) * bb,
00090   //   [a,b])$
00091   //
00092   // c3row(k):=block([a,b,c,pows:pows,n],
00093   //   n:length(pows),
00094   //   a:zeromatrix(n,n),
00095   //   b:copylist(part(a,1)),
00096   //   c:[a,b],
00097   //   for i:1 thru length(xarr) do
00098   //   c:c+addterm(xarr[i],yarr[i],if i=k then 1 else 0,warr[i],pows),
00099   //   a:c[1],b:c[2],
00100   //   part(transpose( a^^-1 . transpose(b)),1))$
00101   // c3:[]$
00102   // for k:1 thru length(warr) do c3:endcons(c3row(k),c3)$
00103   // c3:apply(matrix,c3)$
00104   // c0:part(ratsimp(
00105   // genmatrix(yc,1,length(warr)).abs(c3).genmatrix(yd,length(pows),1)),2)$
00106   // c3:c0*c3$
00107 
00108   const Math::real Geoid::c0_ = 240; // Common denominator
00109   const Math::real Geoid::c3_[stencilsize_ * nterms_] = {
00110       9, -18, -88,    0,  96,   90,   0,   0, -60, -20,
00111      -9,  18,   8,    0, -96,   30,   0,   0,  60, -20,
00112       9, -88, -18,   90,  96,    0, -20, -60,   0,   0,
00113     186, -42, -42, -150, -96, -150,  60,  60,  60,  60,
00114      54, 162, -78,   30, -24,  -90, -60,  60, -60,  60,
00115      -9, -32,  18,   30,  24,    0,  20, -60,   0,   0,
00116      -9,   8,  18,   30, -96,    0, -20,  60,   0,   0,
00117      54, -78, 162,  -90, -24,   30,  60, -60,  60, -60,
00118     -54,  78,  78,   90, 144,   90, -60, -60, -60, -60,
00119       9,  -8, -18,  -30, -24,    0,  20,  60,   0,   0,
00120      -9,  18, -32,    0,  24,   30,   0,   0, -60,  20,
00121       9, -18,  -8,    0, -24,  -30,   0,   0,  60,  20,
00122   };
00123 
00124   // Like c3, but with the coeffs of x, x^2, and x^3 constrained to be zero.
00125   // Use this at the N pole so that the height in independent of the longitude
00126   // there.
00127   //
00128   // Here's the Maxima code to generate this matrix (continued from above).
00129   //
00130   // /* figure which terms to exclude so that fit is indep of x at y=0 */
00131   // mask:part(zeromatrix(1,length(pows)),1)+1$
00132   // for i:1 thru length(pows) do
00133   // if pows[i][1]>0 and pows[i][2]=0 then mask[i]:0$
00134   //
00135   // /* Same as c3row but with masked pows. */
00136   // c3nrow(k):=block([a,b,c,powsa:[],n,d,e],
00137   //   for i:1 thru length(mask) do if mask[i]>0 then
00138   //   powsa:endcons(pows[i],powsa),
00139   //   n:length(powsa),
00140   //   a:zeromatrix(n,n),
00141   //   b:copylist(part(a,1)),
00142   //   c:[a,b],
00143   //   for i:1 thru length(xarr) do
00144   //   c:c+addterm(xarr[i],yarr[i],if i=k then 1 else 0,warr[i],powsa),
00145   //   a:c[1],b:c[2],
00146   //   d:part(transpose( a^^-1 . transpose(b)),1),
00147   //   e:[],
00148   //   for i:1 thru length(mask) do
00149   //   if mask[i]>0 then (e:endcons(first(d),e),d:rest(d)) else e:endcons(0,e),
00150   //   e)$
00151   // c3n:[]$
00152   // for k:1 thru length(warr) do c3n:endcons(c3nrow(k),c3n)$
00153   // c3n:apply(matrix,c3n)$
00154   // c0n:part(ratsimp(
00155   //     genmatrix(yc,1,length(warr)).abs(c3n).genmatrix(yd,length(pows),1)),2)$
00156   // c3n:c0n*c3n$
00157 
00158   const Math::real Geoid::c0n_ = 372; // Common denominator
00159   const Math::real Geoid::c3n_[stencilsize_ * nterms_] = {
00160       0, 0, -131, 0,  138,  144, 0,   0, -102, -31,
00161       0, 0,    7, 0, -138,   42, 0,   0,  102, -31,
00162      62, 0,  -31, 0,    0,  -62, 0,   0,    0,  31,
00163     124, 0,  -62, 0,    0, -124, 0,   0,    0,  62,
00164     124, 0,  -62, 0,    0, -124, 0,   0,    0,  62,
00165      62, 0,  -31, 0,    0,  -62, 0,   0,    0,  31,
00166       0, 0,   45, 0, -183,   -9, 0,  93,   18,   0,
00167       0, 0,  216, 0,   33,   87, 0, -93,   12, -93,
00168       0, 0,  156, 0,  153,   99, 0, -93,  -12, -93,
00169       0, 0,  -45, 0,   -3,    9, 0,  93,  -18,   0,
00170       0, 0,  -55, 0,   48,   42, 0,   0,  -84,  31,
00171       0, 0,   -7, 0,  -48,  -42, 0,   0,   84,  31,
00172   };
00173 
00174   // Like c3n, but y -> 1-y so that h is independent of x at y = 1.  Use this
00175   // at the S pole so that the height in independent of the longitude there.
00176   //
00177   // Here's the Maxima code to generate this matrix (continued from above).
00178   //
00179   // /* Transform c3n to c3s by transforming y -> 1-y */
00180   // vv:[
00181   //      v[11],v[12],
00182   // v[7],v[8],v[9],v[10],
00183   // v[3],v[4],v[5],v[6],
00184   //      v[1],v[2]]$
00185   // poly:expand(vv.(c3n/c0n).transpose(basisvec(x,1-y,pows)))$
00186   // c3sf[i,j]:=coeff(coeff(coeff(poly,v[i]),x,pows[j][1]),y,pows[j][2])$
00187   // c3s:genmatrix(c3sf,length(vv),length(pows))$
00188   // c0s:part(ratsimp(
00189   //     genmatrix(yc,1,length(warr)).abs(c3s).genmatrix(yd,length(pows),1)),2)$
00190   // c3s:c0s*c3s$
00191 
00192   const Math::real Geoid::c0s_ = 372; // Common denominator
00193   const Math::real Geoid::c3s_[stencilsize_ * nterms_] = {
00194      18,  -36, -122,   0,  120,  135, 0,   0,  -84, -31,
00195     -18,   36,   -2,   0, -120,   51, 0,   0,   84, -31,
00196      36, -165,  -27,  93,  147,   -9, 0, -93,   18,   0,
00197     210,   45, -111, -93,  -57, -192, 0,  93,   12,  93,
00198     162,  141,  -75, -93, -129, -180, 0,  93,  -12,  93,
00199     -36,  -21,   27,  93,   39,    9, 0, -93,  -18,   0,
00200       0,    0,   62,   0,    0,   31, 0,   0,    0, -31,
00201       0,    0,  124,   0,    0,   62, 0,   0,    0, -62,
00202       0,    0,  124,   0,    0,   62, 0,   0,    0, -62,
00203       0,    0,   62,   0,    0,   31, 0,   0,    0, -31,
00204     -18,   36,  -64,   0,   66,   51, 0,   0, -102,  31,
00205      18,  -36,    2,   0,  -66,  -51, 0,   0,  102,  31,
00206   };
00207 
00208   Geoid::Geoid(const std::string& name, const std::string& path, bool cubic,
00209                bool threadsafe)
00210     : _name(name)
00211     , _dir(path)
00212     , _cubic(cubic)
00213     , _a( Constants::WGS84_a<real>() )
00214     , _e2( (2 - Constants::WGS84_f<real>()) * Constants::WGS84_f<real>() )
00215     , _degree( Math::degree<real>() )
00216     , _eps( sqrt(numeric_limits<real>::epsilon()) )
00217     , _threadsafe(false)        // Set after cache is read
00218   {
00219     STATIC_ASSERT(sizeof(pixel_t) == pixel_size_, "pixel_t has the wrong size");
00220     if (_dir.empty())
00221       _dir = DefaultGeoidPath();
00222     _filename = _dir + "/" + _name + (pixel_size_ != 4 ? ".pgm" : ".pgm4");
00223     _file.open(_filename.c_str(), ios::binary);
00224     if (!(_file.good()))
00225       throw GeographicErr("File not readable " + _filename);
00226     string s;
00227     if (!(getline(_file, s) && s == "P5"))
00228       throw GeographicErr("File not in PGM format " + _filename);
00229     _offset = numeric_limits<real>::max();
00230     _scale = 0;
00231     _maxerror = _rmserror = -1;
00232     _description = "NONE";
00233     _datetime = "UNKNOWN";
00234     while (getline(_file, s)) {
00235       if (s.empty())
00236         continue;
00237       if (s[0] == '#') {
00238         istringstream is(s);
00239         string commentid, key;
00240         if (!(is >> commentid >> key) || commentid != "#")
00241           continue;
00242         if (key == "Description" || key =="DateTime") {
00243           string::size_type p =
00244             s.find_first_not_of(" \t", unsigned(is.tellg()));
00245           if (p != string::npos)
00246             (key == "Description" ? _description : _datetime) = s.substr(p);
00247         } else if (key == "Offset") {
00248           if (!(is >> _offset))
00249             throw GeographicErr("Error reading offset " + _filename);
00250         } else if (key == "Scale") {
00251           if (!(is >> _scale))
00252             throw GeographicErr("Error reading scale " + _filename);
00253         } else if (key == (_cubic ? "MaxCubicError" : "MaxBilinearError")) {
00254           // It's not an error if the error can't be read
00255           is >> _maxerror;
00256         } else if (key == (_cubic ? "RMSCubicError" : "RMSBilinearError")) {
00257           // It's not an error if the error can't be read
00258           is >> _rmserror;
00259         }
00260       } else {
00261         istringstream is(s);
00262         if (!(is >> _width >> _height))
00263           throw GeographicErr("Error reading raster size " + _filename);
00264         break;
00265       }
00266     }
00267     {
00268       unsigned maxval;
00269       if (!(_file >> maxval))
00270         throw GeographicErr("Error reading maxval " + _filename);
00271       if (maxval != pixel_max_)
00272         throw GeographicErr("Incorrect value of maxval " + _filename);
00273       // Add 1 for whitespace after maxval
00274       _datastart = (unsigned long long)(_file.tellg()) + 1ULL;
00275       _swidth = (unsigned long long)(_width);
00276     }
00277     if (_offset == numeric_limits<real>::max())
00278       throw GeographicErr("Offset not set " + _filename);
00279     if (_scale == 0)
00280       throw GeographicErr("Scale not set " + _filename);
00281     if (_scale < 0)
00282       throw GeographicErr("Scale must be positive " + _filename);
00283     if (_height < 2 || _width < 2)
00284       // Coarsest grid spacing is 180deg.
00285       throw GeographicErr("Raster size too small " + _filename);
00286     if (_width & 1)
00287       // This is so that longitude grids can be extended thru the poles.
00288       throw GeographicErr("Raster width is odd " + _filename);
00289     if (!(_height & 1))
00290       // This is so that latitude grid includes the equator.
00291       throw GeographicErr("Raster height is even " + _filename);
00292     _file.seekg(0, ios::end);
00293     if (!_file.good() ||
00294         _datastart + pixel_size_ * _swidth * (unsigned long long)(_height) !=
00295         (unsigned long long)(_file.tellg()))
00296       // Possibly this test should be "<" because the file contains, e.g., a
00297       // second image.  However, for now we are more strict.
00298       throw GeographicErr("File has the wrong length " + _filename);
00299     _rlonres = _width / real(360);
00300     _rlatres = (_height - 1) / real(180);
00301     _cache = false;
00302     _ix = _width;
00303     _iy = _height;
00304     // Ensure that file errors throw exceptions
00305     _file.exceptions(ifstream::eofbit | ifstream::failbit | ifstream::badbit);
00306     if (threadsafe) {
00307       CacheAll();
00308       _file.close();
00309       _threadsafe = true;
00310     }
00311   }
00312 
00313   Math::real Geoid::height(real lat, real lon, bool gradp,
00314                            real& gradn, real& grade) const {
00315     if (Math::isnan(lat) || Math::isnan(lon)) {
00316       if (gradp) gradn = grade = Math::NaN<real>();
00317       return Math::NaN<real>();
00318     }
00319     real
00320       fx =  lon * _rlonres,
00321       fy = -lat * _rlatres;
00322     int
00323       ix = int(floor(fx)),
00324       iy = min((_height - 1)/2 - 1, int(floor(fy)));
00325     fx -= ix;
00326     fy -= iy;
00327     iy += (_height - 1)/2;
00328     ix += ix < 0 ? _width : (ix >= _width ? -_width : 0);
00329     real v00 = 0, v01 = 0, v10 = 0, v11 = 0;
00330     real t[nterms_];
00331 
00332     if (_threadsafe || !(ix == _ix && iy == _iy)) {
00333       if (!_cubic) {
00334         v00 = rawval(ix    , iy    );
00335         v01 = rawval(ix + 1, iy    );
00336         v10 = rawval(ix    , iy + 1);
00337         v11 = rawval(ix + 1, iy + 1);
00338       } else {
00339         real v[stencilsize_];
00340         int k = 0;
00341         v[k++] = rawval(ix    , iy - 1);
00342         v[k++] = rawval(ix + 1, iy - 1);
00343         v[k++] = rawval(ix - 1, iy    );
00344         v[k++] = rawval(ix    , iy    );
00345         v[k++] = rawval(ix + 1, iy    );
00346         v[k++] = rawval(ix + 2, iy    );
00347         v[k++] = rawval(ix - 1, iy + 1);
00348         v[k++] = rawval(ix    , iy + 1);
00349         v[k++] = rawval(ix + 1, iy + 1);
00350         v[k++] = rawval(ix + 2, iy + 1);
00351         v[k++] = rawval(ix    , iy + 2);
00352         v[k++] = rawval(ix + 1, iy + 2);
00353 
00354         const real* c3x = iy == 0 ? c3n_ : (iy == _height - 2 ? c3s_ : c3_);
00355         real c0x = iy == 0 ? c0n_ : (iy == _height - 2 ? c0s_ : c0_);
00356         for (unsigned i = 0; i < nterms_; ++i) {
00357           t[i] = 0;
00358           for (unsigned j = 0; j < stencilsize_; ++j)
00359             t[i] += v[j] * c3x[nterms_ * j + i];
00360           t[i] /= c0x;
00361         }
00362       }
00363     } else { // same cell; used cached coefficients
00364       if (!_cubic) {
00365         v00 = _v00;
00366         v01 = _v01;
00367         v10 = _v10;
00368         v11 = _v11;
00369       } else
00370         copy(_t, _t + nterms_, t);
00371     }
00372     if (!_cubic) {
00373       real
00374         a = (1 - fx) * v00 + fx * v01,
00375         b = (1 - fx) * v10 + fx * v11,
00376         c = (1 - fy) * a + fy * b,
00377         h = _offset + _scale * c;
00378       if (gradp) {
00379         real
00380           phi = lat * _degree,
00381           cosphi = cos(phi),
00382           sinphi = sin(phi),
00383           n = 1/sqrt(1 - _e2 * sinphi * sinphi);
00384         gradn = ((1 - fx) * (v00 - v10) + fx * (v01 - v11)) *
00385           _rlatres / (_degree * _a * (1 - _e2) * n * n * n);
00386         grade = (cosphi > _eps ?
00387                  ((1 - fy) * (v01 - v00) + fy * (v11 - v10)) /   cosphi :
00388                  (sinphi > 0 ? v11 - v10 : v01 - v00) *
00389                  _rlatres / _degree ) *
00390           _rlonres / (_degree * _a * n);
00391         gradn *= _scale;
00392         grade *= _scale;
00393       }
00394       if (!_threadsafe) {
00395         _ix = ix;
00396         _iy = iy;
00397         _v00 = v00;
00398         _v01 = v01;
00399         _v10 = v10;
00400         _v11 = v11;
00401       }
00402       return h;
00403     } else {
00404       real h = t[0] + fx * (t[1] + fx * (t[3] + fx * t[6])) +
00405         fy * (t[2] + fx * (t[4] + fx * t[7]) +
00406              fy * (t[5] + fx * t[8] + fy * t[9]));
00407       h = _offset + _scale * h;
00408       if (gradp) {
00409         // Avoid 0/0 at the poles by backing off 1/100 of a cell size
00410         lat = min(lat,  90 - 1/(100 * _rlatres));
00411         lat = max(lat, -90 + 1/(100 * _rlatres));
00412         fy = (90 - lat) * _rlatres;
00413         fy -= int(fy);
00414         real
00415           phi = lat * _degree,
00416           cosphi = cos(phi),
00417           sinphi = sin(phi),
00418           n = 1/sqrt(1 - _e2 * sinphi * sinphi);
00419         gradn = t[2] + fx * (t[4] + fx * t[7]) +
00420           fy * (2 * t[5] + fx * 2 * t[8] + 3 * fy * t[9]);
00421         grade = t[1] + fx * (2 * t[3] + fx * 3 * t[6]) +
00422           fy * (t[4] + fx * 2 * t[7] + fy * t[8]);
00423         gradn *= - _rlatres / (_degree * _a * (1 - _e2) * n * n * n) * _scale;
00424         grade *= _rlonres / (_degree * _a * n * cosphi) * _scale;
00425       }
00426       if (!_threadsafe) {
00427         _ix = ix;
00428         _iy = iy;
00429         copy(t, t + nterms_, _t);
00430       }
00431       return h;
00432     }
00433   }
00434 
00435   void Geoid::CacheClear() const throw() {
00436     if (!_threadsafe) {
00437       _cache = false;
00438       try {
00439         _data.clear();
00440         // Use swap to release memory back to system
00441         vector< vector<pixel_t> >().swap(_data);
00442       }
00443       catch (const exception&) {
00444       }
00445     }
00446   }
00447 
00448   void Geoid::CacheArea(real south, real west, real north, real east) const {
00449     if (_threadsafe)
00450       throw GeographicErr("Attempt to change cache of threadsafe Geoid");
00451     if (south > north) {
00452       CacheClear();
00453       return;
00454     }
00455     if (west >= 180)
00456       west -= 360;              // west in [-180, 180)
00457     if (east >= 180)
00458       east -= 360;
00459     if (east <= west)
00460       east += 360;              // east - west in (0, 360]
00461     int
00462       iw = int(floor(west * _rlonres)),
00463       ie = int(floor(east * _rlonres)),
00464       in = int(floor(-north * _rlatres)) + (_height - 1)/2,
00465       is = int(floor(-south * _rlatres)) + (_height - 1)/2;
00466     in = max(0, min(_height - 2, in));
00467     is = max(0, min(_height - 2, is));
00468     is += 1;
00469     ie += 1;
00470     if (_cubic) {
00471       in -= 1;
00472       is += 1;
00473       iw -= 1;
00474       ie += 1;
00475     }
00476     if (ie - iw >= _width - 1) {
00477       // Include entire longitude range
00478       iw = 0;
00479       ie = _width - 1;
00480     } else {
00481       ie += iw < 0 ? _width : (iw >= _width ? -_width : 0);
00482       iw += iw < 0 ? _width : (iw >= _width ? -_width : 0);
00483     }
00484     int oysize = int(_data.size());
00485     _xsize = ie - iw + 1;
00486     _ysize = is - in + 1;
00487     _xoffset = iw;
00488     _yoffset = in;
00489 
00490     try {
00491       _data.resize(_ysize, vector<pixel_t>(_xsize));
00492       for (int iy = min(oysize, _ysize); iy--;)
00493         _data[iy].resize(_xsize);
00494     }
00495     catch (const bad_alloc&) {
00496       CacheClear();
00497       throw GeographicErr("Insufficient memory for caching " + _filename);
00498     }
00499 
00500     try {
00501       for (int iy = in; iy <= is; ++iy) {
00502         int iy1 = iy, iw1 = iw;
00503         if (iy < 0 || iy >= _height) {
00504           // Allow points "beyond" the poles to support interpolation
00505           iy1 = iy1 < 0 ? -iy1 : 2 * (_height - 1) - iy1;
00506           iw1 += _width/2;
00507           if (iw1 >= _width)
00508             iw1 -= _width;
00509         }
00510         int xs1 = min(_width - iw1, _xsize);
00511         filepos(iw1, iy1);
00512         Utility::readarray<pixel_t, pixel_t, true>
00513           (_file, &(_data[iy - in][0]), xs1);
00514         if (xs1 < _xsize) {
00515           // Wrap around longitude = 0
00516           filepos(0, iy1);
00517           Utility::readarray<pixel_t, pixel_t, true>
00518             (_file, &(_data[iy - in][xs1]), _xsize - xs1);
00519         }
00520       }
00521       _cache = true;
00522     }
00523     catch (const exception& e) {
00524       CacheClear();
00525       throw GeographicErr(string("Error filling cache ") + e.what());
00526     }
00527   }
00528 
00529   std::string Geoid::DefaultGeoidPath() {
00530     string path;
00531     char* geoidpath = getenv("GEOID_PATH");
00532     if (geoidpath)
00533       path = string(geoidpath);
00534     if (path.length())
00535       return path;
00536     char* datapath = getenv("GEOGRAPHICLIB_DATA");
00537     if (datapath)
00538       path = string(datapath);
00539     return (path.length() ? path : string(GEOGRAPHICLIB_DATA)) + "/geoids";
00540   }
00541 
00542   std::string Geoid::DefaultGeoidName() {
00543     string name;
00544     char* geoidname = getenv("GEOID_NAME");
00545     if (geoidname)
00546       name = string(geoidname);
00547     return name.length() ? name : string(GEOID_DEFAULT_NAME);
00548   }
00549 
00550 } // namespace GeographicLib
geographiclib-1.21/doc/html/functions_0x7a.html0000644000175000017500000001102511745620415021326 0ustar frankiefrankie GeographicLib: Class Members
Here is a list of all class members with links to the classes they belong to:

- z -

geographiclib-1.21/doc/html/MagneticCircle_8cpp.html0000644000175000017500000001361711745620414022272 0ustar frankiefrankie GeographicLib: MagneticCircle.cpp File Reference
MagneticCircle.cpp File Reference

Implementation for GeographicLib::MagneticCircle class. More...

#include <GeographicLib/MagneticCircle.hpp>
#include <fstream>
#include <sstream>
#include <GeographicLib/Geocentric.hpp>

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_MAGNETICCIRCLE_CPP   "$Id: 8cd933c406708a1f8b90e029e89bb99d2eb177b0 $"
#define MAGNETIC_DEFAULT_PATH   "/home/ckarney/geographiclib/magnetic"

Detailed Description

Implementation for GeographicLib::MagneticCircle class.

Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file MagneticCircle.cpp.


Define Documentation

#define GEOGRAPHICLIB_MAGNETICCIRCLE_CPP   "$Id: 8cd933c406708a1f8b90e029e89bb99d2eb177b0 $"

Definition at line 15 of file MagneticCircle.cpp.

#define MAGNETIC_DEFAULT_PATH   "/home/ckarney/geographiclib/magnetic"

Definition at line 21 of file MagneticCircle.cpp.

geographiclib-1.21/doc/html/ConicProj_8cpp_source.html0000644000175000017500000007074211745620414022671 0ustar frankiefrankie GeographicLib: ConicProj.cpp Source File
ConicProj.cpp
Go to the documentation of this file.
00001 /**
00002  * \file ConicProj.cpp
00003  * \brief Command line utility for conical projections
00004  *
00005  * Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  *
00009  * Compile and link with
00010  *   g++ -g -O3 -I../include -I../man -o ConicProj \
00011  *       ConicProj.cpp \
00012  *       ../src/AlbersEqualArea.cpp \
00013  *       ../src/DMS.cpp \
00014  *       ../src/LambertConformalConic.cpp
00015  *
00016  * See the <a href="ConicProj.1.html">man page</a> for usage
00017  * information.
00018  **********************************************************************/
00019 
00020 #include <iostream>
00021 #include <sstream>
00022 #include <string>
00023 #include <sstream>
00024 #include <fstream>
00025 #include <GeographicLib/LambertConformalConic.hpp>
00026 #include <GeographicLib/AlbersEqualArea.hpp>
00027 #include <GeographicLib/DMS.hpp>
00028 #include <GeographicLib/Utility.hpp>
00029 
00030 #include "ConicProj.usage"
00031 
00032 int main(int argc, char* argv[]) {
00033   try {
00034     using namespace GeographicLib;
00035     typedef Math::real real;
00036     bool lcc = false, albers = false, reverse = false;
00037     real lat1 = 0, lat2 = 0, lon0 = 0, k1 = 1;
00038     real
00039       a = Constants::WGS84_a<real>(),
00040       f = Constants::WGS84_f<real>();
00041     std::string istring, ifile, ofile, cdelim;
00042     char lsep = ';';
00043 
00044     for (int m = 1; m < argc; ++m) {
00045       std::string arg(argv[m]);
00046       if (arg == "-r")
00047         reverse = true;
00048       else if (arg == "-c" || arg == "-a") {
00049         lcc = arg == "-c";
00050         albers = arg == "-a";
00051         if (m + 2 >= argc) return usage(1, true);
00052         try {
00053           for (int i = 0; i < 2; ++i) {
00054             DMS::flag ind;
00055             (i ? lat2 : lat1) = DMS::Decode(std::string(argv[++m]), ind);
00056             if (ind == DMS::LONGITUDE)
00057               throw GeographicErr("Bad hemisphere");
00058           }
00059         }
00060         catch (const std::exception& e) {
00061           std::cerr << "Error decoding arguments of " << arg << ": "
00062                     << e.what() << "\n";
00063           return 1;
00064         }
00065       } else if (arg == "-l") {
00066         if (++m == argc) return usage(1, true);
00067         try {
00068           DMS::flag ind;
00069           lon0 = DMS::Decode(std::string(argv[m]), ind);
00070           if (ind == DMS::LATITUDE)
00071             throw GeographicErr("Bad hemisphere");
00072           if (!(lon0 >= -180 && lon0 <= 360))
00073             throw GeographicErr("Bad longitude");
00074           if (lon0 >= 180) lon0 -= 360;
00075         }
00076         catch (const std::exception& e) {
00077           std::cerr << "Error decoding argument of " << arg << ": "
00078                     << e.what() << "\n";
00079           return 1;
00080         }
00081       } else if (arg == "-k") {
00082         if (++m == argc) return usage(1, true);
00083         try {
00084           k1 = Utility::num<real>(std::string(argv[m]));
00085         }
00086         catch (const std::exception& e) {
00087           std::cerr << "Error decoding argument of " << arg << ": "
00088                     << e.what() << "\n";
00089           return 1;
00090         }
00091       } else if (arg == "-e") {
00092         if (m + 2 >= argc) return usage(1, true);
00093         try {
00094           a = Utility::num<real>(std::string(argv[m + 1]));
00095           f = Utility::fract<real>(std::string(argv[m + 2]));
00096         }
00097         catch (const std::exception& e) {
00098           std::cerr << "Error decoding arguments of -e: " << e.what() << "\n";
00099           return 1;
00100         }
00101         m += 2;
00102       } else if (arg == "--input-string") {
00103         if (++m == argc) return usage(1, true);
00104         istring = argv[m];
00105       } else if (arg == "--input-file") {
00106         if (++m == argc) return usage(1, true);
00107         ifile = argv[m];
00108       } else if (arg == "--output-file") {
00109         if (++m == argc) return usage(1, true);
00110         ofile = argv[m];
00111       } else if (arg == "--line-separator") {
00112         if (++m == argc) return usage(1, true);
00113         if (std::string(argv[m]).size() != 1) {
00114           std::cerr << "Line separator must be a single character\n";
00115           return 1;
00116         }
00117         lsep = argv[m][0];
00118       } else if (arg == "--comment-delimiter") {
00119         if (++m == argc) return usage(1, true);
00120         cdelim = argv[m];
00121       } else if (arg == "--version") {
00122         std::cout
00123           << argv[0]
00124           << ": $Id: 8efb8dcae1b8e8f1abac4d5d6f60e8730ecaa81c $\n"
00125           << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n";
00126         return 0;
00127       } else
00128         return usage(!(arg == "-h" || arg == "--help"), arg != "--help");
00129     }
00130 
00131     if (!ifile.empty() && !istring.empty()) {
00132       std::cerr << "Cannot specify --input-string and --input-file together\n";
00133       return 1;
00134     }
00135     if (ifile == "-") ifile.clear();
00136     std::ifstream infile;
00137     std::istringstream instring;
00138     if (!ifile.empty()) {
00139       infile.open(ifile.c_str());
00140       if (!infile.is_open()) {
00141         std::cerr << "Cannot open " << ifile << " for reading\n";
00142         return 1;
00143       }
00144     } else if (!istring.empty()) {
00145       std::string::size_type m = 0;
00146       while (true) {
00147         m = istring.find(lsep, m);
00148         if (m == std::string::npos)
00149           break;
00150         istring[m] = '\n';
00151       }
00152       instring.str(istring);
00153     }
00154     std::istream* input = !ifile.empty() ? &infile :
00155       (!istring.empty() ? &instring : &std::cin);
00156 
00157     std::ofstream outfile;
00158     if (ofile == "-") ofile.clear();
00159     if (!ofile.empty()) {
00160       outfile.open(ofile.c_str());
00161       if (!outfile.is_open()) {
00162         std::cerr << "Cannot open " << ofile << " for writing\n";
00163         return 1;
00164       }
00165     }
00166     std::ostream* output = !ofile.empty() ? &outfile : &std::cout;
00167 
00168     if (!(lcc || albers)) {
00169       std::cerr << "Must specify \"-c lat1 lat2\" or "
00170                 << "\"-a lat1 lat2\"\n";
00171       return 1;
00172     }
00173 
00174     const LambertConformalConic lproj =
00175       lcc ? LambertConformalConic(a, f, lat1, lat2, k1)
00176       : LambertConformalConic(1, 0, 0, 0, 1);
00177     const AlbersEqualArea aproj =
00178       albers ? AlbersEqualArea(a, f, lat1, lat2, k1)
00179       : AlbersEqualArea(1, 0, 0, 0, 1);
00180 
00181     std::string s;
00182     int retval = 0;
00183     std::cout << std::fixed;
00184     while (std::getline(*input, s)) {
00185       try {
00186         std::string eol("\n");
00187         if (!cdelim.empty()) {
00188           std::string::size_type m = s.find(cdelim);
00189           if (m != std::string::npos) {
00190             eol = " " + s.substr(m) + "\n";
00191             s = s.substr(0, m);
00192           }
00193         }
00194         std::istringstream str(s);
00195         real lat, lon, x, y, gamma, k;
00196         std::string stra, strb;
00197         if (!(str >> stra >> strb))
00198           throw GeographicErr("Incomplete input: " + s);
00199         if (reverse) {
00200           x = Utility::num<real>(stra);
00201           y = Utility::num<real>(strb);
00202         } else
00203           DMS::DecodeLatLon(stra, strb, lat, lon);
00204         std::string strc;
00205         if (str >> strc)
00206           throw GeographicErr("Extraneous input: " + strc);
00207         if (reverse) {
00208           if (lcc)
00209             lproj.Reverse(lon0, x, y, lat, lon, gamma, k);
00210           else
00211             aproj.Reverse(lon0, x, y, lat, lon, gamma, k);
00212           *output << Utility::str<real>(lat, 15) << " "
00213                   << Utility::str<real>(lon, 15) << " "
00214                   << Utility::str<real>(gamma, 16) << " "
00215                   << Utility::str<real>(k, 16) << eol;
00216         } else {
00217           if (lcc)
00218             lproj.Forward(lon0, lat, lon, x, y, gamma, k);
00219           else
00220             aproj.Forward(lon0, lat, lon, x, y, gamma, k);
00221           *output << Utility::str<real>(x, 10) << " "
00222                   << Utility::str<real>(y, 10) << " "
00223                   << Utility::str<real>(gamma, 16) << " "
00224                   << Utility::str<real>(k, 16) << eol;
00225         }
00226       }
00227       catch (const std::exception& e) {
00228         *output << "ERROR: " << e.what() << "\n";
00229         retval = 1;
00230       }
00231     }
00232     return retval;
00233   }
00234   catch (const std::exception& e) {
00235     std::cerr << "Caught exception: " << e.what() << "\n";
00236     return 1;
00237   }
00238   catch (...) {
00239     std::cerr << "Caught unknown exception\n";
00240     return 1;
00241   }
00242 }
geographiclib-1.21/doc/html/functions_func_0x6b.html0000644000175000017500000001121711745620414022343 0ustar frankiefrankie GeographicLib: Class Members - Functions geographiclib-1.21/doc/html/Gnomonic_8hpp.html0000644000175000017500000001267711745620414021204 0ustar frankiefrankie GeographicLib: Gnomonic.hpp File Reference
Gnomonic.hpp File Reference

Header for GeographicLib::Gnomonic class. More...

Go to the source code of this file.

Classes

class  GeographicLib::Gnomonic
 Gnomonic Projection. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_GNOMONIC_HPP   "$Id: f2e7e429e56165c314a518fada607c225132b945 $"

Detailed Description

Header for GeographicLib::Gnomonic class.

Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file Gnomonic.hpp.


Define Documentation

#define GEOGRAPHICLIB_GNOMONIC_HPP   "$Id: f2e7e429e56165c314a518fada607c225132b945 $"

Definition at line 11 of file Gnomonic.hpp.

geographiclib-1.21/doc/html/functions_func_0x6c.html0000644000175000017500000001446111745620414022350 0ustar frankiefrankie GeographicLib: Class Members - Functions geographiclib-1.21/doc/html/Gnomonic_8cpp.html0000644000175000017500000001117411745620415021167 0ustar frankiefrankie GeographicLib: Gnomonic.cpp File Reference
Gnomonic.cpp File Reference

Implementation for GeographicLib::Gnomonic class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_GNOMONIC_CPP   "$Id: 1abf2f2ebdc8a805d0d205051120809f0c0e6071 $"

Detailed Description

Implementation for GeographicLib::Gnomonic class.

Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file Gnomonic.cpp.


Define Documentation

#define GEOGRAPHICLIB_GNOMONIC_CPP   "$Id: 1abf2f2ebdc8a805d0d205051120809f0c0e6071 $"

Definition at line 12 of file Gnomonic.cpp.

geographiclib-1.21/doc/html/GeoConvert.1.html0000644000175000017500000003742611745620414020705 0ustar frankiefrankie GeoConvert -- convert geographic coordinates


NAME

GeoConvert -- convert geographic coordinates


SYNOPSIS

GeoConvert [ -g | -d | -: | -u | -m | -c ] [ -p prec ] [ -z zone | -s | -t ] [ -n ] [ -w ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

GeoConvert reads from standard input interpreting each line as a geographic coordinate and prints the coordinate in the format specified by the options on standard output. The input is interpreted in one of three different ways depending on how many space or comma delimited tokens there are on the line. The options -g, -d, -u, and -m govern the format of output. In all cases, the WGS84 model of the earth is used (a = 6378137 m, f = 1/298.257223563).

geographic

2 tokens (output options -g, -d, or -:) given as latitude longitude using decimal degrees or degrees minutes seconds. d, ', and " are used to denote degrees, minutes, and seconds, with the least significant designator optional. (See QUOTING for how to quote the characters ' and " when entering coordinates on the command line.) Various unicode characters (encoded with UTF-8) may also be used to denote degrees, minutes, and seconds, e.g., the degree, prime, and double prime symbols. Alternatively, : (colon) may be used to separate the various components. Latitude is given first (unless the -w option is given); however, on input, either may be given first by appending or prepending N or S to the latitude and E or W to the longitude. For example, the following are all equivalent

    33.3 44.4
    E44.4 N33.3
    33d18'N 44d24'E
    44d24 33d18N
    33:18 44:24
UTM/UPS

3 tokens (output option -u) given as zone+hemisphere easting northing or easting northing zone+hemisphere, where hemisphere is either N or S. The zone is absent for a UPS specification. For example,

    38N 444140.54 3684706.36
    444140.54 3684706.36 38N
    S 2173854.98 2985980.58
    2173854.98 2985980.58 S
MRGS

1 token (output option -m) is used to specify the center of an MGRS grid square. For example,

    38SMB4484
    38SMB44140847064


OPTIONS

-g

output latitude and longitude using decimal degrees. Default output mode.

-d

output latitude and longitude using degrees, minutes, and seconds (DMS).

-:

like -d, except use : as a separator instead of the d, ', and " delimiters.

-u

output UTM or UPS.

-m

output MGRS.

-c

output meridian convergence and scale for the corresponding UTM or UPS projection. Convergence is the bearing of grid north given as degrees clockwise from true north.

-p

set the output precision to prec (default 0); prec is the precision relative to 1 m. See PRECISION.

-z

set the zone to zone for output. Use either 0 < zone <= 60 for a UTM zone or zone = 0 for UPS. Alternatively use a zone+hemisphere designation (hemisphere is ignored), e.g., 38N. See ZONE.

-s

use the standard UPS and UTM zones.

-t

similar to -s but forces UPS regions to the closest UTM zone.

-n

on input, MGRS coordinates refer to the south-west corner of the MGRS square instead of the center; see MGRS.

-w

on input and output, longitude precedes latitude (except that on input this can be overridden by a hemisphere designator, N, S,E, W).

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


PRECISION

prec gives precision of the output with prec = 0 giving 1 m precision, prec = 3 giving 1 mm precision, etc. prec is the number of digits after the decimal point for UTM/UPS. The number of digits per coordinate for MGRS is 5 + prec. For decimal degrees, the number of digits after the decimal point is 5 + prec. For DMS (degree, minute, seconds) output, the number of digits after the decimal point in the seconds components is 1 + prec; if this is negative then use minutes (prec = -2 or -3) or degrees (prec <= -4) as the least significant component. Print convergence, resp. scale, with 5 + prec, resp. 7 + prec, digits after the decimal point. The minimum value of prec is -5 and the maximum is 9 for UTM/UPS, 9 for decimal degrees, 10 for DMS, 6 for MGRS, and 8 for convergence and scale.


MGRS

MGRS coordinates represent a square patch of the earth, thus 38SMB4488 is in zone 38N with 444km <= easting < 445km and 3688km <= northing < 3689km. Consistent with this representation, coordinates are truncated (instead of rounded) to the requested precision. Similarly, on input an MGRS coordinate represents the center of the square (38N 444500 3688500 in the example above). However, if the -n option is given then the south-west corner of the square is returned instead (38N 444000 3688000 in the example above).


ZONE

If the input is geographic, GeoConvert uses the standard rules of selecting UTM vs UPS and for assigning the UTM zone (with the Norway and Svalbard exceptions). If the input is UTM/UPS, or MGRS, then the choice between UTM and UPS and the UTM zone mirrors the input. The -z zone, -s, -t options allow these rules to be overridden with zone = 0 being used to indicate UPS. For example, the point

   79.9S 6.1E

corresponds to possible MGRS coordinates

   32CMS4324728161 (standard UTM zone = 32)
   31CEM6066227959 (neighboring UTM zone = 31)
     BBZ1945517770 (neighboring UPS zone)

then

   echo 79.9S 6.1E      | GeoConvert -p -3 -m       => 32CMS4328
   echo 31CEM6066227959 | GeoConvert -p -3 -m       => 31CEM6027
   echo 31CEM6066227959 | GeoConvert -p -3 -m -s    => 32CMS4328
   echo 31CEM6066227959 | GeoConvert -p -3 -m -z 0  =>   BBZ1917

NOTE: the letter in the zone specification for UTM is a hemisphere designator N or S and not an MGRS latitude band letter. Convert the MGRS latitude band letter to a hemisphere as follows: replace C thru M by S; replace N thru X by N.


QUOTING

Unfortunately the characters ' and " have special meanings in many shells and have to be entered with care.

Unix shells (sh, bash, tsch)

The special characters can be quoted by preceding them with a \ (backslash). Alternatively you can quote a ' with a pair of "s. The two alternatives are illustrated by

   echo 30d30\'30\" "30d30'30" | GeoConvert -d -p -1
   => 30d30'30"N 030d30'30"E

Alternatively use colon separators, e.g., 30:30:30, which need no quoting.

Windows command shell (cmd)

The ' character needs no quoting and the " character can be quoted by a ^. However this quoting is usually unnecessary because the trailing designator can be omitted. Thus

   echo 30d30'30^" 30d30'30 | GeoConvert -d -p -1
   => 30d30'30"N 030d30'30"E

Alternatively use colon separators, e.g., 30:30:30, which need no quoting.

Input from a file

No quoting need be done if the input from a file. Thus each line of the file input.txt should just contain the plain coordinates.

  GeoConvert -d -p -1 < input.txt


EXAMPLES

   echo 38SMB4488 | GeoConvert         => 33.33424 44.40363
   echo 38SMB4488 | GeoConvert -: -p 1 => 33:20:03.25N 044:2413.06E
   echo 38SMB4488 | GeoConvert -u      => 38N 444500 3688500
   echo E44d24 N33d20 | GeoConvert -m -p -3 => 38SMB4488


ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes GeoConvert to return an exit code of 1. However, an error does not cause GeoConvert to terminate; following lines will be converted.


ABBREVIATIONS

UTM

Universal Transverse Mercator, http://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system.

UPS

Universal Polar Stereographic, http://en.wikipedia.org/wiki/Universal_Polar_Stereographic.

MGRS

Military Grid Reference System, http://en.wikipedia.org/wiki/Military_grid_reference_system.

WGS84

World Geodetic System 1984, http://en.wikipedia.org/wiki/WGS84.


SEE ALSO

The algorithms for the transverse Mercator projection are described in C. F. F. Karney, Transverse Mercator with an accuracy of a few nanometers, J. Geod 85(8), 475-485 (Aug. 2011); DOI http://dx.doi.org/10.1007/s00190-011-0445-3; preprint http://arxiv.org/abs/1002.1417.


AUTHOR

GeoConvert was written by Charles Karney.


HISTORY

GeoConvert was added to GeographicLib, http://geographiclib.sf.net, in 2009-01.

geographiclib-1.21/doc/html/GeoCoords_8hpp_source.html0000644000175000017500000015761711745620414022703 0ustar frankiefrankie GeographicLib: GeoCoords.hpp Source File
GeoCoords.hpp
Go to the documentation of this file.
00001 /**
00002  * \file GeoCoords.hpp
00003  * \brief Header for GeographicLib::GeoCoords class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #ifndef GEOGRAPHICLIB_GEOCOORDS_HPP
00011 #define GEOGRAPHICLIB_GEOCOORDS_HPP \
00012   "$Id: e706d3a35c3be0e2beaf39041cac29beb468a5aa $"
00013 
00014 #include <GeographicLib/UTMUPS.hpp>
00015 #include <GeographicLib/Constants.hpp>
00016 
00017 namespace GeographicLib {
00018 
00019   /**
00020    * \brief Conversion between geographic coordinates
00021    *
00022    * This class stores a geographic position which may be set via the
00023    * constructors or Reset via
00024    * - latitude and longitude
00025    * - UTM or UPS coordinates
00026    * - a string representation of these or an MGRS coordinate string
00027    *
00028    * The state consists of the latitude and longitude and the supplied UTM or
00029    * UPS coordinates (possibly derived from the MGRS coordinates).  If latitude
00030    * and longitude were given then the UTM/UPS coordinates follows the standard
00031    * conventions.
00032    *
00033    * The mutable state consists of the UTM or UPS coordinates for a alternate
00034    * zone.  A method SetAltZone is provided to set the alternate UPS/UTM zone.
00035    *
00036    * Methods are provided to return the geographic coordinates, the input UTM
00037    * or UPS coordinates (and associated meridian convergence and scale), or
00038    * alternate UTM or UPS coordinates (and their associated meridian
00039    * convergence and scale).
00040    *
00041    * Once the input string has been parsed, you can print the result out in any
00042    * of the formats, decimal degrees, degrees minutes seconds, MGRS, UTM/UPS.
00043    *
00044    * Example of use:
00045    * \include example-GeoCoords.cpp
00046    *
00047    * <a href="GeoConvert.1.html">GeoConvert</a> is a command-line utility
00048    * providing access to the functionality of GeoCoords.
00049    **********************************************************************/
00050   class GEOGRAPHIC_EXPORT GeoCoords {
00051   private:
00052     typedef Math::real real;
00053     real _lat, _long, _easting, _northing, _gamma, _k;
00054     bool _northp;
00055     int _zone;                  // See UTMUPS::zonespec
00056     mutable real _alt_easting, _alt_northing, _alt_gamma, _alt_k;
00057     mutable int _alt_zone;
00058 
00059     void CopyToAlt() const throw() {
00060       _alt_easting = _easting;
00061       _alt_northing = _northing;
00062       _alt_gamma = _gamma;
00063       _alt_k = _k;
00064       _alt_zone = _zone;
00065     }
00066     void UTMUPSString(int zone, real easting, real northing,
00067                       int prec, std::string& utm) const;
00068     void FixHemisphere();
00069   public:
00070 
00071     /** \name Initializing the GeoCoords object
00072      **********************************************************************/
00073     ///@{
00074     /**
00075      * The default constructor is equivalent to \e latitude = 90<sup>o</sup>,
00076      * \e longitude = 0<sup>o</sup>.
00077      **********************************************************************/
00078     GeoCoords() throw()
00079       // This is the N pole
00080       : _lat(90)
00081       , _long(0)
00082       , _easting(2000000)
00083       , _northing(2000000)
00084       , _northp(true)
00085       , _zone(0)
00086     { CopyToAlt(); }
00087 
00088     /**
00089      * Construct from a string.
00090      *
00091      * @param[in] s 1-element, 2-element, or 3-element string representation of
00092      *   the position.
00093      * @param[in] centerp governs the interpretation of MGRS coordinates (see
00094      *   below).
00095      * @param[in] swaplatlong governs the interpretation of geographic
00096      *   coordinates (see below).
00097      *
00098      * Parse as a string and interpret it as a geographic position.  The input
00099      * string is broken into space (or comma) separated pieces and Basic
00100      * decision on which format is based on number of components
00101      * -# MGRS
00102      * -# "Lat Long" or "Long Lat"
00103      * -# "Zone Easting Northing" or "Easting Northing Zone"
00104      *
00105      * The following inputs are approximately the same (Ar Ramadi Bridge, Iraq)
00106      * - Latitude and Longitude
00107      *   -  33.44      43.27
00108      *   -  N33d26.4'  E43d16.2'
00109      *   -  43d16'12&quot;E 33d26'24&quot;N
00110      *   -  43:16:12E  33:26:24
00111      * - MGRS
00112      *   -  38SLC301
00113      *   -  38SLC391014
00114      *   -  38SLC3918701405
00115      *   -  37SHT9708
00116      * - UTM
00117      *   -  38N 339188 3701405
00118      *   -  897039 3708229 37N
00119      *
00120      * Latitude and Longitude parsing.  Latitude precedes longitude, unless a
00121      * N, S, E, W hemisphere designator is used on one or both coordinates.  If
00122      * \e swaplatlong = true (default is false), then longitude precedes
00123      * latitude in the absence of a hemisphere designator.  Thus (with \e
00124      * swaplatlong = false)
00125      * - 40 -75
00126      * - N40 W75
00127      * - -75 N40
00128      * - 75W 40N
00129      * - E-75 -40S
00130      * .
00131      * are all the same position.  The coordinates may be given in
00132      * decimal degrees, degrees and decimal minutes, degrees, minutes,
00133      * seconds, etc.  Use d, ', and &quot; to mark off the degrees,
00134      * minutes and seconds.  Alternatively, use : to separate these
00135      * components.  Thus
00136      * - 40d30'30&quot;
00137      * - 40d30'30
00138      * - 40d30.5'
00139      * - 40d30.5
00140      * - 40:30:30
00141      * - 40:30.5
00142      * - 40.508333333
00143      * .
00144      * all specify the same angle.  The leading sign applies to all components
00145      * so -1d30 is -(1+30/60) = -1.5.  Latitudes must be in the range [-90, 90]
00146      * and longitudes in the range [-180, 360].  Internally longitudes are
00147      * reduced to the range [-180, 180).
00148      *
00149      * UTM/UPS parsing.  For UTM zones (-80 <= Lat <= 84), the zone designator
00150      * is made up of a zone number (for 1 to 60) and a hemisphere letter (N or
00151      * S), e.g., 38N.  The latitude zone designer ([C&ndash;M] in the southern
00152      * hemisphere and [N&ndash;X] in the northern) should NOT be used.  (This
00153      * is part of the MGRS coordinate.)  The zone designator for the poles
00154      * (where UPS is employed) is a hemisphere letter by itself, i.e., N or S.
00155      *
00156      * MGRS parsing interprets the grid references as square area at the
00157      * specified precision (1m, 10m, 100m, etc.).  If \e centerp = true (the
00158      * default), the center of this square is then taken to be the precise
00159      * position; thus:
00160      * - 38SMB           = 38N 450000 3650000
00161      * - 38SMB4484       = 38N 444500 3684500
00162      * - 38SMB44148470   = 38N 444145 3684705
00163      * .
00164      * Otherwise, the "south-west" corner of the square is used, i.e.,
00165      * - 38SMB           = 38N 400000 3600000
00166      * - 38SMB4484       = 38N 444000 3684000
00167      * - 38SMB44148470   = 38N 444140 3684700
00168      **********************************************************************/
00169     explicit GeoCoords(const std::string& s,
00170                        bool centerp = true, bool swaplatlong = false)
00171     { Reset(s, centerp, swaplatlong); }
00172 
00173     /**
00174      * Construct from geographic coordinates.
00175      *
00176      * @param[in] latitude (degrees).
00177      * @param[in] longitude (degrees).
00178      * @param[in] zone if specified, force the UTM/UPS representation to use a
00179      *   specified zone using the rules given in UTMUPS::zonespec.
00180      **********************************************************************/
00181     GeoCoords(real latitude, real longitude, int zone = UTMUPS::STANDARD) {
00182       Reset(latitude, longitude, zone);
00183     }
00184 
00185     /**
00186      * Construct from UTM/UPS coordinates.
00187      *
00188      * @param[in] zone UTM zone (zero means UPS).
00189      * @param[in] northp hemisphere (true means north, false means south).
00190      * @param[in] easting (meters).
00191      * @param[in] northing (meters).
00192      **********************************************************************/
00193     GeoCoords(int zone, bool northp, real easting, real northing) {
00194       Reset(zone, northp, easting, northing);
00195     }
00196 
00197     /**
00198      * Reset the location from a string.  See
00199      * GeoCoords(const std::string& s, bool centerp, bool swaplatlong).
00200      **********************************************************************/
00201     void Reset(const std::string& s,
00202                bool centerp = true, bool swaplatlong = false);
00203 
00204     /**
00205      * Reset the location in terms of geographic coordinates.  See
00206      * GeoCoords(real latitude, real longitude, int zone).
00207      **********************************************************************/
00208     void Reset(real latitude, real longitude, int zone = UTMUPS::STANDARD) {
00209       UTMUPS::Forward(latitude, longitude,
00210                       _zone, _northp, _easting, _northing, _gamma, _k,
00211                       zone);
00212       _lat = latitude;
00213       _long = longitude;
00214       if (_long >= 180)
00215         _long -= 360;
00216       CopyToAlt();
00217     }
00218 
00219     /**
00220      * Reset the location in terms of UPS/UPS coordinates.  See
00221      * GeoCoords(int zone, bool northp, real easting, real northing).
00222      **********************************************************************/
00223     void Reset(int zone, bool northp, real easting, real northing) {
00224       UTMUPS::Reverse(zone, northp, easting, northing,
00225                       _lat, _long, _gamma, _k);
00226       _zone = zone;
00227       _northp = northp;
00228       _easting = easting;
00229       _northing = northing;
00230       FixHemisphere();
00231       CopyToAlt();
00232     }
00233     ///@}
00234 
00235     /** \name Querying the GeoCoords object
00236      **********************************************************************/
00237     ///@{
00238     /**
00239      * @return latitude (degrees)
00240      **********************************************************************/
00241     Math::real Latitude() const throw() { return _lat; }
00242 
00243     /**
00244      * @return longitude (degrees)
00245      **********************************************************************/
00246     Math::real Longitude() const throw() { return _long; }
00247 
00248     /**
00249      * @return easting (meters)
00250      **********************************************************************/
00251     Math::real Easting() const throw() { return _easting; }
00252 
00253     /**
00254      * @return northing (meters)
00255      **********************************************************************/
00256     Math::real Northing() const throw() { return _northing; }
00257 
00258     /**
00259      * @return meridian convergence (degrees) for the UTM/UPS projection.
00260      **********************************************************************/
00261     Math::real Convergence() const throw() { return _gamma; }
00262 
00263     /**
00264      * @return scale for the UTM/UPS projection.
00265      **********************************************************************/
00266     Math::real Scale() const throw() { return _k; }
00267 
00268     /**
00269      * @return hemisphere (false means south, true means north).
00270      **********************************************************************/
00271     bool Northp() const throw() { return _northp; }
00272 
00273     /**
00274      * @return hemisphere letter N or S.
00275      **********************************************************************/
00276     char Hemisphere() const throw() { return _northp ? 'N' : 'S'; }
00277 
00278     /**
00279      * @return the zone corresponding to the input (return 0 for UPS).
00280      **********************************************************************/
00281     int Zone() const throw() { return _zone; }
00282 
00283     ///@}
00284 
00285     /** \name Setting and querying the alternate zone
00286      **********************************************************************/
00287     ///@{
00288     /**
00289      * Specify alternate zone number.
00290      *
00291      * @param[in] zone zone number for the alternate representation.
00292      *
00293      * See UTMUPS::zonespec for more information on the interpretation of \e
00294      * zone.  Note that \e zone == UTMUPS::STANDARD (the default) use the
00295      * standard UPS or UTM zone, UTMUPS::MATCH does nothing retaining the
00296      * existing alternate representation.  Before this is called the alternate
00297      * zone is the input zone.
00298      **********************************************************************/
00299     void SetAltZone(int zone = UTMUPS::STANDARD) const {
00300       if (zone == UTMUPS::MATCH)
00301         return;
00302       zone = UTMUPS::StandardZone(_lat, _long, zone);
00303       if (zone == _zone)
00304         CopyToAlt();
00305       else {
00306         bool northp;
00307         UTMUPS::Forward(_lat, _long,
00308                         _alt_zone, northp,
00309                         _alt_easting, _alt_northing, _alt_gamma, _alt_k,
00310                         zone);
00311       }
00312     }
00313 
00314     /**
00315      * @return current alternate zone (return 0 for UPS).
00316      **********************************************************************/
00317     int AltZone() const throw() { return _alt_zone; }
00318 
00319     /**
00320      * @return easting (meters) for alternate zone.
00321      **********************************************************************/
00322     Math::real AltEasting() const throw() { return _alt_easting; }
00323 
00324     /**
00325      * @return northing (meters) for alternate zone.
00326      **********************************************************************/
00327     Math::real AltNorthing() const throw() { return _alt_northing; }
00328 
00329     /**
00330      * @return meridian convergence (degrees) for alternate zone.
00331      **********************************************************************/
00332     Math::real AltConvergence() const throw() { return _alt_gamma; }
00333 
00334     /**
00335      * @return scale for alternate zone.
00336      **********************************************************************/
00337     Math::real AltScale() const throw() { return _alt_k; }
00338     ///@}
00339 
00340     /** \name String representations of the GeoCoords object
00341      **********************************************************************/
00342     ///@{
00343     /**
00344      * String representation with latitude and longitude as signed decimal
00345      * degrees.
00346      *
00347      * @param[in] prec precision (relative to about 1m).
00348      * @param[in] swaplatlong if true give longitude first (default = false)
00349      * @return decimal latitude/longitude string representation.
00350      *
00351      * Precision specifies accuracy of representation as follows:
00352      * - prec = -5 (min), 1d
00353      * - prec = 0, 10<sup>-5</sup>d (about 1m)
00354      * - prec = 3, 10<sup>-8</sup>d
00355      * - prec = 9 (max), 10<sup>-14</sup>d
00356      **********************************************************************/
00357     std::string GeoRepresentation(int prec = 0, bool swaplatlong = false) const;
00358 
00359     /**
00360      * String representation with latitude and longitude as degrees, minutes,
00361      * seconds, and hemisphere.
00362      *
00363      * @param[in] prec precision (relative to about 1m)
00364      * @param[in] swaplatlong if true give longitude first (default = false)
00365      * @param[in] dmssep if non-null, use as the DMS separator character
00366      *   (instead of d, ', &quot; delimiters).
00367      * @return DMS latitude/longitude string representation.
00368      *
00369      * Precision specifies accuracy of representation as follows:
00370      * - prec = -5 (min), 1d
00371      * - prec = -4, 0.1d
00372      * - prec = -3, 1'
00373      * - prec = -2, 0.1'
00374      * - prec = -1, 1&quot;
00375      * - prec = 0, 0.1&quot; (about 3m)
00376      * - prec = 1, 0.01&quot;
00377      * - prec = 10 (max), 10<sup>-11</sup>&quot;
00378      **********************************************************************/
00379     std::string DMSRepresentation(int prec, bool swaplatlong, char dmssep)
00380       const;
00381 
00382     /**
00383      * String representation with latitude and longitude as degrees, minutes,
00384      * seconds, and hemisphere.
00385      *
00386      * @param[in] prec precision (relative to about 1m)
00387      * @param[in] swaplatlong if true give longitude first (default = false)
00388      * @return DMS latitude/longitude string representation.
00389      *
00390      * <b>COMPATIBILITY NOTE:</b> This function calls
00391      * DMSRepresentation(int, bool, char) const with a 3rd argument of
00392      * char(0).  At some point, DMSRepresentation(int, bool) const and
00393      * will be withdrawn and the interface to
00394      * DMSRepresentation(int, bool, char) const changed so that its
00395      * arguments have default values.  This will preserve source-level
00396      * compatibility.
00397      **********************************************************************/
00398     std::string DMSRepresentation(int prec = 0, bool swaplatlong = false) const;
00399 
00400     /**
00401      * MGRS string.
00402      *
00403      * @param[in] prec precision (relative to about 1m).
00404      * @return MGRS string.
00405      *
00406      * This gives the coordinates of the enclosing grid square with size given
00407      * by the precision.  Thus 38N 444180 3684790 converted to a MGRS
00408      * coordinate at precision -2 (100m) is 38SMB441847 and not 38SMB442848.
00409      * \e prec specifies the precision of the MGRS string as follows:
00410      * - prec = -5 (min), 100km
00411      * - prec = -4, 10km
00412      * - prec = -3, 1km
00413      * - prec = -2, 100m
00414      * - prec = -1, 10m
00415      * - prec = 0, 1m
00416      * - prec = 1, 0.1m
00417      * - prec = 6 (max), 1um
00418      **********************************************************************/
00419     std::string MGRSRepresentation(int prec = 0) const;
00420 
00421     /**
00422      * UTM/UPS string.
00423      *
00424      * @param[in] prec precision (relative to about 1m)
00425      * @return UTM/UPS string representation: zone designator, easting, and
00426      *   northing.
00427      *
00428      * Precision specifies accuracy of representation as follows:
00429      * - prec = -5 (min), 100km
00430      * - prec = -3, 1km
00431      * - prec = 0, 1m
00432      * - prec = 3, 1mm
00433      * - prec = 6, 1um
00434      * - prec = 9 (max), 1nm
00435      **********************************************************************/
00436     std::string UTMUPSRepresentation(int prec = 0) const;
00437 
00438     /**
00439      * MGRS string for the alternate zone.  See GeoCoords::MGRSRepresentation.
00440      **********************************************************************/
00441     std::string AltMGRSRepresentation(int prec = 0) const;
00442 
00443     /**
00444      * UTM/UPS string for the alternate zone.  See
00445      * GeoCoords::UTMUPSRepresentation.
00446      **********************************************************************/
00447     std::string AltUTMUPSRepresentation(int prec = 0) const;
00448     ///@}
00449 
00450     /** \name Inspector functions
00451      **********************************************************************/
00452     ///@{
00453     /**
00454      * @return \e a the equatorial radius of the WGS84 ellipsoid (meters).
00455      *
00456      * (The WGS84 value is returned because the UTM and UPS projections are
00457      * based on this ellipsoid.)
00458      **********************************************************************/
00459     Math::real MajorRadius() const throw() { return UTMUPS::MajorRadius(); }
00460 
00461     /**
00462      * @return \e f the flattening of the WGS84 ellipsoid.
00463      *
00464      * (The WGS84 value is returned because the UTM and UPS projections are
00465      * based on this ellipsoid.)
00466      **********************************************************************/
00467     Math::real Flattening() const throw() { return UTMUPS::Flattening(); }
00468     ///@}
00469 
00470     /// \cond SKIP
00471     /**
00472      * <b>DEPRECATED</b>
00473      * @return \e r the inverse flattening of the ellipsoid.
00474      **********************************************************************/
00475     Math::real InverseFlattening() const throw()
00476     { return UTMUPS::InverseFlattening(); }
00477     /// \endcond
00478   };
00479 
00480 } // namespace GeographicLib
00481 
00482 #endif  // GEOGRAPHICLIB_GEOCOORDS_HPP
geographiclib-1.21/doc/html/classGeographicLib_1_1CassiniSoldner.html0000644000175000017500000010220211745620414025502 0ustar frankiefrankie GeographicLib: GeographicLib::CassiniSoldner Class Reference
GeographicLib::CassiniSoldner Class Reference

Cassini-Soldner Projection. More...

#include <GeographicLib/CassiniSoldner.hpp>

List of all members.

Public Member Functions

 CassiniSoldner (const Geodesic &earth=Geodesic::WGS84) throw ()
 CassiniSoldner (real lat0, real lon0, const Geodesic &earth=Geodesic::WGS84) throw ()
void Reset (real lat0, real lon0) throw ()
void Forward (real lat, real lon, real &x, real &y, real &azi, real &rk) const throw ()
void Reverse (real x, real y, real &lat, real &lon, real &azi, real &rk) const throw ()
void Forward (real lat, real lon, real &x, real &y) const throw ()
void Reverse (real x, real y, real &lat, real &lon) const throw ()
Inspector functions
bool Init () const throw ()
Math::real LatitudeOrigin () const throw ()
Math::real LongitudeOrigin () const throw ()
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()

Detailed Description

Cassini-Soldner Projection.

Cassini-Soldner projection centered at an arbitrary position, lat0, lon0, on the ellipsoid. This projection is a transverse cylindrical equidistant projection. The projection from (lat, lon) to easting and northing (x, y) is defined by geodesics as follows. Go north along a geodesic a distance y from the central point; then turn clockwise 90o and go a distance x along a geodesic. (Although the initial heading is north, this changes to south if the pole is crossed.) This procedure uniquely defines the reverse projection. The forward projection is constructed as follows. Find the point (lat1, lon1) on the meridian closest to (lat, lon). Here we consider the full meridian so that lon1 may be either lon0 or lon0 + 180o. x is the geodesic distance from (lat1, lon1) to (lat, lon), appropriately signed according to which side of the central meridian (lat, lon) lies. y is the shortest distance along the meridian from (lat0, lon0) to (lat1, lon1), again, appropriately signed according to the initial heading. [Note that, in the case of prolate ellipsoids, the shortest meridional path from (lat0, lon0) to (lat1, lon1) may not be the shortest path.] This procedure uniquely defines the forward projection except for a small class of points for which there may be two equally short routes for either leg of the path.

Because of the properties of geodesics, the (x, y) grid is orthogonal. The scale in the easting direction is unity. The scale, k, in the northing direction is unity on the central meridian and increases away from the central meridian. The projection routines return azi, the true bearing of the easting direction, and rk = 1/k, the reciprocal of the scale in the northing direction.

The conversions all take place using a Geodesic object (by default Geodesic::WGS84). For more information on geodesics see Geodesics on the ellipsoid. The determination of (lat1, lon1) in the forward projection is by solving the inverse geodesic problem for (lat, lon) and its twin obtained by reflection in the meridional plane. The scale is found by determining where two neighboring geodesics intersecting the central meridian at lat1 and lat1 + dlat1 intersect and taking the ratio of the reduced lengths for the two geodesics between that point and, respectively, (lat1, lon1) and (lat, lon).

Example of use:

// Example of using the GeographicLib::CassiniSoldner class
// $Id: f1d1d192c9449d198226a19cfbdc37d0b14ea52f $

#include <iostream>
#include <exception>
#include <GeographicLib/Geodesic.hpp>
#include <GeographicLib/CassiniSoldner.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    Geodesic geod(Constants::WGS84_a(), Constants::WGS84_f());
    // Alternatively: const Geodesic& geod = Geodesic::WGS84;
    const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris
    CassiniSoldner proj(lat0, lon0, geod);
    {
      // Sample forward calculation
      double lat = 50.9, lon = 1.8; // Calais
      double x, y;
      proj.Forward(lat, lon, x, y);
      cout << x << " " << y << "\n";
    }
    {
      // Sample reverse calculation
      double x = -38e3, y = 230e3;
      double lat, lon;
      proj.Reverse(x, y, lat, lon);
      cout << lat << " " << lon << "\n";
    }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

GeodesicProj is a command-line utility providing access to the functionality of AzimuthalEquidistant, Gnomonic, and CassiniSoldner.


Constructor & Destructor Documentation

GeographicLib::CassiniSoldner::CassiniSoldner ( const Geodesic earth = Geodesic::WGS84) throw () [inline, explicit]

Constructor for CassiniSoldner.

Parameters:
[in]earththe Geodesic object to use for geodesic calculations. By default this uses the WGS84 ellipsoid.

This constructor makes an "uninitialized" object. Call Reset to set the central latitude and longitude, prior to calling Forward and Reverse.

Definition at line 113 of file CassiniSoldner.hpp.

GeographicLib::CassiniSoldner::CassiniSoldner ( real  lat0,
real  lon0,
const Geodesic earth = Geodesic::WGS84 
) throw () [inline]

Constructor for CassiniSoldner specifying a center point.

Parameters:
[in]lat0latitude of center point of projection (degrees).
[in]lon0longitude of center point of projection (degrees).
[in]earththe Geodesic object to use for geodesic calculations. By default this uses the WGS84 ellipsoid.

lat0 should be in the range [-90, 90] and lon0 should be in the range [-180, 360].

Definition at line 127 of file CassiniSoldner.hpp.


Member Function Documentation

void GeographicLib::CassiniSoldner::Reset ( real  lat0,
real  lon0 
) throw ()

Set the central point of the projection

Parameters:
[in]lat0latitude of center point of projection (degrees).
[in]lon0longitude of center point of projection (degrees).

lat0 should be in the range [-90, 90] and lon0 should be in the range [-180, 360].

Definition at line 26 of file CassiniSoldner.cpp.

void GeographicLib::CassiniSoldner::Forward ( real  lat,
real  lon,
real &  x,
real &  y,
real &  azi,
real &  rk 
) const throw ()

Forward projection, from geographic to Cassini-Soldner.

Parameters:
[in]latlatitude of point (degrees).
[in]lonlongitude of point (degrees).
[out]xeasting of point (meters).
[out]ynorthing of point (meters).
[out]aziazimuth of easting direction at point (degrees).
[out]rkreciprocal of azimuthal northing scale at point.

lat should be in the range [-90, 90] and lon should be in the range [-180, 360]. A call to Forward followed by a call to Reverse will return the original (lat, lon) (to within roundoff). The routine does nothing if the origin has not been set.

Definition at line 39 of file CassiniSoldner.cpp.

References GeographicLib::GeodesicLine::GenPosition().

void GeographicLib::CassiniSoldner::Reverse ( real  x,
real  y,
real &  lat,
real &  lon,
real &  azi,
real &  rk 
) const throw ()

Reverse projection, from Cassini-Soldner to geographic.

Parameters:
[in]xeasting of point (meters).
[in]ynorthing of point (meters).
[out]latlatitude of point (degrees).
[out]lonlongitude of point (degrees).
[out]aziazimuth of easting direction at point (degrees).
[out]rkreciprocal of azimuthal northing scale at point.

A call to Reverse followed by a call to Forward will return the original (x, y) (to within roundoff), provided that x and y are sufficiently small not to "wrap around" the earth. The routine does nothing if the origin has not been set.

Definition at line 87 of file CassiniSoldner.cpp.

void GeographicLib::CassiniSoldner::Forward ( real  lat,
real  lon,
real &  x,
real &  y 
) const throw () [inline]

CassiniSoldner::Forward without returning the azimuth and scale.

Definition at line 183 of file CassiniSoldner.hpp.

void GeographicLib::CassiniSoldner::Reverse ( real  x,
real  y,
real &  lat,
real &  lon 
) const throw () [inline]

CassiniSoldner::Reverse without returning the azimuth and scale.

Definition at line 192 of file CassiniSoldner.hpp.

bool GeographicLib::CassiniSoldner::Init ( ) const throw () [inline]
Returns:
true if the object has been initialized.

Definition at line 204 of file CassiniSoldner.hpp.

Math::real GeographicLib::CassiniSoldner::LatitudeOrigin ( ) const throw () [inline]
Returns:
lat0 the latitude of origin (degrees).

Definition at line 209 of file CassiniSoldner.hpp.

Math::real GeographicLib::CassiniSoldner::LongitudeOrigin ( ) const throw () [inline]
Returns:
lon0 the longitude of origin (degrees).

Definition at line 215 of file CassiniSoldner.hpp.

Math::real GeographicLib::CassiniSoldner::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value inherited from the Geodesic object used in the constructor.

Definition at line 222 of file CassiniSoldner.hpp.

Math::real GeographicLib::CassiniSoldner::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid. This is the value inherited from the Geodesic object used in the constructor.

Definition at line 228 of file CassiniSoldner.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/functions_func_0x6d.html0000644000175000017500000002347611745620414022357 0ustar frankiefrankie GeographicLib: Class Members - Functions geographiclib-1.21/doc/html/TransverseMercator_8hpp_source.html0000644000175000017500000006672711745620414024651 0ustar frankiefrankie GeographicLib: TransverseMercator.hpp Source File
TransverseMercator.hpp
Go to the documentation of this file.
00001 /**
00002  * \file TransverseMercator.hpp
00003  * \brief Header for GeographicLib::TransverseMercator class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP)
00011 #define GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP \
00012   "$Id: 94bb078aa13d2d7392cee5498aae7df6e9914e4a $"
00013 
00014 #include <GeographicLib/Constants.hpp>
00015 
00016 #if !defined(TM_TX_MAXPOW)
00017 /**
00018  * The order of the series approximation used in TransverseMercator.
00019  * TM_TX_MAXPOW can be set to any integer in [4, 8].
00020  **********************************************************************/
00021 #define TM_TX_MAXPOW \
00022   (GEOGRAPHICLIB_PREC == 1 ? 6 : (GEOGRAPHICLIB_PREC == 0 ? 4 : 8))
00023 #endif
00024 
00025 namespace GeographicLib {
00026 
00027   /**
00028    * \brief Transverse Mercator Projection
00029    *
00030    * This uses Kr&uuml;ger's method which evaluates the projection and its
00031    * inverse in terms of a series.  See
00032    *  - L. Kr&uuml;ger,
00033    *    <a href="http://dx.doi.org/10.2312/GFZ.b103-krueger28"> Konforme
00034    *    Abbildung des Erdellipsoids in der Ebene</a> (Conformal mapping of the
00035    *    ellipsoidal earth to the plane), Royal Prussian Geodetic Institute, New
00036    *    Series 52, 172 pp. (1912).
00037    *  - C. F. F. Karney,
00038    *    <a href="http://dx.doi.org/10.1007/s00190-011-0445-3">
00039    *    Transverse Mercator with an accuracy of a few nanometers,</a>
00040    *    J. Geodesy 85(8), 475-485 (Aug. 2011);
00041    *    preprint
00042    *    <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>.
00043    *
00044    * Kr&uuml;ger's method has been extended from 4th to 6th order.  The maximum
00045    * error is 5 nm (5 nanometers), ground distance, for all positions within 35
00046    * degrees of the central meridian.  The error in the convergence is
00047    * 2e-15&quot; and the relative error in the scale is 6e-12%%.  See Sec. 4 of
00048    * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for details.
00049    * The speed penalty in going to 6th order is only about 1%.
00050    * TransverseMercatorExact is an alternative implementation of the projection
00051    * using exact formulas which yield accurate (to 8 nm) results over the
00052    * entire ellipsoid.
00053    *
00054    * The ellipsoid parameters and the central scale are set in the constructor.
00055    * The central meridian (which is a trivial shift of the longitude) is
00056    * specified as the \e lon0 argument of the TransverseMercator::Forward and
00057    * TransverseMercator::Reverse functions.  The latitude of origin is taken to
00058    * be the equator.  There is no provision in this class for specifying a
00059    * false easting or false northing or a different latitude of origin.
00060    * However these are can be simply included by the calling function.  For
00061    * example, the UTMUPS class applies the false easting and false northing for
00062    * the UTM projections.  A more complicated example is the British National
00063    * Grid (<a href="http://www.spatialreference.org/ref/epsg/7405/">
00064    * EPSG:7405</a>) which requires the use of a latitude of origin.  This is
00065    * implemented by the GeographicLib::OSGB class.
00066    *
00067    * See TransverseMercator.cpp for more information on the implementation.
00068    *
00069    * See \ref transversemercator for a discussion of this projection.
00070    *
00071    * Example of use:
00072    * \include example-TransverseMercator.cpp
00073    *
00074    * <a href="TransverseMercatorProj.1.html">TransverseMercatorProj</a> is a
00075    * command-line utility providing access to the functionality of
00076    * TransverseMercator and TransverseMercatorExact.
00077    **********************************************************************/
00078 
00079   class GEOGRAPHIC_EXPORT TransverseMercator {
00080   private:
00081     typedef Math::real real;
00082     static const int maxpow_ = TM_TX_MAXPOW;
00083     static const real tol_;
00084     static const real overflow_;
00085     static const int numit_ = 5;
00086     real _a, _f, _k0, _e2, _e, _e2m,  _c, _n;
00087     // _alp[0] and _bet[0] unused
00088     real _a1, _b1, _alp[maxpow_ + 1], _bet[maxpow_ + 1];
00089     // tan(x) for x in [-pi/2, pi/2] ensuring that the sign is right
00090     static inline real tanx(real x) throw() {
00091       real t = std::tan(x);
00092       // Write the tests this way to ensure that tanx(NaN()) is NaN()
00093       return x >= 0 ? (!(t < 0) ? t : overflow_) : (!(t >= 0) ? t : -overflow_);
00094     }
00095     // Return e * atanh(e * x) for f >= 0, else return
00096     // - sqrt(-e2) * atan( sqrt(-e2) * x) for f < 0
00097     inline real eatanhe(real x) const throw() {
00098       return _f >= 0 ? _e * Math::atanh(_e * x) : - _e * std::atan(_e * x);
00099     }
00100   public:
00101 
00102     /**
00103      * Constructor for a ellipsoid with
00104      *
00105      * @param[in] a equatorial radius (meters).
00106      * @param[in] f flattening of ellipsoid.  Setting \e f = 0 gives a sphere.
00107      *   Negative \e f gives a prolate ellipsoid.  If \e f > 1, set flattening
00108      *   to 1/\e f.
00109      * @param[in] k0 central scale factor.
00110      *
00111      * An exception is thrown if either of the axes of the ellipsoid or \e k0
00112      * is not positive.
00113      **********************************************************************/
00114     TransverseMercator(real a, real f, real k0);
00115 
00116     /**
00117      * Forward projection, from geographic to transverse Mercator.
00118      *
00119      * @param[in] lon0 central meridian of the projection (degrees).
00120      * @param[in] lat latitude of point (degrees).
00121      * @param[in] lon longitude of point (degrees).
00122      * @param[out] x easting of point (meters).
00123      * @param[out] y northing of point (meters).
00124      * @param[out] gamma meridian convergence at point (degrees).
00125      * @param[out] k scale of projection at point.
00126      *
00127      * No false easting or northing is added. \e lat should be in the range
00128      * [-90, 90]; \e lon and \e lon0 should be in the range [-180, 360].
00129      **********************************************************************/
00130     void Forward(real lon0, real lat, real lon,
00131                  real& x, real& y, real& gamma, real& k) const throw();
00132 
00133     /**
00134      * Reverse projection, from transverse Mercator to geographic.
00135      *
00136      * @param[in] lon0 central meridian of the projection (degrees).
00137      * @param[in] x easting of point (meters).
00138      * @param[in] y northing of point (meters).
00139      * @param[out] lat latitude of point (degrees).
00140      * @param[out] lon longitude of point (degrees).
00141      * @param[out] gamma meridian convergence at point (degrees).
00142      * @param[out] k scale of projection at point.
00143      *
00144      * No false easting or northing is added.  \e lon0 should be in the range
00145      * [-180, 360].  The value of \e lon returned is in the range [-180, 180).
00146      **********************************************************************/
00147     void Reverse(real lon0, real x, real y,
00148                  real& lat, real& lon, real& gamma, real& k) const throw();
00149 
00150     /**
00151      * TransverseMercator::Forward without returning the convergence and scale.
00152      **********************************************************************/
00153     void Forward(real lon0, real lat, real lon,
00154                  real& x, real& y) const throw() {
00155       real gamma, k;
00156       Forward(lon0, lat, lon, x, y, gamma, k);
00157     }
00158 
00159     /**
00160      * TransverseMercator::Reverse without returning the convergence and scale.
00161      **********************************************************************/
00162     void Reverse(real lon0, real x, real y,
00163                  real& lat, real& lon) const throw() {
00164       real gamma, k;
00165       Reverse(lon0, x, y, lat, lon, gamma, k);
00166     }
00167 
00168     /** \name Inspector functions
00169      **********************************************************************/
00170     ///@{
00171     /**
00172      * @return \e a the equatorial radius of the ellipsoid (meters).  This is
00173      *   the value used in the constructor.
00174      **********************************************************************/
00175     Math::real MajorRadius() const throw() { return _a; }
00176 
00177     /**
00178      * @return \e f the flattening of the ellipsoid.  This is the value used in
00179      *   the constructor.
00180      **********************************************************************/
00181     Math::real Flattening() const throw() { return _f; }
00182 
00183     /// \cond SKIP
00184     /**
00185      * <b>DEPRECATED</b>
00186      * @return \e r the inverse flattening of the ellipsoid.
00187      **********************************************************************/
00188     Math::real InverseFlattening() const throw() { return 1/_f; }
00189     /// \endcond
00190 
00191     /**
00192      * @return \e k0 central scale for the projection.  This is the value of \e
00193      *   k0 used in the constructor and is the scale on the central meridian.
00194      **********************************************************************/
00195     Math::real CentralScale() const throw() { return _k0; }
00196     ///@}
00197 
00198     /**
00199      * A global instantiation of TransverseMercator with the WGS84 ellipsoid
00200      * and the UTM scale factor.  However, unlike UTM, no false easting or
00201      * northing is added.
00202      **********************************************************************/
00203     static const TransverseMercator UTM;
00204   };
00205 
00206 } // namespace GeographicLib
00207 
00208 #endif  // GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP
geographiclib-1.21/doc/html/CartConvert.1.html0000644000175000017500000001542611745620414021060 0ustar frankiefrankie CartConvert -- convert geodetic coordinates to geocentric or local cartesian


NAME

CartConvert -- convert geodetic coordinates to geocentric or local cartesian


SYNOPSIS

CartConvert [ -r ] [ -l lat0 lon0 h0 ] [ -e a f ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

Convert geodetic coordinates to either geocentric or local cartesian coordinates. Geocentric coordinates have the origin at the center of the earth, with the z axis going thru the north pole, and the x axis thru latitude = 0, longitude = 0. By default, the conversion is to geocentric coordinates. Specifying -l lat0 lon0 h0 causes a local coordinate system to be used with the origin at latitude = lat0, longitude = lon0, height = h0, z normal to the ellipsoid and y due north.

Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) latitude, longitude (decimal degrees or degrees, minutes and seconds), and height above the ellipsoid (meters). For each set of geodetic coordinates, the corresponding cartesian coordinates x, y, z (meters) are printed on standard output.


OPTIONS

-r

perform the reverse projection. x, y, z are given on standard input and each line of standard output gives latitude, longitude, height.

-e

specify the ellipsoid via a f; the equatorial radius is a and the flattening is f. Setting f = 0 results in a sphere. Specify f < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


EXAMPLES

   echo 33.3 44.4 6000 | CartConvert
   => 3816209.60 3737108.55 3485109.57
   echo 33.3 44.4 6000 | CartConvert -l 33 44 20
   => 37288.97 33374.29 5783.64
   echo 30000 30000 0 | CartConvert -r
   => 6.483 45 -6335709.73


ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes CartConvert to return an exit code of 1. However, an error does not cause CartConvert to terminate; following lines will be converted.


SEE ALSO

The algorithm for converting geocentric to geodetic coordinates is given in Appendix B of C. F. F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011; preprint http://arxiv.org/abs/1102.1215.


AUTHOR

CartConvert was written by Charles Karney.


HISTORY

CartConvert was added to GeographicLib, http://geographiclib.sf.net, in 2009-02. Prior to 2009-03 it was called ECEFConvert.

geographiclib-1.21/doc/html/classGeographicLib_1_1NormalGravity-members.html0000644000175000017500000002071211745620414027015 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::NormalGravity Member List
This is the complete list of members for GeographicLib::NormalGravity, including all inherited members.
AngularVelocity() const GeographicLib::NormalGravity [inline]
DynamicalFormFactor(int n=2) const GeographicLib::NormalGravity [inline]
Earth() const GeographicLib::NormalGravity [inline]
EquatorialGravity() const GeographicLib::NormalGravity [inline]
Flattening() const GeographicLib::NormalGravity [inline]
Gravity(real lat, real h, real &gammay, real &gammaz) const GeographicLib::NormalGravity
GravityFlattening() const GeographicLib::NormalGravity [inline]
GravityModel classGeographicLib::NormalGravity [friend]
GRS80GeographicLib::NormalGravity [static]
Init() const GeographicLib::NormalGravity [inline]
MajorRadius() const GeographicLib::NormalGravity [inline]
MassConstant() const GeographicLib::NormalGravity [inline]
NormalGravity(real a, real GM, real omega, real f, real J2)GeographicLib::NormalGravity
NormalGravity()GeographicLib::NormalGravity [inline]
Phi(real X, real Y, real &fX, real &fY) const GeographicLib::NormalGravity
PolarGravity() const GeographicLib::NormalGravity [inline]
SurfaceGravity(real lat) const GeographicLib::NormalGravity
SurfacePotential() const GeographicLib::NormalGravity [inline]
U(real X, real Y, real Z, real &gammaX, real &gammaY, real &gammaZ) const GeographicLib::NormalGravity
V0(real X, real Y, real Z, real &GammaX, real &GammaY, real &GammaZ) const GeographicLib::NormalGravity
WGS84GeographicLib::NormalGravity [static]
geographiclib-1.21/doc/html/functions_func_0x6e.html0000644000175000017500000001277611745620414022361 0ustar frankiefrankie GeographicLib: Class Members - Functions geographiclib-1.21/doc/html/AlbersEqualArea_8cpp_source.html0000644000175000017500000015266611745620414024002 0ustar frankiefrankie GeographicLib: AlbersEqualArea.cpp Source File
AlbersEqualArea.cpp
Go to the documentation of this file.
00001 /**
00002  * \file AlbersEqualArea.cpp
00003  * \brief Implementation for GeographicLib::AlbersEqualArea class
00004  *
00005  * Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/AlbersEqualArea.hpp>
00011 
00012 #define GEOGRAPHICLIB_ALBERSEQUALAREA_CPP \
00013   "$Id: a7aa5e2e232feec5c866f0d645f110fd0bb38dd2 $"
00014 
00015 RCSID_DECL(GEOGRAPHICLIB_ALBERSEQUALAREA_CPP)
00016 RCSID_DECL(GEOGRAPHICLIB_ALBERSEQUALAREA_HPP)
00017 
00018 namespace GeographicLib {
00019 
00020   using namespace std;
00021 
00022   const Math::real AlbersEqualArea::eps_ = numeric_limits<real>::epsilon();
00023   const Math::real AlbersEqualArea::epsx_ = Math::sq(eps_);
00024   const Math::real AlbersEqualArea::epsx2_ = Math::sq(epsx_);
00025   const Math::real AlbersEqualArea::tol_ = sqrt(eps_);
00026   const Math::real AlbersEqualArea::tol0_ = tol_ * sqrt(sqrt(eps_));
00027   const Math::real AlbersEqualArea::ahypover_ =
00028     real(numeric_limits<real>::digits) * log(real(numeric_limits<real>::radix))
00029     + 2;
00030 
00031   AlbersEqualArea::AlbersEqualArea(real a, real f, real stdlat, real k0)
00032     : _a(a)
00033     , _f(f <= 1 ? f : 1/f)
00034     , _fm(1 - _f)
00035     , _e2(_f * (2 - _f))
00036     , _e(sqrt(abs(_e2)))
00037     , _e2m(1 - _e2)
00038     , _qZ(1 + _e2m * atanhee(real(1)))
00039     , _qx(_qZ / ( 2 * _e2m ))
00040   {
00041     if (!(Math::isfinite(_a) && _a > 0))
00042       throw GeographicErr("Major radius is not positive");
00043     if (!(Math::isfinite(_f) && _f < 1))
00044       throw GeographicErr("Minor radius is not positive");
00045     if (!(Math::isfinite(k0) && k0 > 0))
00046       throw GeographicErr("Scale is not positive");
00047     if (!(abs(stdlat) <= 90))
00048       throw GeographicErr("Standard latitude not in [-90, 90]");
00049     real
00050       phi = stdlat * Math::degree<real>(),
00051       sphi = sin(phi),
00052       cphi = abs(stdlat) != 90 ? cos(phi) : 0;
00053     Init(sphi, cphi, sphi, cphi, k0);
00054   }
00055 
00056   AlbersEqualArea::AlbersEqualArea(real a, real f, real stdlat1, real stdlat2,
00057                                    real k1)
00058     : _a(a)
00059     , _f(f <= 1 ? f : 1/f)
00060     , _fm(1 - _f)
00061     , _e2(_f * (2 - _f))
00062     , _e(sqrt(abs(_e2)))
00063     , _e2m(1 - _e2)
00064     , _qZ(1 + _e2m * atanhee(real(1)))
00065     , _qx(_qZ / ( 2 * _e2m ))
00066   {
00067     if (!(Math::isfinite(_a) && _a > 0))
00068       throw GeographicErr("Major radius is not positive");
00069     if (!(Math::isfinite(_f) && _f < 1))
00070       throw GeographicErr("Minor radius is not positive");
00071     if (!(Math::isfinite(k1) && k1 > 0))
00072       throw GeographicErr("Scale is not positive");
00073     if (!(abs(stdlat1) <= 90))
00074       throw GeographicErr("Standard latitude 1 not in [-90, 90]");
00075     if (!(abs(stdlat2) <= 90))
00076       throw GeographicErr("Standard latitude 2 not in [-90, 90]");
00077     real
00078       phi1 = stdlat1 * Math::degree<real>(),
00079       phi2 = stdlat2 * Math::degree<real>();
00080     Init(sin(phi1), abs(stdlat1) != 90 ? cos(phi1) : 0,
00081          sin(phi2), abs(stdlat2) != 90 ? cos(phi2) : 0, k1);
00082   }
00083 
00084   AlbersEqualArea::AlbersEqualArea(real a, real f,
00085                                    real sinlat1, real coslat1,
00086                                    real sinlat2, real coslat2,
00087                                    real k1)
00088     : _a(a)
00089     , _f(f <= 1 ? f : 1/f)
00090     , _fm(1 - _f)
00091     , _e2(_f * (2 - _f))
00092     , _e(sqrt(abs(_e2)))
00093     , _e2m(1 - _e2)
00094     , _qZ(1 + _e2m * atanhee(real(1)))
00095     , _qx(_qZ / ( 2 * _e2m ))
00096   {
00097     if (!(Math::isfinite(_a) && _a > 0))
00098       throw GeographicErr("Major radius is not positive");
00099     if (!(Math::isfinite(_f) && _f < 1))
00100       throw GeographicErr("Minor radius is not positive");
00101     if (!(Math::isfinite(k1) && k1 > 0))
00102       throw GeographicErr("Scale is not positive");
00103     if (!(coslat1 >= 0))
00104       throw GeographicErr("Standard latitude 1 not in [-90, 90]");
00105     if (!(coslat2 >= 0))
00106       throw GeographicErr("Standard latitude 2 not in [-90, 90]");
00107     if (!(abs(sinlat1) <= 1 && coslat1 <= 1) || (coslat1 == 0 && sinlat1 == 0))
00108       throw GeographicErr("Bad sine/cosine of standard latitude 1");
00109     if (!(abs(sinlat2) <= 1 && coslat2 <= 1) || (coslat2 == 0 && sinlat2 == 0))
00110       throw GeographicErr("Bad sine/cosine of standard latitude 2");
00111     if (coslat1 == 0 && coslat2 == 0 && sinlat1 * sinlat2 <= 0)
00112       throw GeographicErr
00113         ("Standard latitudes cannot be opposite poles");
00114     Init(sinlat1, coslat1, sinlat2, coslat2, k1);
00115   }
00116 
00117   void AlbersEqualArea::Init(real sphi1, real cphi1,
00118                              real sphi2, real cphi2, real k1) throw() {
00119     {
00120       real r;
00121       r = Math::hypot(sphi1, cphi1);
00122       sphi1 /= r; cphi1 /= r;
00123       r = Math::hypot(sphi2, cphi2);
00124       sphi2 /= r; cphi2 /= r;
00125     }
00126     bool polar = (cphi1 == 0);
00127     cphi1 = max(epsx_, cphi1);   // Avoid singularities at poles
00128     cphi2 = max(epsx_, cphi2);
00129     // Determine hemisphere of tangent latitude
00130     _sign = sphi1 + sphi2 >= 0 ? 1 : -1;
00131     // Internally work with tangent latitude positive
00132     sphi1 *= _sign; sphi2 *= _sign;
00133     if (sphi1 > sphi2) {
00134       swap(sphi1, sphi2); swap(cphi1, cphi2); // Make phi1 < phi2
00135     }
00136     real
00137       tphi1 = sphi1/cphi1, tphi2 = sphi2/cphi2;
00138 
00139     // q = (1-e^2)*(sphi/(1-e^2*sphi^2) - atanhee(sphi))
00140     // qZ = q(pi/2) = (1 + (1-e^2)*atanhee(1))
00141     // atanhee(x) = atanh(e*x)/e
00142     // q = sxi * qZ
00143     // dq/dphi = 2*(1-e^2)*cphi/(1-e^2*sphi^2)^2
00144     //
00145     // n = (m1^2-m2^2)/(q2-q1) -> sin(phi0) for phi1, phi2 -> phi0
00146     // C = m1^2 + n*q1 = (m1^2*q2-m2^2*q1)/(q2-q1)
00147     // let
00148     //   rho(pi/2)/rho(-pi/2) = (1-s)/(1+s)
00149     //   s = n*qZ/C
00150     //     = qZ * (m1^2-m2^2)/(m1^2*q2-m2^2*q1)
00151     //     = qZ * (scbet2^2 - scbet1^2)/(scbet2^2*q2 - scbet1^2*q1)
00152     //     = (scbet2^2 - scbet1^2)/(scbet2^2*sxi2 - scbet1^2*sxi1)
00153     //     = (tbet2^2 - tbet1^2)/(scbet2^2*sxi2 - scbet1^2*sxi1)
00154     // 1-s = -((1-sxi2)*scbet2^2 - (1-sxi1)*scbet1^2)/
00155     //         (scbet2^2*sxi2 - scbet1^2*sxi1)
00156     //
00157     // Define phi0 to give same value of s, i.e.,
00158     //  s = sphi0 * qZ / (m0^2 + sphi0*q0)
00159     //    = sphi0 * scbet0^2 / (1/qZ + sphi0 * scbet0^2 * sxi0)
00160 
00161     real tphi0, C;
00162     if (polar || tphi1 == tphi2) {
00163       tphi0 = tphi2;
00164       C = 1;                    // ignored
00165     } else {
00166       real
00167         tbet1 = _fm * tphi1, scbet12 = 1 + Math::sq(tbet1),
00168         tbet2 = _fm * tphi2, scbet22 = 1 + Math::sq(tbet2),
00169         txi1 = txif(tphi1), cxi1 = 1/hyp(txi1), sxi1 = txi1 * cxi1,
00170         txi2 = txif(tphi2), cxi2 = 1/hyp(txi2), sxi2 = txi2 * cxi2,
00171         dtbet2 = _fm * (tbet1 + tbet2),
00172         es1 = 1 - _e2 * Math::sq(sphi1), es2 = 1 - _e2 * Math::sq(sphi2),
00173         /*
00174         dsxi = ( (_e2 * sq(sphi2 + sphi1) + es2 + es1) / (2 * es2 * es1) +
00175                  Datanhee(sphi2, sphi1) ) * Dsn(tphi2, tphi1, sphi2, sphi1) /
00176         ( 2 * _qx ),
00177         */
00178         dsxi = ( (1 + _e2 * sphi1 * sphi2) / (es2 * es1) +
00179                  Datanhee(sphi2, sphi1) ) * Dsn(tphi2, tphi1, sphi2, sphi1) /
00180         ( 2 * _qx ),
00181         den = (sxi2 + sxi1) * dtbet2 + (scbet22 + scbet12) * dsxi,
00182         // s = (sq(tbet2) - sq(tbet1)) / (scbet22*sxi2 - scbet12*sxi1)
00183         s = 2 * dtbet2 / den,
00184         // 1-s = -(sq(scbet2)*(1-sxi2) - sq(scbet1)*(1-sxi1)) /
00185         //        (scbet22*sxi2 - scbet12*sxi1)
00186         // Write
00187         //   sq(scbet)*(1-sxi) = sq(scbet)*(1-sphi) * (1-sxi)/(1-sphi)
00188         sm1 = -Dsn(tphi2, tphi1, sphi2, sphi1) *
00189         ( -( ((sphi2 <= 0 ? (1 - sxi2) / (1 - sphi2) :
00190                Math::sq(cxi2/cphi2) * (1 + sphi2) / (1 + sxi2)) +
00191               (sphi1 <= 0 ? (1 - sxi1) / (1 - sphi1) :
00192                Math::sq(cxi1/cphi1) * (1 + sphi1) / (1 + sxi1))) ) *
00193           (1 + _e2 * (sphi1 + sphi2 + sphi1 * sphi2)) /
00194           (1 +       (sphi1 + sphi2 + sphi1 * sphi2)) +
00195           (scbet22 * (sphi2 <= 0 ? 1 - sphi2 : Math::sq(cphi2) / ( 1 + sphi2)) +
00196            scbet12 * (sphi1 <= 0 ? 1 - sphi1 : Math::sq(cphi1) / ( 1 + sphi1)))
00197           * (_e2 * (1 + sphi1 + sphi2 + _e2 * sphi1 * sphi2)/(es1 * es2)
00198           +_e2m * DDatanhee(sphi1, sphi2) ) / _qZ ) / den;
00199       // C = (scbet22*sxi2 - scbet12*sxi1) / (scbet22 * scbet12 * (sx2 - sx1))
00200       C = den / (2 * scbet12 * scbet22 * dsxi);
00201       tphi0 = (tphi2 + tphi1)/2;
00202       real stol = tol0_ * max(real(1), abs(tphi0));
00203       for (int i = 0; i < 2*numit0_; ++i) {
00204         // Solve (scbet0^2 * sphi0) / (1/qZ + scbet0^2 * sphi0 * sxi0) = s
00205         // for tphi0 by Newton's method on
00206         // v(tphi0) = (scbet0^2 * sphi0) - s * (1/qZ + scbet0^2 * sphi0 * sxi0)
00207         //          = 0
00208         // Alt:
00209         // (scbet0^2 * sphi0) / (1/qZ - scbet0^2 * sphi0 * (1-sxi0)) = s / (1-s)
00210         // w(tphi0) = (1-s) * (scbet0^2 * sphi0)
00211         //             - s  * (1/qZ - scbet0^2 * sphi0 * (1-sxi0))
00212         //          = (1-s) * (scbet0^2 * sphi0)
00213         //             - S/qZ  * (1 - scbet0^2 * sphi0 * (qZ-q0))
00214         // Now
00215         // qZ-q0 = (1+e2*sphi0)*(1-sphi0)/(1-e2*sphi0^2) +
00216         //         (1-e2)*atanhee((1-sphi0)/(1-e2*sphi0))
00217         // In limit sphi0 -> 1, qZ-q0 -> 2*(1-sphi0)/(1-e2), so wrte
00218         // qZ-q0 = 2*(1-sphi0)/(1-e2) + A + B
00219         // A = (1-sphi0)*( (1+e2*sphi0)/(1-e2*sphi0^2) - (1+e2)/(1-e2) )
00220         //   = -e2 *(1-sphi0)^2 * (2+(1+e2)*sphi0) / ((1-e2)*(1-e2*sphi0^2))
00221         // B = (1-e2)*atanhee((1-sphi0)/(1-e2*sphi0)) - (1-sphi0)
00222         //   = (1-sphi0)*(1-e2)/(1-e2*sphi0)*
00223         //     ((atanhee(x)/x-1) - e2*(1-sphi0)/(1-e2))
00224         // x = (1-sphi0)/(1-e2*sphi0), atanhee(x)/x = atanh(e*x)/(e*x)
00225         //
00226         // 1 - scbet0^2 * sphi0 * (qZ-q0)
00227         //   = 1 - scbet0^2 * sphi0 * (2*(1-sphi0)/(1-e2) + A + B)
00228         //   = D - scbet0^2 * sphi0 * (A + B)
00229         // D = 1 - scbet0^2 * sphi0 * 2*(1-sphi0)/(1-e2)
00230         //   = (1-sphi0)*(1-e2*(1+2*sphi0*(1+sphi0)))/((1-e2)*(1+sphi0))
00231         // dD/dsphi0 = -2*(1-e2*sphi0^2*(2*sphi0+3))/((1-e2)*(1+sphi0)^2)
00232         // d(A+B)/dsphi0 = 2*(1-sphi0^2)*e2*(2-e2*(1+sphi0^2))/
00233         //                 ((1-e2)*(1-e2*sphi0^2)^2)
00234 
00235         real
00236           scphi02 = 1 + Math::sq(tphi0), scphi0 = sqrt(scphi02),
00237           // sphi0m = 1-sin(phi0) = 1/( sec(phi0) * (tan(phi0) + sec(phi0)) )
00238           sphi0 = tphi0 / scphi0, sphi0m = 1/(scphi0 * (tphi0 + scphi0)),
00239           // scbet0^2 * sphi0
00240           g = (1 + Math::sq( _fm * tphi0 )) * sphi0,
00241           // dg/dsphi0 = dg/dtphi0 * scphi0^3
00242           dg = _e2m * scphi02 * (1 + 2 * Math::sq(tphi0)) + _e2,
00243           D = sphi0m * (1 - _e2*(1 + 2*sphi0*(1+sphi0))) / (_e2m * (1+sphi0)),
00244           // dD/dsphi0
00245           dD = -2 * (1 - _e2*Math::sq(sphi0) * (2*sphi0+3)) /
00246                (_e2m * Math::sq(1+sphi0)),
00247           A = -_e2 * Math::sq(sphi0m) * (2+(1+_e2)*sphi0) /
00248               (_e2m*(1-_e2*Math::sq(sphi0))),
00249           B = (sphi0m * _e2m / (1 - _e2*sphi0) *
00250                (atanhxm1(_e2 *
00251                          Math::sq(sphi0m / (1-_e2*sphi0))) - _e2*sphi0m/_e2m)),
00252           // d(A+B)/dsphi0
00253           dAB = (2 * _e2 * (2 - _e2 * (1 + Math::sq(sphi0))) /
00254                  (_e2m * Math::sq(1 - _e2*Math::sq(sphi0)) * scphi02)),
00255           u = sm1 * g - s/_qZ * ( D - g * (A + B) ),
00256           // du/dsphi0
00257           du = sm1 * dg - s/_qZ * (dD - dg * (A + B) - g * dAB),
00258           dtu = -u/du * (scphi0 * scphi02);
00259         tphi0 += dtu;
00260         if (!(abs(dtu) >= stol))
00261           break;
00262       }
00263     }
00264     _txi0 = txif(tphi0); _scxi0 = hyp(_txi0); _sxi0 = _txi0 / _scxi0;
00265     _n0 = tphi0/hyp(tphi0);
00266     _m02 = 1 / (1 + Math::sq(_fm * tphi0));
00267     _nrho0 = polar ? 0 : _a * sqrt(_m02);
00268     _k0 = sqrt(tphi1 == tphi2 ? 1 : C / (_m02 + _n0 * _qZ * _sxi0)) * k1;
00269     _k2 = Math::sq(_k0);
00270     _lat0 = _sign * atan(tphi0)/Math::degree<real>();
00271   }
00272 
00273   const AlbersEqualArea
00274   AlbersEqualArea::CylindricalEqualArea(Constants::WGS84_a<real>(),
00275                                         Constants::WGS84_f<real>(),
00276                                         real(0), real(1), real(0), real(1),
00277                                         real(1));
00278 
00279   const AlbersEqualArea
00280   AlbersEqualArea::AzimuthalEqualAreaNorth(Constants::WGS84_a<real>(),
00281                                            Constants::WGS84_f<real>(),
00282                                            real(1), real(0), real(1), real(0),
00283                                            real(1));
00284 
00285   const AlbersEqualArea
00286   AlbersEqualArea::AzimuthalEqualAreaSouth(Constants::WGS84_a<real>(),
00287                                            Constants::WGS84_f<real>(),
00288                                            real(-1), real(0), real(-1), real(0),
00289                                            real(1));
00290 
00291   Math::real AlbersEqualArea::txif(real tphi) const throw() {
00292     // sxi = ( sphi/(1-e2*sphi^2) + atanhee(sphi) ) /
00293     //       ( 1/(1-e2) + atanhee(1) )
00294     //
00295     // txi = ( sphi/(1-e2*sphi^2) + atanhee(sphi) ) /
00296     //       sqrt( ( (1+e2*sphi)*(1-sphi)/( (1-e2*sphi^2) * (1-e2) ) +
00297     //               atanhee((1-sphi)/(1-e2*sphi)) ) *
00298     //             ( (1-e2*sphi)*(1+sphi)/( (1-e2*sphi^2) * (1-e2) ) +
00299     //               atanhee((1+sphi)/(1+e2*sphi)) ) )
00300     //
00301     // subst 1-sphi = cphi^2/(1+sphi)
00302     int s = tphi < 0 ? -1 : 1;  // Enforce odd parity
00303     tphi *= s;
00304     real
00305       cphi2 = 1 / (1 + Math::sq(tphi)),
00306       sphi = tphi * sqrt(cphi2),
00307       es1 = _e2 * sphi,
00308       es2m1 = 1 - es1 * sphi,
00309       sp1 = 1 + sphi,
00310       es1m1 = (1 - es1) * sp1,
00311       es2m1a = _e2m * es2m1,
00312       es1p1 = sp1 / (1 + es1);
00313     return s * ( sphi / es2m1 + atanhee(sphi) ) /
00314       sqrt( ( cphi2 / (es1p1 * es2m1a) + atanhee(cphi2 / es1m1) ) *
00315             ( es1m1 / es2m1a + atanhee(es1p1) ) );
00316   }
00317 
00318   Math::real AlbersEqualArea::tphif(real txi) const throw() {
00319     real
00320       tphi = txi,
00321       stol = tol_ * max(real(1), abs(txi));
00322     // CHECK: min iterations = 1, max iterations = 2; mean = 1.99
00323     for (int i = 0; i < numit_; ++i) {
00324       // dtxi/dtphi = (scxi/scphi)^3 * 2*(1-e^2)/(qZ*(1-e^2*sphi^2)^2)
00325       real
00326         txia = txif(tphi),
00327         tphi2 = Math::sq(tphi),
00328         scphi2 = 1 + tphi2,
00329         scterm = scphi2/(1 + Math::sq(txia)),
00330         dtphi = (txi - txia) * scterm * sqrt(scterm) *
00331         _qx * Math::sq(1 - _e2 * tphi2 / scphi2);
00332       tphi += dtphi;
00333       if (!(abs(dtphi) >= stol))
00334         break;
00335     }
00336     return tphi;
00337   }
00338 
00339   // return atanh(sqrt(x))/sqrt(x) - 1 = y/3 + y^2/5 + y^3/7 + ...
00340   // typical x < e^2 = 2*f
00341   Math::real AlbersEqualArea::atanhxm1(real x) throw() {
00342     real s = 0;
00343     if (abs(x) < real(0.5)) {
00344       real os = -1, y = 1, k = 1;
00345       while (os != s) {
00346         os = s;
00347         y *= x;                 // y = x^n
00348         k += 2;                 // k = 2*n + 1
00349         s += y/k;               // sum( x^n/(2*n + 1) )
00350       }
00351     } else {
00352       real xs = sqrt(abs(x));
00353       s = (x > 0 ? Math::atanh(xs) : atan(xs)) / xs - 1;
00354     }
00355     return s;
00356   }
00357 
00358   // return (Datanhee(1,y) - Datanhee(1,x))/(y-x)
00359   Math::real AlbersEqualArea::DDatanhee(real x, real y) const throw() {
00360     real s = 0;
00361     if (_e2 * (abs(x) + abs(y)) < real(0.5)) {
00362       real os = -1, z = 1, k = 1, t = 0, c = 0, en = 1;
00363       while (os != s) {
00364         os = s;
00365         t = y * t + z; c += t; z *= x;
00366         t = y * t + z; c += t; z *= x;
00367         k += 2; en *= _e2;
00368         // Here en[l] = e2^l, k[l] = 2*l + 1,
00369         // c[l] = sum( x^i * y^j; i >= 0, j >= 0, i+j < 2*l)
00370         s += en * c / k;
00371       }
00372       // Taylor expansion is
00373       // s = sum( c[l] * e2^l / (2*l + 1), l, 1, N)
00374     } else
00375       s = (Datanhee(1, y) - Datanhee(x, y))/(1 - x);
00376     return s;
00377   }
00378 
00379   void AlbersEqualArea::Forward(real lon0, real lat, real lon,
00380                                 real& x, real& y, real& gamma, real& k)
00381     const throw() {
00382     if (lon - lon0 >= 180)
00383       lon -= lon0 + 360;
00384     else if (lon - lon0 < -180)
00385       lon -= lon0 - 360;
00386     else
00387       lon -= lon0;
00388     lat *= _sign;
00389     real
00390       lam = lon * Math::degree<real>(),
00391       phi = lat * Math::degree<real>(),
00392       sphi = sin(phi), cphi = abs(lat) != 90 ? cos(phi) : epsx_,
00393       tphi = sphi/cphi, txi = txif(tphi), sxi = txi/hyp(txi),
00394       dq = _qZ * Dsn(txi, _txi0, sxi, _sxi0) * (txi - _txi0),
00395       drho = - _a * dq / (sqrt(_m02 - _n0 * dq) + _nrho0 / _a),
00396       theta = _k2 * _n0 * lam, stheta = sin(theta), ctheta = cos(theta),
00397       t = _nrho0 + _n0 * drho;
00398     x = t * (_n0 != 0 ? stheta / _n0 : _k2 * lam) / _k0;
00399     y = (_nrho0 *
00400          (_n0 != 0 ?
00401           (ctheta < 0 ? 1 - ctheta : Math::sq(stheta)/(1 + ctheta)) / _n0 :
00402           0)
00403          - drho * ctheta) / _k0;
00404     k = _k0 * (t != 0 ? t * hyp(_fm * tphi) / _a : 1);
00405     y *= _sign;
00406     gamma = _sign * theta / Math::degree<real>();
00407   }
00408 
00409   void AlbersEqualArea::Reverse(real lon0, real x, real y,
00410                                 real& lat, real& lon,
00411                                 real& gamma, real& k)
00412     const throw() {
00413     y *= _sign;
00414     real
00415       nx = _k0 * _n0 * x, ny = _k0 * _n0 * y, y1 =  _nrho0 - ny,
00416       den = Math::hypot(nx, y1) + _nrho0, // 0 implies origin with polar aspect
00417       drho = den != 0 ? (_k0*x*nx - 2*_k0*y*_nrho0 + _k0*y*ny) / den : 0,
00418       // dsxia = scxi0 * dsxi
00419       dsxia = - _scxi0 * (2 * _nrho0 + _n0 * drho) * drho /
00420               (Math::sq(_a) * _qZ),
00421       txi = (_txi0 + dsxia) / sqrt(max(1 - dsxia * (2*_txi0 + dsxia), epsx2_)),
00422       tphi = tphif(txi),
00423       phi = _sign * atan(tphi),
00424       theta = atan2(nx, y1),
00425       lam = _n0 != 0 ? theta / (_k2 * _n0) : x / (y1 * _k0);
00426     gamma = _sign * theta / Math::degree<real>();
00427     lat = phi / Math::degree<real>();
00428     lon = lam / Math::degree<real>();
00429     // Avoid losing a bit of accuracy in lon (assuming lon0 is an integer)
00430     if (lon + lon0 >= 180)
00431       lon += lon0 - 360;
00432     else if (lon + lon0 < -180)
00433       lon += lon0 + 360;
00434     else
00435       lon += lon0;
00436     k = _k0 * (den != 0 ? (_nrho0 + _n0 * drho) * hyp(_fm * tphi) / _a : 1);
00437   }
00438 
00439   void AlbersEqualArea::SetScale(real lat, real k) {
00440     if (!(Math::isfinite(k) && k > 0))
00441       throw GeographicErr("Scale is not positive");
00442     if (!(abs(lat) < 90))
00443       throw GeographicErr("Latitude for SetScale not in (-90, 90)");
00444     real x, y, gamma, kold;
00445     Forward(0, lat, 0, x, y, gamma, kold);
00446     k /= kold;
00447     _k0 *= k;
00448     _k2 = Math::sq(_k0);
00449   }
00450 
00451 } // namespace GeographicLib
geographiclib-1.21/doc/html/functions_func_0x6f.html0000644000175000017500000002132611745620414022351 0ustar frankiefrankie GeographicLib: Class Members - Functions geographiclib-1.21/doc/html/GravityCircle_8hpp.html0000644000175000017500000001324111745620414022166 0ustar frankiefrankie GeographicLib: GravityCircle.hpp File Reference
GravityCircle.hpp File Reference

Header for GeographicLib::GravityCircle class. More...

#include <string>
#include <vector>
#include <GeographicLib/Constants.hpp>
#include <GeographicLib/CircularEngine.hpp>
#include <GeographicLib/GravityModel.hpp>

Go to the source code of this file.

Classes

class  GeographicLib::GravityCircle
 Gravity on a circle of latitude. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_GRAVITYCIRCLE_HPP   "$Id: 6ae0869411185a48c9f55016e6d1fb14e69aaac1 $"

Detailed Description

Header for GeographicLib::GravityCircle class.

Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file GravityCircle.hpp.


Define Documentation

#define GEOGRAPHICLIB_GRAVITYCIRCLE_HPP   "$Id: 6ae0869411185a48c9f55016e6d1fb14e69aaac1 $"

Definition at line 11 of file GravityCircle.hpp.

geographiclib-1.21/doc/html/dir_addd23a7fcb542c6c8ac894d486b21be.html0000644000175000017500000000423411745620414024176 0ustar frankiefrankie GeographicLib: include/ Directory Reference
include Directory Reference

Directories

directory  GeographicLib
geographiclib-1.21/doc/html/LambertConformalConic_8hpp.html0000644000175000017500000001306311745620415023625 0ustar frankiefrankie GeographicLib: LambertConformalConic.hpp File Reference
LambertConformalConic.hpp File Reference

Header for GeographicLib::LambertConformalConic class. More...

#include <algorithm>
#include <GeographicLib/Constants.hpp>

Go to the source code of this file.

Classes

class  GeographicLib::LambertConformalConic
 Lambert Conformal Conic Projection. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP   "$Id: 9aef04f77098543818681966f13ef97ea47dedb4 $"

Detailed Description

Header for GeographicLib::LambertConformalConic class.

Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file LambertConformalConic.hpp.


Define Documentation

#define GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP   "$Id: 9aef04f77098543818681966f13ef97ea47dedb4 $"

Definition at line 11 of file LambertConformalConic.hpp.

geographiclib-1.21/doc/html/DMS_8hpp_source.html0000644000175000017500000012557611745620414021441 0ustar frankiefrankie GeographicLib: DMS.hpp Source File
DMS.hpp
Go to the documentation of this file.
00001 /**
00002  * \file DMS.hpp
00003  * \brief Header for GeographicLib::DMS class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_DMS_HPP)
00011 #define GEOGRAPHICLIB_DMS_HPP "$Id: 67770a78c105495a31a9d3755c811e938729c85a $"
00012 
00013 #include <sstream>
00014 #include <iomanip>
00015 #include <GeographicLib/Constants.hpp>
00016 #include <GeographicLib/Utility.hpp>
00017 
00018 #if defined(_MSC_VER)
00019 // Squelch warnings about dll vs string
00020 #pragma warning (push)
00021 #pragma warning (disable: 4251)
00022 #endif
00023 
00024 namespace GeographicLib {
00025 
00026   /**
00027    * \brief Convert between degrees and %DMS representation.
00028    *
00029    * Parse a string representing degree, minutes, and seconds and return the
00030    * angle in degrees and format an angle in degrees as degree, minutes, and
00031    * seconds.  In addition, handle NANs and infinities on input and output.
00032    *
00033    * Example of use:
00034    * \include example-DMS.cpp
00035    **********************************************************************/
00036   class GEOGRAPHIC_EXPORT DMS {
00037   private:
00038     typedef Math::real real;
00039     // Replace all occurrences of pat by c
00040     static void replace(std::string& s, const std::string& pat, char c) {
00041       std::string::size_type p = 0;
00042       while (true) {
00043         p = s.find(pat, p);
00044         if (p == std::string::npos)
00045           break;
00046         s.replace(p, pat.length(), 1, c);
00047       }
00048     }
00049     static const std::string hemispheres_;
00050     static const std::string signs_;
00051     static const std::string digits_;
00052     static const std::string dmsindicators_;
00053     static const std::string components_[3];
00054     static Math::real NumMatch(const std::string& s);
00055     DMS();                      // Disable constructor
00056 
00057   public:
00058 
00059     /**
00060      * Indicator for presence of hemisphere indicator (N/S/E/W) on latitudes
00061      * and longitudes.
00062      **********************************************************************/
00063     enum flag {
00064       /**
00065        * No indicator present.
00066        * @hideinitializer
00067        **********************************************************************/
00068       NONE = 0,
00069       /**
00070        * Latitude indicator (N/S) present.
00071        * @hideinitializer
00072        **********************************************************************/
00073       LATITUDE = 1,
00074       /**
00075        * Longitude indicator (E/W) present.
00076        * @hideinitializer
00077        **********************************************************************/
00078       LONGITUDE = 2,
00079       /**
00080        * Used in Encode to indicate output of an azimuth in [000, 360) with no
00081        * letter indicator.
00082        * @hideinitializer
00083        **********************************************************************/
00084       AZIMUTH = 3,
00085       /**
00086        * Used in Encode to indicate output of a plain number.
00087        * @hideinitializer
00088        **********************************************************************/
00089       NUMBER = 4,
00090     };
00091 
00092     /**
00093      * Indicator for trailing units on an angle.
00094      **********************************************************************/
00095     enum component {
00096       /**
00097        * Trailing unit is degrees.
00098        * @hideinitializer
00099        **********************************************************************/
00100       DEGREE = 0,
00101       /**
00102        * Trailing unit is arc minutes.
00103        * @hideinitializer
00104        **********************************************************************/
00105       MINUTE = 1,
00106       /**
00107        * Trailing unit is arc seconds.
00108        * @hideinitializer
00109        **********************************************************************/
00110       SECOND = 2,
00111     };
00112 
00113     /**
00114      * Convert a string in DMS to an angle.
00115      *
00116      * @param[in] dms string input.
00117      * @param[out] ind a DMS::flag value signaling the presence of a
00118      *   hemisphere indicator.
00119      * @return angle (degrees).
00120      *
00121      * Degrees, minutes, and seconds are indicated by the characters d, '
00122      * (single quote), &quot; (double quote), and these components may only be
00123      * given in this order.  Any (but not all) components may be omitted and
00124      * other symbols (e.g., the <sup>o</sup> symbol for degrees and the unicode
00125      * prime and double prime symbols for minutes and seconds) may be
00126      * substituted.  The last component indicator may be omitted and is assumed
00127      * to be the next smallest unit (thus 33d10 is interpreted as 33d10').  The
00128      * final component may be a decimal fraction but the non-final components
00129      * must be integers.  Instead of using d, ', and &quot; to indicate
00130      * degrees, minutes, and seconds, : (colon) may be used to <i>separate</i>
00131      * these components (numbers must appear before and after each colon); thus
00132      * 50d30'10.3&quot; may be written as 50:30:10.3, 5.5' may be written
00133      * 0:5.5, and so on.  The integer parts of the minutes and seconds
00134      * components must be less than 60.  A single leading sign is permitted.  A
00135      * hemisphere designator (N, E, W, S) may be added to the beginning or end
00136      * of the string.  The result is multiplied by the implied sign of the
00137      * hemisphere designator (negative for S and W).  In addition \e ind is set
00138      * to DMS::LATITUDE if N or S is present, to DMS::LONGITUDE if E or W is
00139      * present, and to DMS::NONE otherwise.  Throws an error on a malformed
00140      * string.  No check is performed on the range of the result.  Examples of
00141      * legal and illegal strings are
00142      * - <i>LEGAL</i> (all the entries on each line are equivalent)
00143      *   - -20.51125, 20d30'40.5&quot;S, -20d30'40.5, -20d30.675,
00144      *     N-20d30'40.5&quot;, -20:30:40.5
00145      *   - 4d0'9, 4d9&quot;, 4d9'', 4:0:9, 004:00:09, 4.0025, 4.0025d, 4d0.15,
00146      *     04:.15
00147      * - <i>ILLEGAL</i> (the exception thrown explains the problem)
00148      *   - 4d5&quot;4', 4::5, 4:5:, :4:5, 4d4.5'4&quot;, -N20.5, 1.8e2d, 4:60,
00149      *     4d-5'
00150      *
00151      * <b>NOTE:</b> At present, all the string handling in the C++
00152      * implementation %GeographicLib is with 8-bit characters.  The support for
00153      * unicode symbols for degrees, minutes, and seconds is therefore via the
00154      * <a href="http://en.wikipedia.org/wiki/UTF-8">UTF-8</a> encoding.  (The
00155      * Javascript implementation of this class uses unicode natively, of
00156      * course.)
00157      *
00158      * Here is the list of Unicode symbols supported for degrees, minutes,
00159      * seconds:
00160      * - degrees:
00161      *   - d, D lower and upper case letters
00162      *   - U+00b0 degree symbol
00163      *   - U+00ba masculine ordinal indicator
00164      *   - U+2070 superscript zero
00165      * - minutes:
00166      *   - ' apostrophe
00167      *   - U+2032 prime
00168      *   - U+00b4 acute accent
00169      * - seconds:
00170      *   - &quot; quotation mark
00171      *   - U+2033 double prime
00172      *   - '&nbsp;' any two consecutive symbols for minutes
00173      * .
00174      * The codes with a leading zero byte, e.g., U+00b0, are accepted in their
00175      * UTF-8 coded form 0xc2 0xb0 and as a single byte 0xb0.
00176      **********************************************************************/
00177     static Math::real Decode(const std::string& dms, flag& ind);
00178 
00179     /**
00180      * Convert DMS to an angle.
00181      *
00182      * @param[in] d degrees.
00183      * @param[in] m arc minutes.
00184      * @param[in] s arc seconds.
00185      * @return angle (degrees)
00186      *
00187      * This does not propagate the sign on \e d to the other components, so
00188      * -3d20' would need to be represented as - DMS::Decode(3.0, 20.0) or
00189      * DMS::Decode(-3.0, -20.0).
00190      **********************************************************************/
00191     static Math::real Decode(real d, real m = 0, real s = 0) throw()
00192     { return d + (m + s/real(60))/real(60); }
00193 
00194     /// \cond SKIP
00195     /**
00196      * <b>DEPRECATED</b> (use Utility::num, instead).
00197      * Convert a string to a real number.
00198      *
00199      * @param[in] str string input.
00200      * @return decoded number.
00201      **********************************************************************/
00202     static Math::real Decode(const std::string& str)
00203     { return Utility::num<real>(str); }
00204 
00205     /**
00206      * <b>DEPRECATED</b> (use Utility::fract, instead).
00207      * Convert a string to a real number treating the case where the string is
00208      * a simple fraction.
00209      *
00210      * @param[in] str string input.
00211      * @return decoded number.
00212      **********************************************************************/
00213     static Math::real DecodeFraction(const std::string& str)
00214     { return Utility::fract<real>(str); }
00215     /// \endcond
00216 
00217     /**
00218      * Convert a pair of strings to latitude and longitude.
00219      *
00220      * @param[in] dmsa first string.
00221      * @param[in] dmsb second string.
00222      * @param[out] lat latitude.
00223      * @param[out] lon longitude.
00224      * @param[in] swaplatlong if true assume longitude is given before latitude
00225      *   in the absence of hemisphere designators (default false).
00226      *
00227      * By default, the \e lat (resp., \e lon) is assigned to the results of
00228      * decoding \e dmsa (resp., \e dmsb).  However this is overridden if either
00229      * \e dmsa or \e dmsb contain a latitude or longitude hemisphere designator
00230      * (N, S, E, W).  Throws an error if the decoded numbers are out of the
00231      * ranges [-90<sup>o</sup>, 90<sup>o</sup>] for latitude and
00232      * [-180<sup>o</sup>, 360<sup>o</sup>] for longitude and, in which case \e
00233      * lat and \e lon are unchanged.  Finally the longitude is reduced to the
00234      * range [-180<sup>o</sup>, 180<sup>o</sup>).
00235      **********************************************************************/
00236     static void DecodeLatLon(const std::string& dmsa, const std::string& dmsb,
00237                              real& lat, real& lon, bool swaplatlong = false);
00238 
00239     /**
00240      * Convert a string to an angle in degrees.
00241      *
00242      * @param[in] angstr input string.
00243      * @return angle (degrees)
00244      *
00245      * No hemisphere designator is allowed and no check is done on the range of
00246      * the result.
00247      **********************************************************************/
00248     static Math::real DecodeAngle(const std::string& angstr);
00249 
00250     /**
00251      * Convert a string to an azimuth in degrees.
00252      *
00253      * @param[in] azistr input string.
00254      * @return azimuth (degrees)
00255      *
00256      * A hemisphere designator E/W can be used; the result is multiplied by -1
00257      * if W is present.  Throws an error if the result is out of the range
00258      * [-180<sup>o</sup>, 360<sup>o</sup>].  Finally the azimuth is reduced to
00259      * the range [-180<sup>o</sup>, 180<sup>o</sup>).
00260      **********************************************************************/
00261     static Math::real DecodeAzimuth(const std::string& azistr);
00262 
00263     /**
00264      * Convert angle (in degrees) into a DMS string (using d, ', and &quot;).
00265      *
00266      * @param[in] angle input angle (degrees)
00267      * @param[in] trailing DMS::component value indicating the trailing units
00268      *   on the string and this is given as a decimal number if necessary.
00269      * @param[in] prec the number of digits after the decimal point for the
00270      *   trailing component.
00271      * @param[in] ind DMS::flag value indicated additional formatting.
00272      * @param[in] dmssep if non-null, use as the DMS separator character
00273      *   (instead of d, ', &quot; delimiters).
00274      * @return formatted string
00275      *
00276      * The interpretation of \e ind is as follows:
00277      * - ind == DMS::NONE, signed result no leading zeros on degrees except in
00278      *   the units place, e.g., -8d03'.
00279      * - ind == DMS::LATITUDE, trailing N or S hemisphere designator, no sign,
00280      *   pad degrees to 2 digits, e.g., 08d03'S.
00281      * - ind == DMS::LONGITUDE, trailing E or W hemisphere designator, no
00282      *   sign, pad degrees to 3 digits, e.g., 008d03'W.
00283      * - ind == DMS::AZIMUTH, convert to the range [0, 360<sup>o</sup>), no
00284      *   sign, pad degrees to 3 digits, , e.g., 351d57'.
00285      * .
00286      * The integer parts of the minutes and seconds components are always given
00287      * with 2 digits.
00288      **********************************************************************/
00289     static std::string Encode(real angle, component trailing, unsigned prec,
00290                               flag ind, char dmssep);
00291 
00292     /**
00293      * Convert angle (in degrees) into a DMS string (using d, ', and &quot;).
00294      *
00295      * @param[in] angle input angle (degrees)
00296      * @param[in] trailing DMS::component value indicating the trailing units
00297      *   on the string and this is given as a decimal number if necessary.
00298      * @param[in] prec the number of digits after the decimal point for the
00299      *   trailing component.
00300      * @param[in] ind DMS::flag value indicated additional formatting.
00301      * @return formatted string
00302      *
00303      * <b>COMPATIBILITY NOTE:</b> This function calls
00304      * Encode(real, component, unsigned, flag, char) with a 5th
00305      * argument of char(0).  At some point,
00306      * Encode(real, component, unsigned, flag) and will be withdrawn
00307      * and the interface to
00308      * Encode(real, component, unsigned, flag, char) changed so that
00309      * its 4th and 5th arguments have default values.  This will
00310      * preserve source-level compatibility.
00311      **********************************************************************/
00312     static std::string Encode(real angle, component trailing, unsigned prec,
00313                               flag ind = NONE);
00314 
00315     /**
00316      * Convert angle into a DMS string (using d, ', and &quot;) selecting the
00317      * trailing component based on the precision.
00318      *
00319      * @param[in] angle input angle (degrees)
00320      * @param[in] prec the precision relative to 1 degree.
00321      * @param[in] ind DMS::flag value indicated additional formatting.
00322      * @param[in] dmssep if non-null, use as the DMS separator character
00323      *   (instead of d, ', &quot; delimiters).
00324      * @return formatted string
00325      *
00326      * \e prec indicates the precision relative to 1 degree, e.g., \e prec = 3
00327      * gives a result accurate to 0.1' and \e prec = 4 gives a result accurate
00328      * to 1&quot;.  \e ind is interpreted as in DMS::Encode with the additional
00329      * facility that DMS::NUMBER represents \e angle as a number in fixed
00330      * format with precision \e prec.
00331      **********************************************************************/
00332     static std::string Encode(real angle, unsigned prec, flag ind = NONE,
00333                               char dmssep = char(0)) {
00334       return ind == NUMBER ? Utility::str<real>(angle, int(prec)) :
00335         Encode(angle,
00336                prec < 2 ? DEGREE : (prec < 4 ? MINUTE : SECOND),
00337                prec < 2 ? prec : (prec < 4 ? prec - 2 : prec - 4),
00338                ind, dmssep);
00339     }
00340 
00341     /**
00342      * Split angle into degrees and minutes
00343      *
00344      * @param[in] ang angle (degrees)
00345      * @param[out] d degrees (an integer returned as a real)
00346      * @param[out] m arc minutes.
00347      **********************************************************************/
00348     static void Encode(real ang, real& d, real& m) throw() {
00349       d = int(ang); m = 60 * (ang - d);
00350     }
00351 
00352     /**
00353      * Split angle into degrees and minutes and seconds.
00354      *
00355      * @param[in] ang angle (degrees)
00356      * @param[out] d degrees (an integer returned as a real)
00357      * @param[out] m arc minutes (an integer returned as a real)
00358      * @param[out] s arc seconds.
00359      **********************************************************************/
00360     static void Encode(real ang, real& d, real& m, real& s) throw() {
00361       d = int(ang); ang = 60 * (ang - d);
00362       m = int(ang); s = 60 * (ang - m);
00363     }
00364 
00365   };
00366 
00367 } // namespace GeographicLib
00368 
00369 #if defined(_MSC_VER)
00370 #pragma warning (pop)
00371 #endif
00372 
00373 #endif  // GEOGRAPHICLIB_DMS_HPP
geographiclib-1.21/doc/html/LocalCartesian_8hpp_source.html0000644000175000017500000007424211745620414023673 0ustar frankiefrankie GeographicLib: LocalCartesian.hpp Source File
LocalCartesian.hpp
Go to the documentation of this file.
00001 /**
00002  * \file LocalCartesian.hpp
00003  * \brief Header for GeographicLib::LocalCartesian class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_LOCALCARTESIAN_HPP)
00011 #define GEOGRAPHICLIB_LOCALCARTESIAN_HPP \
00012   "$Id: 133014a30695adf3bdea9f4b52613fab458c505a $"
00013 
00014 #include <GeographicLib/Geocentric.hpp>
00015 #include <GeographicLib/Constants.hpp>
00016 
00017 namespace GeographicLib {
00018 
00019   /**
00020    * \brief Local Cartesian coordinates
00021    *
00022    * Convert between geodetic coordinates latitude = \e lat, longitude = \e
00023    * lon, height = \e h (measured vertically from the surface of the ellipsoid)
00024    * to local cartesian coordinates (\e x, \e y, \e z).  The origin of local
00025    * cartesian coordinate system is at \e lat = \e lat0, \e lon = \e lon0, \e h
00026    * = \e h0. The \e z axis is normal to the ellipsoid; the \e y axis points
00027    * due north.  The plane \e z = - \e h0 is tangent to the ellipsoid.
00028    *
00029    * The conversions all take place via geocentric coordinates using a
00030    * Geocentric object (by default Geocentric::WGS84).
00031    *
00032    * Example of use:
00033    * \include example-LocalCartesian.cpp
00034    *
00035    * <a href="CartConvert.1.html">CartConvert</a> is a command-line utility
00036    * providing access to the functionality of Geocentric and LocalCartesian.
00037    **********************************************************************/
00038 
00039   class GEOGRAPHIC_EXPORT LocalCartesian {
00040   private:
00041     typedef Math::real real;
00042     static const size_t dim_ = 3;
00043     static const size_t dim2_ = dim_ * dim_;
00044     Geocentric _earth;
00045     real _lat0, _lon0, _h0;
00046     real _x0, _y0, _z0, _r[dim2_];
00047     void IntForward(real lat, real lon, real h, real& x, real& y, real& z,
00048                     real M[dim2_]) const throw();
00049     void IntReverse(real x, real y, real z, real& lat, real& lon, real& h,
00050                     real M[dim2_]) const throw();
00051     void MatrixMultiply(real M[dim2_]) const throw();
00052   public:
00053 
00054     /**
00055      * Constructor setting the origin.
00056      *
00057      * @param[in] lat0 latitude at origin (degrees).
00058      * @param[in] lon0 longitude at origin (degrees).
00059      * @param[in] h0 height above ellipsoid at origin (meters); default 0.
00060      * @param[in] earth Geocentric object for the transformation; default
00061      *   Geocentric::WGS84.
00062      **********************************************************************/
00063     LocalCartesian(real lat0, real lon0, real h0 = 0,
00064                    const Geocentric& earth = Geocentric::WGS84) throw()
00065       : _earth(earth)
00066     { Reset(lat0, lon0, h0); }
00067 
00068     /**
00069      * Default constructor.
00070      *
00071      * @param[in] earth Geocentric object for the transformation; default
00072      *   Geocentric::WGS84.
00073      *
00074      * Sets \e lat0 = 0, \e lon0 = 0, \e h0 = 0.
00075      **********************************************************************/
00076     explicit LocalCartesian(const Geocentric& earth = Geocentric::WGS84)
00077       throw()
00078       : _earth(earth)
00079     { Reset(real(0), real(0), real(0)); }
00080 
00081     /**
00082      * Reset the origin.
00083      *
00084      * @param[in] lat0 latitude at origin (degrees).
00085      * @param[in] lon0 longitude at origin (degrees).
00086      * @param[in] h0 height above ellipsoid at origin (meters); default 0.
00087      **********************************************************************/
00088     void Reset(real lat0, real lon0, real h0 = 0)
00089       throw();
00090 
00091     /**
00092      * Convert from geodetic to local cartesian coordinates.
00093      *
00094      * @param[in] lat latitude of point (degrees).
00095      * @param[in] lon longitude of point (degrees).
00096      * @param[in] h height of point above the ellipsoid (meters).
00097      * @param[out] x local cartesian coordinate (meters).
00098      * @param[out] y local cartesian coordinate (meters).
00099      * @param[out] z local cartesian coordinate (meters).
00100      *
00101      * \e lat should be in the range [-90, 90]; \e lon and \e lon0 should be in
00102      * the range [-180, 360].
00103      **********************************************************************/
00104     void Forward(real lat, real lon, real h, real& x, real& y, real& z)
00105       const throw() {
00106       IntForward(lat, lon, h, x, y, z, NULL);
00107     }
00108 
00109     /**
00110      * Convert from geodetic to local cartesian coordinates and return rotation
00111      * matrix.
00112      *
00113      * @param[in] lat latitude of point (degrees).
00114      * @param[in] lon longitude of point (degrees).
00115      * @param[in] h height of point above the ellipsoid (meters).
00116      * @param[out] x local cartesian coordinate (meters).
00117      * @param[out] y local cartesian coordinate (meters).
00118      * @param[out] z local cartesian coordinate (meters).
00119      * @param[out] M if the length of the vector is 9, fill with the rotation
00120      *   matrix in row-major order.
00121      *
00122      * Let \e v be a unit vector located at (\e lat, \e lon, \e h).  We can
00123      * express \e v as \e column vectors in one of two ways
00124      * - in east, north, up coordinates (where the components are relative to a
00125      *   local coordinate system at (\e lat, \e lon, \e h)); call this
00126      *   representation \e v1.
00127      * - in \e x, \e y, \e z coordinates (where the components are relative to
00128      *   the local coordinate system at (\e lat0, \e lon0, \e h0)); call this
00129      *   representation \e v0.
00130      * .
00131      * Then we have \e v0 = \e M . \e v1.
00132      **********************************************************************/
00133     void Forward(real lat, real lon, real h, real& x, real& y, real& z,
00134                  std::vector<real>& M)
00135       const throw()  {
00136       if (M.end() == M.begin() + dim2_) {
00137         real t[dim2_];
00138         IntForward(lat, lon, h, x, y, z, t);
00139         copy(t, t + dim2_, M.begin());
00140       } else
00141         IntForward(lat, lon, h, x, y, z, NULL);
00142     }
00143 
00144     /**
00145      * Convert from local cartesian to geodetic coordinates.
00146      *
00147      * @param[in] x local cartesian coordinate (meters).
00148      * @param[in] y local cartesian coordinate (meters).
00149      * @param[in] z local cartesian coordinate (meters).
00150      * @param[out] lat latitude of point (degrees).
00151      * @param[out] lon longitude of point (degrees).
00152      * @param[out] h height of point above the ellipsoid (meters).
00153      *
00154      * The value of \e lon returned is in the range [-180, 180).
00155      **********************************************************************/
00156     void Reverse(real x, real y, real z, real& lat, real& lon, real& h)
00157       const throw() {
00158       IntReverse(x, y, z, lat, lon, h, NULL);
00159     }
00160 
00161     /**
00162      * Convert from local cartesian to geodetic coordinates and return rotation
00163      * matrix.
00164      *
00165      * @param[in] x local cartesian coordinate (meters).
00166      * @param[in] y local cartesian coordinate (meters).
00167      * @param[in] z local cartesian coordinate (meters).
00168      * @param[out] lat latitude of point (degrees).
00169      * @param[out] lon longitude of point (degrees).
00170      * @param[out] h height of point above the ellipsoid (meters).
00171      * @param[out] M if the length of the vector is 9, fill with the rotation
00172      *   matrix in row-major order.
00173      *
00174      * Let \e v be a unit vector located at (\e lat, \e lon, \e h).  We can
00175      * express \e v as \e column vectors in one of two ways
00176      * - in east, north, up coordinates (where the components are relative to a
00177      *   local coordinate system at (\e lat, \e lon, \e h)); call this
00178      *   representation \e v1.
00179      * - in \e x, \e y, \e z coordinates (where the components are relative to
00180      *   the local coordinate system at (\e lat0, \e lon0, \e h0)); call this
00181      *   representation \e v0.
00182      * .
00183      * Then we have \e v1 = \e M^T . \e v0, where \e M^T is the transpose of \e
00184      * M.
00185      **********************************************************************/
00186     void Reverse(real x, real y, real z, real& lat, real& lon, real& h,
00187                  std::vector<real>& M)
00188       const throw() {
00189       if (M.end() == M.begin() + dim2_) {
00190         real t[dim2_];
00191         IntReverse(x, y, z, lat, lon, h, t);
00192         copy(t, t + dim2_, M.begin());
00193       } else
00194         IntReverse(x, y, z, lat, lon, h, NULL);
00195     }
00196 
00197     /** \name Inspector functions
00198      **********************************************************************/
00199     ///@{
00200     /**
00201      * @return latitude of the origin (degrees).
00202      **********************************************************************/
00203     Math::real LatitudeOrigin() const throw() { return _lat0; }
00204 
00205     /**
00206      * @return longitude of the origin (degrees).
00207      **********************************************************************/
00208     Math::real LongitudeOrigin() const throw() { return _lon0; }
00209 
00210     /**
00211      * @return height of the origin (meters).
00212      **********************************************************************/
00213     Math::real HeightOrigin() const throw() { return _h0; }
00214 
00215     /**
00216      * @return \e a the equatorial radius of the ellipsoid (meters).  This is
00217      *   the value of \e a inherited from the Geocentric object used in the
00218      *   constructor.
00219      **********************************************************************/
00220     Math::real MajorRadius() const throw() { return _earth.MajorRadius(); }
00221 
00222     /**
00223      * @return \e f the flattening of the ellipsoid.  This is the value
00224      *   inherited from the Geocentric object used in the constructor.
00225      **********************************************************************/
00226     Math::real Flattening() const throw() { return _earth.Flattening(); }
00227     ///@}
00228 
00229     /// \cond SKIP
00230     /**
00231      * <b>DEPRECATED</b>
00232      * @return \e r the inverse flattening of the ellipsoid.
00233      **********************************************************************/
00234     Math::real InverseFlattening() const throw()
00235     { return _earth.InverseFlattening(); }
00236     /// \endcond
00237   };
00238 
00239 } // namespace GeographicLib
00240 
00241 #endif  // GEOGRAPHICLIB_LOCALCARTESIAN_HPP
geographiclib-1.21/doc/html/GravityCircle_8cpp.html0000644000175000017500000001353611745620415022171 0ustar frankiefrankie GeographicLib: GravityCircle.cpp File Reference
GravityCircle.cpp File Reference

Implementation for GeographicLib::GravityCircle class. More...

#include <GeographicLib/GravityCircle.hpp>
#include <fstream>
#include <sstream>
#include <GeographicLib/Geocentric.hpp>

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_GRAVITYCIRCLE_CPP   "$Id: 94c2bce8fa9f379b5e3d0e176c89b4989762ef3a $"
#define GRAVITY_DEFAULT_PATH   "/home/ckarney/geographiclib/gravity"

Detailed Description

Implementation for GeographicLib::GravityCircle class.

Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file GravityCircle.cpp.


Define Documentation

#define GEOGRAPHICLIB_GRAVITYCIRCLE_CPP   "$Id: 94c2bce8fa9f379b5e3d0e176c89b4989762ef3a $"

Definition at line 15 of file GravityCircle.cpp.

#define GRAVITY_DEFAULT_PATH   "/home/ckarney/geographiclib/gravity"

Definition at line 21 of file GravityCircle.cpp.

geographiclib-1.21/doc/html/GeodesicProj_8cpp.html0000644000175000017500000001404411745620414021771 0ustar frankiefrankie GeographicLib: GeodesicProj.cpp File Reference
GeodesicProj.cpp File Reference

Command line utility for geodesic projections. More...

#include <iostream>
#include <sstream>
#include <string>
#include <fstream>
#include <GeographicLib/Geodesic.hpp>
#include <GeographicLib/AzimuthalEquidistant.hpp>
#include <GeographicLib/CassiniSoldner.hpp>
#include <GeographicLib/Gnomonic.hpp>
#include <GeographicLib/DMS.hpp>
#include <GeographicLib/Utility.hpp>
#include "GeodesicProj.usage"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Detailed Description

Command line utility for geodesic projections.

Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Compile and link with g++ -g -O3 -I../include -I../man -o GeodesicProj \ GeodesicProj.cpp \ ../src/AzimuthalEquidistant.cpp \ ../src/CassiniSoldner.cpp \ ../src/DMS.cpp \ ../src/Geodesic.cpp \ ../src/GeodesicLine.cpp \ ../src/Gnomonic.cpp

See the man page for usage information.

Definition in file GeodesicProj.cpp.


Function Documentation

geographiclib-1.21/doc/html/GravityModel_8hpp.html0000644000175000017500000001352611745620415022034 0ustar frankiefrankie GeographicLib: GravityModel.hpp File Reference
GravityModel.hpp File Reference

Header for GeographicLib::GravityModel class. More...

#include <string>
#include <sstream>
#include <vector>
#include <GeographicLib/Constants.hpp>
#include <GeographicLib/NormalGravity.hpp>
#include <GeographicLib/SphericalHarmonic.hpp>
#include <GeographicLib/SphericalHarmonic1.hpp>

Go to the source code of this file.

Classes

class  GeographicLib::GravityModel
 Model of the earth's gravity field. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_GRAVITYMODEL_HPP   "$Id: e1a573fb0148fa5bc408b2dbdb096d4cd3091bac $"

Detailed Description

Header for GeographicLib::GravityModel class.

Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file GravityModel.hpp.


Define Documentation

#define GEOGRAPHICLIB_GRAVITYMODEL_HPP   "$Id: e1a573fb0148fa5bc408b2dbdb096d4cd3091bac $"

Definition at line 11 of file GravityModel.hpp.

geographiclib-1.21/doc/html/LambertConformalConic_8cpp.html0000644000175000017500000001162111745620414023615 0ustar frankiefrankie GeographicLib: LambertConformalConic.cpp File Reference
LambertConformalConic.cpp File Reference

Implementation for GeographicLib::LambertConformalConic class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_CPP   "$Id: da8f6ce89092006a26946d671edca1a7836e7ce6 $"

Detailed Description

Implementation for GeographicLib::LambertConformalConic class.

Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file LambertConformalConic.cpp.


Define Documentation

#define GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_CPP   "$Id: da8f6ce89092006a26946d671edca1a7836e7ce6 $"

Definition at line 12 of file LambertConformalConic.cpp.

geographiclib-1.21/doc/html/SphericalEngine_8hpp.html0000644000175000017500000001423111745620414022457 0ustar frankiefrankie GeographicLib: SphericalEngine.hpp File Reference
SphericalEngine.hpp File Reference

Header for GeographicLib::SphericalEngine class. More...

#include <vector>
#include <istream>
#include <GeographicLib/Constants.hpp>

Go to the source code of this file.

Classes

class  GeographicLib::SphericalEngine
 The evaluation engine for SphericalHarmonic. More...
class  GeographicLib::SphericalEngine::coeff
 Package up coefficients for SphericalEngine. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_SPHERICALENGINE_HPP   "$Id: f48320a694ecf901d997b23d32ea625e589f9534 $"

Detailed Description

Header for GeographicLib::SphericalEngine class.

Copyright (c) Charles Karney (2011, 2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file SphericalEngine.hpp.


Define Documentation

#define GEOGRAPHICLIB_SPHERICALENGINE_HPP   "$Id: f48320a694ecf901d997b23d32ea625e589f9534 $"

Definition at line 11 of file SphericalEngine.hpp.

geographiclib-1.21/doc/html/classGeographicLib_1_1PolygonArea.html0000644000175000017500000005326211745620414025015 0ustar frankiefrankie GeographicLib: GeographicLib::PolygonArea Class Reference
GeographicLib::PolygonArea Class Reference

Polygon Areas. More...

#include <GeographicLib/PolygonArea.hpp>

List of all members.

Public Member Functions

 PolygonArea (const Geodesic &earth, bool polyline=false) throw ()
void Clear () throw ()
void AddPoint (real lat, real lon) throw ()
unsigned Compute (bool reverse, bool sign, real &perimeter, real &area) const throw ()
unsigned TestCompute (real lat, real lon, bool reverse, bool sign, real &perimeter, real &area) const throw ()
Inspector functions
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()

Detailed Description

Polygon Areas.

This computes the area of a geodesic polygon using the method given Section 15 of

See also Section 6 of

This class lets you add vertices one at a time to the polygon. The area and perimeter are accumulated in two times the standard floating point precision to guard against the loss of accuracy with many-sided polygons. At any point you can ask for the perimeter and area so far. There's an option to treat the points as defining a polyline instead of a polygon; in that case, only the perimeter is computed.

Example of use:

// Example of using the GeographicLib::PolygonArea class
// $Id: 103c4d2f060347fd499adc2e8487102c8b93d58f $

#include <iostream>
#include <exception>
#include <GeographicLib/PolygonArea.hpp>
#include <GeographicLib/Geodesic.hpp>
#include <GeographicLib/Constants.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    Geodesic geod(Constants::WGS84_a(), Constants::WGS84_f());
    // Alternatively: const Geodesic& geod = Geodesic::WGS84;
    PolygonArea poly(geod);
    poly.AddPoint( 52,  0);     // London
    poly.AddPoint( 41,-74);     // New York
    poly.AddPoint(-23,-43);     // Rio de Janeiro
    poly.AddPoint(-26, 28);     // Johannesburg
    double perimeter, area;
    unsigned n = poly.Compute(false, true, perimeter, area);
    cout << n << " " << perimeter << " " << area << "\n";
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Planimeter is a command-line utility providing access to the functionality of PolygonArea.


Constructor & Destructor Documentation

GeographicLib::PolygonArea::PolygonArea ( const Geodesic earth,
bool  polyline = false 
) throw () [inline]

Constructor for PolygonArea.

Parameters:
[in]earththe Geodesic object to use for geodesic calculations. By default this uses the WGS84 ellipsoid.
[in]polylineif true that treat the points as defining a polyline instead of a polygon (default = false).

Definition at line 98 of file PolygonArea.hpp.


Member Function Documentation

void GeographicLib::PolygonArea::Clear ( ) throw () [inline]

Clear PolygonArea, allowing a new polygon to be started.

Definition at line 110 of file PolygonArea.hpp.

Referenced by main().

void GeographicLib::PolygonArea::AddPoint ( real  lat,
real  lon 
) throw ()

Add a point to the polygon or polyline.

Parameters:
[in]latthe latitude of the point (degrees).
[in]lonthe latitude of the point (degrees).

lat should be in the range [-90, 90] and lon should be in the range [-180, 360].

Definition at line 23 of file PolygonArea.cpp.

Referenced by main().

unsigned GeographicLib::PolygonArea::Compute ( bool  reverse,
bool  sign,
real &  perimeter,
real &  area 
) const throw ()

Return the results so far.

Parameters:
[in]reverseif true then clockwise (instead of counter-clockwise) traversal counts as a positive area.
[in]signif true then return a signed result for the area if the polygon is traversed in the "wrong" direction instead of returning the area for the rest of the earth.
[out]perimeterthe perimeter of the polygon or length of the polyline (meters).
[out]areathe area of the polygon (meters^2); only set if polyline is false in the constructor.
Returns:
the number of points.

Definition at line 41 of file PolygonArea.cpp.

Referenced by main().

unsigned GeographicLib::PolygonArea::TestCompute ( real  lat,
real  lon,
bool  reverse,
bool  sign,
real &  perimeter,
real &  area 
) const throw ()

Return the results assuming a tentative final test point is added; however, the data for the test point is not saved. This lets you report a running result for the perimeter and area as the user moves the mouse cursor. Ordinary floating point arithmetic is used to accumulate the data for the test point; thus the area and perimeter returned are less accurate than if AddPoint and Compute are used.

Parameters:
[in]latthe latitude of the test point (degrees).
[in]lonthe longitude of the test point (degrees).
[in]reverseif true then clockwise (instead of counter-clockwise) traversal counts as a positive area.
[in]signif true then return a signed result for the area if the polygon is traversed in the "wrong" direction instead of returning the area for the rest of the earth.
[out]perimeterthe approximate perimeter of the polygon or length of the polyline (meters).
[out]areathe approximate area of the polygon (meters^2); only set if polyline is false in the constructor.
Returns:
the number of points.

lat should be in the range [-90, 90] and lon should be in the range [-180, 360].

Definition at line 82 of file PolygonArea.cpp.

Math::real GeographicLib::PolygonArea::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value inherited from the Geodesic object used in the constructor.

Definition at line 181 of file PolygonArea.hpp.

Math::real GeographicLib::PolygonArea::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid. This is the value inherited from the Geodesic object used in the constructor.

Definition at line 187 of file PolygonArea.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/geocentric.html0000644000175000017500000002017411745620414020605 0ustar frankiefrankie GeographicLib: Geocentric coordinates
Geocentric coordinates
Back to Transverse Mercator projection. Forward to Old versions. Up to Contents.

The implementation of GeographicLib::Geocentric::Reverse is adapted from

This provides a closed-form solution but can't directly be applied close to the center of the earth. Several changes have been made to remove this restriction and to improve the numerical accuracy. Now the method is accurate for all inputs (even if h is infinite). The changes are described in Appendix B of

The problems encountered near the center of the ellipsoid are:

  • There's a potential division by zero in the definition of s. The equations are easily reformulated to avoid this problem.
  • t3 may be negative. This is OK; we just take the real root.
  • The solution for t may be complex. However this leads to 3 real roots for u/r. It's then just a matter of picking the one that computes the geodetic result which minimizes |h| and which avoids large round-off errors.
  • Some of the equations result in a large loss of accuracy due to subtracting nearly equal quantities. E.g., k= sqrt(u + v + w2) - w is inaccurate if u + v is small; we can fix this by writing k = (u + v)/(sqrt(u + v + w2) + w).

The error is computed as follows. Write a version of Geocentric::WGS84.Forward which uses long doubles (including using long doubles for the WGS84 parameters). Generate random (long double) geodetic coordinates (lat0, lon0, h0) and use the "long double" WGS84.Forward to obtain the corresponding (long double) geocentric coordinates (x0, y0, z0). [We restrict h0 so that h0 >= - a (1 - e2) / sqrt(1 - e2 sin2lat0), which ensures that (lat0, lon0, h0) is the principal geodetic inverse of (x0, y0, z0).] Because the forward calculation is numerically stable and because long doubles (on Linux systems using g++) provide 11 bits additional accuracy (about 3.3 decimal digits), we regard this set of test data as exact.

Apply the double version of WGS84.Reverse to (x0, y0, z0) to compute the approximate geodetic coordinates (lat1, lon1, h1). Convert (lat1 - lat0, lon1 - lon0) to a distance, ds, on the surface of the ellipsoid and define err = hypot(ds, h1 - h0). For |h0| < 5000 km, we have err < 7 nm (7 nanometers).

This methodology is not very useful very far from the globe, because the absolute errors in the approximate geodetic height become large, or within 50 km of the center of the earth, because of errors in computing the approximate geodetic latitude. To illustrate the second issue, the maximum value of err for h0 < 0 is about 80 mm. The error is maximum close to the circle given by geocentric coordinates satisfying hypot(x, y) = a e2 (= 42.7 km), z = 0. (This is the center of meridional curvature for lat = 0.) The geodetic latitude for these points is lat = 0. However, if we move 1 nm towards the center of the earth, the geodetic latitude becomes 0.04", a distance of 1.4 m from the equator. If, instead, we move 1 nm up, the geodetic latitude becomes 7.45", a distance of 229 m from the equator. In light of this, Reverse does quite well in this vicinity.

To obtain a practical measure of the error for the general case we define

  • errh = |h1 - h0| / max(1, h0 / a)
  • for h0 > 0, errout = ds
  • for h0 < 0, apply the long double version of WGS84.Forward to (lat1, lon1, h1) to give (x1, y1, z1) and compute errin = hypot(x1 - x0, y1 - y0, z1 - z0).

We then find errh < 8 nm, errout < 4 nm, and errin < 7 nm. (1 nm = 1 nanometer.)

The testing has been confined to the WGS84 ellipsoid. The method will work for all ellipsoids used in terrestrial geodesy. However, the central region, which leads to multiple real roots for the cubic equation in Reverse, pokes outside the ellipsoid (at the poles) for ellipsoids with e > 1/sqrt(2). Reverse has not been analyzed for this case. Similarly ellipsoids which are very nearly spherical near yield inaccurate results due to underflow; in the other hand, the case of the sphere, f = 0, is treated specially and gives accurate results.

Other comparable methods are K. M. Borkowski, Transformation of geocentric to geodetic coordinates without approximations, Astrophys. Space Sci. 139, 1–4 (1987) (erratum) and T. Fukushima, Fast transform from geocentric to geodetic coordinates, J. Geodesy 73, 603–610 (2003). However the choice of independent variables in these methods leads to a loss of accuracy for points near the equatorial plane.

Back to Transverse Mercator projection. Forward to Old versions. Up to Contents.
geographiclib-1.21/doc/html/classGeographicLib_1_1MagneticModel.html0000644000175000017500000014746111745620414025312 0ustar frankiefrankie GeographicLib: GeographicLib::MagneticModel Class Reference
GeographicLib::MagneticModel Class Reference

Model of the earth's magnetic field. More...

#include <GeographicLib/MagneticModel.hpp>

List of all members.

Public Member Functions

Setting up the magnetic model
 MagneticModel (const std::string &name, const std::string &path="", const Geocentric &earth=Geocentric::WGS84)
Inspector functions
const std::string & Description () const throw ()
const std::string & DateTime () const throw ()
const std::string & MagneticFile () const throw ()
const std::string & MagneticModelName () const throw ()
const std::string & MagneticModelDirectory () const throw ()
Math::real MinHeight () const throw ()
Math::real MaxHeight () const throw ()
Math::real MinTime () const throw ()
Math::real MaxTime () const throw ()
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()

Static Public Member Functions

static std::string DefaultMagneticPath ()
static std::string DefaultMagneticName ()

Compute the magnetic field

void operator() (real t, real lat, real lon, real h, real &Bx, real &By, real &Bz) const throw ()
void operator() (real t, real lat, real lon, real h, real &Bx, real &By, real &Bz, real &Bxt, real &Byt, real &Bzt) const throw ()
MagneticCircle Circle (real t, real lat, real h) const
static void FieldComponents (real Bx, real By, real Bz, real &H, real &F, real &D, real &I) throw ()
static void FieldComponents (real Bx, real By, real Bz, real Bxt, real Byt, real Bzt, real &H, real &F, real &D, real &I, real &Ht, real &Ft, real &Dt, real &It) throw ()

Detailed Description

Model of the earth's magnetic field.

Evaluate the earth's magnetic field according to a model. At present only internal magnetic fields are handled. These are due to the earth's code and crust; these vary slowly (over many years). Excluded are the effects of currents in the ionosphere and magnetosphere which have daily and annual variations.

See Magnetic models for details of how to install the magnetic model and the data format.

See

Example of use:

// Example of using the GeographicLib::MagneticModel class
// $Id: ab27b155755e540d29e5e6bf550df8cdb00c74ba $

#include <iostream>
#include <exception>
#include <GeographicLib/MagneticModel.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    MagneticModel mag("wmm2010");
    double lat = 27.99, lon = 86.93, h = 8820, t = 2012; // Mt Everest
    double Bx, By, Bz;
    mag(t, lat,lon, h, Bx, By, Bz);
    double H, F, D, I;
    MagneticModel::FieldComponents(Bx, By, Bz, H, F, D, I);
    cout << H << " " << F << " " << D << " " << I << "\n";
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

MagneticField is a command-line utility providing access to the functionality of MagneticModel and MagneticCircle.


Constructor & Destructor Documentation

GeographicLib::MagneticModel::MagneticModel ( const std::string &  name,
const std::string &  path = "",
const Geocentric earth = Geocentric::WGS84 
) [explicit]

Construct a magnetic model.

Parameters:
[in]namethe name of the model.
[in]path(optional) directory for data file.
[in]earth(optional) Geocentric object for converting coordinates; default Geocentric::WGS84.

A filename is formed by appending ".wmm" (World Magnetic Model) to the name. If path is specified (and is non-empty), then the file is loaded from directory, path. Otherwise the path is given by the DefaultMagneticPath(). This may throw an exception because the file does not exist, is unreadable, or is corrupt.

This file contains the metadata which specifies the properties of the model. The coefficients for the spherical harmonic sums are obtained from a file obtained by appending ".cof" to metadata file (so the filename ends in ".wwm.cof").

The model is not tied to a particular ellipsoidal model of the earth. The final earth argument to the constructor specify an ellipsoid to allow geodetic coordinates to the transformed into the spherical coordinates used in the spherical harmonic sum.

Definition at line 44 of file MagneticModel.cpp.

References DefaultMagneticPath(), and GeographicLib::SphericalEngine::coeff::readcoeffs().


Member Function Documentation

void GeographicLib::MagneticModel::operator() ( real  t,
real  lat,
real  lon,
real  h,
real &  Bx,
real &  By,
real &  Bz 
) const throw () [inline]

Evaluate the components of the geomagnetic field.

Parameters:
[in]tthe time (years).
[in]latlatitude of the point (degrees).
[in]lonlongitude of the point (degrees).
[in]hthe height of the point above the ellipsoid (meters).
[out]Bxthe easterly component of the magnetic field (nanotesla).
[out]Bythe northerly component of the magnetic field (nanotesla).
[out]Bzthe vertical (up) component of the magnetic field (nanotesla).

Definition at line 131 of file MagneticModel.hpp.

void GeographicLib::MagneticModel::operator() ( real  t,
real  lat,
real  lon,
real  h,
real &  Bx,
real &  By,
real &  Bz,
real &  Bxt,
real &  Byt,
real &  Bzt 
) const throw () [inline]

Evaluate the components of the geomagnetic field and their time derivatives

Parameters:
[in]tthe time (years).
[in]latlatitude of the point (degrees).
[in]lonlongitude of the point (degrees).
[in]hthe height of the point above the ellipsoid (meters).
[out]Bxthe easterly component of the magnetic field (nanotesla).
[out]Bythe northerly component of the magnetic field (nanotesla).
[out]Bzthe vertical (up) component of the magnetic field (nanotesla).
[out]Bxtthe rate of change of Bx (nT/yr).
[out]Bytthe rate of change of By (nT/yr).
[out]Bztthe rate of change of Bz (nT/yr).

Definition at line 153 of file MagneticModel.hpp.

MagneticCircle GeographicLib::MagneticModel::Circle ( real  t,
real  lat,
real  h 
) const

Create a MagneticCircle object to allow the geomagnetic field at many points with constant lat, h, and t and varying lon to be computed efficiently.

Parameters:
[in]tthe time (years).
[in]latlatitude of the point (degrees).
[in]hthe height of the point above the ellipsoid (meters).
Returns:
a MagneticCircle object whose MagneticCircle::operator()(real lon) member function computes the field at particular values of lon.

If the field at several points on a circle of latitude need to be calculated then creating a MagneticCircle and using its member functions will be substantially faster, especially for high-degree models.

Definition at line 207 of file MagneticModel.cpp.

Referenced by main().

static void GeographicLib::MagneticModel::FieldComponents ( real  Bx,
real  By,
real  Bz,
real &  H,
real &  F,
real &  D,
real &  I 
) throw () [inline, static]

Compute various quantities dependent on the magnetic field.

Parameters:
[in]Bxthe x (easterly) component of the magnetic field (nT).
[in]Bythe y (northerly) component of the magnetic field (nT).
[in]Bzthe z (vertical, up positive) component of the magnetic field (nT).
[out]Hthe horizontal magnetic field (nT).
[out]Fthe total magnetic field (nT).
[out]Dthe declination of the field (degrees east of north).
[out]Ithe inclination of the field (degrees down from horizontal).

Definition at line 190 of file MagneticModel.hpp.

Referenced by main().

void GeographicLib::MagneticModel::FieldComponents ( real  Bx,
real  By,
real  Bz,
real  Bxt,
real  Byt,
real  Bzt,
real &  H,
real &  F,
real &  D,
real &  I,
real &  Ht,
real &  Ft,
real &  Dt,
real &  It 
) throw () [static]

Compute various quantities dependent on the magnetic field and its rate of change.

Parameters:
[in]Bxthe x (easterly) component of the magnetic field (nT).
[in]Bythe y (northerly) component of the magnetic field (nT).
[in]Bzthe z (vertical, up positive) component of the magnetic field (nT).
[in]Bxtthe rate of change of Bx (nT/yr).
[in]Bytthe rate of change of By (nT/yr).
[in]Bztthe rate of change of Bz (nT/yr).
[out]Hthe horizontal magnetic field (nT).
[out]Fthe total magnetic field (nT).
[out]Dthe declination of the field (degrees east of north).
[out]Ithe inclination of the field (degrees down from horizontal).
[out]Htthe rate of change of H (nT/yr).
[out]Ftthe rate of change of F (nT/yr).
[out]Dtthe rate of change of D (degrees/yr).
[out]Itthe rate of change of I (degrees/yr).

Definition at line 222 of file MagneticModel.cpp.

References GeographicLib::Math::hypot(), and GeographicLib::Math::sq().

const std::string& GeographicLib::MagneticModel::Description ( ) const throw () [inline]
Returns:
the description of the magnetic model, if available, from the Description file in the data file; if absent, return "NONE".

Definition at line 231 of file MagneticModel.hpp.

Referenced by main().

const std::string& GeographicLib::MagneticModel::DateTime ( ) const throw () [inline]
Returns:
date of the model, if available, from the ReleaseDate field in the data file; if absent, return "UNKNOWN".

Definition at line 237 of file MagneticModel.hpp.

Referenced by main().

const std::string& GeographicLib::MagneticModel::MagneticFile ( ) const throw () [inline]
Returns:
full file name used to load the magnetic model.

Definition at line 242 of file MagneticModel.hpp.

Referenced by main().

const std::string& GeographicLib::MagneticModel::MagneticModelName ( ) const throw () [inline]
Returns:
"name" used to load the magnetic model (from the first argument of the constructor, but this may be overridden by the model file).

Definition at line 248 of file MagneticModel.hpp.

Referenced by main().

const std::string& GeographicLib::MagneticModel::MagneticModelDirectory ( ) const throw () [inline]
Returns:
directory used to load the magnetic model.

Definition at line 253 of file MagneticModel.hpp.

Math::real GeographicLib::MagneticModel::MinHeight ( ) const throw () [inline]
Returns:
the minimum height above the ellipsoid (in meters) for which this MagneticModel should be used.

Because the model will typically provide useful results slightly outside the range of allowed heights, no check of t argument is made by MagneticModel::operator()() or MagneticModel::Circle.

Definition at line 264 of file MagneticModel.hpp.

Referenced by main().

Math::real GeographicLib::MagneticModel::MaxHeight ( ) const throw () [inline]
Returns:
the maximum height above the ellipsoid (in meters) for which this MagneticModel should be used.

Because the model will typically provide useful results slightly outside the range of allowed heights, no check of t argument is made by MagneticModel::operator()() or MagneticModel::Circle.

Definition at line 275 of file MagneticModel.hpp.

Referenced by main().

Math::real GeographicLib::MagneticModel::MinTime ( ) const throw () [inline]
Returns:
the minimum time (in years) for which this MagneticModel should be used.

Because the model will typically provide useful results slightly outside the range of allowed times, no check of t argument is made by MagneticModel::operator()() or MagneticModel::Circle.

Definition at line 286 of file MagneticModel.hpp.

Referenced by main().

Math::real GeographicLib::MagneticModel::MaxTime ( ) const throw () [inline]
Returns:
the maximum time (in years) for which this MagneticModel should be used.

Because the model will typically provide useful results slightly outside the range of allowed times, no check of t argument is made by MagneticModel::operator()() or MagneticModel::Circle.

Definition at line 297 of file MagneticModel.hpp.

Referenced by main().

Math::real GeographicLib::MagneticModel::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value of a inherited from the Geocentric object used in the constructor.

Definition at line 304 of file MagneticModel.hpp.

Math::real GeographicLib::MagneticModel::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid. This is the value inherited from the Geocentric object used in the constructor.

Definition at line 310 of file MagneticModel.hpp.

std::string GeographicLib::MagneticModel::DefaultMagneticPath ( ) [static]
Returns:
the default path for magnetic model data files.

This is the value of the environment variable MAGNETIC_PATH, if set; otherwise, it is $GEOGRAPHICLIB_DATA/magnetic if the environment variable GEOGRAPHICLIB_DATA is set; otherwise, it is a compile-time default (/usr/local/share/GeographicLib/magnetic on non-Windows systems and C:/Documents and Settings/All Users/Application Data/GeographicLib/magnetic on Windows systems).

Definition at line 237 of file MagneticModel.cpp.

References GEOGRAPHICLIB_DATA.

Referenced by main(), and MagneticModel().

std::string GeographicLib::MagneticModel::DefaultMagneticName ( ) [static]
Returns:
the default name for the magnetic model.

This is the value of the environment variable MAGNETIC_NAME, if set, otherwise, it is "wmm2010". The MagneticModel class does not use this function; it is just provided as a convenience for a calling program when constructing a MagneticModel object.

Definition at line 250 of file MagneticModel.cpp.

References MAGNETIC_DEFAULT_NAME.

Referenced by main().


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/GravityModel_8cpp.html0000644000175000017500000001620611745620414022024 0ustar frankiefrankie GeographicLib: GravityModel.cpp File Reference
GravityModel.cpp File Reference

Implementation for GeographicLib::GravityModel class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_GRAVITYMODEL_CPP   "$Id: 1897d0d53c7339ecdf20b1348637340e9f687f30 $"
#define GEOGRAPHICLIB_DATA   "/usr/local/share/GeographicLib"
#define GRAVITY_DEFAULT_NAME   "egm96"

Detailed Description

Implementation for GeographicLib::GravityModel class.

Copyright (c) Charles Karney (2011, 2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file GravityModel.cpp.


Define Documentation

#define GEOGRAPHICLIB_GRAVITYMODEL_CPP   "$Id: 1897d0d53c7339ecdf20b1348637340e9f687f30 $"

Definition at line 15 of file GravityModel.cpp.

#define GEOGRAPHICLIB_DATA   "/usr/local/share/GeographicLib"

Definition at line 26 of file GravityModel.cpp.

Referenced by GeographicLib::GravityModel::DefaultGravityPath().

#define GRAVITY_DEFAULT_NAME   "egm96"

Definition at line 31 of file GravityModel.cpp.

Referenced by GeographicLib::GravityModel::DefaultGravityName().

geographiclib-1.21/doc/html/classGeographicLib_1_1Geocentric.html0000644000175000017500000011506511745620414024657 0ustar frankiefrankie GeographicLib: GeographicLib::Geocentric Class Reference
GeographicLib::Geocentric Class Reference

Geocentric coordinates More...

#include <GeographicLib/Geocentric.hpp>

List of all members.

Public Member Functions

 Geocentric (real a, real f)
 Geocentric ()
void Forward (real lat, real lon, real h, real &X, real &Y, real &Z) const throw ()
void Forward (real lat, real lon, real h, real &X, real &Y, real &Z, std::vector< real > &M) const throw ()
void Reverse (real X, real Y, real Z, real &lat, real &lon, real &h) const throw ()
void Reverse (real X, real Y, real Z, real &lat, real &lon, real &h, std::vector< real > &M) const throw ()
Inspector functions
bool Init () const throw ()
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()

Static Public Attributes

static const Geocentric WGS84

Friends

class LocalCartesian
class MagneticCircle
class MagneticModel
class GravityCircle
class GravityModel
class NormalGravity
class SphericalHarmonic
class SphericalHarmonic1
class SphericalHarmonic2

Detailed Description

Geocentric coordinates

Convert between geodetic coordinates latitude = lat, longitude = lon, height = h (measured vertically from the surface of the ellipsoid) to geocentric coordinates (X, Y, Z). The origin of geocentric coordinates is at the center of the earth. The Z axis goes thru the north pole, lat = 90o. The X axis goes thru lat = 0, lon = 0. Geocentric coordinates are also known as earth centered, earth fixed (ECEF) coordinates.

The conversion from geographic to geocentric coordinates is straightforward. For the reverse transformation we use

Several changes have been made to ensure that the method returns accurate results for all finite inputs (even if h is infinite). The changes are described in Appendix B of

See Geocentric coordinates for more information.

The errors in these routines are close to round-off. Specifically, for points within 5000 km of the surface of the ellipsoid (either inside or outside the ellipsoid), the error is bounded by 7 nm (7 nanometers) for the WGS84 ellipsoid. See Geocentric coordinates for further information on the errors.

Example of use:

// Example of using the GeographicLib::Geocentric class
// $Id: fea8cd4d5464b6029d6a135a25230892f52f318f $

#include <iostream>
#include <exception>
#include <cmath>
#include <GeographicLib/Geocentric.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    Geocentric earth(Constants::WGS84_a(), Constants::WGS84_f());
    // Alternatively: const Geocentric& earth = Geocentric::WGS84;
    {
      // Sample forward calculation
      double lat = 27.99, lon = 86.93, h = 8820; // Mt Everest
      double X, Y, Z;
      earth.Forward(lat, lon, h, X, Y, Z);
      cout << floor(X / 1000 + 0.5) << " "
           << floor(Y / 1000 + 0.5) << " "
           << floor(Z / 1000 + 0.5) << "\n";
    }
    {
      // Sample reverse calculation
      double X = 302e3, Y = 5636e3, Z = 2980e3;
      double lat, lon, h;
      earth.Reverse(X, Y, Z, lat, lon, h);
      cout << lat << " " << lon << " " << h << "\n";
    }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

CartConvert is a command-line utility providing access to the functionality of Geocentric and LocalCartesian.


Constructor & Destructor Documentation

GeographicLib::Geocentric::Geocentric ( real  a,
real  f 
)

Constructor for a ellipsoid with

Parameters:
[in]aequatorial radius (meters).
[in]fflattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid. If f > 1, set flattening to 1/f.

An exception is thrown if either of the axes of the ellipsoid is non-positive.

Definition at line 22 of file Geocentric.cpp.

References GeographicLib::Math::isfinite().

GeographicLib::Geocentric::Geocentric ( ) [inline]

A default constructor (for use by NormalGravity).

Definition at line 119 of file Geocentric.hpp.


Member Function Documentation

void GeographicLib::Geocentric::Forward ( real  lat,
real  lon,
real  h,
real &  X,
real &  Y,
real &  Z 
) const throw () [inline]

Convert from geodetic to geocentric coordinates.

Parameters:
[in]latlatitude of point (degrees).
[in]lonlongitude of point (degrees).
[in]hheight of point above the ellipsoid (meters).
[out]Xgeocentric coordinate (meters).
[out]Ygeocentric coordinate (meters).
[out]Zgeocentric coordinate (meters).

lat should be in the range [-90, 90]; lon and lon0 should be in the range [-180, 360].

Definition at line 134 of file Geocentric.hpp.

Referenced by main().

void GeographicLib::Geocentric::Forward ( real  lat,
real  lon,
real  h,
real &  X,
real &  Y,
real &  Z,
std::vector< real > &  M 
) const throw () [inline]

Convert from geodetic to geocentric coordinates and return rotation matrix.

Parameters:
[in]latlatitude of point (degrees).
[in]lonlongitude of point (degrees).
[in]hheight of point above the ellipsoid (meters).
[out]Xgeocentric coordinate (meters).
[out]Ygeocentric coordinate (meters).
[out]Zgeocentric coordinate (meters).
[out]Mif the length of the vector is 9, fill with the rotation matrix in row-major order.

Let v be a unit vector located at (lat, lon, h). We can express v as column vectors in one of two ways

  • in east, north, up coordinates (where the components are relative to a local coordinate system at (lat, lon, h)); call this representation v1.
  • in geocentric X, Y, Z coordinates; call this representation v0.

Then we have v0 = M . v1.

Definition at line 163 of file Geocentric.hpp.

void GeographicLib::Geocentric::Reverse ( real  X,
real  Y,
real  Z,
real &  lat,
real &  lon,
real &  h 
) const throw () [inline]

Convert from geocentric to geodetic to coordinates.

Parameters:
[in]Xgeocentric coordinate (meters).
[in]Ygeocentric coordinate (meters).
[in]Zgeocentric coordinate (meters).
[out]latlatitude of point (degrees).
[out]lonlongitude of point (degrees).
[out]hheight of point above the ellipsoid (meters).

In general there are multiple solutions and the result which maximizes h is returned. If there are still multiple solutions with different latitudes (applies only if Z = 0), then the solution with lat > 0 is returned. If there are still multiple solutions with different longitudes (applies only if X = Y = 0) then lon = 0 is returned. The value of h returned satisfies h >= - a (1 - e2) / sqrt(1 - e2 sin2lat). The value of lon returned is in the range [-180, 180).

Definition at line 195 of file Geocentric.hpp.

Referenced by main().

void GeographicLib::Geocentric::Reverse ( real  X,
real  Y,
real  Z,
real &  lat,
real &  lon,
real &  h,
std::vector< real > &  M 
) const throw () [inline]

Convert from geocentric to geodetic to coordinates.

Parameters:
[in]Xgeocentric coordinate (meters).
[in]Ygeocentric coordinate (meters).
[in]Zgeocentric coordinate (meters).
[out]latlatitude of point (degrees).
[out]lonlongitude of point (degrees).
[out]hheight of point above the ellipsoid (meters).
[out]Mif the length of the vector is 9, fill with the rotation matrix in row-major order.

Let v be a unit vector located at (lat, lon, h). We can express v as column vectors in one of two ways

  • in east, north, up coordinates (where the components are relative to a local coordinate system at (lat, lon, h)); call this representation v1.
  • in geocentric X, Y, Z coordinates; call this representation v0.

Then we have v1 = M^T . v0, where M^T is the transpose of M.

Definition at line 224 of file Geocentric.hpp.

bool GeographicLib::Geocentric::Init ( ) const throw () [inline]
Returns:
true if the object has been initialized.

Definition at line 243 of file Geocentric.hpp.

Math::real GeographicLib::Geocentric::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value used in the constructor.

Definition at line 248 of file Geocentric.hpp.

Math::real GeographicLib::Geocentric::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid. This is the value used in the constructor.

Definition at line 255 of file Geocentric.hpp.


Friends And Related Function Documentation

friend class LocalCartesian [friend]

Definition at line 66 of file Geocentric.hpp.

friend class MagneticCircle [friend]

Definition at line 67 of file Geocentric.hpp.

friend class MagneticModel [friend]

Definition at line 68 of file Geocentric.hpp.

friend class GravityCircle [friend]

Definition at line 69 of file Geocentric.hpp.

friend class GravityModel [friend]

Definition at line 70 of file Geocentric.hpp.

friend class NormalGravity [friend]

Definition at line 71 of file Geocentric.hpp.

friend class SphericalHarmonic [friend]

Definition at line 72 of file Geocentric.hpp.

friend class SphericalHarmonic1 [friend]

Definition at line 73 of file Geocentric.hpp.

friend class SphericalHarmonic2 [friend]

Definition at line 74 of file Geocentric.hpp.


Member Data Documentation

A global instantiation of Geocentric with the parameters for the WGS84 ellipsoid.

Definition at line 272 of file Geocentric.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/PolarStereographic_8cpp_source.html0000644000175000017500000004313611745620414024575 0ustar frankiefrankie GeographicLib: PolarStereographic.cpp Source File
PolarStereographic.cpp
Go to the documentation of this file.
00001 /**
00002  * \file PolarStereographic.cpp
00003  * \brief Implementation for GeographicLib::PolarStereographic class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/PolarStereographic.hpp>
00011 
00012 #define GEOGRAPHICLIB_POLARSTEREOGRAPHIC_CPP \
00013   "$Id: 3a2dee07e6ef1c55ddcdc2178d818c8edd4d1cd4 $"
00014 
00015 RCSID_DECL(GEOGRAPHICLIB_POLARSTEREOGRAPHIC_CPP)
00016 RCSID_DECL(GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP)
00017 
00018 namespace GeographicLib {
00019 
00020   using namespace std;
00021 
00022   const Math::real PolarStereographic::tol_ =
00023     real(0.1)*sqrt(numeric_limits<real>::epsilon());
00024   // Overflow value s.t. atan(overflow_) = pi/2
00025   const Math::real PolarStereographic::overflow_ =
00026     1 / Math::sq(numeric_limits<real>::epsilon());
00027 
00028   PolarStereographic::PolarStereographic(real a, real f, real k0)
00029     : _a(a)
00030     , _f(f <= 1 ? f : 1/f)
00031     , _e2(_f * (2 - _f))
00032     , _e(sqrt(abs(_e2)))
00033     , _e2m(1 - _e2)
00034     , _Cx(exp(eatanhe(real(1))))
00035     , _c( (1 - _f) * _Cx )
00036     , _k0(k0)
00037   {
00038     if (!(Math::isfinite(_a) && _a > 0))
00039       throw GeographicErr("Major radius is not positive");
00040     if (!(Math::isfinite(_f) && _f < 1))
00041       throw GeographicErr("Minor radius is not positive");
00042     if (!(Math::isfinite(_k0) && _k0 > 0))
00043       throw GeographicErr("Scale is not positive");
00044   }
00045 
00046   const PolarStereographic
00047   PolarStereographic::UPS(Constants::WGS84_a<real>(),
00048                           Constants::WGS84_f<real>(),
00049                           Constants::UPS_k0<real>());
00050 
00051   // This formulation converts to conformal coordinates by tau = tan(phi) and
00052   // tau' = tan(phi') where phi' is the conformal latitude.  The formulas are:
00053   //    tau = tan(phi)
00054   //    secphi = hypot(1, tau)
00055   //    sig = sinh(e * atanh(e * tau / secphi))
00056   //    taup = tan(phip) = tau * hypot(1, sig) - sig * hypot(1, tau)
00057   //    c = (1 - f) * exp(e * atanh(e))
00058   //
00059   // Forward:
00060   //   rho = (2*k0*a/c) / (hypot(1, taup) + taup)  (taup >= 0)
00061   //       = (2*k0*a/c) * (hypot(1, taup) - taup)  (taup <  0)
00062   //
00063   // Reverse:
00064   //   taup = ((2*k0*a/c) / rho - rho / (2*k0*a/c))/2
00065   //
00066   // Scale:
00067   //   k = (rho/a) * secphi * sqrt((1-e2) + e2 / secphi^2)
00068   //
00069   // In limit rho -> 0, tau -> inf, taup -> inf, secphi -> inf, secphip -> inf
00070   //   secphip = taup = exp(-e * atanh(e)) * tau = exp(-e * atanh(e)) * secphi
00071 
00072   void PolarStereographic::Forward(bool northp, real lat, real lon,
00073                                    real& x, real& y, real& gamma, real& k)
00074     const throw() {
00075     lat *= northp ? 1 : -1;
00076     real
00077       phi = lat * Math::degree<real>(),
00078       tau = lat != -90 ? tanx(phi) : -overflow_,
00079       secphi = Math::hypot(real(1), tau),
00080       sig = sinh( eatanhe(tau / secphi) ),
00081       taup = Math::hypot(real(1), sig) * tau - sig * secphi,
00082       rho = Math::hypot(real(1), taup) + abs(taup);
00083     rho = taup >= 0 ? (lat != 90 ? 1/rho : 0) : rho;
00084     rho *= 2 * _k0 * _a / _c;
00085     k = lat != 90 ? (rho / _a) * secphi * sqrt(_e2m + _e2 / Math::sq(secphi)) :
00086       _k0;
00087     lon = lon >= 180 ? lon - 360 : (lon < -180 ? lon + 360 : lon);
00088     real
00089       lam = lon * Math::degree<real>();
00090     x = rho * (lon == -180 ? 0 : sin(lam));
00091     y = (northp ? -rho : rho) * (abs(lon) == 90 ? 0 : cos(lam));
00092     gamma = northp ? lon : -lon;
00093   }
00094 
00095   void PolarStereographic::Reverse(bool northp, real x, real y,
00096                                    real& lat, real& lon, real& gamma, real& k)
00097     const throw() {
00098     real
00099       rho = Math::hypot(x, y),
00100       t = rho / (2 * _k0 * _a / _c),
00101       taup = (1 / t - t) / 2,
00102       tau = taup * _Cx,
00103       stol = tol_ * max(real(1), abs(taup));
00104     // min iterations = 1, max iterations = 2; mean = 1.99
00105     for (int i = 0; i < numit_; ++i) {
00106       real
00107         tau1 = Math::hypot(real(1), tau),
00108         sig = sinh( eatanhe( tau / tau1 ) ),
00109         taupa = Math::hypot(real(1), sig) * tau - sig * tau1,
00110         dtau = (taup - taupa) * (1 + _e2m * Math::sq(tau)) /
00111         ( _e2m * tau1 * Math::hypot(real(1), taupa) );
00112       tau += dtau;
00113       if (!(abs(dtau) >= stol))
00114         break;
00115     }
00116     real
00117       phi = atan(tau),
00118       secphi = Math::hypot(real(1), tau);
00119     k = rho != 0 ?
00120       (rho / _a) * secphi * sqrt(_e2m + _e2 / Math::sq(secphi)) : _k0;
00121     lat = (northp ? 1 : -1) * (rho != 0 ? phi / Math::degree<real>() : 90);
00122     lon = -atan2( -x, northp ? -y : y ) / Math::degree<real>();
00123     gamma = northp ? lon : -lon;
00124   }
00125 
00126   void PolarStereographic::SetScale(real lat, real k) {
00127     if (!(Math::isfinite(k) && k > 0))
00128       throw GeographicErr("Scale is not positive");
00129     if (!(-90 < lat && lat <= 90))
00130       throw GeographicErr("Latitude must be in (-90d, 90d]");
00131     real x, y, gamma, kold;
00132     _k0 = 1;
00133     Forward(true, lat, 0, x, y, gamma, kold);
00134     _k0 *= k/kold;
00135   }
00136 
00137 } // namespace GeographicLib
geographiclib-1.21/doc/html/closed.png0000644000175000017500000000017611745620415017555 0ustar frankiefrankie‰PNG  IHDR à‘EIDATxíÝA @! PŠ­iš/`Є.È?,!ƒu zlÞ–Jh1ߘ+výRLé§x@‘Ù (*79HÑ þl)¡ó²‰IEND®B`‚geographiclib-1.21/doc/html/SphericalEngine_8cpp.html0000644000175000017500000002577011745620414022464 0ustar frankiefrankie GeographicLib: SphericalEngine.cpp File Reference
SphericalEngine.cpp File Reference

Implementation for GeographicLib::SphericalEngine class. More...

#include <GeographicLib/SphericalEngine.hpp>
#include <limits>
#include <algorithm>
#include <GeographicLib/CircularEngine.hpp>
#include <GeographicLib/Utility.hpp>

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_SPHERICALENGINE_CPP   "$Id: 861a718d09c83cdd9bf58939d938a25797b9f306 $"

Detailed Description

Implementation for GeographicLib::SphericalEngine class.

Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

The general sum is

 V(r, theta, lambda) = sum(n = 0..N) sum(m = 0..n)
   q^(n+1) * (C[n,m] * cos(m*lambda) + S[n,m] * sin(m*lambda)) * P[n,m](t)

where t = cos(theta), q = a/r. In addition write u = sin(theta).

P[n,m] is a normalized associated Legendre function of degree n and order m. Here the formulas are given for full normalized functions (usually denoted Pbar).

Rewrite outer sum

 V(r, theta, lambda) = sum(m = 0..N) * P[m,m](t) * q^(m+1) *
    [Sc[m] * cos(m*lambda) + Ss[m] * sin(m*lambda)]

where the inner sums are

   Sc[m] = sum(n = m..N) q^(n-m) * C[n,m] * P[n,m](t)/P[m,m](t)
   Ss[m] = sum(n = m..N) q^(n-m) * S[n,m] * P[n,m](t)/P[m,m](t)

Evaluate sums via Clenshaw method. The overall framework is similar to Deakin with the following changes:

  • Clenshaw summation is used to roll the computation of cos(m*lambda) and sin(m*lambda) into the evaluation of the outer sum (rather than independently computing an array of these trigonometric terms).
  • Scale the coefficients to guard against overflow when N is large.

For the general framework of Clenshaw, see http://mathworld.wolfram.com/ClenshawRecurrenceFormula.html

Let

    S = sum(k = 0..N) c[k] * F[k](x)
    F[n+1](x) = alpha[n](x) * F[n](x) + beta[n](x) * F[n-1](x)

Evaluate S with

    y[N+2] = y[N+1] = 0
    y[k] = alpha[k] * y[k+1] + beta[k+1] * y[k+2] + c[k]
    S = c[0] * F[0] + y[1] * F[1] + beta[1] * F[0] * y[2]

IF F[0](x) = 1 and beta(0,x) = 0, then F[1](x) = alpha(0,x) and we can continue the recursion for y[k] until y[0], giving

    S = y[0]

Evaluating the inner sum

 l = n-m; n = l+m
 Sc[m] = sum(l = 0..N-m) C[l+m,m] * q^l * P[l+m,m](t)/P[m,m](t)
 F[l] = q^l * P[l+m,m](t)/P[m,m](t)

Holmes + Featherstone, Eq. (11), give

   P[n,m] = sqrt((2*n-1)*(2*n+1)/((n-m)*(n+m))) * t * P[n-1,m] -
            sqrt((2*n+1)*(n+m-1)*(n-m-1)/((n-m)*(n+m)*(2*n-3))) * P[n-2,m]

thus

   alpha[l] = t * q * sqrt(((2*n+1)*(2*n+3))/
                           ((n-m+1)*(n+m+1)))
   beta[l+1] = - q^2 * sqrt(((n-m+1)*(n+m+1)*(2*n+5))/
                            ((n-m+2)*(n+m+2)*(2*n+1)))

In this case, F[0] = 1 and beta[0] = 0, so the Sc[m] = y[0].

Evaluating the outer sum

 V = sum(m = 0..N) Sc[m] * q^(m+1) * cos(m*lambda) * P[m,m](t)
   + sum(m = 0..N) Ss[m] * q^(m+1) * cos(m*lambda) * P[m,m](t)
 F[m] = q^(m+1) * cos(m*lambda) * P[m,m](t) [or sin(m*lambda)]

Holmes + Featherstone, Eq. (13), give

   P[m,m] = u * sqrt((2*m+1)/((m>1?2:1)*m)) * P[m-1,m-1]

also, we have

   cos((m+1)*lambda) = 2*cos(lambda)*cos(m*lambda) - cos((m-1)*lambda)

thus

   alpha[m] = 2*cos(lambda) * sqrt((2*m+3)/(2*(m+1))) * u * q
            =   cos(lambda) * sqrt( 2*(2*m+3)/(m+1) ) * u * q
   beta[m+1] = -sqrt((2*m+3)*(2*m+5)/(4*(m+1)*(m+2))) * u^2 * q^2
               * (m == 0 ? sqrt(2) : 1)

Thus

 F[0] = q                                [or 0]
 F[1] = cos(lambda) * sqrt(3) * u * q^2  [or sin(lambda)]
 beta[1] = - sqrt(15/4) * u^2 * q^2

Here is how the various components of the gradient are computed

Differentiate wrt r

   d q^(n+1) / dr = (-1/r) * (n+1) * q^(n+1)

so multiply C[n,m] by n+1 in inner sum and multiply the sum by -1/r.

Differentiate wrt lambda

   d cos(m*lambda) = -m * sin(m*lambda)
   d sin(m*lambda) =  m * cos(m*lambda)

so multiply terms by m in outer sum and swap sine and cosine variables.

Differentiate wrt theta

  dV/dtheta = V' = -u * dV/dt = -u * V'

here ' denotes differentiation wrt theta.

   d/dtheta (Sc[m] * P[m,m](t)) = Sc'[m] * P[m,m](t) + Sc[m] * P'[m,m](t)

Now P[m,m](t) = const * u^m, so P'[m,m](t) = m * t/u * P[m,m](t), thus

   d/dtheta (Sc[m] * P[m,m](t)) = (Sc'[m] + m * t/u * Sc[m]) * P[m,m](t)

Clenshaw recursion for Sc[m] reads

    y[k] = alpha[k] * y[k+1] + beta[k+1] * y[k+2] + c[k]

Substituting alpha[k] = const * t, alpha'[k] = -u/t * alpha[k], beta'[k] = c'[k] = 0 gives

    y'[k] = alpha[k] * y'[k+1] + beta[k+1] * y'[k+2] - u/t * alpha[k] * y[k+1]

Finally, given the derivatives of V, we can compute the components of the gradient in spherical coordinates and transform the result into cartesian coordinates.

Definition in file SphericalEngine.cpp.


Define Documentation

#define GEOGRAPHICLIB_SPHERICALENGINE_CPP   "$Id: 861a718d09c83cdd9bf58939d938a25797b9f306 $"

Definition at line 139 of file SphericalEngine.cpp.

geographiclib-1.21/doc/html/NormalGravity_8hpp.html0000644000175000017500000001271411745620415022222 0ustar frankiefrankie GeographicLib: NormalGravity.hpp File Reference
NormalGravity.hpp File Reference

Header for GeographicLib::NormalGravity class. More...

Go to the source code of this file.

Classes

class  GeographicLib::NormalGravity
 The normal gravity of the earth. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_NORMALGRAVITY_HPP   "$Id: e4b65c9c5787d8ee14f476cbb518fd5007006344 $"

Detailed Description

Header for GeographicLib::NormalGravity class.

Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file NormalGravity.hpp.


Define Documentation

#define GEOGRAPHICLIB_NORMALGRAVITY_HPP   "$Id: e4b65c9c5787d8ee14f476cbb518fd5007006344 $"

Definition at line 11 of file NormalGravity.hpp.

geographiclib-1.21/doc/html/TransverseMercatorExact_8cpp_source.html0000644000175000017500000016535511745620414025626 0ustar frankiefrankie GeographicLib: TransverseMercatorExact.cpp Source File
TransverseMercatorExact.cpp
Go to the documentation of this file.
00001 /**
00002  * \file TransverseMercatorExact.cpp
00003  * \brief Implementation for GeographicLib::TransverseMercatorExact class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  *
00009  * The relevant section of Lee's paper is part V, pp 67&ndash;101,
00010  * <a href="http://dx.doi.org/10.3138/X687-1574-4325-WM62">Conformal
00011  * Projections Based On Jacobian Elliptic Functions</a>.
00012  *
00013  * The method entails using the Thompson Transverse Mercator as an
00014  * intermediate projection.  The projections from the intermediate
00015  * coordinates to [\e phi, \e lam] and [\e x, \e y] are given by elliptic
00016  * functions.  The inverse of these projections are found by Newton's method
00017  * with a suitable starting guess.
00018  *
00019  * This implementation and notation closely follows Lee, with the following
00020  * exceptions:
00021  * <center><table>
00022  * <tr><th>Lee    <th>here    <th>Description
00023  * <tr><td>x/a    <td>xi      <td>Northing (unit Earth)
00024  * <tr><td>y/a    <td>eta     <td>Easting (unit Earth)
00025  * <tr><td>s/a    <td>sigma   <td>xi + i * eta
00026  * <tr><td>y      <td>x       <td>Easting
00027  * <tr><td>x      <td>y       <td>Northing
00028  * <tr><td>k      <td>e       <td>eccentricity
00029  * <tr><td>k^2    <td>mu      <td>elliptic function parameter
00030  * <tr><td>k'^2   <td>mv      <td>elliptic function complementary parameter
00031  * <tr><td>m      <td>k       <td>scale
00032  * <tr><td>zeta   <td>zeta    <td>complex longitude = Mercator = chi in paper
00033  * <tr><td>s      <td>sigma   <td>complex GK = zeta in paper
00034  * </table></center>
00035  *
00036  * Minor alterations have been made in some of Lee's expressions in an
00037  * attempt to control round-off.  For example atanh(sin(phi)) is replaced by
00038  * asinh(tan(phi)) which maintains accuracy near phi = pi/2.  Such changes
00039  * are noted in the code.
00040  **********************************************************************/
00041 
00042 #include <GeographicLib/TransverseMercatorExact.hpp>
00043 
00044 #define GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_CPP \
00045   "$Id: 125a2d11919018a84fb0c09ea2e77011a35a4a2d $"
00046 
00047 RCSID_DECL(GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_CPP)
00048 RCSID_DECL(GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP)
00049 
00050 namespace GeographicLib {
00051 
00052   using namespace std;
00053 
00054   const Math::real TransverseMercatorExact::tol_ =
00055     numeric_limits<real>::epsilon();
00056   const Math::real TransverseMercatorExact::tol1_ = real(0.1) * sqrt(tol_);
00057   const Math::real TransverseMercatorExact::tol2_ = real(0.1) * tol_;
00058   const Math::real TransverseMercatorExact::taytol_ = pow(tol_, real(0.6));
00059   // Overflow value s.t. atan(overflow_) = pi/2
00060   const Math::real TransverseMercatorExact::overflow_ = 1 / Math::sq(tol_);
00061 
00062   TransverseMercatorExact::TransverseMercatorExact(real a, real f, real k0,
00063                                                    bool extendp)
00064     : _a(a)
00065     , _f(f <= 1 ? f : 1/f)
00066     , _k0(k0)
00067     , _mu(_f * (2 - _f))        // e^2
00068     , _mv(1 - _mu)              // 1 - e^2
00069     , _e(sqrt(_mu))
00070     , _ep2(_mu / _mv)           // e^2 / (1 - e^2)
00071     , _extendp(extendp)
00072     , _Eu(_mu)
00073     , _Ev(_mv)
00074   {
00075     if (!(Math::isfinite(_a) && _a > 0))
00076       throw GeographicErr("Major radius is not positive");
00077     if (!(_f > 0))
00078       throw GeographicErr("Flattening is not positive");
00079     if (!(_f < 1))
00080       throw GeographicErr("Minor radius is not positive");
00081     if (!(Math::isfinite(_k0) && _k0 > 0))
00082       throw GeographicErr("Scale is not positive");
00083   }
00084 
00085   const TransverseMercatorExact
00086   TransverseMercatorExact::UTM(Constants::WGS84_a<real>(),
00087                                Constants::WGS84_f<real>(),
00088                                Constants::UTM_k0<real>());
00089 
00090   // tau = tan(phi), taup = sinh(psi)
00091   Math::real TransverseMercatorExact::taup(real tau) const throw() {
00092     real
00093       tau1 = Math::hypot(real(1), tau),
00094       sig = sinh( _e * Math::atanh(_e * tau / tau1) );
00095     return Math::hypot(real(1), sig) * tau - sig * tau1;
00096   }
00097 
00098   Math::real TransverseMercatorExact::taupinv(real taup) const throw() {
00099     real
00100       // See comment in TransverseMercator.cpp about the initial guess
00101       tau = taup/_mv,
00102       stol = tol_ * max(real(1), abs(taup));
00103     // min iterations = 1, max iterations = 2; mean = 1.94
00104     for (int i = 0; i < numit_; ++i) {
00105       real
00106         tau1 = Math::hypot(real(1), tau),
00107         sig = sinh( _e * Math::atanh(_e * tau / tau1 ) ),
00108         taupa = Math::hypot(real(1), sig) * tau - sig * tau1,
00109         dtau = (taup - taupa) * (1 + _mv * Math::sq(tau)) /
00110         ( _mv * tau1 * Math::hypot(real(1), taupa) );
00111       tau += dtau;
00112       if (!(abs(dtau) >= stol))
00113         break;
00114     }
00115     return tau;
00116   }
00117 
00118   void TransverseMercatorExact::zeta(real /*u*/, real snu, real cnu, real dnu,
00119                                      real /*v*/, real snv, real cnv, real dnv,
00120                                      real& taup, real& lam) const throw() {
00121     // Lee 54.17 but write
00122     // atanh(snu * dnv) = asinh(snu * dnv / sqrt(cnu^2 + _mv * snu^2 * snv^2))
00123     // atanh(_e * snu / dnv) =
00124     //         asinh(_e * snu / sqrt(_mu * cnu^2 + _mv * cnv^2))
00125     real
00126       d1 = sqrt(Math::sq(cnu) + _mv * Math::sq(snu * snv)),
00127       d2 = sqrt(_mu * Math::sq(cnu) + _mv * Math::sq(cnv)),
00128       t1 = (d1 ? snu * dnv / d1 : (snu < 0 ? -overflow_ : overflow_)),
00129       t2 = (d2 ? sinh( _e * Math::asinh(_e * snu / d2) ) :
00130             (snu < 0 ? -overflow_ : overflow_));
00131     // psi = asinh(t1) - asinh(t2)
00132     // taup = sinh(psi)
00133     taup = t1 * Math::hypot(real(1), t2) - t2 * Math::hypot(real(1), t1);
00134     lam = (d1 != 0 && d2 != 0) ?
00135       atan2(dnu * snv, cnu * cnv) - _e * atan2(_e * cnu * snv, dnu * cnv) :
00136       0;
00137   }
00138 
00139   void TransverseMercatorExact::dwdzeta(real /*u*/,
00140                                         real snu, real cnu, real dnu,
00141                                         real /*v*/,
00142                                         real snv, real cnv, real dnv,
00143                                         real& du, real& dv) const throw() {
00144     // Lee 54.21 but write (1 - dnu^2 * snv^2) = (cnv^2 + _mu * snu^2 * snv^2)
00145     // (see A+S 16.21.4)
00146     real d = _mv * Math::sq(Math::sq(cnv) + _mu * Math::sq(snu * snv));
00147     du =  cnu * dnu * dnv * (Math::sq(cnv) - _mu * Math::sq(snu * snv)) / d;
00148     dv = -snu * snv * cnv * (Math::sq(dnu * dnv) + _mu * Math::sq(cnu)) / d;
00149   }
00150 
00151   // Starting point for zetainv
00152   bool TransverseMercatorExact::zetainv0(real psi, real lam, real& u, real& v)
00153     const throw() {
00154     bool retval = false;
00155     if (psi < -_e * Math::pi<real>()/4 &&
00156         lam > (1 - 2 * _e) * Math::pi<real>()/2 &&
00157         psi < lam - (1 - _e) * Math::pi<real>()/2) {
00158       // N.B. this branch is normally not taken because psi < 0 is converted
00159       // psi > 0 by Forward.
00160       //
00161       // There's a log singularity at w = w0 = Eu.K() + i * Ev.K(),
00162       // corresponding to the south pole, where we have, approximately
00163       //
00164       //   psi = _e + i * pi/2 - _e * atanh(cos(i * (w - w0)/(1 + _mu/2)))
00165       //
00166       // Inverting this gives:
00167       real
00168         psix = 1 - psi / _e,
00169         lamx = (Math::pi<real>()/2 - lam) / _e;
00170       u = Math::asinh(sin(lamx) / Math::hypot(cos(lamx), sinh(psix))) *
00171         (1 + _mu/2);
00172       v = atan2(cos(lamx), sinh(psix)) * (1 + _mu/2);
00173       u = _Eu.K() - u;
00174       v = _Ev.K() - v;
00175     } else if (psi < _e * Math::pi<real>()/2 &&
00176                lam > (1 - 2 * _e) * Math::pi<real>()/2) {
00177       // At w = w0 = i * Ev.K(), we have
00178       //
00179       //     zeta = zeta0 = i * (1 - _e) * pi/2
00180       //     zeta' = zeta'' = 0
00181       //
00182       // including the next term in the Taylor series gives:
00183       //
00184       // zeta = zeta0 - (_mv * _e) / 3 * (w - w0)^3
00185       //
00186       // When inverting this, we map arg(w - w0) = [-90, 0] to
00187       // arg(zeta - zeta0) = [-90, 180]
00188       real
00189         dlam = lam - (1 - _e) * Math::pi<real>()/2,
00190         rad = Math::hypot(psi, dlam),
00191         // atan2(dlam-psi, psi+dlam) + 45d gives arg(zeta - zeta0) in range
00192         // [-135, 225).  Subtracting 180 (since multiplier is negative) makes
00193         // range [-315, 45).  Multiplying by 1/3 (for cube root) gives range
00194         // [-105, 15).  In particular the range [-90, 180] in zeta space maps
00195         // to [-90, 0] in w space as required.
00196         ang = atan2(dlam-psi, psi+dlam) - real(0.75) * Math::pi<real>();
00197       // Error using this guess is about 0.21 * (rad/e)^(5/3)
00198       retval = rad < _e * taytol_;
00199       rad = Math::cbrt(3 / (_mv * _e) * rad);
00200       ang /= 3;
00201       u = rad * cos(ang);
00202       v = rad * sin(ang) + _Ev.K();
00203     } else {
00204       // Use spherical TM, Lee 12.6 -- writing atanh(sin(lam) / cosh(psi)) =
00205       // asinh(sin(lam) / hypot(cos(lam), sinh(psi))).  This takes care of the
00206       // log singularity at zeta = Eu.K() (corresponding to the north pole)
00207       v = Math::asinh(sin(lam) / Math::hypot(cos(lam), sinh(psi)));
00208       u = atan2(sinh(psi), cos(lam));
00209       // But scale to put 90,0 on the right place
00210       u *= _Eu.K() / (Math::pi<real>()/2);
00211       v *= _Eu.K() / (Math::pi<real>()/2);
00212     }
00213     return retval;
00214   }
00215 
00216   // Invert zeta using Newton's method
00217   void TransverseMercatorExact::zetainv(real taup, real lam, real& u, real& v)
00218     const throw()  {
00219     real
00220       psi = Math::asinh(taup),
00221       scal = 1/Math::hypot(real(1), taup);
00222     if (zetainv0(psi, lam, u, v))
00223       return;
00224     real stol2 = tol2_ / Math::sq(max(psi, real(1)));
00225     // min iterations = 2, max iterations = 6; mean = 4.0
00226     for (int i = 0, trip = 0; i < numit_; ++i) {
00227       real snu, cnu, dnu, snv, cnv, dnv;
00228       _Eu.sncndn(u, snu, cnu, dnu);
00229       _Ev.sncndn(v, snv, cnv, dnv);
00230       real tau1, lam1, du1, dv1;
00231       zeta(u, snu, cnu, dnu, v, snv, cnv, dnv, tau1, lam1);
00232       dwdzeta(u, snu, cnu, dnu, v, snv, cnv, dnv, du1, dv1);
00233       tau1 -= taup;
00234       lam1 -= lam;
00235       tau1 *= scal;
00236       real
00237         delu = tau1 * du1 - lam1 * dv1,
00238         delv = tau1 * dv1 + lam1 * du1;
00239       u -= delu;
00240       v -= delv;
00241       if (trip)
00242         break;
00243       real delw2 = Math::sq(delu) + Math::sq(delv);
00244       if (!(delw2 >= stol2))
00245         ++trip;
00246     }
00247   }
00248 
00249   void TransverseMercatorExact::sigma(real /*u*/, real snu, real cnu, real dnu,
00250                                       real v, real snv, real cnv, real dnv,
00251                                       real& xi, real& eta) const throw() {
00252     // Lee 55.4 writing
00253     // dnu^2 + dnv^2 - 1 = _mu * cnu^2 + _mv * cnv^2
00254     real d = _mu * Math::sq(cnu) + _mv * Math::sq(cnv);
00255     xi = _Eu.E(snu, cnu, dnu) - _mu * snu * cnu * dnu / d;
00256     eta = v - _Ev.E(snv, cnv, dnv) + _mv * snv * cnv * dnv / d;
00257   }
00258 
00259   void TransverseMercatorExact::dwdsigma(real /*u*/,
00260                                          real snu, real cnu, real dnu,
00261                                          real /*v*/,
00262                                          real snv, real cnv, real dnv,
00263                                          real& du, real& dv) const throw() {
00264     // Reciprocal of 55.9: dw/ds = dn(w)^2/_mv, expanding complex dn(w) using
00265     // A+S 16.21.4
00266     real d = _mv * Math::sq(Math::sq(cnv) + _mu * Math::sq(snu * snv));
00267     real
00268       dnr = dnu * cnv * dnv,
00269       dni = - _mu * snu * cnu * snv;
00270     du = (Math::sq(dnr) - Math::sq(dni)) / d;
00271     dv = 2 * dnr * dni / d;
00272   }
00273 
00274   // Starting point for sigmainv
00275   bool TransverseMercatorExact::sigmainv0(real xi, real eta, real& u, real& v)
00276     const throw() {
00277     bool retval = false;
00278     if (eta > real(1.25) * _Ev.KE() ||
00279         (xi < -real(0.25) * _Eu.E() && xi < eta - _Ev.KE())) {
00280       // sigma as a simple pole at w = w0 = Eu.K() + i * Ev.K() and sigma is
00281       // approximated by
00282       //
00283       // sigma = (Eu.E() + i * Ev.KE()) + 1/(w - w0)
00284       real
00285         x = xi - _Eu.E(),
00286         y = eta - _Ev.KE(),
00287         r2 = Math::sq(x) + Math::sq(y);
00288       u = _Eu.K() + x/r2;
00289       v = _Ev.K() - y/r2;
00290     } else if ((eta > real(0.75) * _Ev.KE() && xi < real(0.25) * _Eu.E())
00291                || eta > _Ev.KE()) {
00292       // At w = w0 = i * Ev.K(), we have
00293       //
00294       //     sigma = sigma0 = i * Ev.KE()
00295       //     sigma' = sigma'' = 0
00296       //
00297       // including the next term in the Taylor series gives:
00298       //
00299       // sigma = sigma0 - _mv / 3 * (w - w0)^3
00300       //
00301       // When inverting this, we map arg(w - w0) = [-pi/2, -pi/6] to
00302       // arg(sigma - sigma0) = [-pi/2, pi/2]
00303       // mapping arg = [-pi/2, -pi/6] to [-pi/2, pi/2]
00304       real
00305         deta = eta - _Ev.KE(),
00306         rad = Math::hypot(xi, deta),
00307         // Map the range [-90, 180] in sigma space to [-90, 0] in w space.  See
00308         // discussion in zetainv0 on the cut for ang.
00309         ang = atan2(deta-xi, xi+deta) - real(0.75) * Math::pi<real>();
00310       // Error using this guess is about 0.068 * rad^(5/3)
00311       retval = rad < 2 * taytol_;
00312       rad = Math::cbrt(3 / _mv * rad);
00313       ang /= 3;
00314       u = rad * cos(ang);
00315       v = rad * sin(ang) + _Ev.K();
00316     } else {
00317       // Else use w = sigma * Eu.K/Eu.E (which is correct in the limit _e -> 0)
00318       u = xi * _Eu.K()/_Eu.E();
00319       v = eta * _Eu.K()/_Eu.E();
00320     }
00321     return retval;
00322   }
00323 
00324   // Invert sigma using Newton's method
00325   void TransverseMercatorExact::sigmainv(real xi, real eta, real& u, real& v)
00326     const throw() {
00327     if (sigmainv0(xi, eta, u, v))
00328       return;
00329     // min iterations = 2, max iterations = 7; mean = 3.9
00330     for (int i = 0, trip = 0; i < numit_; ++i) {
00331       real snu, cnu, dnu, snv, cnv, dnv;
00332       _Eu.sncndn(u, snu, cnu, dnu);
00333       _Ev.sncndn(v, snv, cnv, dnv);
00334       real xi1, eta1, du1, dv1;
00335       sigma(u, snu, cnu, dnu, v, snv, cnv, dnv, xi1, eta1);
00336       dwdsigma(u, snu, cnu, dnu, v, snv, cnv, dnv, du1, dv1);
00337       xi1 -= xi;
00338       eta1 -= eta;
00339       real
00340         delu = xi1 * du1 - eta1 * dv1,
00341         delv = xi1 * dv1 + eta1 * du1;
00342       u -= delu;
00343       v -= delv;
00344       if (trip)
00345         break;
00346       real delw2 = Math::sq(delu) + Math::sq(delv);
00347       if (!(delw2 >= tol2_))
00348         ++trip;
00349     }
00350   }
00351 
00352   void TransverseMercatorExact::Scale(real tau, real /*lam*/,
00353                                        real snu, real cnu, real dnu,
00354                                        real snv, real cnv, real dnv,
00355                                        real& gamma, real& k) const throw() {
00356     real sec2 = 1 + Math::sq(tau);    // sec(phi)^2
00357     // Lee 55.12 -- negated for our sign convention.  gamma gives the bearing
00358     // (clockwise from true north) of grid north
00359     gamma = atan2(_mv * snu * snv * cnv, cnu * dnu * dnv);
00360     // Lee 55.13 with nu given by Lee 9.1 -- in sqrt change the numerator
00361     // from
00362     //
00363     //    (1 - snu^2 * dnv^2) to (_mv * snv^2 + cnu^2 * dnv^2)
00364     //
00365     // to maintain accuracy near phi = 90 and change the denomintor from
00366     //
00367     //    (dnu^2 + dnv^2 - 1) to (_mu * cnu^2 + _mv * cnv^2)
00368     //
00369     // to maintain accuracy near phi = 0, lam = 90 * (1 - e).  Similarly
00370     // rewrite sqrt term in 9.1 as
00371     //
00372     //    _mv + _mu * c^2 instead of 1 - _mu * sin(phi)^2
00373     k = sqrt(_mv + _mu / sec2) * sqrt(sec2) *
00374       sqrt( (_mv * Math::sq(snv) + Math::sq(cnu * dnv)) /
00375             (_mu * Math::sq(cnu) + _mv * Math::sq(cnv)) );
00376   }
00377 
00378   void TransverseMercatorExact::Forward(real lon0, real lat, real lon,
00379                                         real& x, real& y, real& gamma, real& k)
00380     const throw() {
00381     // Avoid losing a bit of accuracy in lon (assuming lon0 is an integer)
00382     if (lon - lon0 > 180)
00383       lon -= lon0 + 360;
00384     else if (lon - lon0 <= -180)
00385       lon -= lon0 - 360;
00386     else
00387       lon -= lon0;
00388     // Now lon in (-180, 180]
00389     // Explicitly enforce the parity
00390     int
00391       latsign = !_extendp && lat < 0 ? -1 : 1,
00392       lonsign = !_extendp && lon < 0 ? -1 : 1;
00393     lon *= lonsign;
00394     lat *= latsign;
00395     bool backside = !_extendp && lon > 90;
00396     if (backside) {
00397       if (lat == 0)
00398         latsign = -1;
00399       lon = 180 - lon;
00400     }
00401     real
00402       phi = lat * Math::degree<real>(),
00403       lam = lon * Math::degree<real>(),
00404       tau = tanx(phi);
00405 
00406     // u,v = coordinates for the Thompson TM, Lee 54
00407     real u, v;
00408     if (lat == 90) {
00409       u = _Eu.K();
00410       v = 0;
00411     } else if (lat == 0 && lon == 90 * (1 - _e)) {
00412       u = 0;
00413       v = _Ev.K();
00414     } else
00415       zetainv(taup(tau), lam, u, v);
00416 
00417     real snu, cnu, dnu, snv, cnv, dnv;
00418     _Eu.sncndn(u, snu, cnu, dnu);
00419     _Ev.sncndn(v, snv, cnv, dnv);
00420 
00421     real xi, eta;
00422     sigma(u, snu, cnu, dnu, v, snv, cnv, dnv, xi, eta);
00423     if (backside)
00424       xi = 2 * _Eu.E() - xi;
00425     y = xi * _a * _k0 * latsign;
00426     x = eta * _a * _k0 * lonsign;
00427 
00428     // Recompute (tau, lam) from (u, v) to improve accuracy of Scale
00429     zeta(u, snu, cnu, dnu, v, snv, cnv, dnv, tau, lam);
00430     tau=taupinv(tau);
00431     Scale(tau, lam, snu, cnu, dnu, snv, cnv, dnv, gamma, k);
00432     gamma /= Math::degree<real>();
00433     if (backside)
00434       gamma = 180 - gamma;
00435     gamma *= latsign * lonsign;
00436     k *= _k0;
00437   }
00438 
00439   void TransverseMercatorExact::Reverse(real lon0, real x, real y,
00440                                         real& lat, real& lon,
00441                                         real& gamma, real& k)
00442     const throw() {
00443     // This undoes the steps in Forward.
00444     real
00445       xi = y / (_a * _k0),
00446       eta = x / (_a * _k0);
00447     // Explicitly enforce the parity
00448     int
00449       latsign = !_extendp && y < 0 ? -1 : 1,
00450       lonsign = !_extendp && x < 0 ? -1 : 1;
00451     xi *= latsign;
00452     eta *= lonsign;
00453     bool backside = !_extendp && xi > _Eu.E();
00454     if (backside)
00455       xi = 2 * _Eu.E()- xi;
00456 
00457     // u,v = coordinates for the Thompson TM, Lee 54
00458     real u, v;
00459     if (xi == 0 && eta == _Ev.KE()) {
00460       u = 0;
00461       v = _Ev.K();
00462     } else
00463       sigmainv(xi, eta, u, v);
00464 
00465     real snu, cnu, dnu, snv, cnv, dnv;
00466     _Eu.sncndn(u, snu, cnu, dnu);
00467     _Ev.sncndn(v, snv, cnv, dnv);
00468     real phi, lam, tau;
00469     if (v != 0 || u != _Eu.K()) {
00470       zeta(u, snu, cnu, dnu, v, snv, cnv, dnv, tau, lam);
00471       tau = taupinv(tau);
00472       phi = atan(tau);
00473       lat = phi / Math::degree<real>();
00474       lon = lam / Math::degree<real>();
00475     } else {
00476       tau = overflow_;
00477       phi = Math::pi<real>()/2;
00478       lat = 90;
00479       lon = lam = 0;
00480     }
00481     Scale(tau, lam, snu, cnu, dnu, snv, cnv, dnv, gamma, k);
00482     gamma /= Math::degree<real>();
00483     if (backside)
00484       lon = 180 - lon;
00485     lon *= lonsign;
00486     // Avoid losing a bit of accuracy in lon (assuming lon0 is an integer)
00487     if (lon + lon0 >= 180)
00488       lon += lon0 - 360;
00489     else if (lon + lon0 < -180)
00490       lon += lon0 + 360;
00491     else
00492       lon += lon0;
00493     lat *= latsign;
00494     if (backside)
00495       y = 2 * _Eu.E() - y;
00496     y *= _a * _k0 * latsign;
00497     x *= _a * _k0 * lonsign;
00498     if (backside)
00499       gamma = 180 - gamma;
00500     gamma *= latsign * lonsign;
00501     k *= _k0;
00502   }
00503 
00504 } // namespace GeographicLib
geographiclib-1.21/doc/html/GravityModel_8hpp_source.html0000644000175000017500000020200111745620414023377 0ustar frankiefrankie GeographicLib: GravityModel.hpp Source File
GravityModel.hpp
Go to the documentation of this file.
00001 /**
00002  * \file GravityModel.hpp
00003  * \brief Header for GeographicLib::GravityModel class
00004  *
00005  * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under
00006  * the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_GRAVITYMODEL_HPP)
00011 #define GEOGRAPHICLIB_GRAVITYMODEL_HPP \
00012   "$Id: e1a573fb0148fa5bc408b2dbdb096d4cd3091bac $"
00013 
00014 #include <string>
00015 #include <sstream>
00016 #include <vector>
00017 #include <GeographicLib/Constants.hpp>
00018 #include <GeographicLib/NormalGravity.hpp>
00019 #include <GeographicLib/SphericalHarmonic.hpp>
00020 #include <GeographicLib/SphericalHarmonic1.hpp>
00021 
00022 #if defined(_MSC_VER)
00023 // Squelch warnings about dll vs vector
00024 #pragma warning (push)
00025 #pragma warning (disable: 4251)
00026 #endif
00027 
00028 namespace GeographicLib {
00029 
00030   class GravityCircle;
00031 
00032   /**
00033    * \brief Model of the earth's gravity field
00034    *
00035    * Evaluate the earth's gravity field according to a model.  The supported
00036    * models treat only the gravitational field exterior to the mass of the
00037    * earth.  When computing the field at points near (but above) the surface of
00038    * the earth a small correction can be applied to account for the mass of the
00039    * atomsphere above the point in question; see \ref gravityatmos.
00040    * Determining the geoid height entails correcting for the mass of the earth
00041    * above the geoid.  The egm96 and egm2008 include separate correction terms
00042    * to account for this mass.
00043    *
00044    * Definitions and terminology (from Heiskanen and Moritz, Sec 2-13):
00045    * - \e V = gravitational potential;
00046    * - \e Phi = rotational potential;
00047    * - \e W = \e V + \e Phi = \e T + \e U = total potential;
00048    * - <i>V</i><sub>0</sub> = normal gravitation potential;
00049    * - \e U = <i>V</i><sub>0</sub> + \e Phi = total normal potential;
00050    * - \e T = \e W - \e U = \e V - <i>V</i><sub>0</sub> = anomalous or
00051    *   disturbing potential;
00052    * - <b>g</b> = <b>grad</b> \e W = <b>gamma</b> + <b>delta</b>;
00053    * - <b>f</b> = <b>grad</b> \e Phi;
00054    * - <b>Gamma</b> = <b>grad</b> <i>V</i><sub>0</sub>;
00055    * - <b>gamma</b> = <b>grad</b> \e U;
00056    * - <b>delta</b> = <b>grad</b> \e T = gravity disturbance vector
00057    *   = <b>g</b><sub><i>P</i></sub> - <b>gamma</b><sub><i>P</i></sub>;
00058    * - delta \e g = gravity disturbance = \e g<sub><i>P</i></sub> - \e
00059    *   gamma<sub><i>P</i></sub>;
00060    * - Delta <b>g</b> = gravity anomaly vector =
00061    *   <b>g</b><sub><i>P</i></sub> - <b>gamma</b><sub><i>Q</i></sub>; here the
00062    *   line \e PQ is perpendicular to ellipsoid and the potential at \e P
00063    *   equals the normal potential at \e Q;
00064    * - Delta \e g = gravity anomaly = \e g<sub><i>P</i></sub> - \e
00065    *   gamma<sub><i>Q</i></sub>;
00066    * - (\e xi, \e eta) deflection of the vertical, the difference in
00067    *   directions of <b>g</b><sub><i>P</i></sub> and
00068    *   <b>gamma</b><sub><i>Q</i></sub>, \e xi = NS, \e eta = EW.
00069    * - \e X, \e Y, \e Z, geocentric coordinates;
00070    * - \e x, \e y, \e z, local cartesian coordinates used to denote the east,
00071    *   north and up directions.
00072    *
00073    * See \ref gravity for details of how to install the gravity model and the
00074    * data format.
00075    *
00076    * References:
00077    * - W. A. Heiskanen and H. Moritz, Physical Geodesy (Freeman, San
00078    *   Francisco, 1967).
00079    *
00080    * Example of use:
00081    * \include example-GravityModel.cpp
00082    *
00083    * <a href="Gravity.1.html">Gravity</a> is a command-line utility providing
00084    * access to the functionality of GravityModel and GravityCircle.
00085    **********************************************************************/
00086 
00087   class GEOGRAPHIC_EXPORT GravityModel {
00088   private:
00089     typedef Math::real real;
00090     friend class GravityCircle;
00091     static const int idlength_ = 8;
00092     std::string _name, _dir, _description, _date, _filename, _id;
00093     real _amodel, _GMmodel, _zeta0, _corrmult;
00094     SphericalHarmonic::normalization _norm;
00095     NormalGravity _earth;
00096     std::vector<real> _C, _S, _CC, _CS, _zonal;
00097     real _dzonal0;              // A left over contribution to _zonal.
00098     SphericalHarmonic _gravitational;
00099     SphericalHarmonic1 _disturbing;
00100     SphericalHarmonic _correction;
00101     void ReadMetadata(const std::string& name);
00102     Math::real InternalT(real X, real Y, real Z,
00103                          real& deltaX, real& deltaY, real& deltaZ,
00104                          bool gradp, bool correct) const throw();
00105     enum captype {
00106       CAP_NONE   = 0U,
00107       CAP_G      = 1U<<0,       // implies potentials W and V
00108       CAP_T      = 1U<<1,
00109       CAP_DELTA  = 1U<<2 | CAP_T, // delta implies T?
00110       CAP_C      = 1U<<3,
00111       CAP_GAMMA0 = 1U<<4,
00112       CAP_GAMMA  = 1U<<5,
00113       CAP_ALL    = 0x3FU,
00114     };
00115 
00116   public:
00117 
00118     /**
00119      * Bit masks for the capabilities to be given to the GravityCircle object
00120      * produced by Circle.
00121      **********************************************************************/
00122     enum mask {
00123       /**
00124        * No capabilities.
00125        * @hideinitializer
00126        **********************************************************************/
00127       NONE = 0U,
00128       /**
00129        * Allow calls to GravityCircle::Gravity, GravityCircle::W, and
00130        * GravityCircle::V.
00131        * @hideinitializer
00132        **********************************************************************/
00133       GRAVITY = CAP_G,
00134       /**
00135        * Allow calls to GravityCircle::Disturbance and GravityCircle::T.
00136        * @hideinitializer
00137        **********************************************************************/
00138       DISTURBANCE = CAP_DELTA,
00139       /**
00140        * Allow calls to GravityCircle::T(real lon) (i.e., computing the
00141        * disturbing potential and not the gravity disturbance vector).
00142        * @hideinitializer
00143        **********************************************************************/
00144       DISTURBING_POTENTIAL = CAP_T,
00145       /**
00146        * Allow calls to GravityCircle::SphericalAnomaly.
00147        * @hideinitializer
00148        **********************************************************************/
00149       SPHERICAL_ANOMALY = CAP_DELTA | CAP_GAMMA,
00150       /**
00151        * Allow calls to GravityCircle::GeoidHeight.
00152        * @hideinitializer
00153        **********************************************************************/
00154       GEOID_HEIGHT = CAP_T | CAP_C | CAP_GAMMA0,
00155       /**
00156        * All capabilities.
00157        * @hideinitializer
00158        **********************************************************************/
00159       ALL = CAP_ALL,
00160     };
00161     /** \name Setting up the gravity model
00162      **********************************************************************/
00163     ///@{
00164     /**
00165      * Construct a gravity model.
00166      *
00167      * @param[in] name the name of the model.
00168      * @param[in] path (optional) directory for data file.
00169      *
00170      * A filename is formed by appending ".egm" (World Gravity Model) to the
00171      * name.  If \e path is specified (and is non-empty), then the file is
00172      * loaded from directory, \e path.  Otherwise the path is given by
00173      * DefaultGravityPath().  This may throw an exception because the file does
00174      * not exist, is unreadable, or is corrupt.
00175      *
00176      * This file contains the metadata which specifies the properties of the
00177      * model.  The coefficients for the spherical harmonic sums are obtained
00178      * from a file obtained by appending ".cof" to metadata file (so the
00179      * filename ends in ".egm.cof").
00180      **********************************************************************/
00181     explicit GravityModel(const std::string& name,
00182                           const std::string& path = "");
00183     ///@}
00184 
00185     /** \name Compute gravity in geodetic coordinates
00186      **********************************************************************/
00187     ///@{
00188     /**
00189      * Evaluate the gravity at an arbitrary point above (or below) the
00190      * ellipsoid.
00191      *
00192      * @param[in] lat the geographic latitude (degrees).
00193      * @param[in] lon the geographic longitude (degrees).
00194      * @param[in] h the height above the ellipsoid (meters).
00195      * @param[out] gx the easterly component of the acceleration
00196      *   (m s<sup>-2</sup>).
00197      * @param[out] gy the northerly component of the acceleration
00198      *   (m s<sup>-2</sup>).
00199      * @param[out] gz the upward component of the acceleration
00200      *   (m s<sup>-2</sup>); this is usually negative.
00201      * @return \e W the sum of the gravitational and centrifugal potentials.
00202      *
00203      * The function includes the effects of the earth's rotation.
00204      **********************************************************************/
00205     Math::real Gravity(real lat, real lon, real h,
00206                        real& gx, real& gy, real& gz) const throw();
00207 
00208     /**
00209      * Evaluate the gravity disturbance vector at an arbitrary point above (or
00210      * below) the ellipsoid.
00211      *
00212      * @param[in] lat the geographic latitude (degrees).
00213      * @param[in] lon the geographic longitude (degrees).
00214      * @param[in] h the height above the ellipsoid (meters).
00215      * @param[out] deltax the easterly component of the disturbance vector
00216      *   (m s<sup>-2</sup>).
00217      * @param[out] deltay the northerly component of the disturbance vector
00218      *   (m s<sup>-2</sup>).
00219      * @param[out] deltaz the upward component of the disturbance vector
00220      *   (m s<sup>-2</sup>).
00221      * @return \e T the corresponding disturbing potential.
00222      **********************************************************************/
00223     Math::real Disturbance(real lat, real lon, real h,
00224                            real& deltax, real& deltay, real& deltaz)
00225       const throw();
00226 
00227     /**
00228      * Evaluate the geoid height.
00229      *
00230      * @param[in] lat the geographic latitude (degrees).
00231      * @param[in] lon the geographic longitude (degrees).
00232      * @return \e N the height of the geoid above the ReferenceEllipsoid()
00233      *   (meters).
00234      *
00235      * This calls NormalGravity::U for ReferenceEllipsoid().  Some
00236      * approximations are made in computing the geoid height so that the
00237      * results of the NGA codes are reproduced accurately.  Details are given
00238      * in \ref gravitygeoid.
00239      **********************************************************************/
00240     Math::real GeoidHeight(real lat, real lon) const throw();
00241 
00242     /**
00243      * Evaluate the components of the gravity anomaly vector using the
00244      * spherical approximation.
00245      *
00246      * @param[in] lat the geographic latitude (degrees).
00247      * @param[in] lon the geographic longitude (degrees).
00248      * @param[in] h the height above the ellipsoid (meters).
00249      * @param[out] Dg01 the gravity anomaly (m s<sup>-2</sup>).
00250      * @param[out] xi the northerly component of the deflection of the vertical
00251      *  (degrees).
00252      * @param[out] eta the easterly component of the deflection of the vertical
00253      *  (degrees).
00254      *
00255      * The spherical approximation (see Heiskanen and Moritz, Sec 2-14) is used
00256      * so that the results of the NGA codes are reproduced accurately.
00257      * approximations used here.  Details are given in \ref gravitygeoid.
00258      **********************************************************************/
00259     void SphericalAnomaly(real lat, real lon, real h,
00260                           real& Dg01, real& xi, real& eta) const throw();
00261     ///@}
00262 
00263     /** \name Compute gravity in geocentric coordinates
00264      **********************************************************************/
00265     ///@{
00266     /**
00267      * Evaluate the components of the acceleration due to gravity and the
00268      * centrifugal acceleration in geocentric coordinates.
00269      *
00270      * @param[in] X geocentric coordinate of point (meters).
00271      * @param[in] Y geocentric coordinate of point (meters).
00272      * @param[in] Z geocentric coordinate of point (meters).
00273      * @param[out] gX the \e X component of the acceleration
00274      *   (m s<sup>-2</sup>).
00275      * @param[out] gY the \e Y component of the acceleration
00276      *   (m s<sup>-2</sup>).
00277      * @param[out] gZ the \e Z component of the acceleration
00278      *   (m s<sup>-2</sup>).
00279      * @return \e W = \e V + \e Phi the sum of the gravitational and
00280      *   centrifugal potentials (m<sup>2</sup> s<sup>-2</sup>).
00281      *
00282      * This calls NormalGravity::U for  ReferenceEllipsoid().
00283      **********************************************************************/
00284     Math::real W(real X, real Y, real Z,
00285                  real& gX, real& gY, real& gZ) const throw();
00286 
00287     /**
00288      * Evaluate the components of the acceleration due to gravity in geocentric
00289      * coordinates.
00290      *
00291      * @param[in] X geocentric coordinate of point (meters).
00292      * @param[in] Y geocentric coordinate of point (meters).
00293      * @param[in] Z geocentric coordinate of point (meters).
00294      * @param[out] GX the \e X component of the acceleration
00295      *   (m s<sup>-2</sup>).
00296      * @param[out] GY the \e Y component of the acceleration
00297      *   (m s<sup>-2</sup>).
00298      * @param[out] GZ the \e Z component of the acceleration
00299      *   (m s<sup>-2</sup>).
00300      * @return \e V = \e W - \e Phi the gravitational potential
00301      *   (m<sup>2</sup> s<sup>-2</sup>).
00302      **********************************************************************/
00303     Math::real V(real X, real Y, real Z,
00304                  real& GX, real& GY, real& GZ) const throw();
00305 
00306     /**
00307      * Evaluate the components of the gravity disturbance in geocentric
00308      * coordinates.
00309      *
00310      * @param[in] X geocentric coordinate of point (meters).
00311      * @param[in] Y geocentric coordinate of point (meters).
00312      * @param[in] Z geocentric coordinate of point (meters).
00313      * @param[out] deltaX the \e X component of the gravity disturbance
00314      *   (m s<sup>-2</sup>).
00315      * @param[out] deltaY the \e Y component of the gravity disturbance
00316      *   (m s<sup>-2</sup>).
00317      * @param[out] deltaZ the \e Z component of the gravity disturbance
00318      *   (m s<sup>-2</sup>).
00319      * @return \e T = \e W - \e U the disturbing potential (also called the
00320      *   anomalous potential) (m<sup>2</sup> s<sup>-2</sup>).
00321      **********************************************************************/
00322     Math::real T(real X, real Y, real Z,
00323                  real& deltaX, real& deltaY, real& deltaZ) const throw()
00324     { return InternalT(X, Y, Z, deltaX, deltaY, deltaZ, true, true); }
00325 
00326     /**
00327      * Evaluate disturbing potential in geocentric coordinates.
00328      *
00329      * @param[in] X geocentric coordinate of point (meters).
00330      * @param[in] Y geocentric coordinate of point (meters).
00331      * @param[in] Z geocentric coordinate of point (meters).
00332      * @return \e T = \e W - \e U the disturbing potential (also called the
00333      *   anomalous potential) (m<sup>2</sup> s<sup>-2</sup>).
00334      **********************************************************************/
00335     Math::real T(real X, real Y, real Z) const throw() {
00336       real dummy;
00337       return InternalT(X, Y, Z, dummy, dummy, dummy, false, true);
00338     }
00339 
00340     /**
00341      * Evaluate the components of the acceleration due to normal gravity and the
00342      * centrifugal acceleration in geocentric coordinates.
00343      *
00344      * @param[in] X geocentric coordinate of point (meters).
00345      * @param[in] Y geocentric coordinate of point (meters).
00346      * @param[in] Z geocentric coordinate of point (meters).
00347      * @param[out] gammaX the \e X component of the normal acceleration
00348      *   (m s<sup>-2</sup>).
00349      * @param[out] gammaY the \e Y component of the normal acceleration
00350      *   (m s<sup>-2</sup>).
00351      * @param[out] gammaZ the \e Z component of the normal acceleration
00352      *   (m s<sup>-2</sup>).
00353      * @return \e U = <i>V</i><sub>0</sub> + \e Phi the sum of the
00354      *   normal gravitational and centrifugal potentials
00355      *   (m<sup>2</sup> s<sup>-2</sup>).
00356      *
00357      * This calls NormalGravity::U for  ReferenceEllipsoid().
00358      **********************************************************************/
00359     Math::real U(real X, real Y, real Z,
00360                  real& gammaX, real& gammaY, real& gammaZ) const throw()
00361     { return _earth.U(X, Y, Z, gammaX, gammaY, gammaZ); }
00362 
00363     /**
00364      * Evaluate the centrifugal acceleration in geocentric coordinates.
00365      *
00366      * @param[in] X geocentric coordinate of point (meters).
00367      * @param[in] Y geocentric coordinate of point (meters).
00368      * @param[out] fX the \e X component of the centrifugal acceleration
00369      *   (m s<sup>-2</sup>).
00370      * @param[out] fY the \e Y component of the centrifugal acceleration
00371      *   (m s<sup>-2</sup>).
00372      * @return \e Phi the centrifugal potential (m<sup>2</sup> s<sup>-2</sup>).
00373      *
00374      * This calls NormalGravity::Phi for  ReferenceEllipsoid().
00375      **********************************************************************/
00376     Math::real Phi(real X, real Y, real& fX, real& fY) const throw()
00377     { return _earth.Phi(X, Y, fX, fY); }
00378     ///@}
00379 
00380     /** \name Compute gravity on a circle of constant latitude
00381      **********************************************************************/
00382     ///@{
00383     /**
00384      * Create a GravityCircle object to allow the gravity field at many points
00385      * with constant \e lat and \e h and varying \e lon to be computed
00386      * efficiently.
00387      *
00388      * @param[in] lat latitude of the point (degrees).
00389      * @param[in] h the height of the point above the ellipsoid (meters).
00390      * @param[in] caps bitor'ed combination of GravityModel::mask values
00391      *   specifying the capabilities of the resulting GravityCircle object.
00392      * @return a GravityCircle object whose member functions computes the
00393      *   gravitational field at a particular values of \e lon.
00394      *
00395      * The GravityModel::mask values are
00396      * - \e caps |= GravityModel::GRAVITY
00397      * - \e caps |= GravityModel::DISTURBANCE
00398      * - \e caps |= GravityModel::DISTURBING_POTENTIAL
00399      * - \e caps |= GravityModel::SPHERICAL_ANOMALY
00400      * - \e caps |= GravityModel::GEOID_HEIGHT
00401      * .
00402      * The default value of \e caps is GravityModel::ALL which turns on all the
00403      * capabilities.  If an unsupported function is invoked, it will return
00404      * NaNs.  Note that GravityModel::GEOID_HEIGHT will only be honored if \e h
00405      * = 0.
00406      *
00407      * If the field at several points on a circle of latitude need to be
00408      * calculated then creating a GravityCircle object and using its member
00409      * functions will be substantially faster, especially for high-degree
00410      * models.  See \ref gravityparallel for an example of using GravityCircle
00411      * (together with OpenMP) to speed up the computation of geoid heights.
00412      **********************************************************************/
00413     GravityCircle Circle(real lat, real h, unsigned caps = ALL) const;
00414     ///@}
00415 
00416     /** \name Inspector functions
00417      **********************************************************************/
00418     ///@{
00419 
00420     /**
00421      * @return the NormalGravity object for the reference ellipsoid.
00422      **********************************************************************/
00423     const NormalGravity& ReferenceEllipsoid() const throw() { return _earth; }
00424 
00425     /**
00426      * @return the description of the gravity model, if available, in the data
00427      *   file; if absent, return "NONE".
00428      **********************************************************************/
00429     const std::string& Description() const throw() { return _description; }
00430 
00431     /**
00432      * @return date of the model; if absent, return "UNKNOWN".
00433      **********************************************************************/
00434     const std::string& DateTime() const throw() { return _date; }
00435 
00436     /**
00437      * @return full file name used to load the gravity model.
00438      **********************************************************************/
00439     const std::string& GravityFile() const throw() { return _filename; }
00440 
00441     /**
00442      * @return "name" used to load the gravity model (from the first argument
00443      *   of the constructor, but this may be overridden by the model file).
00444      **********************************************************************/
00445     const std::string& GravityModelName() const throw() { return _name; }
00446 
00447     /**
00448      * @return directory used to load the gravity model.
00449      **********************************************************************/
00450     const std::string& GravityModelDirectory() const throw() { return _dir; }
00451 
00452     /**
00453      * @return \e a the equatorial radius of the ellipsoid (meters).
00454      **********************************************************************/
00455     Math::real MajorRadius() const throw() { return _earth.MajorRadius(); }
00456 
00457     /**
00458      * @return \e GM the mass constant of the model
00459      *   (m<sup>3</sup> s<sup>-2</sup>); this is the product of \e G the
00460      *   gravitational constant and \e M the mass of the earth (usually
00461      *   including the mass of the earth's atmosphere).
00462      **********************************************************************/
00463     Math::real MassConstant() const throw() { return _GMmodel; }
00464 
00465     /**
00466      * @return \e GM the mass constant of the ReferenceEllipsoid()
00467      *   (m<sup>3</sup> s<sup>-2</sup>).
00468      **********************************************************************/
00469     Math::real ReferenceMassConstant() const throw()
00470     { return _earth.MassConstant(); }
00471 
00472     /**
00473      * @return \e omega the angular velocity of the model and the
00474      *   ReferenceEllipsoid() (rad s<sup>-1</sup>).
00475      **********************************************************************/
00476     Math::real AngularVelocity() const throw()
00477     { return _earth.AngularVelocity(); }
00478 
00479     /**
00480      * @return \e f the flattening of the ellipsoid.
00481      **********************************************************************/
00482     Math::real Flattening() const throw() { return _earth.Flattening(); }
00483     ///@}
00484 
00485     /**
00486      * @return the default path for gravity model data files.
00487      *
00488      * This is the value of the environment variable GRAVITY_PATH, if set;
00489      * otherwise, it is $GEOGRAPHICLIB_DATA/gravity if the environment variable
00490      * GEOGRAPHICLIB_DATA is set; otherwise, it is a compile-time default
00491      * (/usr/local/share/GeographicLib/gravity on non-Windows systems and
00492      * C:/Documents and Settings/All Users/Application
00493      * Data/GeographicLib/gravity on Windows systems).
00494      **********************************************************************/
00495     static std::string DefaultGravityPath();
00496 
00497     /**
00498      * @return the default name for the gravity model.
00499      *
00500      * This is the value of the environment variable GRAVITY_NAME, if set,
00501      * otherwise, it is "egm96".  The GravityModel class does not use
00502      * this function; it is just provided as a convenience for a calling
00503      * program when constructing a GravityModel object.
00504      **********************************************************************/
00505     static std::string DefaultGravityName();
00506   };
00507 
00508 } // namespace GeographicLib
00509 
00510 #if defined(_MSC_VER)
00511 #pragma warning (pop)
00512 #endif
00513 
00514 #endif  // GEOGRAPHICLIB_GRAVITYMODEL_HPP
geographiclib-1.21/doc/html/NormalGravity_8cpp.html0000644000175000017500000001135511745620415022215 0ustar frankiefrankie GeographicLib: NormalGravity.cpp File Reference
NormalGravity.cpp File Reference

Implementation for GeographicLib::NormalGravity class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_NORMALGRAVITY_CPP   "$Id: ccd3d6bd4bddefb0b40cbce0006d863f08d64db4 $"

Detailed Description

Implementation for GeographicLib::NormalGravity class.

Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file NormalGravity.cpp.


Define Documentation

#define GEOGRAPHICLIB_NORMALGRAVITY_CPP   "$Id: ccd3d6bd4bddefb0b40cbce0006d863f08d64db4 $"

Definition at line 12 of file NormalGravity.cpp.

geographiclib-1.21/doc/html/PolygonArea_8hpp.html0000644000175000017500000001274711745620414021651 0ustar frankiefrankie GeographicLib: PolygonArea.hpp File Reference
PolygonArea.hpp File Reference

Header for GeographicLib::PolygonArea class. More...

Go to the source code of this file.

Classes

class  GeographicLib::PolygonArea
 Polygon Areas. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_POLYGONAREA_HPP   "$Id: 7a339f312a9c977b9fccad3c0c8bfa9009d863e2 $"

Detailed Description

Header for GeographicLib::PolygonArea class.

Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file PolygonArea.hpp.


Define Documentation

#define GEOGRAPHICLIB_POLYGONAREA_HPP   "$Id: 7a339f312a9c977b9fccad3c0c8bfa9009d863e2 $"

Definition at line 11 of file PolygonArea.hpp.

geographiclib-1.21/doc/html/nav_f.png0000644000175000017500000000023711745620414017372 0ustar frankiefrankie‰PNG  IHDR8³»fIDATxíÝIB1 Q;uÛ¿@ÑÏh;áÚ ±aË !ŽÐ‹V½CÈíþ âŠÅÆ|c±˜¾™¶¶3èsÑFÐFP»S{PšSšsVãlN®F.F.“ã2’ˆüµ¤ï_U¿Œ¾˜Ïþ«‰ÈH Ým”°•IEND®B`‚geographiclib-1.21/doc/html/nav_h.png0000644000175000017500000000014111745620415017367 0ustar frankiefrankie‰PNG  IHDR ,é@(IDATxíݱ 0 A½2°ÁU¶— !kÜJrª¯ƒžZýÿÆo‡üèIEND®B`‚geographiclib-1.21/doc/html/functions_func_0x7a.html0000644000175000017500000001053311745620415022344 0ustar frankiefrankie GeographicLib: Class Members - Functions
 

- z -

geographiclib-1.21/doc/html/OSGB_8hpp_source.html0000644000175000017500000007233711745620414021544 0ustar frankiefrankie GeographicLib: OSGB.hpp Source File
OSGB.hpp
Go to the documentation of this file.
00001 /**
00002  * \file OSGB.hpp
00003  * \brief Header for GeographicLib::OSGB class
00004  *
00005  * Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_OSGB_HPP)
00011 #define GEOGRAPHICLIB_OSGB_HPP "$Id: e91367e693ad63bb500c953e9c21445bef017464 $"
00012 
00013 #include <string>
00014 #include <sstream>
00015 #include <GeographicLib/Constants.hpp>
00016 #include <GeographicLib/TransverseMercator.hpp>
00017 
00018 #if defined(_MSC_VER)
00019 // Squelch warnings about dll vs string
00020 #pragma warning (push)
00021 #pragma warning (disable: 4251)
00022 #endif
00023 
00024 namespace GeographicLib {
00025 
00026   /**
00027    * \brief Ordnance Survey grid system for Great Britain
00028    *
00029    * The class implements the coordinate system used by the Ordnance Survey for
00030    * maps of Great Britain and conversions to the grid reference system.
00031    *
00032    * See
00033    * - <a href="http://www.ordnancesurvey.co.uk/oswebsite/gps/docs/A_Guide_to_Coordinate_Systems_in_Great_Britain.pdf">
00034    * A guide to coordinate systems in Great Britain</a>
00035    * - <a href="http://www.ordnancesurvey.co.uk/oswebsite/gps/information/coordinatesystemsinfo/guidetonationalgrid/page1.html">
00036    * Guide to National Grid</a>
00037    *
00038    * \b WARNING: the latitudes and longitudes for the Ordnance Survey grid
00039    * system do not use the WGS84 datum.  Do not use the values returned by this
00040    * class in the UTMUPS, MGRS, or Geoid classes without first converting the
00041    * datum (and vice versa).
00042    *
00043    * Example of use:
00044    * \include example-OSGB.cpp
00045    **********************************************************************/
00046   class GEOGRAPHIC_EXPORT OSGB {
00047   private:
00048     typedef Math::real real;
00049     static const std::string letters_;
00050     static const std::string digits_;
00051     static const TransverseMercator OSGBTM_;
00052     static const real northoffset_;
00053     enum {
00054       base_ = 10,
00055       tile_ = 100000,
00056       tilelevel_ = 5,
00057       tilegrid_ = 5,
00058       tileoffx_ = 2 * tilegrid_,
00059       tileoffy_ = 1 * tilegrid_,
00060       minx_ = - tileoffx_ * tile_,
00061       miny_ = - tileoffy_ * tile_,
00062       maxx_ = (tilegrid_*tilegrid_ - tileoffx_) * tile_,
00063       maxy_ = (tilegrid_*tilegrid_ - tileoffy_) * tile_,
00064       // Maximum precision is um
00065       maxprec_ = 5 + 6,
00066     };
00067     static real computenorthoffset() throw();
00068     static void CheckCoords(real x, real y);
00069     OSGB();                     // Disable constructor
00070 
00071   public:
00072 
00073     /**
00074      * Forward projection, from geographic to OSGB coordinates.
00075      *
00076      * @param[in] lat latitude of point (degrees).
00077      * @param[in] lon longitude of point (degrees).
00078      * @param[out] x easting of point (meters).
00079      * @param[out] y northing of point (meters).
00080      * @param[out] gamma meridian convergence at point (degrees).
00081      * @param[out] k scale of projection at point.
00082      *
00083      * \e lat should be in the range [-90, 90]; \e lon and \e lon0 should be in
00084      * the range [-180, 360].
00085      **********************************************************************/
00086     static void Forward(real lat, real lon,
00087                         real& x, real& y, real& gamma, real& k) throw() {
00088       OSGBTM_.Forward(OriginLongitude(), lat, lon, x, y, gamma, k);
00089       x += FalseEasting();
00090       y += northoffset_;
00091     }
00092 
00093     /**
00094      * Reverse projection, from OSGB coordinates to geographic.
00095      *
00096      * @param[in] x easting of point (meters).
00097      * @param[in] y northing of point (meters).
00098      * @param[out] lat latitude of point (degrees).
00099      * @param[out] lon longitude of point (degrees).
00100      * @param[out] gamma meridian convergence at point (degrees).
00101      * @param[out] k scale of projection at point.
00102      *
00103      * The value of \e lon returned is in the range [-180, 180).
00104      **********************************************************************/
00105 
00106     static void Reverse(real x, real y,
00107                         real& lat, real& lon, real& gamma, real& k) throw() {
00108       x -= FalseEasting();
00109       y -= northoffset_;
00110       OSGBTM_.Reverse(OriginLongitude(), x, y, lat, lon, gamma, k);
00111     }
00112 
00113     /**
00114      * OSGB::Forward without returning the convergence and scale.
00115      **********************************************************************/
00116     static void Forward(real lat, real lon, real& x, real& y) throw() {
00117       real gamma, k;
00118       Forward(lat, lon, x, y, gamma, k);
00119     }
00120 
00121     /**
00122      * OSGB::Reverse without returning the convergence and scale.
00123      **********************************************************************/
00124     static void Reverse(real x, real y, real& lat, real& lon) throw() {
00125       real gamma, k;
00126       Reverse(x, y, lat, lon, gamma, k);
00127     }
00128 
00129     /**
00130      * Convert OSGB coordinates to a grid reference.
00131      *
00132      * @param[in] x easting of point (meters).
00133      * @param[in] y northing of point (meters).
00134      * @param[in] prec precision relative to 100 km.
00135      * @param[out] gridref National Grid reference.
00136      *
00137      * \e prec specifies the precision of the grid reference string as follows:
00138      * - prec = 0 (min), 100km
00139      * - prec = 1, 10km
00140      * - prec = 2, 1km
00141      * - prec = 3, 100m
00142      * - prec = 4, 10m
00143      * - prec = 5, 1m
00144      * - prec = 6, 0.1m
00145      * - prec = 11 (max), 1um
00146      *
00147      * The easting must be in the range [-1000 km, 1500 km) and the northing
00148      * must be in the range [-500 km, 2000 km).  An exception is thrown if
00149      * either the easting and northing is outside these bounds.  These bounds
00150      * are consistent with rules for the letter designations for the grid
00151      * system.
00152      **********************************************************************/
00153     static void GridReference(real x, real y, int prec, std::string& gridref);
00154 
00155     /**
00156      * Convert OSGB coordinates to a grid reference.
00157      *
00158      * @param[in] gridref National Grid reference.
00159      * @param[out] x easting of point (meters).
00160      * @param[out] y northing of point (meters).
00161      * @param[out] prec precision relative to 100 km.
00162      * @param[in] centerp if true (default), return center of the grid square,
00163      *   else return SW (lower left) corner.
00164      *
00165      * The grid reference must be of the form: two letters (not including I)
00166      * followed by an even number of digits (up to 22).
00167      **********************************************************************/
00168     static void GridReference(const std::string& gridref,
00169                               real& x, real& y, int& prec,
00170                               bool centerp = true);
00171 
00172     /** \name Inspector functions
00173      **********************************************************************/
00174     ///@{
00175     /**
00176      * @return \e a the equatorial radius of the Airy 1830 ellipsoid (meters).
00177      *
00178      * This is 20923713 ft converted to meters using the rule 1 ft =
00179      * 10^(9.48401603-10) m.  (The Airy 1830 value is returned because the OSGB
00180      * projection is based on this ellipsoid.)
00181      **********************************************************************/
00182     static Math::real MajorRadius() throw()
00183     // result is about 6377563.3960320664406 m
00184     { return real(20923713) * std::pow(real(10), real(0.48401603L) - 1); }
00185 
00186     /**
00187      * @return \e f the inverse flattening of the Airy 1830 ellipsoid.
00188      *
00189      * For the Airy 1830 ellipsoid, \e a = 20923713 ft and \e b = 20853810 ft;
00190      * thus the flattening = (20923713 - 20853810)/20923713 = 7767/2324857 =
00191      * 1/299.32496459...  (The Airy 1830 value is returned because the OSGB
00192      * projection is based on this ellipsoid.)
00193      **********************************************************************/
00194     static Math::real Flattening() throw()
00195     { return real(20923713 - 20853810) / real(20923713); }
00196 
00197     /// \cond SKIP
00198     /**
00199      * <b>DEPRECATED</b>
00200      * @return \e r the inverse flattening of the Airy 1830 ellipsoid.
00201      **********************************************************************/
00202     static Math::real InverseFlattening() throw() { return 1/Flattening(); }
00203     /// \endcond
00204 
00205     /**
00206      * @return \e k0 central scale for the OSGB projection (0.9996012717).
00207      **********************************************************************/
00208     static Math::real CentralScale() throw()
00209     { return real(0.9996012717L); }
00210 
00211     /**
00212      * @return latitude of the origin for the OSGB projection (49 degrees).
00213      **********************************************************************/
00214     static Math::real OriginLatitude() throw() { return real(49); }
00215 
00216     /**
00217      * @return longitude of the origin for the OSGB projection (-2 degrees).
00218      **********************************************************************/
00219     static Math::real OriginLongitude() throw() { return real(-2); }
00220 
00221     /**
00222      * @return false northing the OSGB projection (-100000 meters).
00223      **********************************************************************/
00224     static Math::real FalseNorthing() throw() { return real(-100000); }
00225 
00226     /**
00227      * @return false easting the OSGB projection (400000 meters).
00228      **********************************************************************/
00229     static Math::real FalseEasting() throw() { return real(400000); }
00230     ///@}
00231 
00232   };
00233 
00234 } // namespace GeographicLib
00235 
00236 #if defined(_MSC_VER)
00237 #pragma warning (pop)
00238 #endif
00239 
00240 #endif
geographiclib-1.21/doc/html/classGeographicLib_1_1GeographicErr.html0000644000175000017500000001373511745620414025317 0ustar frankiefrankie GeographicLib: GeographicLib::GeographicErr Class Reference
GeographicLib::GeographicErr Class Reference

Exception handling for GeographicLib. More...

#include <GeographicLib/Constants.hpp>

List of all members.

Public Member Functions

 GeographicErr (const std::string &msg)

Detailed Description

Exception handling for GeographicLib.

A class to handle exceptions. It's derived from std::runtime_error so it can be caught by the usual catch clauses.

Example of use:

// Example of using the GeographicLib::GeographicErr class
// $Id: aaa4cf5e9b5070f9a6307a59daabf578880b85d3 $

#include <iostream>
#include <GeographicLib/Constants.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    throw GeographicErr("Test throwing an exception");
  }
  catch (const GeographicErr& e) {
    cout << "Caught exception: " << e.what() << "\n";
  }
  return 0;
}

Constructor & Destructor Documentation

GeographicLib::GeographicErr::GeographicErr ( const std::string &  msg) [inline]

Constructor

Parameters:
[in]msga string message, which is accessible in the catch clause, via what().

Definition at line 323 of file Constants.hpp.


The documentation for this class was generated from the following file:
geographiclib-1.21/doc/html/PolygonArea_8cpp.html0000644000175000017500000001125111745620415021632 0ustar frankiefrankie GeographicLib: PolygonArea.cpp File Reference
PolygonArea.cpp File Reference

Implementation for GeographicLib::PolygonArea class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_POLYGONAREA_CPP   "$Id: ae2fce0b24653309ca8835d962b1a3e047a6768a $"

Detailed Description

Implementation for GeographicLib::PolygonArea class.

Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file PolygonArea.cpp.


Define Documentation

#define GEOGRAPHICLIB_POLYGONAREA_CPP   "$Id: ae2fce0b24653309ca8835d962b1a3e047a6768a $"

Definition at line 12 of file PolygonArea.cpp.

geographiclib-1.21/doc/html/classGeographicLib_1_1SphericalHarmonic1.html0000644000175000017500000010560011745620414026243 0ustar frankiefrankie GeographicLib: GeographicLib::SphericalHarmonic1 Class Reference
GeographicLib::SphericalHarmonic1 Class Reference

Spherical Harmonic series with a correction to the coefficients. More...

#include <GeographicLib/SphericalHarmonic1.hpp>

List of all members.

Public Types

enum  normalization { FULL, SCHMIDT }

Public Member Functions

 SphericalHarmonic1 (const std::vector< real > &C, const std::vector< real > &S, int N, const std::vector< real > &C1, const std::vector< real > &S1, int N1, real a, unsigned norm=FULL)
 SphericalHarmonic1 (const std::vector< real > &C, const std::vector< real > &S, int N, int nmx, int mmx, const std::vector< real > &C1, const std::vector< real > &S1, int N1, int nmx1, int mmx1, real a, unsigned norm=FULL)
 SphericalHarmonic1 ()
Math::real operator() (real tau, real x, real y, real z) const throw ()
Math::real operator() (real tau, real x, real y, real z, real &gradx, real &grady, real &gradz) const throw ()
CircularEngine Circle (real tau, real p, real z, bool gradp) const
const SphericalEngine::coeffCoefficients () const throw ()
const SphericalEngine::coeffCoefficients1 () const throw ()

Detailed Description

Spherical Harmonic series with a correction to the coefficients.

This classes is similar to SphericalHarmonic, except that the coefficients Cnm are replaced by Cnm + tau C'nm (and similarly for Snm).

Example of use:

// Example of using the GeographicLib::SphericalHarmonic1 class
// $Id: 9d964d2e64c201179a88e51697b508414ff8c800 $

#include <iostream>
#include <exception>
#include <vector>
#include <GeographicLib/SphericalHarmonic1.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    int N = 3, N1 = 2;                  // The maxium degrees
    double ca[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients
    vector<double> C(ca, ca + (N + 1) * (N + 2) / 2);
    double sa[] = {6, 5, 4, 3, 2, 1}; // sine coefficients
    vector<double> S(sa, sa + N * (N + 1) / 2);
    double cb[] = {1, 2, 3, 4, 5, 6};
    vector<double> C1(cb, cb + (N1 + 1) * (N1 + 2) / 2);
    double sb[] = {3, 2, 1};
    vector<double> S1(sb, sb + N1 * (N1 + 1) / 2);
    double a = 1;
    SphericalHarmonic1 h(C, S, N, C1, S1, N1, a);
    double tau = 0.1, x = 2, y = 3, z = 1;
    double v, vx, vy, vz;
    v = h(tau, x, y, z, vx, vy, vz);
    cout << v << " " << vx << " " << vy << " " << vz << "\n";
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Member Enumeration Documentation

Supported normalizations for associate Legendre polynomials.

Enumerator:
FULL 

Fully normalized associated Legendre polynomials. See SphericalHarmonic::FULL for documentation.

SCHMIDT 

Schmidt semi-normalized associated Legendre polynomials. See SphericalHarmonic::SCHMIDT for documentation.

Definition at line 37 of file SphericalHarmonic1.hpp.


Constructor & Destructor Documentation

GeographicLib::SphericalHarmonic1::SphericalHarmonic1 ( const std::vector< real > &  C,
const std::vector< real > &  S,
int  N,
const std::vector< real > &  C1,
const std::vector< real > &  S1,
int  N1,
real  a,
unsigned  norm = FULL 
) [inline]

Constructor with a full set of coefficients specified.

Parameters:
[in]Cthe coefficients Cnm.
[in]Sthe coefficients Snm.
[in]Nthe maximum degree and order of the sum
[in]C1the coefficients C'nm.
[in]S1the coefficients S'nm.
[in]N1the maximum degree and order of the correction coefficients C'nm and S'nm.
[in]athe reference radius appearing in the definition of the sum.
[in]normthe normalization for the associated Legendre polynomials, either SphericalHarmonic1::FULL (the default) or SphericalHarmonic1::SCHMIDT.

See SphericalHarmonic for the way the coefficients should be stored. N1 should satisfy N1 <= N.

The class stores pointers to the first elements of C, S, C', and S'. These arrays should not be altered or destroyed during the lifetime of a SphericalHarmonic object.

Definition at line 89 of file SphericalHarmonic1.hpp.

GeographicLib::SphericalHarmonic1::SphericalHarmonic1 ( const std::vector< real > &  C,
const std::vector< real > &  S,
int  N,
int  nmx,
int  mmx,
const std::vector< real > &  C1,
const std::vector< real > &  S1,
int  N1,
int  nmx1,
int  mmx1,
real  a,
unsigned  norm = FULL 
) [inline]

Constructor with a subset of coefficients specified.

Parameters:
[in]Cthe coefficients Cnm.
[in]Sthe coefficients Snm.
[in]Nthe degree used to determine the layout of C and S.
[in]nmxthe maximum degree used in the sum. The sum over n is from 0 thru nmx.
[in]mmxthe maximum order used in the sum. The sum over m is from 0 thru min(n, mmx).
[in]C1the coefficients C'nm.
[in]S1the coefficients S'nm.
[in]N1the degree used to determine the layout of C' and S'.
[in]nmx1the maximum degree used for C' and S'.
[in]mmx1the maximum order used for C' and S'.
[in]athe reference radius appearing in the definition of the sum.
[in]normthe normalization for the associated Legendre polynomials, either SphericalHarmonic1::FULL (the default) or SphericalHarmonic1::SCHMIDT.

The class stores pointers to the first elements of C, S, C', and S'. These arrays should not be altered or destroyed during the lifetime of a SphericalHarmonic object.

Definition at line 130 of file SphericalHarmonic1.hpp.

GeographicLib::SphericalHarmonic1::SphericalHarmonic1 ( ) [inline]

A default constructor so that the object can be created when the constructor for another object is initialized. This default object can then be reset with the default copy assignment operator.

Definition at line 152 of file SphericalHarmonic1.hpp.


Member Function Documentation

Math::real GeographicLib::SphericalHarmonic1::operator() ( real  tau,
real  x,
real  y,
real  z 
) const throw () [inline]

Compute a spherical harmonic sum with a correction term.

Parameters:
[in]taumultiplier for correction coefficients C' and S'.
[in]xcartesian coordinate.
[in]ycartesian coordinate.
[in]zcartesian coordinate.
Returns:
V the spherical harmonic sum.

This routine requires constant memory and thus never throws an exception.

Definition at line 166 of file SphericalHarmonic1.hpp.

Math::real GeographicLib::SphericalHarmonic1::operator() ( real  tau,
real  x,
real  y,
real  z,
real &  gradx,
real &  grady,
real &  gradz 
) const throw () [inline]

Compute a spherical harmonic sum with a correction term and its gradient.

Parameters:
[in]taumultiplier for correction coefficients C' and S'.
[in]xcartesian coordinate.
[in]ycartesian coordinate.
[in]zcartesian coordinate.
[out]gradxx component of the gradient
[out]gradyy component of the gradient
[out]gradzz component of the gradient
Returns:
V the spherical harmonic sum.

This is the same as the previous function, except that the components of the gradients of the sum in the x, y, and z directions are computed. This routine requires constant memory and thus never throws an exception.

Definition at line 201 of file SphericalHarmonic1.hpp.

CircularEngine GeographicLib::SphericalHarmonic1::Circle ( real  tau,
real  p,
real  z,
bool  gradp 
) const [inline]

Create a CircularEngine to allow the efficient evaluation of several points on a circle of latitude at a fixed value of tau.

Parameters:
[in]tauthe multiplier for the correction coefficients.
[in]pthe radius of the circle.
[in]zthe height of the circle above the equatorial plane.
[in]gradpif true the returned object will be able to compute the gradient of the sum.
Returns:
the CircularEngine object.

SphericalHarmonic1::operator()() exchanges the order of the sums in the definition, i.e., sum(n = 0..N)[sum(m = 0..n)[...]] becomes sum(m = 0..N)[sum(n = m..N)[...]]. SphericalHarmonic1::Circle performs the inner sum over degree n (which entails about N2 operations). Calling CircularEngine::operator()() on the returned object performs the outer sum over the order m (about N operations). This routine may throw a bad_alloc exception in the CircularEngine constructor.

See SphericalHarmonic::Circle for an example of its use.

Definition at line 240 of file SphericalHarmonic1.hpp.

Referenced by GeographicLib::GravityModel::Circle().

const SphericalEngine::coeff& GeographicLib::SphericalHarmonic1::Coefficients ( ) const throw () [inline]
Returns:
the zeroth SphericalEngine::coeff object.

Definition at line 264 of file SphericalHarmonic1.hpp.

const SphericalEngine::coeff& GeographicLib::SphericalHarmonic1::Coefficients1 ( ) const throw () [inline]
Returns:
the first SphericalEngine::coeff object.

Definition at line 269 of file SphericalHarmonic1.hpp.


The documentation for this class was generated from the following file:
geographiclib-1.21/doc/html/EllipticFunction_8hpp.html0000644000175000017500000001315511745620414022676 0ustar frankiefrankie GeographicLib: EllipticFunction.hpp File Reference
EllipticFunction.hpp File Reference

Header for GeographicLib::EllipticFunction class. More...

Go to the source code of this file.

Classes

class  GeographicLib::EllipticFunction
 Elliptic functions needed for TransverseMercatorExact. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP   "$Id: 30ac447643e48afcaf5ab4671fbf2b235008dabe $"

Detailed Description

Header for GeographicLib::EllipticFunction class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file EllipticFunction.hpp.


Define Documentation

#define GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP   "$Id: 30ac447643e48afcaf5ab4671fbf2b235008dabe $"

Definition at line 11 of file EllipticFunction.hpp.

geographiclib-1.21/doc/html/GeoCoords_8hpp.html0000644000175000017500000001262711745620414021312 0ustar frankiefrankie GeographicLib: GeoCoords.hpp File Reference
GeoCoords.hpp File Reference

Header for GeographicLib::GeoCoords class. More...

Go to the source code of this file.

Classes

class  GeographicLib::GeoCoords
 Conversion between geographic coordinates. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_GEOCOORDS_HPP   "$Id: e706d3a35c3be0e2beaf39041cac29beb468a5aa $"

Detailed Description

Header for GeographicLib::GeoCoords class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file GeoCoords.hpp.


Define Documentation

#define GEOGRAPHICLIB_GEOCOORDS_HPP   "$Id: e706d3a35c3be0e2beaf39041cac29beb468a5aa $"

Definition at line 11 of file GeoCoords.hpp.

geographiclib-1.21/doc/html/globals_defs.html0000644000175000017500000003321411745620414021106 0ustar frankiefrankie GeographicLib: File Members
 

- g -

- m -

- p -

- r -

- s -

- t -

- w -

geographiclib-1.21/doc/html/functions_rela.html0000644000175000017500000001236311745620414021477 0ustar frankiefrankie GeographicLib: Class Members - Related Functions geographiclib-1.21/doc/html/NormalGravity_8cpp_source.html0000644000175000017500000006616411745620414023604 0ustar frankiefrankie GeographicLib: NormalGravity.cpp Source File
NormalGravity.cpp
Go to the documentation of this file.
00001 /**
00002  * \file NormalGravity.cpp
00003  * \brief Implementation for GeographicLib::NormalGravity class
00004  *
00005  * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under
00006  * the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/NormalGravity.hpp>
00011 
00012 #define GEOGRAPHICLIB_NORMALGRAVITY_CPP \
00013   "$Id: ccd3d6bd4bddefb0b40cbce0006d863f08d64db4 $"
00014 
00015 RCSID_DECL(GEOGRAPHICLIB_NORMALGRAVITY_CPP)
00016 RCSID_DECL(GEOGRAPHICLIB_NORMALGRAVITY_HPP)
00017 
00018 namespace GeographicLib {
00019 
00020   using namespace std;
00021 
00022   NormalGravity::NormalGravity(real a, real GM, real omega, real f, real J2)
00023     : _a(a)
00024     , _GM(GM)
00025     , _omega(omega)
00026     , _f(f)
00027     , _J2(J2)
00028     , _omega2(Math::sq(_omega))
00029     , _aomega2(Math::sq(_omega * _a))
00030     {
00031       if (!(Math::isfinite(_a) && _a > 0))
00032         throw GeographicErr("Major radius is not positive");
00033       if (!(Math::isfinite(_GM) && _GM > 0))
00034         throw GeographicErr("Gravitational constants is not positive");
00035       bool flatp = _f > 0 && Math::isfinite(_f);
00036       if (_J2 > 0 && Math::isfinite(_J2) && flatp)
00037         throw GeographicErr("Cannot specify both f and J2");
00038       if (!(_J2 > 0 && Math::isfinite(_J2)) && !flatp)
00039         throw GeographicErr("Must specify one of f and J2");
00040       if (!(Math::isfinite(_omega) && _omega != 0))
00041         throw GeographicErr("Angular velocity is not non-zero");
00042       real K = 2 * _aomega2 * _a / (15 * _GM);
00043       if (flatp) {
00044         _e2 = _f * (2 - _f);
00045         _ep2 = _e2 / (1 - _e2);
00046         _q0 = qf(_ep2);
00047         _J2 = _e2 * ( 1 - K * sqrt(_e2) / _q0) / 3; // H+M, Eq 2-90
00048       } else {
00049         _e2 = 3 * _J2;          // See Moritz (1980), p 398.
00050         for (int j = 0; j < maxit_; ++j) {
00051           real e2a = _e2;
00052           real q0 = qf(_e2 / (1 - _e2));
00053           _e2 = 3 * _J2 + K * _e2 * sqrt(_e2) / q0;
00054           if (_e2 == e2a)
00055             break;
00056         }
00057         _f = _e2 / (1 + sqrt(1 - _e2));
00058         _ep2 = _e2 / (1 - _e2);
00059         _q0 = qf(_ep2);
00060       }
00061       _earth = Geocentric(_a, _f);
00062       _b = _a * (1 - _f);
00063       _E = a * sqrt(_e2);                               // H+M, Eq 2-54
00064       _U0 = _GM / _E * atan(sqrt(_ep2)) + _aomega2 / 3; // H+M, Eq 2-61
00065       // The approximate ratio of the centrifugal acceleration (at the equator)
00066       // to gravity.
00067       _m = _aomega2 * _b / _GM;                         // H+M, Eq 2-70
00068       real
00069         Q = _m * sqrt(_ep2) * qpf(_ep2) / (3 * _q0),
00070         G = (1 - _m - Q / 2);
00071       _gammae = _GM / (_a * _b) * G;       // H+M, Eq 2-73
00072       _gammap = _GM / (_a * _a) * (1 + Q); // H+M, Eq 2-74
00073       // k = b * gammap / (a * gammae) - 1
00074       _k = (_m + 3 * Q / 2 - _e2 * (1 + Q)) / G;
00075       // f* = (gammap - gammae) / gammae
00076       _fstar = (_m + 3 * Q / 2 - _f * (1 + Q)) / G;
00077     }
00078 
00079   const NormalGravity
00080   NormalGravity::WGS84(Constants::WGS84_a<real>(), Constants::WGS84_GM<real>(),
00081                        Constants::WGS84_omega<real>(),
00082                        Constants::WGS84_f<real>(), 0);
00083 
00084   const NormalGravity
00085   NormalGravity::GRS80(Constants::GRS80_a<real>(), Constants::GRS80_GM<real>(),
00086                        Constants::GRS80_omega<real>(),
00087                        0, Constants::GRS80_J2<real>());
00088 
00089   Math::real NormalGravity::qf(real ep2) throw() {
00090     // Compute
00091     //
00092     //   ((1 + 3/e'^2) * atan(e') - 3/e')/2
00093     //
00094     // See H+M, Eq 2-57, with E/u = e'.  This suffers from two levels of
00095     // cancelation.  The e'^-1 and e'^1 terms drop out, so that the leading
00096     // term is O(e'^3).
00097     real ep = sqrt(ep2);
00098     if (abs(ep2) > real(0.5))  // Use the closed expression
00099       return ((1 + 3 / ep2) * atan(ep) - 3 / ep)/2;
00100     else {
00101       real ep2n = 1, q = 0;     // The series expansion H+M, Eq 2-86
00102       for (int n = 1; ; ++n) {
00103         ep2n *= -ep2;
00104         real
00105           t = (ep2n * n) / ((2 * n + 1) * (2 * n + 3)),
00106           qn = q + t;
00107         if (qn == q)
00108           break;
00109         q = qn;
00110       }
00111       q *= -2 * ep;
00112       return q;
00113     }
00114   }
00115 
00116   Math::real NormalGravity::qpf(real ep2) throw() {
00117     // Compute
00118     //
00119     //   3*(1 + 1/e'^2) * (1 - atan(e')/e') - 1
00120     //
00121     // See H+M, Eq 2-67, with E/u = e'.  This suffers from two levels of
00122     // cancelation.  The e'^-2 and e'^0 terms drop out, so that the leading
00123     // term is O(e'^2).
00124     if (abs(ep2) > real(0.5)) { // Use the closed expression
00125       real ep = sqrt(ep2);
00126       return 3 * (1 + 1 / ep2) * (1 - atan(ep) / ep) - 1;
00127     } else {
00128       real ep2n = 1, qp = 0;    // The series expansion H+M, Eq 2-101c
00129       for (int n = 1; ; ++n) {
00130         ep2n *= -ep2;
00131         real
00132           t = ep2n / ((2 * n + 1) * (2 * n + 3)),
00133           qpn = qp + t;
00134         if (qpn == qp)
00135           break;
00136         qp = qpn;
00137       }
00138       qp *= -6;
00139       return qp;
00140     }
00141   }
00142 
00143   Math::real NormalGravity::Jn(int n) const throw() {
00144     // Note Jn(0) = -1; Jn(2) = _J2; Jn(odd) = 0
00145     if (n & 1 || n < 0)
00146       return 0;
00147     n /= 2;
00148     real e2n = 1;            // Perhaps this should just be e2n = pow(-_e2, n);
00149     for (int j = n; j--;)
00150       e2n *= -_e2;
00151     return                      // H+M, Eq 2-92
00152       -3 * e2n * (1 - n + 5 * n * _J2 / _e2) / ((2 * n + 1) * (2 * n + 3));
00153   }
00154 
00155   Math::real NormalGravity::SurfaceGravity(real lat) const throw() {
00156     real
00157       phi = lat * Math::degree<real>(),
00158       sphi2 = abs(lat) == 90 ? 1 : Math::sq(sin(phi));
00159     // H+M, Eq 2-78
00160     return _gammae * (1 + _k * sphi2) / sqrt(1 - _e2 * sphi2);
00161   }
00162 
00163   Math::real NormalGravity::V0(real X, real Y, real Z,
00164                                real& GammaX, real& GammaY, real& GammaZ)
00165     const throw() {
00166     // See H+M, Sec 6-2
00167     real
00168       p = Math::hypot(X, Y),
00169       clam = p ? X/p : 1,
00170       slam = p ? Y/p : 0,
00171       r = Math::hypot(p, Z),
00172       Q = Math::sq(r) - Math::sq(_E),
00173       t2 = Math::sq(2 * _E * Z),
00174       disc = sqrt(Math::sq(Q) + t2),
00175       // This is H+M, Eq 6-8a, but generalized to deal with Q negative
00176       // accurately.
00177       u = sqrt((Q >= 0 ? (Q + disc) : t2 / (disc - Q)) / 2),
00178       uE = Math::hypot(u, _E),
00179       // H+M, Eq 6-8b
00180       sbet = Z * uE,
00181       cbet = p * u,
00182       s = Math::hypot(cbet, sbet);
00183     cbet = s ? cbet/s : 0;
00184     sbet = s ? sbet/s : 1;
00185     real
00186       invw = uE / Math::hypot(u, _E * sbet), // H+M, Eq 2-63
00187       ep = _E/u,
00188       ep2 = Math::sq(ep),
00189       q = qf(ep2) / _q0,
00190       qp = qpf(ep2) / _q0,
00191       // H+M, Eqs 2-62 + 6-9, but omitting last (rotational) term .
00192       Vres = (_GM / _E * atan(_E / u)
00193               + _aomega2 * q * (Math::sq(sbet) - 1/real(3)) / 2),
00194       // H+M, Eq 6-10
00195       gamu = - invw * (_GM
00196                        + (_aomega2 * _E * qp
00197                           * (Math::sq(sbet) - 1/real(3)) / 2)) / Math::sq(uE),
00198       gamb = _aomega2 * q * sbet * cbet * invw / uE,
00199       t = u * invw / uE;
00200     // H+M, Eq 6-12
00201     GammaX = t * cbet * gamu - invw * sbet * gamb;
00202     GammaY = GammaX * slam;
00203     GammaX *= clam;
00204     GammaZ = invw * sbet * gamu + t * cbet * gamb;
00205     return Vres;
00206   }
00207 
00208   Math::real NormalGravity::Phi(real X, real Y, real& fX, real& fY)
00209     const throw() {
00210     fX = _omega2 * X;
00211     fY = _omega2 * Y;
00212     // N.B. fZ = 0;
00213     return _omega2 * (Math::sq(X) + Math::sq(Y)) / 2;
00214   }
00215 
00216   Math::real NormalGravity::U(real X, real Y, real Z,
00217                               real& gammaX, real& gammaY, real& gammaZ)
00218     const throw() {
00219     real fX, fY;
00220     real Ures = V0(X, Y, Z, gammaX, gammaY, gammaZ) + Phi(X, Y, fX, fY);
00221     gammaX += fX;
00222     gammaY += fY;
00223     return Ures;
00224   }
00225 
00226   Math::real NormalGravity::Gravity(real lat, real h,
00227                                     real& gammay, real& gammaz)
00228     const throw() {
00229     real X, Y, Z;
00230     real M[Geocentric::dim2_];
00231     _earth.IntForward(lat, 0, h, X, Y, Z, M);
00232     real gammaX, gammaY, gammaZ,
00233       Ures = U(X, Y, Z, gammaX, gammaY, gammaZ);
00234     // gammax = M[0] * gammaX + M[3] * gammaY + M[6] * gammaZ;
00235     gammay = M[1] * gammaX + M[4] * gammaY + M[7] * gammaZ;
00236     gammaz = M[2] * gammaX + M[5] * gammaY + M[8] * gammaZ;
00237     return Ures;
00238   }
00239 
00240 } // namespace GeographicLib
geographiclib-1.21/doc/html/AlbersEqualArea_8hpp.html0000644000175000017500000001267311745620414022420 0ustar frankiefrankie GeographicLib: AlbersEqualArea.hpp File Reference
AlbersEqualArea.hpp File Reference

Header for GeographicLib::AlbersEqualArea class. More...

#include <algorithm>
#include <GeographicLib/Constants.hpp>

Go to the source code of this file.

Classes

class  GeographicLib::AlbersEqualArea
 Albers Equal Area Conic Projection. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_ALBERSEQUALAREA_HPP   "$Id: d17f37d1bec84543dc3753e882d8e95f1c1d5a1b $"

Detailed Description

Header for GeographicLib::AlbersEqualArea class.

Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file AlbersEqualArea.hpp.


Define Documentation

#define GEOGRAPHICLIB_ALBERSEQUALAREA_HPP   "$Id: d17f37d1bec84543dc3753e882d8e95f1c1d5a1b $"

Definition at line 11 of file AlbersEqualArea.hpp.

geographiclib-1.21/doc/html/functions_vars.html0000644000175000017500000001026011745620414021521 0ustar frankiefrankie GeographicLib: Class Members - Variables geographiclib-1.21/doc/html/classGeographicLib_1_1SphericalHarmonic2.html0000644000175000017500000012146711745620415026256 0ustar frankiefrankie GeographicLib: GeographicLib::SphericalHarmonic2 Class Reference
GeographicLib::SphericalHarmonic2 Class Reference

Spherical Harmonic series with two corrections to the coefficients. More...

#include <GeographicLib/SphericalHarmonic2.hpp>

List of all members.

Public Types

enum  normalization { FULL, SCHMIDT }

Public Member Functions

 SphericalHarmonic2 (const std::vector< real > &C, const std::vector< real > &S, int N, const std::vector< real > &C1, const std::vector< real > &S1, int N1, const std::vector< real > &C2, const std::vector< real > &S2, int N2, real a, unsigned norm=FULL)
 SphericalHarmonic2 (const std::vector< real > &C, const std::vector< real > &S, int N, int nmx, int mmx, const std::vector< real > &C1, const std::vector< real > &S1, int N1, int nmx1, int mmx1, const std::vector< real > &C2, const std::vector< real > &S2, int N2, int nmx2, int mmx2, real a, unsigned norm=FULL)
 SphericalHarmonic2 ()
Math::real operator() (real tau1, real tau2, real x, real y, real z) const throw ()
Math::real operator() (real tau1, real tau2, real x, real y, real z, real &gradx, real &grady, real &gradz) const throw ()
CircularEngine Circle (real tau1, real tau2, real p, real z, bool gradp) const
const SphericalEngine::coeffCoefficients () const throw ()
const SphericalEngine::coeffCoefficients1 () const throw ()
const SphericalEngine::coeffCoefficients2 () const throw ()

Detailed Description

Spherical Harmonic series with two corrections to the coefficients.

This classes is similar to SphericalHarmonic, except that the coefficients Cnm are replaced by Cnm + tau' C'nm + tau'' C''nm (and similarly for Snm).

Example of use:

// Example of using the GeographicLib::SphericalHarmonic2 class
// $Id: 123fa26549f23444cf8b29d2381f2a6e5e672b5f $

#include <iostream>
#include <exception>
#include <vector>
#include <GeographicLib/SphericalHarmonic2.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    int N = 3, N1 = 2, N2 = 1;                     // The maxium degrees
    double ca[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients
    vector<double> C(ca, ca + (N + 1) * (N + 2) / 2);
    double sa[] = {6, 5, 4, 3, 2, 1}; // sine coefficients
    vector<double> S(sa, sa + N * (N + 1) / 2);
    double cb[] = {1, 2, 3, 4, 5, 6};
    vector<double> C1(cb, cb + (N1 + 1) * (N1 + 2) / 2);
    double sb[] = {3, 2, 1};
    vector<double> S1(sb, sb + N1 * (N1 + 1) / 2);
    double cc[] = {2, 1};
    vector<double> C2(cc, cc + (N2 + 1));
    vector<double> S2;
    double a = 1;
    SphericalHarmonic2 h(C, S, N, N, N, C1, S1, N1, N1, N1,
                         C2, S2, N2, N2, 0, a);
    double tau1 = 0.1, tau2 = 0.05, x = 2, y = 3, z = 1;
    double v, vx, vy, vz;
    v = h(tau1, tau2, x, y, z, vx, vy, vz);
    cout << v << " " << vx << " " << vy << " " << vz << "\n";
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Member Enumeration Documentation

Supported normalizations for associate Legendre polynomials.

Enumerator:
FULL 

Fully normalized associated Legendre polynomials. See SphericalHarmonic::FULL for documentation.

SCHMIDT 

Schmidt semi-normalized associated Legendre polynomials. See SphericalHarmonic::SCHMIDT for documentation.

Definition at line 38 of file SphericalHarmonic2.hpp.


Constructor & Destructor Documentation

GeographicLib::SphericalHarmonic2::SphericalHarmonic2 ( const std::vector< real > &  C,
const std::vector< real > &  S,
int  N,
const std::vector< real > &  C1,
const std::vector< real > &  S1,
int  N1,
const std::vector< real > &  C2,
const std::vector< real > &  S2,
int  N2,
real  a,
unsigned  norm = FULL 
) [inline]

Constructor with a full set of coefficients specified.

Parameters:
[in]Cthe coefficients Cnm.
[in]Sthe coefficients Snm.
[in]Nthe maximum degree and order of the sum
[in]C1the coefficients C'nm.
[in]S1the coefficients S'nm.
[in]N1the maximum degree and order of the first correction coefficients C'nm and S'nm.
[in]C2the coefficients C''nm.
[in]S2the coefficients S''nm.
[in]N2the maximum degree and order of the second correction coefficients C'nm and S'nm.
[in]athe reference radius appearing in the definition of the sum.
[in]normthe normalization for the associated Legendre polynomials, either SphericalHarmonic2::FULL (the default) or SphericalHarmonic2::SCHMIDT.

See SphericalHarmonic for the way the coefficients should be stored. N1 and N2 should satisfy N1 <= N and N2 <= N.

The class stores pointers to the first elements of C, S, C', S', C'', and S''. These arrays should not be altered or destroyed during the lifetime of a SphericalHarmonic object.

Definition at line 94 of file SphericalHarmonic2.hpp.

GeographicLib::SphericalHarmonic2::SphericalHarmonic2 ( const std::vector< real > &  C,
const std::vector< real > &  S,
int  N,
int  nmx,
int  mmx,
const std::vector< real > &  C1,
const std::vector< real > &  S1,
int  N1,
int  nmx1,
int  mmx1,
const std::vector< real > &  C2,
const std::vector< real > &  S2,
int  N2,
int  nmx2,
int  mmx2,
real  a,
unsigned  norm = FULL 
) [inline]

Constructor with a subset of coefficients specified.

Parameters:
[in]Cthe coefficients Cnm.
[in]Sthe coefficients Snm.
[in]Nthe degree used to determine the layout of C and S.
[in]nmxthe maximum degree used in the sum. The sum over n is from 0 thru nmx.
[in]mmxthe maximum order used in the sum. The sum over m is from 0 thru min(n, mmx).
[in]C1the coefficients C'nm.
[in]S1the coefficients S'nm.
[in]N1the degree used to determine the layout of C' and S'.
[in]nmx1the maximum degree used for C' and S'.
[in]mmx1the maximum order used for C' and S'.
[in]C2the coefficients C''nm.
[in]S2the coefficients S''nm.
[in]N2the degree used to determine the layout of C'' and S''.
[in]nmx2the maximum degree used for C'' and S''.
[in]mmx2the maximum order used for C'' and S''.
[in]athe reference radius appearing in the definition of the sum.
[in]normthe normalization for the associated Legendre polynomials, either SphericalHarmonic2::FULL (the default) or SphericalHarmonic2::SCHMIDT.

The class stores pointers to the first elements of C, S, C', S', C'', and S''. These arrays should not be altered or destroyed during the lifetime of a SphericalHarmonic object.

Definition at line 145 of file SphericalHarmonic2.hpp.

GeographicLib::SphericalHarmonic2::SphericalHarmonic2 ( ) [inline]

A default constructor so that the object can be created when the constructor for another object is initialized. This default object can then be reset with the default copy assignment operator.

Definition at line 171 of file SphericalHarmonic2.hpp.


Member Function Documentation

Math::real GeographicLib::SphericalHarmonic2::operator() ( real  tau1,
real  tau2,
real  x,
real  y,
real  z 
) const throw () [inline]

Compute a spherical harmonic sum with two correction terms.

Parameters:
[in]tau1multiplier for correction coefficients C' and S'.
[in]tau2multiplier for correction coefficients C'' and S''.
[in]xcartesian coordinate.
[in]ycartesian coordinate.
[in]zcartesian coordinate.
Returns:
V the spherical harmonic sum.

This routine requires constant memory and thus never throws an exception.

Definition at line 186 of file SphericalHarmonic2.hpp.

Math::real GeographicLib::SphericalHarmonic2::operator() ( real  tau1,
real  tau2,
real  x,
real  y,
real  z,
real &  gradx,
real &  grady,
real &  gradz 
) const throw () [inline]

Compute a spherical harmonic sum with two correction terms and its gradient.

Parameters:
[in]tau1multiplier for correction coefficients C' and S'.
[in]tau2multiplier for correction coefficients C'' and S''.
[in]xcartesian coordinate.
[in]ycartesian coordinate.
[in]zcartesian coordinate.
[out]gradxx component of the gradient
[out]gradyy component of the gradient
[out]gradzz component of the gradient
Returns:
V the spherical harmonic sum.

This is the same as the previous function, except that the components of the gradients of the sum in the x, y, and z directions are computed. This routine requires constant memory and thus never throws an exception.

Definition at line 223 of file SphericalHarmonic2.hpp.

CircularEngine GeographicLib::SphericalHarmonic2::Circle ( real  tau1,
real  tau2,
real  p,
real  z,
bool  gradp 
) const [inline]

Create a CircularEngine to allow the efficient evaluation of several points on a circle of latitude at fixed values of tau1 and tau2.

Parameters:
[in]tau1multiplier for correction coefficients C' and S'.
[in]tau2multiplier for correction coefficients C'' and S''.
[in]pthe radius of the circle.
[in]zthe height of the circle above the equatorial plane.
[in]gradpif true the returned object will be able to compute the gradient of the sum.
Returns:
the CircularEngine object.

SphericalHarmonic2::operator()() exchanges the order of the sums in the definition, i.e., sum(n = 0..N)[sum(m = 0..n)[...]] becomes sum(m = 0..N)[sum(n = m..N)[...]]. SphericalHarmonic2::Circle performs the inner sum over degree n (which entails about N2 operations). Calling CircularEngine::operator()() on the returned object performs the outer sum over the order m (about N operations). This routine may throw a bad_alloc exception in the CircularEngine constructor.

See SphericalHarmonic::Circle for an example of its use.

Definition at line 263 of file SphericalHarmonic2.hpp.

const SphericalEngine::coeff& GeographicLib::SphericalHarmonic2::Coefficients ( ) const throw () [inline]
Returns:
the zeroth SphericalEngine::coeff object.

Definition at line 288 of file SphericalHarmonic2.hpp.

const SphericalEngine::coeff& GeographicLib::SphericalHarmonic2::Coefficients1 ( ) const throw () [inline]
Returns:
the first SphericalEngine::coeff object.

Definition at line 293 of file SphericalHarmonic2.hpp.

const SphericalEngine::coeff& GeographicLib::SphericalHarmonic2::Coefficients2 ( ) const throw () [inline]
Returns:
the second SphericalEngine::coeff object.

Definition at line 298 of file SphericalHarmonic2.hpp.


The documentation for this class was generated from the following file:
geographiclib-1.21/doc/html/Planimeter_8cpp_source.html0000644000175000017500000005404111745620414023075 0ustar frankiefrankie GeographicLib: Planimeter.cpp Source File
Planimeter.cpp
Go to the documentation of this file.
00001 /**
00002  * \file Planimeter.cpp
00003  * \brief Command line utility for measuring the area of geodesic polygons
00004  *
00005  * Copyright (c) Charles Karney (2010-2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  *
00009  * Compile and link with
00010  *   g++ -g -O3 -I../include -I../man -o Planimeter \
00011  *       Planimeter.cpp \
00012  *       ../src/DMS.cpp \
00013  *       ../src/GeoCoords.cpp \
00014  *       ../src/Geodesic.cpp \
00015  *       ../src/GeodesicLine.cpp \
00016  *       ../src/MGRS.cpp \
00017  *       ../src/PolarStereographic.cpp \
00018  *       ../src/PolygonArea.cpp \
00019  *       ../src/TransverseMercator.cpp \
00020  *       ../src/UTMUPS.cpp
00021  *
00022  * See the <a href="Planimeter.1.html">man page</a> for usage
00023  * information.
00024  **********************************************************************/
00025 
00026 #include <iostream>
00027 #include <string>
00028 #include <sstream>
00029 #include <fstream>
00030 #include <GeographicLib/PolygonArea.hpp>
00031 #include <GeographicLib/DMS.hpp>
00032 #include <GeographicLib/Utility.hpp>
00033 #include <GeographicLib/GeoCoords.hpp>
00034 
00035 #include "Planimeter.usage"
00036 
00037 int main(int argc, char* argv[]) {
00038   try {
00039     using namespace GeographicLib;
00040     typedef Math::real real;
00041     real
00042       a = Constants::WGS84_a<real>(),
00043       f = Constants::WGS84_f<real>();
00044     bool reverse = false, sign = true, polyline = false;
00045     std::string istring, ifile, ofile, cdelim;
00046     char lsep = ';';
00047 
00048     for (int m = 1; m < argc; ++m) {
00049       std::string arg(argv[m]);
00050       if (arg == "-r")
00051         reverse = !reverse;
00052       else if (arg == "-s")
00053         sign = !sign;
00054       else if (arg == "-l")
00055         polyline = !polyline;
00056       else if (arg == "-e") {
00057         if (m + 2 >= argc) return usage(1, true);
00058         try {
00059           a = Utility::num<real>(std::string(argv[m + 1]));
00060           f = Utility::fract<real>(std::string(argv[m + 2]));
00061         }
00062         catch (const std::exception& e) {
00063           std::cerr << "Error decoding arguments of -e: " << e.what() << "\n";
00064           return 1;
00065         }
00066         m += 2;
00067       } else if (arg == "--input-string") {
00068         if (++m == argc) return usage(1, true);
00069         istring = argv[m];
00070       } else if (arg == "--input-file") {
00071         if (++m == argc) return usage(1, true);
00072         ifile = argv[m];
00073       } else if (arg == "--output-file") {
00074         if (++m == argc) return usage(1, true);
00075         ofile = argv[m];
00076       } else if (arg == "--line-separator") {
00077         if (++m == argc) return usage(1, true);
00078         if (std::string(argv[m]).size() != 1) {
00079           std::cerr << "Line separator must be a single character\n";
00080           return 1;
00081         }
00082         lsep = argv[m][0];
00083       } else if (arg == "--comment-delimiter") {
00084         if (++m == argc) return usage(1, true);
00085         cdelim = argv[m];
00086       } else if (arg == "--version") {
00087         std::cout
00088           << argv[0]
00089           << ": $Id: dbb8a9a0d79f172256044e72f65ebc667801eeac $\n"
00090           << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n";
00091         return 0;
00092       } else
00093         return usage(!(arg == "-h" || arg == "--help"), arg != "--help");
00094     }
00095 
00096     if (!ifile.empty() && !istring.empty()) {
00097       std::cerr << "Cannot specify --input-string and --input-file together\n";
00098       return 1;
00099     }
00100     if (ifile == "-") ifile.clear();
00101     std::ifstream infile;
00102     std::istringstream instring;
00103     if (!ifile.empty()) {
00104       infile.open(ifile.c_str());
00105       if (!infile.is_open()) {
00106         std::cerr << "Cannot open " << ifile << " for reading\n";
00107         return 1;
00108       }
00109     } else if (!istring.empty()) {
00110       std::string::size_type m = 0;
00111       while (true) {
00112         m = istring.find(lsep, m);
00113         if (m == std::string::npos)
00114           break;
00115         istring[m] = '\n';
00116       }
00117       instring.str(istring);
00118     }
00119     std::istream* input = !ifile.empty() ? &infile :
00120       (!istring.empty() ? &instring : &std::cin);
00121 
00122     std::ofstream outfile;
00123     if (ofile == "-") ofile.clear();
00124     if (!ofile.empty()) {
00125       outfile.open(ofile.c_str());
00126       if (!outfile.is_open()) {
00127         std::cerr << "Cannot open " << ofile << " for writing\n";
00128         return 1;
00129       }
00130     }
00131     std::ostream* output = !ofile.empty() ? &outfile : &std::cout;
00132 
00133     const Geodesic geod(a, f);
00134     PolygonArea poly(geod, polyline);
00135     GeoCoords p;
00136 
00137     std::string s;
00138     real perimeter, area;
00139     unsigned num;
00140     std::string eol("\n");
00141     while (std::getline(*input, s)) {
00142       if (!cdelim.empty()) {
00143         std::string::size_type m = s.find(cdelim);
00144         if (m != std::string::npos) {
00145           eol = " " + s.substr(m) + "\n";
00146           s = s.substr(0, m);
00147         }
00148       }
00149       bool endpoly = s.empty();
00150       if (!endpoly) {
00151         try {
00152           p.Reset(s);
00153           if (Math::isnan(p.Latitude()) || Math::isnan(p.Longitude()))
00154             endpoly = true;
00155         }
00156         catch (const GeographicErr&) {
00157           endpoly = true;
00158         }
00159       }
00160       if (endpoly) {
00161         num = poly.Compute(reverse, sign, perimeter, area);
00162         if (num > 0) {
00163           *output << num << " "
00164                   << Utility::str<real>(perimeter, 8);
00165           if (!polyline)
00166             *output << " " << Utility::str<real>(area, 3);
00167           *output << eol;
00168         }
00169         poly.Clear();
00170         eol = "\n";
00171       } else
00172         poly.AddPoint(p.Latitude(), p.Longitude());
00173     }
00174     num = poly.Compute(reverse, sign, perimeter, area);
00175     if (num > 0) {
00176       *output << num << " "
00177               << Utility::str<real>(perimeter, 8);
00178       if (!polyline)
00179         *output << " " << Utility::str<real>(area, 3);
00180       *output << eol;
00181     }
00182     poly.Clear();
00183     eol = "\n";
00184     return 0;
00185   }
00186   catch (const std::exception& e) {
00187     std::cerr << "Caught exception: " << e.what() << "\n";
00188     return 1;
00189   }
00190   catch (...) {
00191     std::cerr << "Caught unknown exception\n";
00192     return 1;
00193   }
00194 }
geographiclib-1.21/doc/html/classGeographicLib_1_1Utility.html0000644000175000017500000012322311745620414024233 0ustar frankiefrankie GeographicLib: GeographicLib::Utility Class Reference
GeographicLib::Utility Class Reference

Some utility routines for GeographicLib. More...

#include <GeographicLib/Utility.hpp>

List of all members.

Static Public Member Functions

static int day (int y, int m=1, int d=1) throw ()
static int day (int y, int m, int d, bool check)
static void date (int s, int &y, int &m, int &d) throw ()
static void date (const std::string &s, int &y, int &m, int &d)
static int dow (int y, int m, int d) throw ()
static int dow (int s) throw ()
template<typename T >
static T fractionalyear (const std::string &s)
template<typename T >
static std::string str (T x, int p=-1)
template<typename T >
static T num (const std::string &s)
template<typename T >
static T nummatch (const std::string &s)
template<typename T >
static T fract (const std::string &s)
static int lookup (const std::string &s, char c) throw ()
template<typename ExtT , typename IntT , bool bigendp>
static void readarray (std::istream &str, IntT array[], size_t num)
template<typename ExtT , typename IntT , bool bigendp>
static void readarray (std::istream &str, std::vector< IntT > &array)
template<typename ExtT , typename IntT , bool bigendp>
static void writearray (std::ostream &str, const IntT array[], size_t num)
template<typename ExtT , typename IntT , bool bigendp>
static void writearray (std::ostream &str, std::vector< IntT > &array)
static bool ParseLine (const std::string &line, std::string &key, std::string &val)

Detailed Description

Some utility routines for GeographicLib.

Example of use:

// Example of using the GeographicLib::Utility class
// $Id: 34856fc274a1db91814bb96768a6c8feee03dacc $

#include <iostream>
#include <exception>
#include <GeographicLib/Utility.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    int
      d1 = Utility::day(1939, 9, 3),  // Britain declares war on Germany
      d2 = Utility::day(1945, 8, 15); // Japan surrenders
    cout << d2 - d1 << "\n";          // Length of Second World War for Britain
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Member Function Documentation

static int GeographicLib::Utility::day ( int  y,
int  m = 1,
int  d = 1 
) throw () [inline, static]

Convert a date to the day numbering sequentially starting with 0001-01-01 as day 1.

Parameters:
[in]ythe year (must be positive).
[in]mthe month, Jan = 1, etc. (must be positive). Default = 1.
[in]dthe day of the month (must be positive). Default = 1.
Returns:
the sequential day number.

Definition at line 55 of file Utility.hpp.

static int GeographicLib::Utility::day ( int  y,
int  m,
int  d,
bool  check 
) [inline, static]

Convert a date to the day numbering sequentially starting with 0001-01-01 as day 1.

Parameters:
[in]ythe year (must be positive).
[in]mthe month, Jan = 1, etc. (must be positive). Default = 1.
[in]dthe day of the month (must be positive). Default = 1.
[in]checkwhether to check the date.
Returns:
the sequential day number.

If check is true and the date is invalid an exception is thrown.

Definition at line 119 of file Utility.hpp.

static void GeographicLib::Utility::date ( int  s,
int &  y,
int &  m,
int &  d 
) throw () [inline, static]

Given a day (counting from 0001-01-01 as day 1), return the date.

Parameters:
[in]sthe sequential day number (must be positive)
[out]ythe year.
[out]mthe month, Jan = 1, etc.
[out]dthe day of the month.

Definition at line 142 of file Utility.hpp.

static void GeographicLib::Utility::date ( const std::string &  s,
int &  y,
int &  m,
int &  d 
) [inline, static]

Given a date as a string in the format yyyy, yyyy-mm, or yyyy-mm-dd, return the numeric values for the year, month, and day. No checking is done on these values.

Parameters:
[in]sthe date in string format.
[out]ythe year.
[out]mthe month, Jan = 1, etc.
[out]dthe day of the month.

Definition at line 173 of file Utility.hpp.

static int GeographicLib::Utility::dow ( int  y,
int  m,
int  d 
) throw () [inline, static]

Given the date, return the day of the week.

Parameters:
[in]ythe year (must be positive).
[in]mthe month, Jan = 1, etc. (must be positive).
[in]dthe day of the month (must be positive).
Returns:
the day of the week with Sunday, Monday - Saturday = 0, 1 - 6.

Definition at line 212 of file Utility.hpp.

References dow().

Referenced by dow().

static int GeographicLib::Utility::dow ( int  s) throw () [inline, static]

Given the sequential day, return the day of the week.

Parameters:
[in]sthe sequential day (must be positive).
Returns:
the day of the week with Sunday, Monday - Saturday = 0, 1 - 6.

Definition at line 220 of file Utility.hpp.

template<typename T >
static T GeographicLib::Utility::fractionalyear ( const std::string &  s) [inline, static]

Convert a string representing a date to a fractional year.

Template Parameters:
Tthe type of the argument.
Parameters:
[in]sthe string to be converted.
Returns:
the fractional year.

The string is first read as an ordinary number (e.g., 2010 or 2012.5); if this is successful, the value is returned. Otherwise the string should be of the form yyyy-mm or yyyy-mm-dd and this is converted to a number with 2010-01-01 giving 2010.0 and 2012-07-03 giving 2012.5.

Definition at line 236 of file Utility.hpp.

template<typename T >
static std::string GeographicLib::Utility::str ( x,
int  p = -1 
) [inline, static]

Convert a object of type T to a string.

Template Parameters:
Tthe type of the argument.
Parameters:
[in]xthe value to be converted.
[in]pthe precision used (default -1).
Returns:
the string representation.

If p >= 0, then the number fixed format is used with p bits of precision. With p < 0, there is no manipulation of the format.

Definition at line 259 of file Utility.hpp.

Referenced by main().

template<typename T >
static T GeographicLib::Utility::num ( const std::string &  s) [inline, static]

Convert a string to an object of type T.

Template Parameters:
Tthe type of the return value.
Parameters:
[in]sthe string to be converted.
Returns:
object of type T

Definition at line 275 of file Utility.hpp.

template<typename T >
static T GeographicLib::Utility::nummatch ( const std::string &  s) [inline, static]

Match "nan" and "inf" (and variants thereof) in a string.

Template Parameters:
Tthe type of the return value.
Parameters:
[in]sthe string to be matched.
Returns:
appropriate special value (+/-inf, nan) or 0 is none is found.

Definition at line 304 of file Utility.hpp.

template<typename T >
static T GeographicLib::Utility::fract ( const std::string &  s) [inline, static]

Read a simple fraction, e.g., 3/4, from a string to an object of type T.

Template Parameters:
Tthe type of the return value.
Parameters:
[in]sthe string to be converted.
Returns:
object of type T

Definition at line 334 of file Utility.hpp.

static int GeographicLib::Utility::lookup ( const std::string &  s,
char  c 
) throw () [inline, static]

Lookup up a character in a string.

Parameters:
[in]sthe string to be searched.
[in]cthe character to look for.
Returns:
the index of the first occurrence character in the string or -1 is the character is not present.

c is converted to upper case before search s. Therefore, it is intended that s should not contain any lower case letters.

Definition at line 354 of file Utility.hpp.

template<typename ExtT , typename IntT , bool bigendp>
static void GeographicLib::Utility::readarray ( std::istream &  str,
IntT  array[],
size_t  num 
) [inline, static]

Read data of type ExtT from a binary stream to an array of type IntT. The data in the file is in (bigendp ? big : little)-endian format.

Template Parameters:
ExtTthe type of the objects in the binary stream (external).
IntTthe type of the objects in the array (internal).
bigendptrue if the external storage format is big-endian.
Parameters:
[in]strthe input stream containing the data of type ExtT (external).
[out]arraythe output array of type IntT (internal).
[in]numthe size of the array.

Definition at line 372 of file Utility.hpp.

References GeographicLib::Math::bigendian.

template<typename ExtT , typename IntT , bool bigendp>
static void GeographicLib::Utility::readarray ( std::istream &  str,
std::vector< IntT > &  array 
) [inline, static]

Read data of type ExtT from a binary stream to a vector array of type IntT. The data in the file is in (bigendp ? big : little)-endian format.

Template Parameters:
ExtTthe type of the objects in the binary stream (external).
IntTthe type of the objects in the array (internal).
bigendptrue if the external storage format is big-endian.
Parameters:
[in]strthe input stream containing the data of type ExtT (external).
[out]arraythe output vector of type IntT (internal).

Definition at line 418 of file Utility.hpp.

template<typename ExtT , typename IntT , bool bigendp>
static void GeographicLib::Utility::writearray ( std::ostream &  str,
const IntT  array[],
size_t  num 
) [inline, static]

Write data in an array of type IntT as type ExtT to a binary stream. The data in the file is in (bigendp ? big : little)-endian format.

Template Parameters:
ExtTthe type of the objects in the binary stream (external).
IntTthe type of the objects in the array (internal).
bigendptrue if the external storage format is big-endian.
Parameters:
[out]strthe output stream for the data of type ExtT (external).
[in]arraythe input array of type IntT (internal).
[in]numthe size of the array.

Definition at line 435 of file Utility.hpp.

References GeographicLib::Math::bigendian.

template<typename ExtT , typename IntT , bool bigendp>
static void GeographicLib::Utility::writearray ( std::ostream &  str,
std::vector< IntT > &  array 
) [inline, static]

Write data in an array of type IntT as type ExtT to a binary stream. The data in the file is in (bigendp ? big : little)-endian format.

Template Parameters:
ExtTthe type of the objects in the binary stream (external).
IntTthe type of the objects in the array (internal).
bigendptrue if the external storage format is big-endian.
Parameters:
[out]strthe output stream for the data of type ExtT (external).
[in]arraythe input vector of type IntT (internal).

Definition at line 476 of file Utility.hpp.

bool GeographicLib::Utility::ParseLine ( const std::string &  line,
std::string &  key,
std::string &  val 
) [static]

Parse a KEY VALUE line.

Parameters:
[in]linethe input line.
[out]keythe key.
[out]valthe value.
Returns:
whether a key was found.

A # character and everything after it are discarded. If the results is just white space, the routine returns false (and key and val are not set). Otherwise the first token is taken to be the key and the rest of the line (trimmed of leading and trailing white space) is the value.

Definition at line 22 of file Utility.cpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/MagneticModel_8hpp.html0000644000175000017500000001334211745620414022131 0ustar frankiefrankie GeographicLib: MagneticModel.hpp File Reference
MagneticModel.hpp File Reference

Header for GeographicLib::MagneticModel class. More...

#include <string>
#include <sstream>
#include <vector>
#include <GeographicLib/Constants.hpp>
#include <GeographicLib/Geocentric.hpp>
#include <GeographicLib/SphericalHarmonic.hpp>

Go to the source code of this file.

Classes

class  GeographicLib::MagneticModel
 Model of the earth's magnetic field. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_MAGNETICMODEL_HPP   "$Id: 7f8c59ee3cdbfce252d1172c1bb4d7db7cf5ef38 $"

Detailed Description

Header for GeographicLib::MagneticModel class.

Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file MagneticModel.hpp.


Define Documentation

#define GEOGRAPHICLIB_MAGNETICMODEL_HPP   "$Id: 7f8c59ee3cdbfce252d1172c1bb4d7db7cf5ef38 $"

Definition at line 11 of file MagneticModel.hpp.

geographiclib-1.21/doc/html/EllipticFunction_8cpp.html0000644000175000017500000001152711745620414022672 0ustar frankiefrankie GeographicLib: EllipticFunction.cpp File Reference
EllipticFunction.cpp File Reference

Implementation for GeographicLib::EllipticFunction class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_ELLIPTICFUNCTION_CPP   "$Id: 00b30b3d051fce1da7eb0c7e74c1c03854de6ea3 $"

Detailed Description

Implementation for GeographicLib::EllipticFunction class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file EllipticFunction.cpp.


Define Documentation

#define GEOGRAPHICLIB_ELLIPTICFUNCTION_CPP   "$Id: 00b30b3d051fce1da7eb0c7e74c1c03854de6ea3 $"

Definition at line 12 of file EllipticFunction.cpp.

geographiclib-1.21/doc/html/classGeographicLib_1_1MagneticCircle.html0000644000175000017500000005713611745620415025453 0ustar frankiefrankie GeographicLib: GeographicLib::MagneticCircle Class Reference
GeographicLib::MagneticCircle Class Reference

Geomagnetic field on a circle of latitude. More...

#include <GeographicLib/MagneticCircle.hpp>

List of all members.

Public Member Functions

 MagneticCircle ()
Compute the magnetic field
void operator() (real lon, real &Bx, real &By, real &Bz) const throw ()
void operator() (real lon, real &Bx, real &By, real &Bz, real &Bxt, real &Byt, real &Bzt) const throw ()
Inspector functions
bool Init () const throw ()
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()
Math::real Latitude () const throw ()
Math::real Height () const throw ()
Math::real Time () const throw ()

Friends

class MagneticModel

Detailed Description

Geomagnetic field on a circle of latitude.

Evaluate the earth's magnetic field on a circle of constant height and latitude. This uses a CircleEngine to pre-evaluate the inner sum of the spherical harmonic sum, allowing the values of the field at several different longitudes to be evaluated rapidly.

Use MagneticModel::Circle to create a MagneticCircle object. (The constructor for this class is private.)

Example of use:

// Example of using the GeographicLib::MagneticCircle class
// $Id: d499f22160be523e01c0a6e3c740dbe828aa918d $

#include <iostream>
#include <exception>
#include <GeographicLib/MagneticModel.hpp>
#include <GeographicLib/MagneticCircle.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    MagneticModel mag("wmm2010");
    double lat = 27.99, lon0 = 86.93, h = 8820, t = 2012; // Mt Everest
    {
      // Slow method of evaluating the values at several points on a circle of
      // latitude.
      for (int i = -5; i <= 5; ++i) {
        double lon = lon0 + i * 0.2;
        double Bx, By, Bz;
        mag(t, lat, lon, h, Bx, By, Bz);
        cout << lon << " " << Bx << " " << By << " " << Bz << "\n";
      }
    }
    {
      // Fast method of evaluating the values at several points on a circle of
      // latitude using MagneticCircle.
      MagneticCircle circ = mag.Circle(t, lat, h);
      for (int i = -5; i <= 5; ++i) {
        double lon = lon0 + i * 0.2;
        double Bx, By, Bz;
        circ(lon, Bx, By, Bz);
        cout << lon << " " << Bx << " " << By << " " << Bz << "\n";
      }
    }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

MagneticField is a command-line utility providing access to the functionality of MagneticModel and MagneticCircle.


Constructor & Destructor Documentation

GeographicLib::MagneticCircle::MagneticCircle ( ) [inline]

A default constructor for the normal gravity. This sets up an uninitialized object which can be later replaced by the MagneticModel::Circle.

Definition at line 78 of file MagneticCircle.hpp.


Member Function Documentation

void GeographicLib::MagneticCircle::operator() ( real  lon,
real &  Bx,
real &  By,
real &  Bz 
) const throw () [inline]

Evaluate the components of the geomagnetic field at a particular longitude.

Parameters:
[in]lonlongitude of the point (degrees).
[out]Bxthe easterly component of the magnetic field (nanotesla).
[out]Bythe northerly component of the magnetic field (nanotesla).
[out]Bzthe vertical (up) component of the magnetic field (nanotesla).

Definition at line 93 of file MagneticCircle.hpp.

void GeographicLib::MagneticCircle::operator() ( real  lon,
real &  Bx,
real &  By,
real &  Bz,
real &  Bxt,
real &  Byt,
real &  Bzt 
) const throw () [inline]

Evaluate the components of the geomagnetic field and their time derivatives at a particular longitude.

Parameters:
[in]lonlongitude of the point (degrees).
[out]Bxthe easterly component of the magnetic field (nanotesla).
[out]Bythe northerly component of the magnetic field (nanotesla).
[out]Bzthe vertical (up) component of the magnetic field (nanotesla).
[out]Bxtthe rate of change of Bx (nT/yr).
[out]Bytthe rate of change of By (nT/yr).
[out]Bztthe rate of change of Bz (nT/yr).

Definition at line 111 of file MagneticCircle.hpp.

bool GeographicLib::MagneticCircle::Init ( ) const throw () [inline]
Returns:
true if the object has been initialized.

Definition at line 123 of file MagneticCircle.hpp.

Math::real GeographicLib::MagneticCircle::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value inherited from the MagneticModel object used in the constructor.

Definition at line 129 of file MagneticCircle.hpp.

Math::real GeographicLib::MagneticCircle::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid. This is the value inherited from the MagneticModel object used in the constructor.

Definition at line 135 of file MagneticCircle.hpp.

Math::real GeographicLib::MagneticCircle::Latitude ( ) const throw () [inline]
Returns:
the latitude of the circle (degrees).

Definition at line 140 of file MagneticCircle.hpp.

Math::real GeographicLib::MagneticCircle::Height ( ) const throw () [inline]
Returns:
the height of the circle (meters).

Definition at line 145 of file MagneticCircle.hpp.

Math::real GeographicLib::MagneticCircle::Time ( ) const throw () [inline]
Returns:
the time (fractional years).

Definition at line 150 of file MagneticCircle.hpp.


Friends And Related Function Documentation

friend class MagneticModel [friend]

Definition at line 69 of file MagneticCircle.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/GeoCoords_8cpp.html0000644000175000017500000001201211745620414021271 0ustar frankiefrankie GeographicLib: GeoCoords.cpp File Reference
GeoCoords.cpp File Reference

Implementation for GeographicLib::GeoCoords class. More...

#include <GeographicLib/GeoCoords.hpp>
#include <vector>
#include <sstream>
#include <iomanip>
#include <GeographicLib/MGRS.hpp>
#include <GeographicLib/DMS.hpp>

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_GEOCOORDS_CPP   "$Id: 084d4ec9163dc9d8989b54b12a04bf0f44a8c23f $"

Detailed Description

Implementation for GeographicLib::GeoCoords class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file GeoCoords.cpp.


Define Documentation

#define GEOGRAPHICLIB_GEOCOORDS_CPP   "$Id: 084d4ec9163dc9d8989b54b12a04bf0f44a8c23f $"

Definition at line 17 of file GeoCoords.cpp.

geographiclib-1.21/doc/html/classGeographicLib_1_1CircularEngine-members.html0000644000175000017500000001150611745620414027112 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::CircularEngine Member List
This is the complete list of members for GeographicLib::CircularEngine, including all inherited members.
CircularEngine()GeographicLib::CircularEngine [inline]
GravityCircle classGeographicLib::CircularEngine [friend]
MagneticCircle classGeographicLib::CircularEngine [friend]
operator()(real coslon, real sinlon) const GeographicLib::CircularEngine [inline]
operator()(real lon) const GeographicLib::CircularEngine [inline]
operator()(real coslon, real sinlon, real &gradx, real &grady, real &gradz) const GeographicLib::CircularEngine [inline]
operator()(real lon, real &gradx, real &grady, real &gradz) const GeographicLib::CircularEngine [inline]
SphericalEngine classGeographicLib::CircularEngine [friend]
geographiclib-1.21/doc/html/AlbersEqualArea_8cpp.html0000644000175000017500000001143711745620414022410 0ustar frankiefrankie GeographicLib: AlbersEqualArea.cpp File Reference
AlbersEqualArea.cpp File Reference

Implementation for GeographicLib::AlbersEqualArea class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_ALBERSEQUALAREA_CPP   "$Id: a7aa5e2e232feec5c866f0d645f110fd0bb38dd2 $"

Detailed Description

Implementation for GeographicLib::AlbersEqualArea class.

Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file AlbersEqualArea.cpp.


Define Documentation

#define GEOGRAPHICLIB_ALBERSEQUALAREA_CPP   "$Id: a7aa5e2e232feec5c866f0d645f110fd0bb38dd2 $"

Definition at line 12 of file AlbersEqualArea.cpp.

geographiclib-1.21/doc/html/Accumulator_8hpp_source.html0000644000175000017500000006044011745620414023261 0ustar frankiefrankie GeographicLib: Accumulator.hpp Source File
Accumulator.hpp
Go to the documentation of this file.
00001 /**
00002  * \file Accumulator.hpp
00003  * \brief Header for GeographicLib::Accumulator class
00004  *
00005  * Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_ACCUMULATOR_HPP)
00011 #define GEOGRAPHICLIB_ACCUMULATOR_HPP \
00012   "$Id: 03b7f4fdb9974c822f98d5f5aab1094b5a9ac8f2 $"
00013 
00014 #include <GeographicLib/Constants.hpp>
00015 
00016 namespace GeographicLib {
00017 
00018   /**
00019    * \brief An accumulator for sums.
00020    *
00021    * This allow many numbers of floating point type \e T to be added together
00022    * with twice the normal precision.  Thus if \e T is double, the effective
00023    * precision of the sum is 106 bits or about 32 decimal places.  The core
00024    * idea is the error free transformation of a sum, D. E. Knuth, TAOCP, Vol 2,
00025    * 4.2.2, Theorem B.
00026    *
00027    * The implementation follows J. R. Shewchuk,
00028    * <a href="http://dx.doi.org/10.1007/PL00009321"> Adaptive Precision
00029    * Floating-Point Arithmetic and Fast Robust Geometric Predicates</a>,
00030    * Discrete & Computational Geometry 18(3) 305-363 (1997).
00031    *
00032    * Approximate timings (summing a vector<double>)
00033    * - double:               2ns
00034    * - Accumulator<double>: 23ns
00035    *
00036    * In the documentation of the member functions, \e sum stands for the value
00037    * currently held in the accumulator.
00038    *
00039    * Example of use:
00040    * \include example-Accumulator.cpp
00041    **********************************************************************/
00042   template<typename T = Math::real>
00043   class GEOGRAPHIC_EXPORT Accumulator {
00044   private:
00045     // _s + _t accumulates for the sum.
00046     T _s, _t;
00047     // Error free transformation of a sum.  Note that t can be the same as one
00048     // of the first two arguments.
00049     static inline T sum(T u, T v, T& t) {
00050       volatile T s = u + v;
00051       volatile T up = s - v;
00052       volatile T vpp = s - up;
00053       up -= u;
00054       vpp -= v;
00055       t = -(up + vpp);
00056       // u + v =       s      + t
00057       //       = round(u + v) + t
00058       return s;
00059     }
00060     // Same as sum, but requires abs(u) >= abs(v).  This isn't currently used.
00061     static inline T fastsum(T u, T v, T& t) {
00062       volatile T s = u + v;
00063       volatile T vp = s - u;
00064       t = v - vp;
00065       return s;
00066     }
00067     void Add(T y) throw() {
00068       // Here's Shewchuk's solution...
00069       T u;                      // hold exact sum as [s, t, u]
00070       y  = sum(y, _t,  u);      // Accumulate starting at least significant end
00071       _s = sum(y, _s, _t);
00072       // Start is _s, _t decreasing and non-adjacent.  Sum is now (s + t + u)
00073       // exactly with s, t, u non-adjacent and in decreasing order (except for
00074       // possible zeros).  The following code tries to normalize the result.
00075       // Ideally, we want _s = round(s+t+u) and _u = round(s+t+u - _s).  The
00076       // following does an approximate job (and maintains the decreasing
00077       // non-adjacent property).  Here are two "failures" using 3-bit floats:
00078       //
00079       // Case 1: _s is not equal to round(s+t+u) -- off by 1 ulp
00080       // [12, -1] - 8 -> [4, 0, -1] -> [4, -1] = 3 should be [3, 0] = 3
00081       //
00082       // Case 2: _s+_t is not as close to s+t+u as it shold be
00083       // [64, 5] + 4 -> [64, 8, 1] -> [64,  8] = 72 (off by 1)
00084       //                    should be [80, -7] = 73 (exact)
00085       //
00086       // "Fixing" these problems is probably not worth the expense.  The
00087       // representation inevitably leads to small errors in the accumulated
00088       // values.  The additional errors illustrated here amount to 1 ulp of the
00089       // less significant word during each addition to the Accumulator and an
00090       // additional possible error of 1 ulp in the reported sum.
00091       //
00092       // Incidentally, the "ideal" representation described above is not
00093       // canonical, because _s = round(_s + _t) may not be true.  For example,
00094       // with 3-bit floats:
00095       //
00096       // [128, 16] + 1 -> [160, -16] -- 160 = round(145).
00097       // But [160, 0] - 16 -> [128, 16] -- 128 = round(144).
00098       //
00099       if (_s == 0)              // This implies t == 0,
00100         _s = u;                 // so result is u
00101       else
00102         _t += u;                // otherwise just accumulate u to t.
00103     }
00104     T Sum(T y) const throw() {
00105       Accumulator a(*this);
00106       a.Add(y);
00107       return a._s;
00108     }
00109   public:
00110     /**
00111      * Construct from a \e T.  This is not declared explicit, so that you can
00112      * write <code>Accumulator<double> a = 5;</code>.
00113      *
00114      * @param[in] y set \e sum = \e y.
00115      **********************************************************************/
00116     Accumulator(T y = T(0)) throw() : _s(y), _t(0) {
00117       STATIC_ASSERT(!std::numeric_limits<T>::is_integer,
00118                     "Accumulator type is not floating point");
00119     }
00120     /**
00121      * Set the accumulator to a number.
00122      *
00123      * @param[in] y set \e sum = \e y.
00124      **********************************************************************/
00125     Accumulator& operator=(T y) throw() { _s = y; _t = 0; return *this; }
00126     /**
00127      * Return the value held in the accumulator.
00128      *
00129      * @return \e sum.
00130      **********************************************************************/
00131     T operator()() const throw() { return _s; }
00132     /**
00133      * Return the result of adding a number to \e sum (but don't change \e sum).
00134      *
00135      * @param[in] y the number to be added to the sum.
00136      * @return \e sum + \e y.
00137      **********************************************************************/
00138     T operator()(T y) const throw() { return Sum(y); }
00139     /**
00140      * Add a number to the accumulator.
00141      *
00142      * @param[in] y set \e sum += \e y.
00143      **********************************************************************/
00144     Accumulator& operator+=(T y) throw() { Add(y); return *this; }
00145     /**
00146      * Subtract a number from the accumulator.
00147      *
00148      * @param[in] y set \e sum -= \e y.
00149      **********************************************************************/
00150     Accumulator& operator-=(T y) throw() { Add(-y); return *this; }
00151     /**
00152      * Multiply accumulator by an integer.  To avoid loss of accuracy, use only
00153      * integers such that \e n * \e T is exactly representable as a \e T (i.e.,
00154      * +/- powers of two).  Use \e n = -1 to negate \e sum.
00155      *
00156      * @param[in] n set \e sum *= \e n.
00157      **********************************************************************/
00158     Accumulator& operator*=(int n) throw() { _s *= n; _t *= n; return *this; }
00159     /**
00160      * Test equality of an Accumulator with a number.
00161      **********************************************************************/
00162     bool operator==(T y) const throw() { return _s == y; }
00163     /**
00164      * Test inequality of an Accumulator with a number.
00165      **********************************************************************/
00166     bool operator!=(T y) const throw() { return _s != y; }
00167     /**
00168      * Less operator on an Accumulator and a number.
00169      **********************************************************************/
00170     bool operator<(T y) const throw() { return _s < y; }
00171     /**
00172      * Less or equal operator on an Accumulator and a number.
00173      **********************************************************************/
00174     bool operator<=(T y) const throw() { return _s <= y; }
00175     /**
00176      * Greater operator on an Accumulator and a number.
00177      **********************************************************************/
00178     bool operator>(T y) const throw() { return _s > y; }
00179     /**
00180      * Greater or equal operator on an Accumulator and a number.
00181      **********************************************************************/
00182     bool operator>=(T y) const throw() { return _s >= y; }
00183   };
00184 
00185 } // namespace GeographicLib
00186 
00187 #endif  // GEOGRAPHICLIB_ACCUMULATOR_HPP
geographiclib-1.21/doc/html/MagneticModel_8cpp.html0000644000175000017500000001625611745620414022133 0ustar frankiefrankie GeographicLib: MagneticModel.cpp File Reference
MagneticModel.cpp File Reference

Implementation for GeographicLib::MagneticModel class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_MAGNETICMODEL_CPP   "$Id: b0287ac014f10e4c6656b67f21c764432a47559a $"
#define GEOGRAPHICLIB_DATA   "/usr/local/share/GeographicLib"
#define MAGNETIC_DEFAULT_NAME   "wmm2010"

Detailed Description

Implementation for GeographicLib::MagneticModel class.

Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file MagneticModel.cpp.


Define Documentation

#define GEOGRAPHICLIB_MAGNETICMODEL_CPP   "$Id: b0287ac014f10e4c6656b67f21c764432a47559a $"

Definition at line 16 of file MagneticModel.cpp.

#define GEOGRAPHICLIB_DATA   "/usr/local/share/GeographicLib"

Definition at line 27 of file MagneticModel.cpp.

Referenced by GeographicLib::MagneticModel::DefaultMagneticPath().

#define MAGNETIC_DEFAULT_NAME   "wmm2010"

Definition at line 32 of file MagneticModel.cpp.

Referenced by GeographicLib::MagneticModel::DefaultMagneticName().

geographiclib-1.21/doc/html/Utility_8hpp.html0000644000175000017500000001277611745620414021076 0ustar frankiefrankie GeographicLib: Utility.hpp File Reference
Utility.hpp File Reference

Header for GeographicLib::Utility class. More...

#include <GeographicLib/Constants.hpp>
#include <iomanip>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <cctype>

Go to the source code of this file.

Classes

class  GeographicLib::Utility
 Some utility routines for GeographicLib. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_UTILITY_HPP   "$Id: 92c92fcb8ea92116fed01909c2611934b708e4cd $"

Detailed Description

Header for GeographicLib::Utility class.

Copyright (c) Charles Karney (2011, 2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file Utility.hpp.


Define Documentation

#define GEOGRAPHICLIB_UTILITY_HPP   "$Id: 92c92fcb8ea92116fed01909c2611934b708e4cd $"

Definition at line 11 of file Utility.hpp.

geographiclib-1.21/doc/html/AzimuthalEquidistant_8hpp_source.html0000644000175000017500000005064311745620414025157 0ustar frankiefrankie GeographicLib: AzimuthalEquidistant.hpp Source File
AzimuthalEquidistant.hpp
Go to the documentation of this file.
00001 /**
00002  * \file AzimuthalEquidistant.hpp
00003  * \brief Header for GeographicLib::AzimuthalEquidistant class
00004  *
00005  * Copyright (c) Charles Karney (2009-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP)
00011 #define GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP \
00012   "$Id: 95a1d6e7a8c4613be25ec32550231601202da1e5 $"
00013 
00014 #include <GeographicLib/Geodesic.hpp>
00015 #include <GeographicLib/Constants.hpp>
00016 
00017 namespace GeographicLib {
00018 
00019   /**
00020    * \brief Azimuthal Equidistant Projection.
00021    *
00022    * Azimuthal equidistant projection centered at an arbitrary position on the
00023    * ellipsoid.  For a point in projected space (\e x, \e y), the geodesic
00024    * distance from the center position is hypot(\e x, \e y) and the azimuth of
00025    * the geodesic from the center point is atan2(\e x, \e y).  The Forward and
00026    * Reverse methods also return the azimuth \e azi of the geodesic at (\e x,
00027    * \e y) and reciprocal scale \e rk in the azimuthal direction which,
00028    * together with the basic properties of the projection, serve to specify
00029    * completely the local affine transformation between geographic and
00030    * projected coordinates.
00031    *
00032    * The conversions all take place using a Geodesic object (by default
00033    * Geodesic::WGS84).  For more information on geodesics see \ref geodesic.
00034    *
00035    * Example of use:
00036    * \include example-AzimuthalEquidistant.cpp
00037    *
00038    * <a href="GeodesicProj.1.html">GeodesicProj</a> is a command-line utility
00039    * providing access to the functionality of AzimuthalEquidistant, Gnomonic,
00040    * and CassiniSoldner.
00041    **********************************************************************/
00042 
00043   class GEOGRAPHIC_EXPORT AzimuthalEquidistant {
00044   private:
00045     typedef Math::real real;
00046     Geodesic _earth;
00047     static const real eps_;
00048   public:
00049 
00050     /**
00051      * Constructor for AzimuthalEquidistant.
00052      *
00053      * @param[in] earth the Geodesic object to use for geodesic calculations.
00054      *   By default this uses the WGS84 ellipsoid.
00055      **********************************************************************/
00056     explicit AzimuthalEquidistant(const Geodesic& earth = Geodesic::WGS84)
00057       throw() : _earth(earth) {}
00058 
00059     /**
00060      * Forward projection, from geographic to azimuthal equidistant.
00061      *
00062      * @param[in] lat0 latitude of center point of projection (degrees).
00063      * @param[in] lon0 longitude of center point of projection (degrees).
00064      * @param[in] lat latitude of point (degrees).
00065      * @param[in] lon longitude of point (degrees).
00066      * @param[out] x easting of point (meters).
00067      * @param[out] y northing of point (meters).
00068      * @param[out] azi azimuth of geodesic at point (degrees).
00069      * @param[out] rk reciprocal of azimuthal scale at point.
00070      *
00071      * \e lat0 and \e lat should be in the range [-90, 90] and \e lon0 and \e
00072      * lon should be in the range [-180, 360].  The scale of the projection is
00073      * 1 in the "radial" direction, \e azi clockwise from true north, and is
00074      * 1/\e rk in the direction perpendicular to this.  A call to Forward
00075      * followed by a call to Reverse will return the original (\e lat, \e lon)
00076      * (to within roundoff).
00077      **********************************************************************/
00078     void Forward(real lat0, real lon0, real lat, real lon,
00079                  real& x, real& y, real& azi, real& rk) const throw();
00080 
00081     /**
00082      * Reverse projection, from azimuthal equidistant to geographic.
00083      *
00084      * @param[in] lat0 latitude of center point of projection (degrees).
00085      * @param[in] lon0 longitude of center point of projection (degrees).
00086      * @param[in] x easting of point (meters).
00087      * @param[in] y northing of point (meters).
00088      * @param[out] lat latitude of point (degrees).
00089      * @param[out] lon longitude of point (degrees).
00090      * @param[out] azi azimuth of geodesic at point (degrees).
00091      * @param[out] rk reciprocal of azimuthal scale at point.
00092      *
00093      * \e lat0 should be in the range [-90, 90] and \e lon0 should be in the
00094      * range [-180, 360].  \e lat will be in the range [-90, 90] and \e lon
00095      * will be in the range [-180, 180).  The scale of the projection is 1 in
00096      * the "radial" direction, \e azi clockwise from true north, and is 1/\e rk
00097      * in the direction perpendicular to this.  A call to Reverse followed by a
00098      * call to Forward will return the original (\e x, \e y) (to roundoff) only
00099      * if the geodesic to (\e x, \e y) is a shortest path.
00100      **********************************************************************/
00101     void Reverse(real lat0, real lon0, real x, real y,
00102                  real& lat, real& lon, real& azi, real& rk) const throw();
00103 
00104     /**
00105      * AzimuthalEquidistant::Forward without returning the azimuth and scale.
00106      **********************************************************************/
00107     void Forward(real lat0, real lon0, real lat, real lon,
00108                  real& x, real& y) const throw() {
00109       real azi, rk;
00110       Forward(lat0, lon0, lat, lon, x, y, azi, rk);
00111     }
00112 
00113     /**
00114      * AzimuthalEquidistant::Reverse without returning the azimuth and scale.
00115      **********************************************************************/
00116     void Reverse(real lat0, real lon0, real x, real y,
00117                  real& lat, real& lon) const throw() {
00118       real azi, rk;
00119       Reverse(lat0, lon0, x, y, lat, lon, azi, rk);
00120     }
00121 
00122     /** \name Inspector functions
00123      **********************************************************************/
00124     ///@{
00125     /**
00126      * @return \e a the equatorial radius of the ellipsoid (meters).  This is
00127      *   the value inherited from the Geodesic object used in the constructor.
00128      **********************************************************************/
00129     Math::real MajorRadius() const throw() { return _earth.MajorRadius(); }
00130 
00131     /**
00132      * @return \e f the flattening of the ellipsoid.  This is the value
00133      *   inherited from the Geodesic object used in the constructor.
00134      **********************************************************************/
00135     Math::real Flattening() const throw() { return _earth.Flattening(); }
00136     ///@}
00137 
00138     /// \cond SKIP
00139     /**
00140      * <b>DEPRECATED</b>
00141      * @return \e r the inverse flattening of the ellipsoid.
00142      **********************************************************************/
00143     Math::real InverseFlattening() const throw()
00144     { return _earth.InverseFlattening(); }
00145     /// \endcond
00146   };
00147 
00148 } // namespace GeographicLib
00149 
00150 #endif  // GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP
geographiclib-1.21/doc/html/Utility_8cpp.html0000644000175000017500000001121311745620415021053 0ustar frankiefrankie GeographicLib: Utility.cpp File Reference
Utility.cpp File Reference

Implementation for GeographicLib::Utility class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_UTILITY_CPP   "$Id: 6f06d5d8fa9d731dc5a5fa4516838f639a2ba40b $"

Detailed Description

Implementation for GeographicLib::Utility class.

Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file Utility.cpp.


Define Documentation

#define GEOGRAPHICLIB_UTILITY_CPP   "$Id: 6f06d5d8fa9d731dc5a5fa4516838f639a2ba40b $"

Definition at line 12 of file Utility.cpp.

geographiclib-1.21/doc/html/functions_func.html0000644000175000017500000001636611745620415021517 0ustar frankiefrankie GeographicLib: Class Members - Functions
 

- a -

geographiclib-1.21/doc/html/DMS_8hpp.html0000644000175000017500000001260611745620414020046 0ustar frankiefrankie GeographicLib: DMS.hpp File Reference
DMS.hpp File Reference

Header for GeographicLib::DMS class. More...

#include <sstream>
#include <iomanip>
#include <GeographicLib/Constants.hpp>
#include <GeographicLib/Utility.hpp>

Go to the source code of this file.

Classes

class  GeographicLib::DMS
 Convert between degrees and DMS representation. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_DMS_HPP   "$Id: 67770a78c105495a31a9d3755c811e938729c85a $"

Detailed Description

Header for GeographicLib::DMS class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file DMS.hpp.


Define Documentation

#define GEOGRAPHICLIB_DMS_HPP   "$Id: 67770a78c105495a31a9d3755c811e938729c85a $"

Definition at line 11 of file DMS.hpp.

geographiclib-1.21/doc/html/classGeographicLib_1_1NormalGravity.html0000644000175000017500000013657311745620415025403 0ustar frankiefrankie GeographicLib: GeographicLib::NormalGravity Class Reference
GeographicLib::NormalGravity Class Reference

The normal gravity of the earth. More...

#include <GeographicLib/NormalGravity.hpp>

List of all members.

Public Member Functions

Setting up the normal gravity
 NormalGravity (real a, real GM, real omega, real f, real J2)
 NormalGravity ()
Compute the gravity
Math::real SurfaceGravity (real lat) const throw ()
Math::real Gravity (real lat, real h, real &gammay, real &gammaz) const throw ()
Math::real U (real X, real Y, real Z, real &gammaX, real &gammaY, real &gammaZ) const throw ()
Math::real V0 (real X, real Y, real Z, real &GammaX, real &GammaY, real &GammaZ) const throw ()
Math::real Phi (real X, real Y, real &fX, real &fY) const throw ()
Inspector functions
bool Init () const throw ()
Math::real MajorRadius () const throw ()
Math::real MassConstant () const throw ()
Math::real DynamicalFormFactor (int n=2) const throw ()
Math::real AngularVelocity () const throw ()
Math::real Flattening () const throw ()
Math::real EquatorialGravity () const throw ()
Math::real PolarGravity () const throw ()
Math::real GravityFlattening () const throw ()
Math::real SurfacePotential () const throw ()
const GeocentricEarth () const throw ()

Static Public Attributes

static const NormalGravity WGS84
static const NormalGravity GRS80

Friends

class GravityModel

Detailed Description

The normal gravity of the earth.

"Normal" gravity refers to an idealization of the earth which is modeled as an rotating ellipsoid. The eccentricity of the ellipsoid, the rotation speed, and the distribution of mass within the ellipsoid are such that the surface of the ellipsoid is a surface of constant potential (gravitational plus centrifugal). The acceleration due to gravity is therefore perpendicular to the surface of the ellipsoid.

There is a closed solution to this problem which is implemented here. Series "approximations" are only used to evaluate certain combinations of elementary functions where use of the closed expression results in a loss of accuracy for small arguments due to cancellation of the two leading terms. However these series include sufficient terms to give full machine precision.

Definitions:

  • V0, the gravitational contribution to the normal potential;
  • Phi, the rotational contribution to the normal potential;
  • U = V0 + Phi, the total potential;
  • Gamma = grad V0, the acceleration due to mass of the earth;
  • f = grad Phi, the centrifugal acceleration;
  • gamma = grad U = Gamma + f, the normal acceleration;
  • X, Y, Z, geocentric coordinates;
  • x, y, z, local cartesian coordinates used to denote the east, north and up directions.

References:

  • W. A. Heiskanen and H. Moritz, Physical Geodesy (Freeman, San Francisco, 1967), Secs. 1-19, 2-7, 2-8 (2-9, 2-10), 6-2 (6-3).
  • H. Moritz, Geodetic Reference System 1980, J. Geod. 54(3), 395-405 (1980) http://dx.doi.org/10.1007/BF02521480

Example of use:

// Example of using the GeographicLib::NormalGravity class
// $Id: 8d0337072d40334e8147a50b1e6035d75d38c53c $

#include <iostream>
#include <exception>
#include <GeographicLib/NormalGravity.hpp>
#include <GeographicLib/Constants.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    NormalGravity grav(Constants::WGS84_a(), Constants::WGS84_GM<double>(),
                       Constants::WGS84_omega<double>(),
                       Constants::WGS84_f(), 0);
    // Alternatively: const NormalGravity& grav = NormalGravity::WGS84;
    double lat = 27.99, h = 8820; // Mt Everest
    double gammay, gammaz;
    grav.Gravity(lat, h, gammay, gammaz);
    cout << gammay << " " << gammaz << "\n";
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Constructor & Destructor Documentation

GeographicLib::NormalGravity::NormalGravity ( real  a,
real  GM,
real  omega,
real  f,
real  J2 
)

Constructor for the normal gravity.

Parameters:
[in]aequatorial radius (meters).
[in]GMmass constant of the ellipsoid (meters3/seconds2); this is the product of G the gravitational constant and M the mass of the earth (usually including the mass of the earth's atmosphere).
[in]omegathe angular velocity (rad s-1).
[in]fthe flattening of the ellipsoid.
[in]J2dynamical form factor.

Exactly one of f and J2 should be positive and this will be used to define the ellipsoid. The shape of the ellipsoid can be given in one of two ways:

  • geometrically, the ellipsoid is defined by the flattening f = (a - b) / a, where a and b are the equatorial radius and the polar semi-axis.
  • physically, the ellipsoid is defined by the dynamical form factor J2 = (C - A) / Ma2, where A and C are the equatorial and polar moments of inertia and M is the mass of the earth.

Definition at line 22 of file NormalGravity.cpp.

References GeographicLib::Math::isfinite().

GeographicLib::NormalGravity::NormalGravity ( ) [inline]

A default constructor for the normal gravity. This sets up an uninitialized object and is used by GravityModel which constructs this object before it has read in the parameters for the reference ellipsoid.

Definition at line 107 of file NormalGravity.hpp.


Member Function Documentation

Math::real GeographicLib::NormalGravity::SurfaceGravity ( real  lat) const throw ()

Evaluate the gravity on the surface of the ellipsoid.

Parameters:
[in]latthe geographic latitude (degrees).
Returns:
gamma the acceleration due to gravity, positive downwards (m s-2).

Due to the axial symmetry of the ellipsoid, the result is independent of the value of the longitude. This acceleration is perpendicular to the surface of the ellipsoid. It includes the effects of the earth's rotation.

Definition at line 155 of file NormalGravity.cpp.

References GeographicLib::Math::sq().

Referenced by GeographicLib::GravityModel::Circle().

Math::real GeographicLib::NormalGravity::Gravity ( real  lat,
real  h,
real &  gammay,
real &  gammaz 
) const throw ()

Evaluate the gravity at an arbitrary point above (or below) the ellipsoid.

Parameters:
[in]latthe geographic latitude (degrees).
[in]hthe height above the ellipsoid (meters).
[out]gammaythe northerly component of the acceleration (m s-2).
[out]gammazthe upward component of the acceleration (m s-2); this is usually negative.
Returns:
U the corresponding normal potential.

Due to the axial symmetry of the ellipsoid, the result is independent of the value of the longitude and the easterly component of the acceleration vanishes, gammax = 0. The function includes the effects of the earth's rotation. When h = 0, this function gives gammay = 0 and the returned value matches that of NormalGravity::SurfaceGravity.

Definition at line 226 of file NormalGravity.cpp.

Math::real GeographicLib::NormalGravity::U ( real  X,
real  Y,
real  Z,
real &  gammaX,
real &  gammaY,
real &  gammaZ 
) const throw ()

Evaluate the components of the acceleration due to gravity and the centrifugal acceleration in geocentric coordinates.

Parameters:
[in]Xgeocentric coordinate of point (meters).
[in]Ygeocentric coordinate of point (meters).
[in]Zgeocentric coordinate of point (meters).
[out]gammaXthe X component of the acceleration (m s-2).
[out]gammaYthe Y component of the acceleration (m s-2).
[out]gammaZthe Z component of the acceleration (m s-2).
Returns:
U = V0 + Phi the sum of the gravitational and centrifugal potentials (m2 s-2).

The acceleration given by gamma = grad U = grad V0 + grad Phi = Gamma + f.

Definition at line 216 of file NormalGravity.cpp.

Referenced by GeographicLib::GravityModel::Circle().

Math::real GeographicLib::NormalGravity::V0 ( real  X,
real  Y,
real  Z,
real &  GammaX,
real &  GammaY,
real &  GammaZ 
) const throw ()

Evaluate the components of the acceleration due to gravity alone in geocentric coordinates.

Parameters:
[in]Xgeocentric coordinate of point (meters).
[in]Ygeocentric coordinate of point (meters).
[in]Zgeocentric coordinate of point (meters).
[out]GammaXthe X component of the acceleration due to gravity (m s-2).
[out]GammaYthe Y component of the acceleration due to gravity (m s-2).
[out]GammaZthe Z component of the acceleration due to gravity (m s-2).
Returns:
V0 the gravitational potential (m2 s-2).

This function excludes the centrifugal acceleration and is appropriate to use for space applications. In terrestrial applications, the function NormalGravity::U (which includes this effect) should usually be used.

Definition at line 163 of file NormalGravity.cpp.

References GeographicLib::Math::hypot(), and GeographicLib::Math::sq().

Math::real GeographicLib::NormalGravity::Phi ( real  X,
real  Y,
real &  fX,
real &  fY 
) const throw ()

Evaluate the centrifugal acceleration in geocentric coordinates.

Parameters:
[in]Xgeocentric coordinate of point (meters).
[in]Ygeocentric coordinate of point (meters).
[out]fXthe X component of the centrifugal acceleration (m s-2).
[out]fYthe Y component of the centrifugal acceleration (m s-2).
Returns:
Phi the centrifugal potential (m2 s-2).

Phi is independent of Z, thus fZ = 0. This function NormalGravity::U sums the results of NormalGravity::V0 and NormalGravity::Phi.

Definition at line 208 of file NormalGravity.cpp.

References GeographicLib::Math::sq().

Referenced by GeographicLib::GravityModel::Circle().

bool GeographicLib::NormalGravity::Init ( ) const throw () [inline]
Returns:
true if the object has been initialized.

Definition at line 219 of file NormalGravity.hpp.

Math::real GeographicLib::NormalGravity::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value used in the constructor.

Definition at line 225 of file NormalGravity.hpp.

Math::real GeographicLib::NormalGravity::MassConstant ( ) const throw () [inline]
Returns:
GM the mass constant of the ellipsoid (m3 s-2). This is the value used in the constructor.

Definition at line 233 of file NormalGravity.hpp.

Referenced by GeographicLib::GravityModel::GravityModel().

Math::real GeographicLib::NormalGravity::DynamicalFormFactor ( int  n = 2) const throw () [inline]
Returns:
Jn the dynamical form factors of the ellipsoid.

If n = 2 (the default), this is the value of J2 used in the constructor. Otherwise it is the zonal coefficient of the Legendre harmonic sum of the normal gravitational potential. Note that Jn = 0 if is odd. In most gravity applications, fully normalized Legendre functions are used and the corresponding coefficient is Cn0 = -Jn / sqrt(2 n + 1).

Definition at line 246 of file NormalGravity.hpp.

Math::real GeographicLib::NormalGravity::AngularVelocity ( ) const throw () [inline]
Returns:
omega the angular velocity of the ellipsoid (rad s-1). This is the value used in the constructor.

Definition at line 253 of file NormalGravity.hpp.

Math::real GeographicLib::NormalGravity::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid (a - b)/a.

Definition at line 259 of file NormalGravity.hpp.

Math::real GeographicLib::NormalGravity::EquatorialGravity ( ) const throw () [inline]
Returns:
gammae the normal gravity at equator (m s-2).

Definition at line 266 of file NormalGravity.hpp.

Math::real GeographicLib::NormalGravity::PolarGravity ( ) const throw () [inline]
Returns:
gammap the normal gravity at poles (m s-2).

Definition at line 273 of file NormalGravity.hpp.

Math::real GeographicLib::NormalGravity::GravityFlattening ( ) const throw () [inline]
Returns:
f* the gravity flattening (gammap - gammae) / gammae.

Definition at line 281 of file NormalGravity.hpp.

Math::real GeographicLib::NormalGravity::SurfacePotential ( ) const throw () [inline]
Returns:
U0 the constant normal potential for the surface of the ellipsoid (m2 s-2).

Definition at line 288 of file NormalGravity.hpp.

const Geocentric& GeographicLib::NormalGravity::Earth ( ) const throw () [inline]
Returns:
the Geocentric object used by this instance.

Definition at line 294 of file NormalGravity.hpp.

Referenced by GeographicLib::GravityModel::Circle().


Friends And Related Function Documentation

friend class GravityModel [friend]

Definition at line 65 of file NormalGravity.hpp.


Member Data Documentation

A global instantiation of NormalGravity for the WGS84 ellipsoid.

Definition at line 300 of file NormalGravity.hpp.

A global instantiation of NormalGravity for the GRS80 ellipsoid.

Definition at line 305 of file NormalGravity.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/Geodesic_8hpp_source.html0000644000175000017500000031261211745620414022525 0ustar frankiefrankie GeographicLib: Geodesic.hpp Source File
Geodesic.hpp
Go to the documentation of this file.
00001 /**
00002  * \file Geodesic.hpp
00003  * \brief Header for GeographicLib::Geodesic class
00004  *
00005  * Copyright (c) Charles Karney (2009-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_GEODESIC_HPP)
00011 #define GEOGRAPHICLIB_GEODESIC_HPP \
00012   "$Id: c1b085aadd7b8eabe0f9518b29531a38c152d495 $"
00013 
00014 #include <GeographicLib/Constants.hpp>
00015 
00016 #if !defined(GEOD_ORD)
00017 /**
00018  * The order of the expansions used by Geodesic.
00019  **********************************************************************/
00020 #define GEOD_ORD \
00021   (GEOGRAPHICLIB_PREC == 1 ? 6 : (GEOGRAPHICLIB_PREC == 0 ? 3 : 7))
00022 #endif
00023 
00024 namespace GeographicLib {
00025 
00026   class GeodesicLine;
00027 
00028   /**
00029    * \brief %Geodesic calculations
00030    *
00031 
00032    * The shortest path between two points on a ellipsoid at (\e lat1, \e lon1)
00033    * and (\e lat2, \e lon2) is called the geodesic.  Its length is \e s12 and
00034    * the geodesic from point 1 to point 2 has azimuths \e azi1 and \e azi2 at
00035    * the two end points.  (The azimuth is the heading measured clockwise from
00036    * north.  \e azi2 is the "forward" azimuth, i.e., the heading that takes you
00037    * beyond point 2 not back to point 1.)
00038    *
00039    * Given \e lat1, \e lon1, \e azi1, and \e s12, we can determine \e lat2, \e
00040    * lon2, and \e azi2.  This is the \e direct geodesic problem and its
00041    * solution is given by the function Geodesic::Direct.  (If \e s12 is
00042    * sufficiently large that the geodesic wraps more than halfway around the
00043    * earth, there will be another geodesic between the points with a smaller \e
00044    * s12.)
00045    *
00046    * Given \e lat1, \e lon1, \e lat2, and \e lon2, we can determine \e azi1, \e
00047    * azi2, and \e s12.  This is the \e inverse geodesic problem, whose solution
00048    * is given by Geodesic::Inverse.  Usually, the solution to the inverse
00049    * problem is unique.  In cases where there are multiple solutions (all with
00050    * the same \e s12, of course), all the solutions can be easily generated
00051    * once a particular solution is provided.
00052    *
00053    * The standard way of specifying the direct problem is the specify the
00054    * distance \e s12 to the second point.  However it is sometimes useful
00055    * instead to specify the the arc length \e a12 (in degrees) on the auxiliary
00056    * sphere.  This is a mathematical construct used in solving the geodesic
00057    * problems.  The solution of the direct problem in this form is provide by
00058    * Geodesic::ArcDirect.  An arc length in excess of 180<sup>o</sup> indicates
00059    * that the geodesic is not a shortest path.  In addition, the arc length
00060    * between an equatorial crossing and the next extremum of latitude for a
00061    * geodesic is 90<sup>o</sup>.
00062    *
00063    * This class can also calculate several other quantities related to
00064    * geodesics.  These are:
00065    * - <i>reduced length</i>.  If we fix the first point and increase \e azi1
00066    *   by \e dazi1 (radians), the the second point is displaced \e m12 \e dazi1
00067    *   in the direction \e azi2 + 90<sup>o</sup>.  The quantity \e m12 is
00068    *   called the "reduced length" and is symmetric under interchange of the
00069    *   two points.  On a curved surface the reduced length obeys a symmetry
00070    *   relation, \e m12 + \e m21 = 0.  On a flat surface, we have \e m12 = \e
00071    *   s12.  The ratio <i>s12</i>/\e m12 gives the azimuthal scale for an
00072    *   azimuthal equidistant projection.
00073    * - <i>geodesic scale</i>.  Consider a reference geodesic and a second
00074    *   geodesic parallel to this one at point 1 and separated by a small
00075    *   distance \e dt.  The separation of the two geodesics at point 2 is \e
00076    *   M12 \e dt where \e M12 is called the "geodesic scale".  \e M21 is
00077    *   defined similarly (with the geodesics being parallel at point 2).  On a
00078    *   flat surface, we have \e M12 = \e M21 = 1.  The quantity 1/\e M12 gives
00079    *   the scale of the Cassini-Soldner projection.
00080    * - <i>area</i>.  Consider the quadrilateral bounded by the following lines:
00081    *   the geodesic from point 1 to point 2, the meridian from point 2 to the
00082    *   equator, the equator from \e lon2 to \e lon1, the meridian from the
00083    *   equator to point 1.  The area of this quadrilateral is represented by \e
00084    *   S12 with a clockwise traversal of the perimeter counting as a positive
00085    *   area and it can be used to compute the area of any simple geodesic
00086    *   polygon.
00087    *
00088    * Overloaded versions of Geodesic::Direct, Geodesic::ArcDirect, and
00089    * Geodesic::Inverse allow these quantities to be returned.  In addition
00090    * there are general functions Geodesic::GenDirect, and Geodesic::GenInverse
00091    * which allow an arbitrary set of results to be computed.  The quantities \e
00092    * m12, \e M12, \e M21 which all specify the behavior of nearby geodesics
00093    * obey addition rules.  Let points 1, 2, and 3 all lie on a single geodesic,
00094    * then
00095    * - \e m13 = \e m12 \e M23 + \e m23 \e M21
00096    * - \e M13 = \e M12 \e M23 - (1 - \e M12 \e M21) \e m23 / \e m12
00097    * - \e M31 = \e M32 \e M21 - (1 - \e M23 \e M32) \e m12 / \e m23
00098    *
00099    * Additional functionality is provided by the GeodesicLine class, which
00100    * allows a sequence of points along a geodesic to be computed.
00101    *
00102    * The calculations are accurate to better than 15 nm (15 nanometers).  See
00103    * Sec. 9 of
00104    * <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a>
00105    * for details.
00106    *
00107    * The algorithms are described in
00108    * - C. F. F. Karney,
00109    *   <a href="http://arxiv.org/abs/1102.1215v1">Geodesics
00110    *   on an ellipsoid of revolution</a>,
00111    *   Feb. 2011;
00112    *   preprint
00113    *   <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a>.
00114    * - C. F. F. Karney,
00115    *   <a href="http://arxiv.org/abs/1109.4448">Algorithms for geodesics</a>,
00116    *   Sept. 2011;
00117    *   preprint
00118    *   <a href="http://arxiv.org/abs/1109.4448">arxiv:1109.4448</a>.
00119    * .
00120    * For more information on geodesics see \ref geodesic.
00121    *
00122    * Example of use:
00123    * \include example-Geodesic.cpp
00124    *
00125    * <a href="Geod.1.html">Geod</a> is a command-line utility providing access
00126    * to the functionality of Geodesic and GeodesicLine.
00127    **********************************************************************/
00128 
00129   class GEOGRAPHIC_EXPORT Geodesic {
00130   private:
00131     typedef Math::real real;
00132     friend class GeodesicLine;
00133     static const int nA1_ = GEOD_ORD;
00134     static const int nC1_ = GEOD_ORD;
00135     static const int nC1p_ = GEOD_ORD;
00136     static const int nA2_ = GEOD_ORD;
00137     static const int nC2_ = GEOD_ORD;
00138     static const int nA3_ = GEOD_ORD;
00139     static const int nA3x_ = nA3_;
00140     static const int nC3_ = GEOD_ORD;
00141     static const int nC3x_ = (nC3_ * (nC3_ - 1)) / 2;
00142     static const int nC4_ = GEOD_ORD;
00143     static const int nC4x_ = (nC4_ * (nC4_ + 1)) / 2;
00144     static const unsigned maxit_ = 50;
00145 
00146     static const real tiny_;
00147     static const real tol0_;
00148     static const real tol1_;
00149     static const real tol2_;
00150     static const real xthresh_;
00151 
00152     enum captype {
00153       CAP_NONE = 0U,
00154       CAP_C1   = 1U<<0,
00155       CAP_C1p  = 1U<<1,
00156       CAP_C2   = 1U<<2,
00157       CAP_C3   = 1U<<3,
00158       CAP_C4   = 1U<<4,
00159       CAP_ALL  = 0x1FU,
00160       OUT_ALL  = 0x7F80U,
00161     };
00162 
00163     static real SinCosSeries(bool sinp,
00164                              real sinx, real cosx, const real c[], int n)
00165       throw();
00166     static inline real AngNormalize(real x) throw() {
00167       // Place angle in [-180, 180).  Assumes x is in [-540, 540).
00168       return x >= 180 ? x - 360 : (x < -180 ? x + 360 : x);
00169     }
00170     static inline real AngRound(real x) throw() {
00171       // The makes the smallest gap in x = 1/16 - nextafter(1/16, 0) = 1/2^57
00172       // for reals = 0.7 pm on the earth if x is an angle in degrees.  (This
00173       // is about 1000 times more resolution than we get with angles around 90
00174       // degrees.)  We use this to avoid having to deal with near singular
00175       // cases when x is non-zero but tiny (e.g., 1.0e-200).
00176       const real z = real(0.0625); // 1/16
00177       volatile real y = std::abs(x);
00178       // The compiler mustn't "simplify" z - (z - y) to y
00179       y = y < z ? z - (z - y) : y;
00180       return x < 0 ? -y : y;
00181     }
00182     static inline void SinCosNorm(real& sinx, real& cosx) throw() {
00183       real r = Math::hypot(sinx, cosx);
00184       sinx /= r;
00185       cosx /= r;
00186     }
00187     static real Astroid(real x, real y) throw();
00188 
00189     real _a, _f, _f1, _e2, _ep2, _n, _b, _c2, _etol2;
00190     real _A3x[nA3x_], _C3x[nC3x_], _C4x[nC4x_];
00191 
00192     void Lengths(real eps, real sig12,
00193                  real ssig1, real csig1, real ssig2, real csig2,
00194                  real cbet1, real cbet2,
00195                  real& s12s, real& m12a, real& m0,
00196                  bool scalep, real& M12, real& M21,
00197                  real C1a[], real C2a[]) const throw();
00198     real InverseStart(real sbet1, real cbet1, real sbet2, real cbet2,
00199                       real lam12,
00200                       real& salp1, real& calp1,
00201                       real& salp2, real& calp2,
00202                       real C1a[], real C2a[]) const throw();
00203     real Lambda12(real sbet1, real cbet1, real sbet2, real cbet2,
00204                   real salp1, real calp1,
00205                   real& salp2, real& calp2, real& sig12,
00206                   real& ssig1, real& csig1, real& ssig2, real& csig2,
00207                   real& eps, real& domg12, bool diffp, real& dlam12,
00208                   real C1a[], real C2a[], real C3a[])
00209       const throw();
00210 
00211     // These are Maxima generated functions to provide series approximations to
00212     // the integrals for the ellipsoidal geodesic.
00213     static real A1m1f(real eps) throw();
00214     static void C1f(real eps, real c[]) throw();
00215     static void C1pf(real eps, real c[]) throw();
00216     static real A2m1f(real eps) throw();
00217     static void C2f(real eps, real c[]) throw();
00218 
00219     void A3coeff() throw();
00220     real A3f(real eps) const throw();
00221     void C3coeff() throw();
00222     void C3f(real eps, real c[]) const throw();
00223     void C4coeff() throw();
00224     void C4f(real k2, real c[]) const throw();
00225 
00226   public:
00227 
00228     /**
00229      * Bit masks for what calculations to do.  These masks do double duty.
00230      * They signify to the GeodesicLine::GeodesicLine constructor and to
00231      * Geodesic::Line what capabilities should be included in the GeodesicLine
00232      * object.  They also specify which results to return in the general
00233      * routines Geodesic::GenDirect and Geodesic::GenInverse routines.
00234      * GeodesicLine::mask is a duplication of this enum.
00235      **********************************************************************/
00236     enum mask {
00237       /**
00238        * No capabilities, no output.
00239        * @hideinitializer
00240        **********************************************************************/
00241       NONE          = 0U,
00242       /**
00243        * Calculate latitude \e lat2.  (It's not necessary to include this as a
00244        * capability to GeodesicLine because this is included by default.)
00245        * @hideinitializer
00246        **********************************************************************/
00247       LATITUDE      = 1U<<7  | CAP_NONE,
00248       /**
00249        * Calculate longitude \e lon2.
00250        * @hideinitializer
00251        **********************************************************************/
00252       LONGITUDE     = 1U<<8  | CAP_C3,
00253       /**
00254        * Calculate azimuths \e azi1 and \e azi2.  (It's not necessary to
00255        * include this as a capability to GeodesicLine because this is included
00256        * by default.)
00257        * @hideinitializer
00258        **********************************************************************/
00259       AZIMUTH       = 1U<<9  | CAP_NONE,
00260       /**
00261        * Calculate distance \e s12.
00262        * @hideinitializer
00263        **********************************************************************/
00264       DISTANCE      = 1U<<10 | CAP_C1,
00265       /**
00266        * Allow distance \e s12 to be used as input in the direct geodesic
00267        * problem.
00268        * @hideinitializer
00269        **********************************************************************/
00270       DISTANCE_IN   = 1U<<11 | CAP_C1 | CAP_C1p,
00271       /**
00272        * Calculate reduced length \e m12.
00273        * @hideinitializer
00274        **********************************************************************/
00275       REDUCEDLENGTH = 1U<<12 | CAP_C1 | CAP_C2,
00276       /**
00277        * Calculate geodesic scales \e M12 and \e M21.
00278        * @hideinitializer
00279        **********************************************************************/
00280       GEODESICSCALE = 1U<<13 | CAP_C1 | CAP_C2,
00281       /**
00282        * Calculate area \e S12.
00283        * @hideinitializer
00284        **********************************************************************/
00285       AREA          = 1U<<14 | CAP_C4,
00286       /**
00287        * All capabilities.  Calculate everything.
00288        * @hideinitializer
00289        **********************************************************************/
00290       ALL           = OUT_ALL| CAP_ALL,
00291     };
00292 
00293     /** \name Constructor
00294      **********************************************************************/
00295     ///@{
00296     /**
00297      * Constructor for a ellipsoid with
00298      *
00299      * @param[in] a equatorial radius (meters).
00300      * @param[in] f flattening of ellipsoid.  Setting \e f = 0 gives a sphere.
00301      *   Negative \e f gives a prolate ellipsoid.  If \e f > 1, set flattening
00302      *   to 1/\e f.
00303      *
00304      * An exception is thrown if either of the axes of the ellipsoid is
00305      * non-positive.
00306      **********************************************************************/
00307     Geodesic(real a, real f);
00308     ///@}
00309 
00310     /** \name Direct geodesic problem specified in terms of distance.
00311      **********************************************************************/
00312     ///@{
00313     /**
00314      * Perform the direct geodesic calculation where the length of the geodesic
00315      * is specify in terms of distance.
00316      *
00317      * @param[in] lat1 latitude of point 1 (degrees).
00318      * @param[in] lon1 longitude of point 1 (degrees).
00319      * @param[in] azi1 azimuth at point 1 (degrees).
00320      * @param[in] s12 distance between point 1 and point 2 (meters); it can be
00321      *   signed.
00322      * @param[out] lat2 latitude of point 2 (degrees).
00323      * @param[out] lon2 longitude of point 2 (degrees).
00324      * @param[out] azi2 (forward) azimuth at point 2 (degrees).
00325      * @param[out] m12 reduced length of geodesic (meters).
00326      * @param[out] M12 geodesic scale of point 2 relative to point 1
00327      *   (dimensionless).
00328      * @param[out] M21 geodesic scale of point 1 relative to point 2
00329      *   (dimensionless).
00330      * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
00331      * @return \e a12 arc length of between point 1 and point 2 (degrees).
00332      *
00333      * \e lat1 should be in the range [-90, 90]; \e lon1 and \e azi1 should be
00334      * in the range [-180, 360].  The values of \e lon2 and \e azi2 returned
00335      * are in the range [-180, 180).
00336      *
00337      * If either point is at a pole, the azimuth is defined by keeping the
00338      * longitude fixed and writing \e lat = 90 - \e eps or -90 + \e eps and
00339      * taking the limit \e eps -> 0 from above.  An arc length greater that 180
00340      * degrees signifies a geodesic which is not a shortest path.  (For a
00341      * prolate ellipsoid, an additional condition is necessary for a shortest
00342      * path: the longitudinal extent must not exceed of 180 degrees.)
00343      *
00344      * The following functions are overloaded versions of Geodesic::Direct
00345      * which omit some of the output parameters.  Note, however, that the arc
00346      * length is always computed and returned as the function value.
00347      **********************************************************************/
00348     Math::real Direct(real lat1, real lon1, real azi1, real s12,
00349                       real& lat2, real& lon2, real& azi2,
00350                       real& m12, real& M12, real& M21, real& S12)
00351       const throw() {
00352       real t;
00353       return GenDirect(lat1, lon1, azi1, false, s12,
00354                        LATITUDE | LONGITUDE | AZIMUTH |
00355                        REDUCEDLENGTH | GEODESICSCALE | AREA,
00356                        lat2, lon2, azi2, t, m12, M12, M21, S12);
00357     }
00358 
00359     /**
00360      * See the documentation for Geodesic::Direct.
00361      **********************************************************************/
00362     Math::real Direct(real lat1, real lon1, real azi1, real s12,
00363                       real& lat2, real& lon2)
00364       const throw() {
00365       real t;
00366       return GenDirect(lat1, lon1, azi1, false, s12,
00367                        LATITUDE | LONGITUDE,
00368                        lat2, lon2, t, t, t, t, t, t);
00369     }
00370 
00371     /**
00372      * See the documentation for Geodesic::Direct.
00373      **********************************************************************/
00374     Math::real Direct(real lat1, real lon1, real azi1, real s12,
00375                       real& lat2, real& lon2, real& azi2)
00376       const throw() {
00377       real t;
00378       return GenDirect(lat1, lon1, azi1, false, s12,
00379                        LATITUDE | LONGITUDE | AZIMUTH,
00380                        lat2, lon2, azi2, t, t, t, t, t);
00381     }
00382 
00383     /**
00384      * See the documentation for Geodesic::Direct.
00385      **********************************************************************/
00386     Math::real Direct(real lat1, real lon1, real azi1, real s12,
00387                       real& lat2, real& lon2, real& azi2, real& m12)
00388       const throw() {
00389       real t;
00390       return GenDirect(lat1, lon1, azi1, false, s12,
00391                        LATITUDE | LONGITUDE | AZIMUTH | REDUCEDLENGTH,
00392                        lat2, lon2, azi2, t, m12, t, t, t);
00393     }
00394 
00395     /**
00396      * See the documentation for Geodesic::Direct.
00397      **********************************************************************/
00398     Math::real Direct(real lat1, real lon1, real azi1, real s12,
00399                       real& lat2, real& lon2, real& azi2,
00400                       real& M12, real& M21)
00401       const throw() {
00402       real t;
00403       return GenDirect(lat1, lon1, azi1, false, s12,
00404                        LATITUDE | LONGITUDE | AZIMUTH | GEODESICSCALE,
00405                        lat2, lon2, azi2, t, t, M12, M21, t);
00406     }
00407 
00408     /**
00409      * See the documentation for Geodesic::Direct.
00410      **********************************************************************/
00411     Math::real Direct(real lat1, real lon1, real azi1, real s12,
00412                       real& lat2, real& lon2, real& azi2,
00413                       real& m12, real& M12, real& M21)
00414       const throw() {
00415       real t;
00416       return GenDirect(lat1, lon1, azi1, false, s12,
00417                        LATITUDE | LONGITUDE | AZIMUTH |
00418                        REDUCEDLENGTH | GEODESICSCALE,
00419                        lat2, lon2, azi2, t, m12, M12, M21, t);
00420     }
00421     ///@}
00422 
00423     /** \name Direct geodesic problem specified in terms of arc length.
00424      **********************************************************************/
00425     ///@{
00426     /**
00427      * Perform the direct geodesic calculation where the length of the geodesic
00428      * is specify in terms of arc length.
00429      *
00430      * @param[in] lat1 latitude of point 1 (degrees).
00431      * @param[in] lon1 longitude of point 1 (degrees).
00432      * @param[in] azi1 azimuth at point 1 (degrees).
00433      * @param[in] a12 arc length between point 1 and point 2 (degrees); it can
00434      *   be signed.
00435      * @param[out] lat2 latitude of point 2 (degrees).
00436      * @param[out] lon2 longitude of point 2 (degrees).
00437      * @param[out] azi2 (forward) azimuth at point 2 (degrees).
00438      * @param[out] s12 distance between point 1 and point 2 (meters).
00439      * @param[out] m12 reduced length of geodesic (meters).
00440      * @param[out] M12 geodesic scale of point 2 relative to point 1
00441      *   (dimensionless).
00442      * @param[out] M21 geodesic scale of point 1 relative to point 2
00443      *   (dimensionless).
00444      * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
00445      *
00446      * \e lat1 should be in the range [-90, 90]; \e lon1 and \e azi1 should be
00447      * in the range [-180, 360].  The values of \e lon2 and \e azi2 returned
00448      * are in the range [-180, 180).
00449      *
00450      * If either point is at a pole, the azimuth is defined by keeping the
00451      * longitude fixed and writing \e lat = 90 - \e eps or -90 + \e eps and
00452      * taking the limit \e eps -> 0 from above.  An arc length greater that 180
00453      * degrees signifies a geodesic which is not a shortest path.  (For a
00454      * prolate ellipsoid, an additional condition is necessary for a shortest
00455      * path: the longitudinal extent must not exceed of 180 degrees.)
00456      *
00457      * The following functions are overloaded versions of Geodesic::Direct
00458      * which omit some of the output parameters.
00459      **********************************************************************/
00460     void ArcDirect(real lat1, real lon1, real azi1, real a12,
00461                    real& lat2, real& lon2, real& azi2, real& s12,
00462                    real& m12, real& M12, real& M21, real& S12)
00463       const throw() {
00464       GenDirect(lat1, lon1, azi1, true, a12,
00465                 LATITUDE | LONGITUDE | AZIMUTH | DISTANCE |
00466                 REDUCEDLENGTH | GEODESICSCALE | AREA,
00467                 lat2, lon2, azi2, s12, m12, M12, M21, S12);
00468     }
00469 
00470     /**
00471      * See the documentation for Geodesic::ArcDirect.
00472      **********************************************************************/
00473     void ArcDirect(real lat1, real lon1, real azi1, real a12,
00474                    real& lat2, real& lon2) const throw() {
00475       real t;
00476       GenDirect(lat1, lon1, azi1, true, a12,
00477                 LATITUDE | LONGITUDE,
00478                 lat2, lon2, t, t, t, t, t, t);
00479     }
00480 
00481     /**
00482      * See the documentation for Geodesic::ArcDirect.
00483      **********************************************************************/
00484     void ArcDirect(real lat1, real lon1, real azi1, real a12,
00485                    real& lat2, real& lon2, real& azi2) const throw() {
00486       real t;
00487       GenDirect(lat1, lon1, azi1, true, a12,
00488                 LATITUDE | LONGITUDE | AZIMUTH,
00489                 lat2, lon2, azi2, t, t, t, t, t);
00490     }
00491 
00492     /**
00493      * See the documentation for Geodesic::ArcDirect.
00494      **********************************************************************/
00495     void ArcDirect(real lat1, real lon1, real azi1, real a12,
00496                    real& lat2, real& lon2, real& azi2, real& s12)
00497       const throw() {
00498       real t;
00499       GenDirect(lat1, lon1, azi1, true, a12,
00500                 LATITUDE | LONGITUDE | AZIMUTH | DISTANCE,
00501                 lat2, lon2, azi2, s12, t, t, t, t);
00502     }
00503 
00504     /**
00505      * See the documentation for Geodesic::ArcDirect.
00506      **********************************************************************/
00507     void ArcDirect(real lat1, real lon1, real azi1, real a12,
00508                    real& lat2, real& lon2, real& azi2,
00509                    real& s12, real& m12) const throw() {
00510       real t;
00511       GenDirect(lat1, lon1, azi1, true, a12,
00512                 LATITUDE | LONGITUDE | AZIMUTH | DISTANCE |
00513                 REDUCEDLENGTH,
00514                 lat2, lon2, azi2, s12, m12, t, t, t);
00515     }
00516 
00517     /**
00518      * See the documentation for Geodesic::ArcDirect.
00519      **********************************************************************/
00520     void ArcDirect(real lat1, real lon1, real azi1, real a12,
00521                    real& lat2, real& lon2, real& azi2, real& s12,
00522                    real& M12, real& M21) const throw() {
00523       real t;
00524       GenDirect(lat1, lon1, azi1, true, a12,
00525                 LATITUDE | LONGITUDE | AZIMUTH | DISTANCE |
00526                 GEODESICSCALE,
00527                 lat2, lon2, azi2, s12, t, M12, M21, t);
00528     }
00529 
00530     /**
00531      * See the documentation for Geodesic::ArcDirect.
00532      **********************************************************************/
00533     void ArcDirect(real lat1, real lon1, real azi1, real a12,
00534                    real& lat2, real& lon2, real& azi2, real& s12,
00535                    real& m12, real& M12, real& M21) const throw() {
00536       real t;
00537       GenDirect(lat1, lon1, azi1, true, a12,
00538                 LATITUDE | LONGITUDE | AZIMUTH | DISTANCE |
00539                 REDUCEDLENGTH | GEODESICSCALE,
00540                 lat2, lon2, azi2, s12, m12, M12, M21, t);
00541     }
00542     ///@}
00543 
00544     /** \name General version of the direct geodesic solution.
00545      **********************************************************************/
00546     ///@{
00547 
00548     /**
00549      * The general direct geodesic calculation.  Geodesic::Direct and
00550      * Geodesic::ArcDirect are defined in terms of this function.
00551      *
00552      * @param[in] lat1 latitude of point 1 (degrees).
00553      * @param[in] lon1 longitude of point 1 (degrees).
00554      * @param[in] azi1 azimuth at point 1 (degrees).
00555      * @param[in] arcmode boolean flag determining the meaning of the second
00556      *   parameter.
00557      * @param[in] s12_a12 if \e arcmode is false, this is the distance between
00558      *   point 1 and point 2 (meters); otherwise it is the arc length between
00559      *   point 1 and point 2 (degrees); it can be signed.
00560      * @param[in] outmask a bitor'ed combination of Geodesic::mask values
00561      *   specifying which of the following parameters should be set.
00562      * @param[out] lat2 latitude of point 2 (degrees).
00563      * @param[out] lon2 longitude of point 2 (degrees).
00564      * @param[out] azi2 (forward) azimuth at point 2 (degrees).
00565      * @param[out] s12 distance between point 1 and point 2 (meters).
00566      * @param[out] m12 reduced length of geodesic (meters).
00567      * @param[out] M12 geodesic scale of point 2 relative to point 1
00568      *   (dimensionless).
00569      * @param[out] M21 geodesic scale of point 1 relative to point 2
00570      *   (dimensionless).
00571      * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
00572      * @return \e a12 arc length of between point 1 and point 2 (degrees).
00573      *
00574      * The Geodesic::mask values possible for \e outmask are
00575      * - \e outmask |= Geodesic::LATITUDE for the latitude \e lat2.
00576      * - \e outmask |= Geodesic::LONGITUDE for the latitude \e lon2.
00577      * - \e outmask |= Geodesic::AZIMUTH for the latitude \e azi2.
00578      * - \e outmask |= Geodesic::DISTANCE for the distance \e s12.
00579      * - \e outmask |= Geodesic::REDUCEDLENGTH for the reduced length \e
00580      *   m12.
00581      * - \e outmask |= Geodesic::GEODESICSCALE for the geodesic scales \e
00582      *   M12 and \e M21.
00583      * - \e outmask |= Geodesic::AREA for the area \e S12.
00584      * .
00585      * The function value \e a12 is always computed and returned and this
00586      * equals \e s12_a12 is \e arcmode is true.  If \e outmask includes
00587      * Geodesic::DISTANCE and \e arcmode is false, then \e s12 = \e s12_a12.
00588      * It is not necessary to include Geodesic::DISTANCE_IN in \e outmask; this
00589      * is automatically included is \e arcmode is false.
00590      **********************************************************************/
00591     Math::real GenDirect(real lat1, real lon1, real azi1,
00592                          bool arcmode, real s12_a12, unsigned outmask,
00593                          real& lat2, real& lon2, real& azi2,
00594                          real& s12, real& m12, real& M12, real& M21,
00595                          real& S12) const throw();
00596     ///@}
00597 
00598     /** \name Inverse geodesic problem.
00599      **********************************************************************/
00600     ///@{
00601     /**
00602      * Perform the inverse geodesic calculation.
00603      *
00604      * @param[in] lat1 latitude of point 1 (degrees).
00605      * @param[in] lon1 longitude of point 1 (degrees).
00606      * @param[in] lat2 latitude of point 2 (degrees).
00607      * @param[in] lon2 longitude of point 2 (degrees).
00608      * @param[out] s12 distance between point 1 and point 2 (meters).
00609      * @param[out] azi1 azimuth at point 1 (degrees).
00610      * @param[out] azi2 (forward) azimuth at point 2 (degrees).
00611      * @param[out] m12 reduced length of geodesic (meters).
00612      * @param[out] M12 geodesic scale of point 2 relative to point 1
00613      *   (dimensionless).
00614      * @param[out] M21 geodesic scale of point 1 relative to point 2
00615      *   (dimensionless).
00616      * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
00617      * @return \e a12 arc length of between point 1 and point 2 (degrees).
00618      *
00619      * \e lat1 and \e lat2 should be in the range [-90, 90]; \e lon1 and \e
00620      * lon2 should be in the range [-180, 360].  The values of \e azi1 and \e
00621      * azi2 returned are in the range [-180, 180).
00622      *
00623      * If either point is at a pole, the azimuth is defined by keeping the
00624      * longitude fixed and writing \e lat = 90 - \e eps or -90 + \e eps and
00625      * taking the limit \e eps -> 0 from above.  If the routine fails to
00626      * converge, then all the requested outputs are set to Math::NaN().  (Test
00627      * for such results with Math::isnan.)  This is not expected to happen with
00628      * ellipsoidal models of the earth; please report all cases where this
00629      * occurs.
00630      *
00631      * The following functions are overloaded versions of Geodesic::Inverse
00632      * which omit some of the output parameters.  Note, however, that the arc
00633      * length is always computed and returned as the function value.
00634      **********************************************************************/
00635     Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
00636                        real& s12, real& azi1, real& azi2, real& m12,
00637                        real& M12, real& M21, real& S12) const throw() {
00638       return GenInverse(lat1, lon1, lat2, lon2,
00639                         DISTANCE | AZIMUTH |
00640                         REDUCEDLENGTH | GEODESICSCALE | AREA,
00641                         s12, azi1, azi2, m12, M12, M21, S12);
00642     }
00643 
00644     /**
00645      * See the documentation for Geodesic::Inverse.
00646      **********************************************************************/
00647     Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
00648                        real& s12) const throw() {
00649       real t;
00650       return GenInverse(lat1, lon1, lat2, lon2,
00651                         DISTANCE,
00652                         s12, t, t, t, t, t, t);
00653     }
00654 
00655     /**
00656      * See the documentation for Geodesic::Inverse.
00657      **********************************************************************/
00658     Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
00659                        real& azi1, real& azi2) const throw() {
00660       real t;
00661       return GenInverse(lat1, lon1, lat2, lon2,
00662                         AZIMUTH,
00663                         t, azi1, azi2, t, t, t, t);
00664     }
00665 
00666     /**
00667      * See the documentation for Geodesic::Inverse.
00668      **********************************************************************/
00669     Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
00670                        real& s12, real& azi1, real& azi2)
00671       const throw() {
00672       real t;
00673       return GenInverse(lat1, lon1, lat2, lon2,
00674                         DISTANCE | AZIMUTH,
00675                         s12, azi1, azi2, t, t, t, t);
00676     }
00677 
00678     /**
00679      * See the documentation for Geodesic::Inverse.
00680      **********************************************************************/
00681     Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
00682                        real& s12, real& azi1, real& azi2, real& m12)
00683       const throw() {
00684       real t;
00685       return GenInverse(lat1, lon1, lat2, lon2,
00686                         DISTANCE | AZIMUTH | REDUCEDLENGTH,
00687                         s12, azi1, azi2, m12, t, t, t);
00688     }
00689 
00690     /**
00691      * See the documentation for Geodesic::Inverse.
00692      **********************************************************************/
00693     Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
00694                        real& s12, real& azi1, real& azi2,
00695                        real& M12, real& M21) const throw() {
00696       real t;
00697       return GenInverse(lat1, lon1, lat2, lon2,
00698                         DISTANCE | AZIMUTH | GEODESICSCALE,
00699                         s12, azi1, azi2, t, M12, M21, t);
00700     }
00701 
00702     /**
00703      * See the documentation for Geodesic::Inverse.
00704      **********************************************************************/
00705     Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
00706                        real& s12, real& azi1, real& azi2, real& m12,
00707                        real& M12, real& M21) const throw() {
00708       real t;
00709       return GenInverse(lat1, lon1, lat2, lon2,
00710                         DISTANCE | AZIMUTH |
00711                         REDUCEDLENGTH | GEODESICSCALE,
00712                         s12, azi1, azi2, m12, M12, M21, t);
00713     }
00714     ///@}
00715 
00716     /** \name General version of inverse geodesic solution.
00717      **********************************************************************/
00718     ///@{
00719     /**
00720      * The general inverse geodesic calculation.  Geodesic::Inverse is defined
00721      * in terms of this function.
00722      *
00723      * @param[in] lat1 latitude of point 1 (degrees).
00724      * @param[in] lon1 longitude of point 1 (degrees).
00725      * @param[in] lat2 latitude of point 2 (degrees).
00726      * @param[in] lon2 longitude of point 2 (degrees).
00727      * @param[in] outmask a bitor'ed combination of Geodesic::mask values
00728      *   specifying which of the following parameters should be set.
00729      * @param[out] s12 distance between point 1 and point 2 (meters).
00730      * @param[out] azi1 azimuth at point 1 (degrees).
00731      * @param[out] azi2 (forward) azimuth at point 2 (degrees).
00732      * @param[out] m12 reduced length of geodesic (meters).
00733      * @param[out] M12 geodesic scale of point 2 relative to point 1
00734      *   (dimensionless).
00735      * @param[out] M21 geodesic scale of point 1 relative to point 2
00736      *   (dimensionless).
00737      * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
00738      * @return \e a12 arc length of between point 1 and point 2 (degrees).
00739      *
00740      * The Geodesic::mask values possible for \e outmask are
00741      * - \e outmask |= Geodesic::DISTANCE for the distance \e s12.
00742      * - \e outmask |= Geodesic::AZIMUTH for the latitude \e azi2.
00743      * - \e outmask |= Geodesic::REDUCEDLENGTH for the reduced length \e
00744      *   m12.
00745      * - \e outmask |= Geodesic::GEODESICSCALE for the geodesic scales \e
00746      *   M12 and \e M21.
00747      * - \e outmask |= Geodesic::AREA for the area \e S12.
00748      * .
00749      * The arc length is always computed and returned as the function value.
00750      **********************************************************************/
00751     Math::real GenInverse(real lat1, real lon1, real lat2, real lon2,
00752                           unsigned outmask,
00753                           real& s12, real& azi1, real& azi2,
00754                           real& m12, real& M12, real& M21, real& S12)
00755       const throw();
00756     ///@}
00757 
00758     /** \name Interface to GeodesicLine.
00759      **********************************************************************/
00760     ///@{
00761 
00762     /**
00763      * Set up to compute several points on a singe geodesic.
00764      *
00765      * @param[in] lat1 latitude of point 1 (degrees).
00766      * @param[in] lon1 longitude of point 1 (degrees).
00767      * @param[in] azi1 azimuth at point 1 (degrees).
00768      * @param[in] caps bitor'ed combination of Geodesic::mask values
00769      *   specifying the capabilities the GeodesicLine object should possess,
00770      *   i.e., which quantities can be returned in calls to
00771      *   GeodesicLib::Position.
00772      *
00773      * \e lat1 should be in the range [-90, 90]; \e lon1 and \e azi1 should be
00774      * in the range [-180, 360].
00775      *
00776      * The Geodesic::mask values are
00777      * - \e caps |= Geodesic::LATITUDE for the latitude \e lat2; this is
00778      *   added automatically
00779      * - \e caps |= Geodesic::LONGITUDE for the latitude \e lon2
00780      * - \e caps |= Geodesic::AZIMUTH for the latitude \e azi2; this is
00781      *   added automatically
00782      * - \e caps |= Geodesic::DISTANCE for the distance \e s12
00783      * - \e caps |= Geodesic::REDUCEDLENGTH for the reduced length \e m12
00784      * - \e caps |= Geodesic::GEODESICSCALE for the geodesic scales \e M12
00785      *   and \e M21
00786      * - \e caps |= Geodesic::AREA for the area \e S12
00787      * - \e caps |= Geodesic::DISTANCE_IN permits the length of the
00788      *   geodesic to be given in terms of \e s12; without this capability the
00789      *   length can only be specified in terms of arc length.
00790      * .
00791      * The default value of \e caps is Geodesic::ALL which turns on all the
00792      * capabilities.
00793      *
00794      * If the point is at a pole, the azimuth is defined by keeping the \e lon1
00795      * fixed and writing \e lat1 = 90 - \e eps or -90 + \e eps and taking the
00796      * limit \e eps -> 0 from above.
00797      **********************************************************************/
00798     GeodesicLine Line(real lat1, real lon1, real azi1, unsigned caps = ALL)
00799       const throw();
00800 
00801     ///@}
00802 
00803     /** \name Inspector functions.
00804      **********************************************************************/
00805     ///@{
00806 
00807     /**
00808      * @return \e a the equatorial radius of the ellipsoid (meters).  This is
00809      *   the value used in the constructor.
00810      **********************************************************************/
00811     Math::real MajorRadius() const throw() { return _a; }
00812 
00813     /**
00814      * @return \e f the  flattening of the ellipsoid.  This is the
00815      *   value used in the constructor.
00816      **********************************************************************/
00817     Math::real Flattening() const throw() { return _f; }
00818 
00819     /// \cond SKIP
00820     /**
00821      * <b>DEPRECATED</b>
00822      * @return \e r the inverse flattening of the ellipsoid.
00823      **********************************************************************/
00824     Math::real InverseFlattening() const throw() { return 1/_f; }
00825     /// \endcond
00826 
00827     /**
00828      * @return total area of ellipsoid in meters<sup>2</sup>.  The area of a
00829      *   polygon encircling a pole can be found by adding
00830      *   Geodesic::EllipsoidArea()/2 to the sum of \e S12 for each side of the
00831      *   polygon.
00832      **********************************************************************/
00833     Math::real EllipsoidArea() const throw()
00834     { return 4 * Math::pi<real>() * _c2; }
00835     ///@}
00836 
00837     /**
00838      * A global instantiation of Geodesic with the parameters for the WGS84
00839      * ellipsoid.
00840      **********************************************************************/
00841     static const Geodesic WGS84;
00842 
00843   };
00844 
00845 } // namespace GeographicLib
00846 
00847 #endif  // GEOGRAPHICLIB_GEODESIC_HPP
geographiclib-1.21/doc/html/functions_0x62.html0000644000175000017500000001060611745620414021251 0ustar frankiefrankie GeographicLib: Class Members
Here is a list of all class members with links to the classes they belong to:

- b -

geographiclib-1.21/doc/html/DMS_8cpp.html0000644000175000017500000001135611745620414020042 0ustar frankiefrankie GeographicLib: DMS.cpp File Reference
DMS.cpp File Reference

Implementation for GeographicLib::DMS class. More...

#include <GeographicLib/DMS.hpp>
#include <algorithm>
#include <GeographicLib/Utility.hpp>

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_DMS_CPP   "$Id: db38ddc05f7c27732da3aa820191a51200ce92ac $"

Detailed Description

Implementation for GeographicLib::DMS class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file DMS.cpp.


Define Documentation

#define GEOGRAPHICLIB_DMS_CPP   "$Id: db38ddc05f7c27732da3aa820191a51200ce92ac $"

Definition at line 14 of file DMS.cpp.

geographiclib-1.21/doc/html/PolarStereographic_8hpp.html0000644000175000017500000001267511745620414023226 0ustar frankiefrankie GeographicLib: PolarStereographic.hpp File Reference
PolarStereographic.hpp File Reference

Header for GeographicLib::PolarStereographic class. More...

Go to the source code of this file.

Classes

class  GeographicLib::PolarStereographic
 Polar Stereographic Projection. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP   "$Id: 07add8492c46e42012007a8738060abc902a5504 $"

Detailed Description

Header for GeographicLib::PolarStereographic class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file PolarStereographic.hpp.


Define Documentation

#define GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP   "$Id: 07add8492c46e42012007a8738060abc902a5504 $"

Definition at line 11 of file PolarStereographic.hpp.

geographiclib-1.21/doc/html/GeoCoords_8cpp_source.html0000644000175000017500000004470611745620414022670 0ustar frankiefrankie GeographicLib: GeoCoords.cpp Source File
GeoCoords.cpp
Go to the documentation of this file.
00001 /**
00002  * \file GeoCoords.cpp
00003  * \brief Implementation for GeographicLib::GeoCoords class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/GeoCoords.hpp>
00011 #include <vector>
00012 #include <sstream>
00013 #include <iomanip>
00014 #include <GeographicLib/MGRS.hpp>
00015 #include <GeographicLib/DMS.hpp>
00016 
00017 #define GEOGRAPHICLIB_GEOCOORDS_CPP \
00018   "$Id: 084d4ec9163dc9d8989b54b12a04bf0f44a8c23f $"
00019 
00020 RCSID_DECL(GEOGRAPHICLIB_GEOCOORDS_CPP)
00021 RCSID_DECL(GEOGRAPHICLIB_GEOCOORDS_HPP)
00022 
00023 namespace GeographicLib {
00024 
00025   using namespace std;
00026 
00027   void GeoCoords::Reset(const std::string& s, bool centerp, bool swaplatlong) {
00028     vector<string> sa;
00029     const char* spaces = " \t\n\v\f\r,"; // Include comma as a space
00030     for (string::size_type pos0 = 0, pos1; pos0 != string::npos;) {
00031       pos1 = s.find_first_not_of(spaces, pos0);
00032       if (pos1 == string::npos)
00033         break;
00034       pos0 = s.find_first_of(spaces, pos1);
00035       sa.push_back(s.substr(pos1, pos0 == string::npos ? pos0 : pos0 - pos1));
00036     }
00037     if (sa.size() == 1) {
00038       int prec;
00039       MGRS::Reverse(sa[0], _zone, _northp, _easting, _northing, prec, centerp);
00040       UTMUPS::Reverse(_zone, _northp, _easting, _northing,
00041                       _lat, _long, _gamma, _k);
00042     } else if (sa.size() == 2) {
00043       DMS::DecodeLatLon(sa[0], sa[1], _lat, _long, swaplatlong);
00044       UTMUPS::Forward( _lat, _long,
00045                        _zone, _northp, _easting, _northing, _gamma, _k);
00046     } else if (sa.size() == 3) {
00047       unsigned zoneind, coordind;
00048       if (sa[0].size() > 0 && isalpha(sa[0][sa[0].size() - 1])) {
00049         zoneind = 0;
00050         coordind = 1;
00051       } else if (sa[2].size() > 0 && isalpha(sa[2][sa[2].size() - 1])) {
00052         zoneind = 2;
00053         coordind = 0;
00054       } else
00055         throw GeographicErr("Neither " + sa[0] + " nor " + sa[2]
00056                             + " of the form UTM/UPS Zone + Hemisphere"
00057                             + " (ex: 38N, 09S, N)");
00058       UTMUPS::DecodeZone(sa[zoneind], _zone, _northp);
00059       for (unsigned i = 0; i < 2; ++i)
00060         (i ? _northing : _easting) = DMS::Decode(sa[coordind + i]);
00061       UTMUPS::Reverse(_zone, _northp, _easting, _northing,
00062                       _lat, _long, _gamma, _k);
00063       FixHemisphere();
00064     } else
00065       throw GeographicErr("Coordinate requires 1, 2, or 3 elements");
00066     CopyToAlt();
00067   }
00068 
00069 
00070   string GeoCoords::GeoRepresentation(int prec, bool swaplatlong) const {
00071     prec = max(0, min(9, prec) + 5);
00072     ostringstream os;
00073     os << fixed << setprecision(prec);
00074     real a = swaplatlong ? _long : _lat;
00075     real b = swaplatlong ? _lat : _long;
00076     if (!Math::isnan(a))
00077       os << a;
00078     else
00079       os << "nan";
00080     os << " ";
00081     if (!Math::isnan(b))
00082       os << b;
00083     else
00084       os << "nan";
00085     return os.str();
00086   }
00087 
00088   string GeoCoords::DMSRepresentation(int prec, bool swaplatlong,
00089                                       char dmssep) const {
00090     prec = max(0, min(10, prec) + 5);
00091     return DMS::Encode(swaplatlong ? _long : _lat, unsigned(prec),
00092                        swaplatlong ? DMS::LONGITUDE : DMS::LATITUDE, dmssep) +
00093       " " + DMS::Encode(swaplatlong ? _lat : _long, unsigned(prec),
00094                         swaplatlong ? DMS::LATITUDE : DMS::LONGITUDE, dmssep);
00095   }
00096 
00097   string GeoCoords::DMSRepresentation(int prec, bool swaplatlong) const
00098   { return DMSRepresentation(prec, swaplatlong, char(0)); }
00099 
00100   string GeoCoords::MGRSRepresentation(int prec) const {
00101     // Max precision is um
00102     prec = max(0, min(6, prec) + 5);
00103     string mgrs;
00104     MGRS::Forward(_zone, _northp, _easting, _northing, _lat, prec, mgrs);
00105     return mgrs;
00106   }
00107 
00108   string GeoCoords::AltMGRSRepresentation(int prec) const {
00109     // Max precision is um
00110     prec = max(0, min(6, prec) + 5);
00111     string mgrs;
00112     MGRS::Forward(_alt_zone, _northp, _alt_easting, _alt_northing, _lat, prec,
00113                   mgrs);
00114     return mgrs;
00115   }
00116 
00117   void GeoCoords::UTMUPSString(int zone, real easting, real northing, int prec,
00118                                std::string& utm) const {
00119     ostringstream os;
00120     prec = max(-5, min(9, prec));
00121     real scale = prec < 0 ? pow(real(10), -prec) : real(1);
00122     os << UTMUPS::EncodeZone(zone, _northp) << fixed << setfill('0');
00123     if (Math::isfinite(easting)) {
00124       os << " " << setprecision(max(0, prec)) << easting / scale;
00125       if (prec < 0 && abs(easting / scale) > real(0.5))
00126         os << setw(-prec) << 0;
00127     } else
00128       os << " nan";
00129     if (Math::isfinite(northing)) {
00130       os << " " << setprecision(max(0, prec)) << northing / scale;
00131       if (prec < 0 && abs(northing / scale) > real(0.5))
00132         os << setw(-prec) << 0;
00133     } else
00134       os << " nan";
00135     utm = os.str();
00136   }
00137 
00138   string GeoCoords::UTMUPSRepresentation(int prec) const {
00139     string utm;
00140     UTMUPSString(_zone, _easting, _northing, prec, utm);
00141     return utm;
00142   }
00143 
00144   string GeoCoords::AltUTMUPSRepresentation(int prec) const {
00145     string utm;
00146     UTMUPSString(_alt_zone, _alt_easting, _alt_northing, prec, utm);
00147     return utm;
00148   }
00149 
00150   void GeoCoords::FixHemisphere() {
00151     if (_lat == 0 || (_northp && _lat >= 0) || (!_northp && _lat < 0) ||
00152         Math::isnan(_lat))
00153       // Allow either hemisphere for equator
00154       return;
00155     if (_zone != UTMUPS::UPS) {
00156       _northing += (_northp ? 1 : -1) * UTMUPS::UTMShift();
00157       _northp = !_northp;
00158     } else
00159       throw GeographicErr("Hemisphere mixup");
00160   }
00161 
00162 } // namespace GeographicLib
geographiclib-1.21/doc/html/TransverseMercator_8cpp_source.html0000644000175000017500000013745011745620415024635 0ustar frankiefrankie GeographicLib: TransverseMercator.cpp Source File
TransverseMercator.cpp
Go to the documentation of this file.
00001 /**
00002  * \file TransverseMercator.cpp
00003  * \brief Implementation for GeographicLib::TransverseMercator class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  *
00009  * This implementation follows closely
00010  * <a href="http://www.jhs-suositukset.fi/suomi/jhs154"> JHS 154, ETRS89 -
00011  * j&auml;rjestelm&auml;&auml;n liittyv&auml;t karttaprojektiot,
00012  * tasokoordinaatistot ja karttalehtijako</a> (Map projections, plane
00013  * coordinates, and map sheet index for ETRS89), published by JUHTA, Finnish
00014  * Geodetic Institute, and the National Land Survey of Finland (2006).
00015  *
00016  * The relevant section is available as the 2008 PDF file
00017  * http://docs.jhs-suositukset.fi/jhs-suositukset/JHS154/JHS154_liite1.pdf
00018  *
00019  * This is a straight transcription of the formulas in this paper with the
00020  * following exceptions:
00021  *  - use of 6th order series instead of 4th order series.  This reduces the
00022  *    error to about 5nm for the UTM range of coordinates (instead of 200nm),
00023  *    with a speed penalty of only 1%;
00024  *  - use Newton's method instead of plain iteration to solve for latitude in
00025  *    terms of isometric latitude in the Reverse method;
00026  *  - use of Horner's representation for evaluating polynomials and Clenshaw's
00027  *    method for summing trigonometric series;
00028  *  - several modifications of the formulas to improve the numerical accuracy;
00029  *  - evaluating the convergence and scale using the expression for the
00030  *    projection or its inverse.
00031  *
00032  * If the preprocessor variable TM_TX_MAXPOW is set to an integer between 4 and
00033  * 8, then this specifies the order of the series used for the forward and
00034  * reverse transformations.  The default value is 6.  (The series accurate to
00035  * 12th order is given in \ref tmseries.)
00036  *
00037  * Other equivalent implementations are given in
00038  *  - http://www.ign.fr/DISPLAY/000/526/702/5267021/NTG_76.pdf
00039  *  - http://www.lantmateriet.se/upload/filer/kartor/geodesi_gps_och_detaljmatning/geodesi/Formelsamling/Gauss_Conformal_Projection.pdf
00040  **********************************************************************/
00041 
00042 #include <GeographicLib/TransverseMercator.hpp>
00043 
00044 #define GEOGRAPHICLIB_TRANSVERSEMERCATOR_CPP \
00045   "$Id: 7b5a1854a015da061b8fdad0a4b35be7e06fcb9a $"
00046 
00047 RCSID_DECL(GEOGRAPHICLIB_TRANSVERSEMERCATOR_CPP)
00048 RCSID_DECL(GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP)
00049 
00050 namespace GeographicLib {
00051 
00052   using namespace std;
00053 
00054   const Math::real TransverseMercator::tol_ =
00055     real(0.1)*sqrt(numeric_limits<real>::epsilon());
00056   // Overflow value s.t. atan(overflow_) = pi/2
00057   const Math::real TransverseMercator::overflow_ =
00058     1 / Math::sq(numeric_limits<real>::epsilon());
00059 
00060   TransverseMercator::TransverseMercator(real a, real f, real k0)
00061     : _a(a)
00062     , _f(f <= 1 ? f : 1/f)
00063     , _k0(k0)
00064     , _e2(_f * (2 - _f))
00065     , _e(sqrt(abs(_e2)))
00066     , _e2m(1 - _e2)
00067       // _c = sqrt( pow(1 + _e, 1 + _e) * pow(1 - _e, 1 - _e) ) )
00068       // See, for example, Lee (1976), p 100.
00069     , _c( sqrt(_e2m) * exp(eatanhe(real(1))) )
00070     , _n(_f / (2 - _f))
00071   {
00072     if (!(Math::isfinite(_a) && _a > 0))
00073       throw GeographicErr("Major radius is not positive");
00074     if (!(Math::isfinite(_f) && _f < 1))
00075       throw GeographicErr("Minor radius is not positive");
00076     if (!(Math::isfinite(_k0) && _k0 > 0))
00077       throw GeographicErr("Scale is not positive");
00078     // If coefficents might overflow_ an int, convert them to double (and they
00079     // are all exactly representable as doubles).
00080     real nx = Math::sq(_n);
00081     switch (maxpow_) {
00082     case 4:
00083       _b1 = 1/(1+_n)*(nx*(nx+16)+64)/64;
00084       _alp[1] = _n*(_n*(_n*(164*_n+225)-480)+360)/720;
00085       _bet[1] = _n*(_n*((555-4*_n)*_n-960)+720)/1440;
00086       _alp[2] = nx*(_n*(557*_n-864)+390)/1440;
00087       _bet[2] = nx*((96-437*_n)*_n+30)/1440;
00088       nx *= _n;
00089       _alp[3] = (427-1236*_n)*nx/1680;
00090       _bet[3] = (119-148*_n)*nx/3360;
00091       nx *= _n;
00092       _alp[4] = 49561*nx/161280;
00093       _bet[4] = 4397*nx/161280;
00094       break;
00095     case 5:
00096       _b1 = 1/(1+_n)*(nx*(nx+16)+64)/64;
00097       _alp[1] = _n*(_n*(_n*((328-635*_n)*_n+450)-960)+720)/1440;
00098       _bet[1] = _n*(_n*(_n*((-3645*_n-64)*_n+8880)-15360)+11520)/23040;
00099       _alp[2] = nx*(_n*(_n*(4496*_n+3899)-6048)+2730)/10080;
00100       _bet[2] = nx*(_n*(_n*(4416*_n-3059)+672)+210)/10080;
00101       nx *= _n;
00102       _alp[3] = nx*(_n*(15061*_n-19776)+6832)/26880;
00103       _bet[3] = nx*((-627*_n-592)*_n+476)/13440;
00104       nx *= _n;
00105       _alp[4] = (49561-171840*_n)*nx/161280;
00106       _bet[4] = (4397-3520*_n)*nx/161280;
00107       nx *= _n;
00108       _alp[5] = 34729*nx/80640;
00109       _bet[5] = 4583*nx/161280;
00110       break;
00111     case 6:
00112       _b1 = 1/(1+_n)*(nx*(nx*(nx+4)+64)+256)/256;
00113       _alp[1] = _n*(_n*(_n*(_n*(_n*(31564*_n-66675)+34440)+47250)-100800)+
00114                     75600)/151200;
00115       _bet[1] = _n*(_n*(_n*(_n*(_n*(384796*_n-382725)-6720)+932400)-1612800)+
00116                     1209600)/2419200;
00117       _alp[2] = nx*(_n*(_n*((863232-1983433*_n)*_n+748608)-1161216)+524160)/
00118         1935360;
00119       _bet[2] = nx*(_n*(_n*((1695744-1118711*_n)*_n-1174656)+258048)+80640)/
00120         3870720;
00121       nx *= _n;
00122       _alp[3] = nx*(_n*(_n*(670412*_n+406647)-533952)+184464)/725760;
00123       _bet[3] = nx*(_n*(_n*(22276*_n-16929)-15984)+12852)/362880;
00124       nx *= _n;
00125       _alp[4] = nx*(_n*(6601661*_n-7732800)+2230245)/7257600;
00126       _bet[4] = nx*((-830251*_n-158400)*_n+197865)/7257600;
00127       nx *= _n;
00128       _alp[5] = (3438171-13675556*_n)*nx/7983360;
00129       _bet[5] = (453717-435388*_n)*nx/15966720;
00130       nx *= _n;
00131       _alp[6] = 212378941*nx/319334400;
00132       _bet[6] = 20648693*nx/638668800;
00133       break;
00134     case 7:
00135       _b1 = 1/(1+_n)*(nx*(nx*(nx+4)+64)+256)/256;
00136       _alp[1] = _n*(_n*(_n*(_n*(_n*(_n*(1804025*_n+2020096)-4267200)+2204160)+
00137                             3024000)-6451200)+4838400)/9676800;
00138       _bet[1] = _n*(_n*(_n*(_n*(_n*((6156736-5406467*_n)*_n-6123600)-107520)+
00139                             14918400)-25804800)+19353600)/38707200;
00140       _alp[2] = nx*(_n*(_n*(_n*(_n*(4626384*_n-9917165)+4316160)+3743040)-
00141                         5806080)+2620800)/9676800;
00142       _bet[2] = nx*(_n*(_n*(_n*(_n*(829456*_n-5593555)+8478720)-5873280)+
00143                         1290240)+403200)/19353600;
00144       nx *= _n;
00145       _alp[3] = nx*(_n*(_n*((26816480-67102379*_n)*_n+16265880)-21358080)+
00146                     7378560)/29030400;
00147       _bet[3] = nx*(_n*(_n*(_n*(9261899*_n+3564160)-2708640)-2557440)+
00148                     2056320)/58060800;
00149       nx *= _n;
00150       _alp[4] = nx*(_n*(_n*(155912000*_n+72618271)-85060800)+24532695)/
00151         79833600;
00152       _bet[4] = nx*(_n*(_n*(14928352*_n-9132761)-1742400)+2176515)/79833600;
00153       nx *= _n;
00154       _alp[5] = nx*(_n*(102508609*_n-109404448)+27505368)/63866880;
00155       _bet[5] = nx*((-8005831*_n-1741552)*_n+1814868)/63866880;
00156       nx *= _n;
00157       _alp[6] = (2760926233.0-12282192400.0*_n)*nx/4151347200.0;
00158       _bet[6] = (268433009-261810608*_n)*nx/8302694400.0;
00159       nx *= _n;
00160       _alp[7] = 1522256789.0*nx/1383782400.0;
00161       _bet[7] = 219941297*nx/5535129600.0;
00162       break;
00163     case 8:
00164       _b1 = 1/(1+_n)*(nx*(nx*(nx*(25*nx+64)+256)+4096)+16384)/16384;
00165       _alp[1] = _n*(_n*(_n*(_n*(_n*(_n*((37884525-75900428*_n)*_n+42422016)-
00166                                     89611200)+46287360)+63504000)-135475200)+
00167                     101606400)/203212800;
00168       _bet[1] = _n*(_n*(_n*(_n*(_n*(_n*(_n*(31777436*_n-37845269)+43097152)-
00169                                     42865200)-752640)+104428800)-180633600)+
00170                     135475200)/270950400;
00171       _alp[2] = nx*(_n*(_n*(_n*(_n*(_n*(148003883*_n+83274912)-178508970)+
00172                                 77690880)+67374720)-104509440)+47174400)/
00173         174182400;
00174       _bet[2] = nx*(_n*(_n*(_n*(_n*(_n*(24749483*_n+14930208)-100683990)+
00175                                 152616960)-105719040)+23224320)+7257600)/
00176         348364800;
00177       nx *= _n;
00178       _alp[3] = nx*(_n*(_n*(_n*(_n*(318729724*_n-738126169)+294981280)+
00179                             178924680)-234938880)+81164160)/319334400;
00180       _bet[3] = nx*(_n*(_n*(_n*((101880889-232468668*_n)*_n+39205760)-
00181                             29795040)-28131840)+22619520)/638668800;
00182       nx *= _n;
00183       _alp[4] = nx*(_n*(_n*((14967552000.0-40176129013.0*_n)*_n+6971354016.0)-
00184                         8165836800.0)+2355138720.0)/7664025600.0;
00185       _bet[4] = nx*(_n*(_n*(_n*(324154477*_n+1433121792.0)-876745056)-
00186                         167270400)+208945440)/7664025600.0;
00187       nx *= _n;
00188       _alp[5] = nx*(_n*(_n*(10421654396.0*_n+3997835751.0)-4266773472.0)+
00189                     1072709352.0)/2490808320.0;
00190       _bet[5] = nx*(_n*(_n*(457888660*_n-312227409)-67920528)+70779852)/
00191         2490808320.0;
00192       nx *= _n;
00193       _alp[6] = nx*(_n*(175214326799.0*_n-171950693600.0)+38652967262.0)/
00194         58118860800.0;
00195       _bet[6] = nx*((-19841813847.0*_n-3665348512.0)*_n+3758062126.0)/
00196         116237721600.0;
00197       nx *= _n;
00198       _alp[7] = (13700311101.0-67039739596.0*_n)*nx/12454041600.0;
00199       _bet[7] = (1979471673.0-1989295244.0*_n)*nx/49816166400.0;
00200       nx *= _n;
00201       _alp[8] = 1424729850961.0*nx/743921418240.0;
00202       _bet[8] = 191773887257.0*nx/3719607091200.0;
00203       break;
00204     default:
00205       STATIC_ASSERT(maxpow_ >= 4 && maxpow_ <= 8, "Bad value of maxpow_");
00206     }
00207     // _a1 is the equivalent radius for computing the circumference of
00208     // ellipse.
00209     _a1 = _b1 * _a;
00210   }
00211 
00212   const TransverseMercator
00213   TransverseMercator::UTM(Constants::WGS84_a<real>(),
00214                           Constants::WGS84_f<real>(),
00215                           Constants::UTM_k0<real>());
00216 
00217   void TransverseMercator::Forward(real lon0, real lat, real lon,
00218                                    real& x, real& y, real& gamma, real& k)
00219     const throw() {
00220     // Avoid losing a bit of accuracy in lon (assuming lon0 is an integer)
00221     if (lon - lon0 > 180)
00222       lon -= lon0 + 360;
00223     else if (lon - lon0 <= -180)
00224       lon -= lon0 - 360;
00225     else
00226       lon -= lon0;
00227     // Now lon in (-180, 180]
00228     // Explicitly enforce the parity
00229     int
00230       latsign = lat < 0 ? -1 : 1,
00231       lonsign = lon < 0 ? -1 : 1;
00232     lon *= lonsign;
00233     lat *= latsign;
00234     bool backside = lon > 90;
00235     if (backside) {
00236       if (lat == 0)
00237         latsign = -1;
00238       lon = 180 - lon;
00239     }
00240     real
00241       phi = lat * Math::degree<real>(),
00242       lam = lon * Math::degree<real>();
00243     // phi = latitude
00244     // phi' = conformal latitude
00245     // psi = isometric latitude
00246     // tau = tan(phi)
00247     // tau' = tan(phi')
00248     // [xi', eta'] = Gauss-Schreiber TM coordinates
00249     // [xi, eta] = Gauss-Krueger TM coordinates
00250     //
00251     // We use
00252     //   tan(phi') = sinh(psi)
00253     //   sin(phi') = tanh(psi)
00254     //   cos(phi') = sech(psi)
00255     //   denom^2    = 1-cos(phi')^2*sin(lam)^2 = 1-sech(psi)^2*sin(lam)^2
00256     //   sin(xip)   = sin(phi')/denom          = tanh(psi)/denom
00257     //   cos(xip)   = cos(phi')*cos(lam)/denom = sech(psi)*cos(lam)/denom
00258     //   cosh(etap) = 1/denom                  = 1/denom
00259     //   sinh(etap) = cos(phi')*sin(lam)/denom = sech(psi)*sin(lam)/denom
00260     real etap, xip;
00261     if (lat != 90) {
00262       real
00263         c = max(real(0), cos(lam)), // cos(pi/2) might be negative
00264         tau = tan(phi),
00265         secphi = Math::hypot(real(1), tau),
00266         sig = sinh( eatanhe(tau / secphi) ),
00267         taup = Math::hypot(real(1), sig) * tau - sig * secphi;
00268       xip = atan2(taup, c);
00269       // Used to be
00270       //   etap = Math::atanh(sin(lam) / cosh(psi));
00271       etap = Math::asinh(sin(lam) / Math::hypot(taup, c));
00272       // convergence and scale for Gauss-Schreiber TM (xip, etap) -- gamma0 =
00273       // atan(tan(xip) * tanh(etap)) = atan(tan(lam) * sin(phi'));
00274       // sin(phi') = tau'/sqrt(1 + tau'^2)
00275       gamma = atan(tanx(lam) *
00276                    taup / Math::hypot(real(1), taup)); // Krueger p 22 (44)
00277       // k0 = sqrt(1 - _e2 * sin(phi)^2) * (cos(phi') / cos(phi)) * cosh(etap)
00278       // Note 1/cos(phi) = cosh(psip);
00279       // and cos(phi') * cosh(etap) = 1/hypot(sinh(psi), cos(lam))
00280       //
00281       // This form has cancelling errors.  This property is lost if cosh(psip)
00282       // is replaced by 1/cos(phi), even though it's using "primary" data (phi
00283       // instead of psip).
00284       k = sqrt(_e2m + _e2 * Math::sq(cos(phi))) * secphi / Math::hypot(taup, c);
00285     } else {
00286       xip = Math::pi<real>()/2;
00287       etap = 0;
00288       gamma = lam;
00289       k = _c;
00290     }
00291     // {xi',eta'} is {northing,easting} for Gauss-Schreiber transverse Mercator
00292     // (for eta' = 0, xi' = bet). {xi,eta} is {northing,easting} for transverse
00293     // Mercator with constant scale on the central meridian (for eta = 0, xip =
00294     // rectifying latitude).  Define
00295     //
00296     //   zeta = xi + i*eta
00297     //   zeta' = xi' + i*eta'
00298     //
00299     // The conversion from conformal to rectifying latitude can be expresses as
00300     // a series in _n:
00301     //
00302     //   zeta = zeta' + sum(h[j-1]' * sin(2 * j * zeta'), j = 1..maxpow_)
00303     //
00304     // where h[j]' = O(_n^j).  The reversion of this series gives
00305     //
00306     //   zeta' = zeta - sum(h[j-1] * sin(2 * j * zeta), j = 1..maxpow_)
00307     //
00308     // which is used in Reverse.
00309     //
00310     // Evaluate sums via Clenshaw method.  See
00311     //    http://mathworld.wolfram.com/ClenshawRecurrenceFormula.html
00312     //
00313     // Let
00314     //
00315     //    S = sum(c[k] * F[k](x), k = 0..N)
00316     //    F[n+1](x) = alpha(n,x) * F[n](x) + beta(n,x) * F[n-1](x)
00317     //
00318     // Evaluate S with
00319     //
00320     //    y[N+2] = y[N+1] = 0
00321     //    y[k] = alpha(k,x) * y[k+1] + beta(k+1,x) * y[k+2] + c[k]
00322     //    S = c[0] * F[0](x) + y[1] * F[1](x) + beta(1,x) * F[0](x) * y[2]
00323     //
00324     // Here we have
00325     //
00326     //    x = 2 * zeta'
00327     //    F[n](x) = sin(n * x)
00328     //    a(n, x) = 2 * cos(x)
00329     //    b(n, x) = -1
00330     //    [ sin(A+B) - 2*cos(B)*sin(A) + sin(A-B) = 0, A = n*x, B = x ]
00331     //    N = maxpow_
00332     //    c[k] = _alp[k]
00333     //    S = y[1] * sin(x)
00334     //
00335     // For the derivative we have
00336     //
00337     //    x = 2 * zeta'
00338     //    F[n](x) = cos(n * x)
00339     //    a(n, x) = 2 * cos(x)
00340     //    b(n, x) = -1
00341     //    [ cos(A+B) - 2*cos(B)*cos(A) + cos(A-B) = 0, A = n*x, B = x ]
00342     //    c[0] = 1; c[k] = 2*k*_alp[k]
00343     //    S = (c[0] - y[2]) + y[1] * cos(x)
00344     real
00345       c0 = cos(2 * xip), ch0 = cosh(2 * etap),
00346       s0 = sin(2 * xip), sh0 = sinh(2 * etap),
00347       ar = 2 * c0 * ch0, ai = -2 * s0 * sh0; // 2 * cos(2*zeta')
00348     int n = maxpow_;
00349     real
00350       xi0 = (n & 1 ? _alp[n] : 0), eta0 = 0,
00351       xi1 = 0, eta1 = 0;
00352     real                        // Accumulators for dzeta/dzeta'
00353       yr0 = (n & 1 ? 2 * maxpow_ * _alp[n--] : 0), yi0 = 0,
00354       yr1 = 0, yi1 = 0;
00355     while (n) {
00356       xi1  = ar * xi0 - ai * eta0 - xi1 + _alp[n];
00357       eta1 = ai * xi0 + ar * eta0 - eta1;
00358       yr1 = ar * yr0 - ai * yi0 - yr1 + 2 * n * _alp[n];
00359       yi1 = ai * yr0 + ar * yi0 - yi1;
00360       --n;
00361       xi0  = ar * xi1 - ai * eta1 - xi0 + _alp[n];
00362       eta0 = ai * xi1 + ar * eta1 - eta0;
00363       yr0 = ar * yr1 - ai * yi1 - yr0 + 2 * n * _alp[n];
00364       yi0 = ai * yr1 + ar * yi1 - yi0;
00365       --n;
00366     }
00367     ar /= 2; ai /= 2;           // cos(2*zeta')
00368     yr1 = 1 - yr1 + ar * yr0 - ai * yi0;
00369     yi1 =   - yi1 + ai * yr0 + ar * yi0;
00370     ar = s0 * ch0; ai = c0 * sh0; // sin(2*zeta')
00371     real
00372       xi  = xip  + ar * xi0 - ai * eta0,
00373       eta = etap + ai * xi0 + ar * eta0;
00374     // Fold in change in convergence and scale for Gauss-Schreiber TM to
00375     // Gauss-Krueger TM.
00376     gamma -= atan2(yi1, yr1);
00377     k *= _b1 * Math::hypot(yr1, yi1);
00378     gamma /= Math::degree<real>();
00379     y = _a1 * _k0 * (backside ? Math::pi<real>() - xi : xi) * latsign;
00380     x = _a1 * _k0 * eta * lonsign;
00381     if (backside)
00382       gamma = 180 - gamma;
00383     gamma *= latsign * lonsign;
00384     k *= _k0;
00385   }
00386 
00387   void TransverseMercator::Reverse(real lon0, real x, real y,
00388                                    real& lat, real& lon, real& gamma, real& k)
00389     const throw() {
00390     // This undoes the steps in Forward.  The wrinkles are: (1) Use of the
00391     // reverted series to express zeta' in terms of zeta. (2) Newton's method
00392     // to solve for phi in terms of tan(phi).
00393     real
00394       xi = y / (_a1 * _k0),
00395       eta = x / (_a1 * _k0);
00396     // Explicitly enforce the parity
00397     int
00398       xisign = xi < 0 ? -1 : 1,
00399       etasign = eta < 0 ? -1 : 1;
00400     xi *= xisign;
00401     eta *= etasign;
00402     bool backside = xi > Math::pi<real>()/2;
00403     if (backside)
00404       xi = Math::pi<real>() - xi;
00405     real
00406       c0 = cos(2 * xi), ch0 = cosh(2 * eta),
00407       s0 = sin(2 * xi), sh0 = sinh(2 * eta),
00408       ar = 2 * c0 * ch0, ai = -2 * s0 * sh0; // 2 * cos(2*zeta)
00409     int n = maxpow_;
00410     real                        // Accumulators for zeta'
00411       xip0 = (n & 1 ? -_bet[n] : 0), etap0 = 0,
00412       xip1 = 0, etap1 = 0;
00413     real                        // Accumulators for dzeta'/dzeta
00414       yr0 = (n & 1 ? - 2 * maxpow_ * _bet[n--] : 0), yi0 = 0,
00415       yr1 = 0, yi1 = 0;
00416     while (n) {
00417       xip1  = ar * xip0 - ai * etap0 - xip1 - _bet[n];
00418       etap1 = ai * xip0 + ar * etap0 - etap1;
00419       yr1 = ar * yr0 - ai * yi0 - yr1 - 2 * n * _bet[n];
00420       yi1 = ai * yr0 + ar * yi0 - yi1;
00421       --n;
00422       xip0  = ar * xip1 - ai * etap1 - xip0 - _bet[n];
00423       etap0 = ai * xip1 + ar * etap1 - etap0;
00424       yr0 = ar * yr1 - ai * yi1 - yr0 - 2 * n * _bet[n];
00425       yi0 = ai * yr1 + ar * yi1 - yi0;
00426       --n;
00427     }
00428     ar /= 2; ai /= 2;           // cos(2*zeta')
00429     yr1 = 1 - yr1 + ar * yr0 - ai * yi0;
00430     yi1 =   - yi1 + ai * yr0 + ar * yi0;
00431     ar = s0 * ch0; ai = c0 * sh0; // sin(2*zeta)
00432     real
00433       xip  = xi  + ar * xip0 - ai * etap0,
00434       etap = eta + ai * xip0 + ar * etap0;
00435     // Convergence and scale for Gauss-Schreiber TM to Gauss-Krueger TM.
00436     gamma = atan2(yi1, yr1);
00437     k = _b1 / Math::hypot(yr1, yi1);
00438     // JHS 154 has
00439     //
00440     //   phi' = asin(sin(xi') / cosh(eta')) (Krueger p 17 (25))
00441     //   lam = asin(tanh(eta') / cos(phi')
00442     //   psi = asinh(tan(phi'))
00443     real lam, phi;
00444     real
00445       s = sinh(etap),
00446       c = max(real(0), cos(xip)), // cos(pi/2) might be negative
00447       r = Math::hypot(s, c);
00448     if (r != 0) {
00449       lam = atan2(s, c);        // Krueger p 17 (25)
00450       // Use Newton's method to solve for tau
00451       real
00452         taup = sin(xip)/r,
00453         // To lowest order in e^2, taup = (1 - e^2) * tau = _e2m * tau; so use
00454         // tau = taup/_e2m as a starting guess.  Only 1 iteration is needed for
00455         // |lat| < 3.35 deg, otherwise 2 iterations are needed.  If, instead,
00456         // tau = taup is used the mean number of iterations increases to 1.99
00457         // (2 iterations are needed except near tau = 0).
00458         tau = taup/_e2m,
00459         stol = tol_ * max(real(1), abs(taup));
00460       // min iterations = 1, max iterations = 2; mean = 1.94
00461       for (int i = 0; i < numit_; ++i) {
00462         real
00463           tau1 = Math::hypot(real(1), tau),
00464           sig = sinh( eatanhe( tau / tau1 ) ),
00465           taupa = Math::hypot(real(1), sig) * tau - sig * tau1,
00466           dtau = (taup - taupa) * (1 + _e2m * Math::sq(tau)) /
00467           ( _e2m * tau1 * Math::hypot(real(1), taupa) );
00468         tau += dtau;
00469         if (!(abs(dtau) >= stol))
00470           break;
00471       }
00472       phi = atan(tau);
00473       gamma += atan(tanx(xip) * tanh(etap)); // Krueger p 19 (31)
00474       // Note cos(phi') * cosh(eta') = r
00475       k *= sqrt(_e2m + _e2 * Math::sq(cos(phi))) *
00476         Math::hypot(real(1), tau) * r;
00477     } else {
00478       phi = Math::pi<real>()/2;
00479       lam = 0;
00480       k *= _c;
00481     }
00482     lat = phi / Math::degree<real>() * xisign;
00483     lon = lam / Math::degree<real>();
00484     if (backside)
00485       lon = 180 - lon;
00486     lon *= etasign;
00487     // Avoid losing a bit of accuracy in lon (assuming lon0 is an integer)
00488     if (lon + lon0 >= 180)
00489       lon += lon0 - 360;
00490     else if (lon + lon0 < -180)
00491       lon += lon0 + 360;
00492     else
00493       lon += lon0;
00494     gamma /= Math::degree<real>();
00495     if (backside)
00496       gamma = 180 - gamma;
00497     gamma *= xisign * etasign;
00498     k *= _k0;
00499   }
00500 
00501 } // namespace GeographicLib
geographiclib-1.21/doc/html/classGeographicLib_1_1GravityCircle-members.html0000644000175000017500000001663211745620415026775 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::GravityCircle Member List
This is the complete list of members for GeographicLib::GravityCircle, including all inherited members.
Capabilities() const GeographicLib::GravityCircle [inline]
Capabilities(unsigned testcaps) const GeographicLib::GravityCircle [inline]
Disturbance(real lon, real &deltax, real &deltay, real &deltaz) const GeographicLib::GravityCircle
Flattening() const GeographicLib::GravityCircle [inline]
GeoidHeight(real lon) const GeographicLib::GravityCircle
Gravity(real lon, real &gx, real &gy, real &gz) const GeographicLib::GravityCircle
GravityCircle()GeographicLib::GravityCircle [inline]
GravityModel classGeographicLib::GravityCircle [friend]
Height() const GeographicLib::GravityCircle [inline]
Init() const GeographicLib::GravityCircle [inline]
Latitude() const GeographicLib::GravityCircle [inline]
MajorRadius() const GeographicLib::GravityCircle [inline]
SphericalAnomaly(real lon, real &Dg01, real &xi, real &eta) const GeographicLib::GravityCircle
T(real lon, real &deltaX, real &deltaY, real &deltaZ) const GeographicLib::GravityCircle [inline]
T(real lon) const GeographicLib::GravityCircle [inline]
V(real lon, real &GX, real &GY, real &GZ) const GeographicLib::GravityCircle [inline]
W(real lon, real &gX, real &gY, real &gZ) const GeographicLib::GravityCircle [inline]
geographiclib-1.21/doc/html/Geod_8cpp.html0000644000175000017500000003741611745620414020302 0ustar frankiefrankie GeographicLib: Geod.cpp File Reference
Geod.cpp File Reference

Command line utility for geodesic calculations. More...

#include <iostream>
#include <sstream>
#include <string>
#include <fstream>
#include <GeographicLib/Geodesic.hpp>
#include <GeographicLib/GeodesicLine.hpp>
#include <GeographicLib/DMS.hpp>
#include <GeographicLib/Utility.hpp>
#include "Geod.usage"

Go to the source code of this file.

Typedefs

typedef GeographicLib::Math::real real

Functions

std::string LatLonString (real lat, real lon, int prec, bool dms, char dmssep)
std::string AzimuthString (real azi, int prec, bool dms, char dmssep)
std::string DistanceStrings (real s12, real a12, bool full, bool arcmode, int prec, bool dms)
real ReadDistance (const std::string &s, bool arcmode)
int main (int argc, char *argv[])

Detailed Description

Command line utility for geodesic calculations.

Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Compile and link with g++ -g -O3 -I../include -I../man -o Geod \ Geod.cpp \ ../src/DMS.cpp \ ../src/Geodesic.cpp \ ../src/GeodesicLine.cpp

See the man page for usage information.

Definition in file Geod.cpp.


Typedef Documentation

Definition at line 32 of file Geod.cpp.


Function Documentation

std::string LatLonString ( real  lat,
real  lon,
int  prec,
bool  dms,
char  dmssep 
)
std::string AzimuthString ( real  azi,
int  prec,
bool  dms,
char  dmssep 
)

Definition at line 43 of file Geod.cpp.

References GeographicLib::DMS::Encode(), GeographicLib::DMS::AZIMUTH, and GeographicLib::DMS::NUMBER.

Referenced by main().

std::string DistanceStrings ( real  s12,
real  a12,
bool  full,
bool  arcmode,
int  prec,
bool  dms 
)

Definition at line 49 of file Geod.cpp.

References GeographicLib::DMS::Encode(), GeographicLib::DMS::NONE, and GeographicLib::DMS::NUMBER.

Referenced by main().

real ReadDistance ( const std::string &  s,
bool  arcmode 
)

Definition at line 62 of file Geod.cpp.

References GeographicLib::DMS::DecodeAngle().

Referenced by main().

geographiclib-1.21/doc/html/functions_0x63.html0000644000175000017500000002477111745620414021262 0ustar frankiefrankie GeographicLib: Class Members
Here is a list of all class members with links to the classes they belong to:

- c -

geographiclib-1.21/doc/html/MagneticCircle_8hpp_source.html0000644000175000017500000005217511745620415023662 0ustar frankiefrankie GeographicLib: MagneticCircle.hpp Source File
MagneticCircle.hpp
Go to the documentation of this file.
00001 /**
00002  * \file MagneticCircle.hpp
00003  * \brief Header for GeographicLib::MagneticCircle class
00004  *
00005  * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under
00006  * the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_MAGNETICCIRCLE_HPP)
00011 #define GEOGRAPHICLIB_MAGNETICCIRCLE_HPP \
00012   "$Id: 5b3adc58d894f36ca4206864eb565541f24ff492 $"
00013 
00014 #include <string>
00015 #include <vector>
00016 #include <GeographicLib/Constants.hpp>
00017 #include <GeographicLib/CircularEngine.hpp>
00018 
00019 namespace GeographicLib {
00020 
00021   /**
00022    * \brief Geomagnetic field on a circle of latitude
00023    *
00024    * Evaluate the earth's magnetic field on a circle of constant height and
00025    * latitude.  This uses a CircleEngine to pre-evaluate the inner sum of the
00026    * spherical harmonic sum, allowing the values of the field at several
00027    * different longitudes to be evaluated rapidly.
00028    *
00029    * Use MagneticModel::Circle to create a MagneticCircle object.  (The
00030    * constructor for this class is private.)
00031    *
00032    * Example of use:
00033    * \include example-MagneticCircle.cpp
00034    *
00035    * <a href="MagneticField.1.html">MagneticField</a> is a command-line utility
00036    * providing access to the functionality of MagneticModel and MagneticCircle.
00037    **********************************************************************/
00038 
00039   class GEOGRAPHIC_EXPORT MagneticCircle {
00040   private:
00041     typedef Math::real real;
00042 
00043     real _a, _f, _lat, _h, _t, _cphi, _sphi, _t1, _dt0;
00044     bool _interpolate;
00045     CircularEngine _circ0, _circ1;
00046 
00047     MagneticCircle(real a, real f, real lat, real h, real t,
00048                    real cphi, real sphi, real t1, real dt0,
00049                    bool interpolate,
00050                    const CircularEngine& circ0, const CircularEngine& circ1)
00051       : _a(a)
00052       , _f(f)
00053       , _lat(lat)
00054       , _h(h)
00055       , _t(t)
00056       , _cphi(cphi)
00057       , _sphi(sphi)
00058       , _t1(t1)
00059       , _dt0(dt0)
00060       , _interpolate(interpolate)
00061       , _circ0(circ0)
00062       , _circ1(circ1)
00063     {}
00064 
00065     void Field(real lon, bool diffp,
00066                real& Bx, real& By, real& Bz,
00067                real& Bxt, real& Byt, real& Bzt) const throw();
00068 
00069     friend class MagneticModel; // MagneticModel calls the private constructor
00070 
00071   public:
00072 
00073     /**
00074      * A default constructor for the normal gravity.  This sets up an
00075      * uninitialized object which can be later replaced by the
00076      * MagneticModel::Circle.
00077      **********************************************************************/
00078     MagneticCircle() : _a(-1) {}
00079 
00080     /** \name Compute the magnetic field
00081      **********************************************************************/
00082     ///@{
00083     /**
00084      * Evaluate the components of the geomagnetic field at a particular
00085      * longitude.
00086      *
00087      * @param[in] lon longitude of the point (degrees).
00088      * @param[out] Bx the easterly component of the magnetic field (nanotesla).
00089      * @param[out] By the northerly component of the magnetic field (nanotesla).
00090      * @param[out] Bz the vertical (up) component of the magnetic field
00091      *   (nanotesla).
00092      **********************************************************************/
00093     void operator()(real lon, real& Bx, real& By, real& Bz) const throw() {
00094       real dummy;
00095       Field(lon, false, Bx, By, Bz, dummy, dummy, dummy);
00096     }
00097 
00098     /**
00099      * Evaluate the components of the geomagnetic field and their time
00100      * derivatives at a particular longitude.
00101      *
00102      * @param[in] lon longitude of the point (degrees).
00103      * @param[out] Bx the easterly component of the magnetic field (nanotesla).
00104      * @param[out] By the northerly component of the magnetic field (nanotesla).
00105      * @param[out] Bz the vertical (up) component of the magnetic field
00106      *   (nanotesla).
00107      * @param[out] Bxt the rate of change of \e Bx (nT/yr).
00108      * @param[out] Byt the rate of change of \e By (nT/yr).
00109      * @param[out] Bzt the rate of change of \e Bz (nT/yr).
00110      **********************************************************************/
00111     void operator()(real lon, real& Bx, real& By, real& Bz,
00112                     real& Bxt, real& Byt, real& Bzt) const throw() {
00113       Field(lon, true, Bx, By, Bz, Bxt, Byt, Bzt);
00114     }
00115     ///@}
00116 
00117     /** \name Inspector functions
00118      **********************************************************************/
00119     ///@{
00120     /**
00121      * @return true if the object has been initialized.
00122      **********************************************************************/
00123     bool Init() const throw() { return _a > 0; }
00124     /**
00125      * @return \e a the equatorial radius of the ellipsoid (meters).  This is
00126      *   the value inherited from the MagneticModel object used in the
00127      *   constructor.
00128      **********************************************************************/
00129     Math::real MajorRadius() const throw()
00130     { return Init() ? _a : Math::NaN<real>(); }
00131     /**
00132      * @return \e f the flattening of the ellipsoid.  This is the value
00133      *   inherited from the MagneticModel object used in the constructor.
00134      **********************************************************************/
00135     Math::real Flattening() const throw()
00136     { return Init() ? _f : Math::NaN<real>(); }
00137     /**
00138      * @return the latitude of the circle (degrees).
00139      **********************************************************************/
00140     Math::real Latitude() const throw()
00141     { return Init() ? _lat : Math::NaN<real>(); }
00142     /**
00143      * @return the height of the circle (meters).
00144      **********************************************************************/
00145     Math::real Height() const throw()
00146     { return Init() ? _h : Math::NaN<real>(); }
00147     /**
00148      * @return the time (fractional years).
00149      **********************************************************************/
00150     Math::real Time() const throw()
00151     { return Init() ? _t : Math::NaN<real>(); }
00152 
00153     ///@}
00154   };
00155 
00156 } // namespace GeographicLib
00157 
00158 #endif  // GEOGRAPHICLIB_MAGNETICCIRCLE_HPP
geographiclib-1.21/doc/html/PolarStereographic_8cpp.html0000644000175000017500000001151711745620414023213 0ustar frankiefrankie GeographicLib: PolarStereographic.cpp File Reference
PolarStereographic.cpp File Reference

Implementation for GeographicLib::PolarStereographic class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_POLARSTEREOGRAPHIC_CPP   "$Id: 3a2dee07e6ef1c55ddcdc2178d818c8edd4d1cd4 $"

Detailed Description

Implementation for GeographicLib::PolarStereographic class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file PolarStereographic.cpp.


Define Documentation

#define GEOGRAPHICLIB_POLARSTEREOGRAPHIC_CPP   "$Id: 3a2dee07e6ef1c55ddcdc2178d818c8edd4d1cd4 $"

Definition at line 12 of file PolarStereographic.cpp.

geographiclib-1.21/doc/html/doxygen.css0000644000175000017500000003500311745620415017762 0ustar frankiefrankie/* The standard CSS for doxygen */ body, table, div, p, dl { font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif; font-size: 12px; } /* @group Heading Levels */ h1 { font-size: 150%; } .title { font-size: 150%; font-weight: bold; margin: 10px 2px; } h2 { font-size: 120%; } h3 { font-size: 100%; } dt { font-weight: bold; } div.multicol { -moz-column-gap: 1em; -webkit-column-gap: 1em; -moz-column-count: 3; -webkit-column-count: 3; } p.startli, p.startdd, p.starttd { margin-top: 2px; } p.endli { margin-bottom: 0px; } p.enddd { margin-bottom: 4px; } p.endtd { margin-bottom: 2px; } /* @end */ caption { font-weight: bold; } span.legend { font-size: 70%; text-align: center; } h3.version { font-size: 90%; text-align: center; } div.qindex, div.navtab{ background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; } div.qindex, div.navpath { width: 100%; line-height: 140%; } div.navtab { margin-right: 15px; } /* @group Link Styling */ a { color: #3D578C; font-weight: normal; text-decoration: none; } .contents a:visited { color: #4665A2; } a:hover { text-decoration: underline; } a.qindex { font-weight: bold; } a.qindexHL { font-weight: bold; background-color: #9CAFD4; color: #ffffff; border: 1px double #869DCA; } .contents a.qindexHL:visited { color: #ffffff; } a.el { font-weight: bold; } a.elRef { } a.code { color: #4665A2; } a.codeRef { color: #4665A2; } /* @end */ dl.el { margin-left: -1cm; } .fragment { font-family: monospace, fixed; font-size: 105%; } pre.fragment { border: 1px solid #C4CFE5; background-color: #FBFCFD; padding: 4px 6px; margin: 4px 8px 4px 2px; overflow: auto; word-wrap: break-word; font-size: 9pt; line-height: 125%; } div.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px; padding: 0.2em; border: solid thin #333; border-radius: 0.5em; -webkit-border-radius: .5em; -moz-border-radius: .5em; box-shadow: 2px 2px 3px #999; -webkit-box-shadow: 2px 2px 3px #999; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000); } div.groupHeader { margin-left: 16px; margin-top: 12px; font-weight: bold; } div.groupText { margin-left: 16px; font-style: italic; } body { background-color: white; color: black; margin: 0; } div.contents { margin-top: 10px; margin-left: 8px; margin-right: 8px; } td.indexkey { background-color: #EBEFF6; font-weight: bold; border: 1px solid #C4CFE5; margin: 2px 0px 2px 0; padding: 2px 10px; } td.indexvalue { background-color: #EBEFF6; border: 1px solid #C4CFE5; padding: 2px 10px; margin: 2px 0px; } tr.memlist { background-color: #EEF1F7; } p.formulaDsp { text-align: center; } img.formulaDsp { } img.formulaInl { vertical-align: middle; } div.center { text-align: center; margin-top: 0px; margin-bottom: 0px; padding: 0px; } div.center img { border: 0px; } address.footer { text-align: right; padding-right: 12px; } img.footer { border: 0px; vertical-align: middle; } /* @group Code Colorization */ span.keyword { color: #008000 } span.keywordtype { color: #604020 } span.keywordflow { color: #e08000 } span.comment { color: #800000 } span.preprocessor { color: #806020 } span.stringliteral { color: #002080 } span.charliteral { color: #008080 } span.vhdldigit { color: #ff00ff } span.vhdlchar { color: #000000 } span.vhdlkeyword { color: #700070 } span.vhdllogic { color: #ff0000 } /* @end */ /* .search { color: #003399; font-weight: bold; } form.search { margin-bottom: 0px; margin-top: 0px; } input.search { font-size: 75%; color: #000080; font-weight: normal; background-color: #e8eef2; } */ td.tiny { font-size: 75%; } .dirtab { padding: 4px; border-collapse: collapse; border: 1px solid #A3B4D7; } th.dirtab { background: #EBEFF6; font-weight: bold; } hr { height: 0px; border: none; border-top: 1px solid #4A6AAA; } hr.footer { height: 1px; } /* @group Member Descriptions */ table.memberdecls { border-spacing: 0px; padding: 0px; } .mdescLeft, .mdescRight, .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight, .memTemplParams { background-color: #F9FAFC; border: none; margin: 4px; padding: 1px 0 0 8px; } .mdescLeft, .mdescRight { padding: 0px 8px 4px 8px; color: #555; } .memItemLeft, .memItemRight, .memTemplParams { border-top: 1px solid #C4CFE5; } .memItemLeft, .memTemplItemLeft { white-space: nowrap; } .memItemRight { width: 100%; } .memTemplParams { color: #4665A2; white-space: nowrap; } /* @end */ /* @group Member Details */ /* Styles for detailed member documentation */ .memtemplate { font-size: 80%; color: #4665A2; font-weight: normal; margin-left: 9px; } .memnav { background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; margin: 2px; margin-right: 15px; padding: 2px; } .mempage { width: 100%; } .memitem { padding: 0; margin-bottom: 10px; margin-right: 5px; } .memname { white-space: nowrap; font-weight: bold; margin-left: 6px; } .memproto, dl.reflist dt { border-top: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 6px 0px 6px 0px; color: #253555; font-weight: bold; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); /* opera specific markup */ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); border-top-right-radius: 8px; border-top-left-radius: 8px; /* firefox specific markup */ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; -moz-border-radius-topright: 8px; -moz-border-radius-topleft: 8px; /* webkit specific markup */ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); -webkit-border-top-right-radius: 8px; -webkit-border-top-left-radius: 8px; background-image:url('nav_f.png'); background-repeat:repeat-x; background-color: #E2E8F2; } .memdoc, dl.reflist dd { border-bottom: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 2px 5px; background-color: #FBFCFD; border-top-width: 0; /* opera specific markup */ border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); /* firefox specific markup */ -moz-border-radius-bottomleft: 8px; -moz-border-radius-bottomright: 8px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7); /* webkit specific markup */ -webkit-border-bottom-left-radius: 8px; -webkit-border-bottom-right-radius: 8px; -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7)); } dl.reflist dt { padding: 5px; } dl.reflist dd { margin: 0px 0px 10px 0px; padding: 5px; } .paramkey { text-align: right; } .paramtype { white-space: nowrap; } .paramname { color: #602020; white-space: nowrap; } .paramname em { font-style: normal; } .params, .retval, .exception, .tparams { border-spacing: 6px 2px; } .params .paramname, .retval .paramname { font-weight: bold; vertical-align: top; } .params .paramtype { font-style: italic; vertical-align: top; } .params .paramdir { font-family: "courier new",courier,monospace; vertical-align: top; } /* @end */ /* @group Directory (tree) */ /* for the tree view */ .ftvtree { font-family: sans-serif; margin: 0px; } /* these are for tree view when used as main index */ .directory { font-size: 9pt; font-weight: bold; margin: 5px; } .directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } /* The following two styles can be used to replace the root node title with an image of your choice. Simply uncomment the next two styles, specify the name of your image and be sure to set 'height' to the proper pixel height of your image. */ /* .directory h3.swap { height: 61px; background-repeat: no-repeat; background-image: url("yourimage.gif"); } .directory h3.swap span { display: none; } */ .directory > h3 { margin-top: 0; } .directory p { margin: 0px; white-space: nowrap; } .directory div { display: none; margin: 0px; } .directory img { vertical-align: -30%; } /* these are for tree view when not used as main index */ .directory-alt { font-size: 100%; font-weight: bold; } .directory-alt h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } .directory-alt > h3 { margin-top: 0; } .directory-alt p { margin: 0px; white-space: nowrap; } .directory-alt div { display: none; margin: 0px; } .directory-alt img { vertical-align: -30%; } /* @end */ div.dynheader { margin-top: 8px; } address { font-style: normal; color: #2A3D61; } table.doxtable { border-collapse:collapse; } table.doxtable td, table.doxtable th { border: 1px solid #2D4068; padding: 3px 7px 2px; } table.doxtable th { background-color: #374F7F; color: #FFFFFF; font-size: 110%; padding-bottom: 4px; padding-top: 5px; text-align:left; } table.fieldtable { width: 100%; margin-bottom: 10px; border: 1px solid #A8B8D9; border-spacing: 0px; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); } .fieldtable td, .fieldtable th { padding: 3px 7px 2px; } .fieldtable td.fieldtype, .fieldtable td.fieldname { white-space: nowrap; border-right: 1px solid #A8B8D9; border-bottom: 1px solid #A8B8D9; vertical-align: top; } .fieldtable td.fielddoc { border-bottom: 1px solid #A8B8D9; width: 100%; } .fieldtable tr:last-child td { border-bottom: none; } .fieldtable th { background-image:url('nav_f.png'); background-repeat:repeat-x; background-color: #E2E8F2; font-size: 90%; color: #253555; padding-bottom: 4px; padding-top: 5px; text-align:left; -moz-border-radius-topleft: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-left-radius: 4px; -webkit-border-top-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom: 1px solid #A8B8D9; } .tabsearch { top: 0px; left: 10px; height: 36px; background-image: url('tab_b.png'); z-index: 101; overflow: hidden; font-size: 13px; } .navpath ul { font-size: 11px; background-image:url('tab_b.png'); background-repeat:repeat-x; height:30px; line-height:30px; color:#8AA0CC; border:solid 1px #C2CDE4; overflow:hidden; margin:0px; padding:0px; } .navpath li { list-style-type:none; float:left; padding-left:10px; padding-right:15px; background-image:url('bc_s.png'); background-repeat:no-repeat; background-position:right; color:#364D7C; } .navpath li.navelem a { height:32px; display:block; text-decoration: none; outline: none; } .navpath li.navelem a:hover { color:#6884BD; } .navpath li.footer { list-style-type:none; float:right; padding-left:10px; padding-right:15px; background-image:none; background-repeat:no-repeat; background-position:right; color:#364D7C; font-size: 8pt; } div.summary { float: right; font-size: 8pt; padding-right: 5px; width: 50%; text-align: right; } div.summary a { white-space: nowrap; } div.ingroups { margin-left: 5px; font-size: 8pt; padding-left: 5px; width: 50%; text-align: left; } div.ingroups a { white-space: nowrap; } div.header { background-image:url('nav_h.png'); background-repeat:repeat-x; background-color: #F9FAFC; margin: 0px; border-bottom: 1px solid #C4CFE5; } div.headertitle { padding: 5px 5px 5px 7px; } dl { padding: 0 0 0 10px; } dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug { border-left:4px solid; padding: 0 0 0 6px; } dl.note { border-color: #D0C000; } dl.warning, dl.attention { border-color: #FF0000; } dl.pre, dl.post, dl.invariant { border-color: #00D000; } dl.deprecated { border-color: #505050; } dl.todo { border-color: #00C0E0; } dl.test { border-color: #3030E0; } dl.bug { border-color: #C08050; } #projectlogo { text-align: center; vertical-align: bottom; border-collapse: separate; } #projectlogo img { border: 0px none; } #projectname { font: 300% Tahoma, Arial,sans-serif; margin: 0px; padding: 2px 0px; } #projectbrief { font: 120% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #projectnumber { font: 50% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #titlearea { padding: 0px; margin: 0px; width: 100%; border-bottom: 1px solid #5373B4; } .image { text-align: center; } .dotgraph { text-align: center; } .mscgraph { text-align: center; } .caption { font-weight: bold; } div.zoom { border: 1px solid #90A5CE; } dl.citelist { margin-bottom:50px; } dl.citelist dt { color:#334975; float:left; font-weight:bold; margin-right:10px; padding:5px; } dl.citelist dd { margin:2px 0; padding:5px 0; } @media print { #top { display: none; } #side-nav { display: none; } #nav-path { display: none; } body { overflow:visible; } h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } .summary { display: none; } .memitem { page-break-inside: avoid; } #doc-content { margin-left:0 !important; height:auto !important; width:auto !important; overflow:inherit; display:inline; } pre.fragment { overflow: visible; text-wrap: unrestricted; white-space: -moz-pre-wrap; /* Moz */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ white-space: pre-wrap; /* CSS3 */ word-wrap: break-word; /* IE 5.5+ */ } } geographiclib-1.21/doc/html/doxygen.png0000644000175000017500000000754611745620414017770 0ustar frankiefrankie‰PNG  IHDRh ;ˆØ-IDATxí]{XŒyÿ¾sZ%Ê”NF:¨´FåЪքbÝè@;~ÓŽÃ"DH‘ÚZ•ð–m_Œéè4ÄÙÚ!ë-‡2«U«Ce[Š"§š_ñÌ3óLSìõ¾ï¾öº|®««y>§ïý¹ïïá_ ™L†öþZ·¼ß¦ajëñ®¹L•oñúþ}«.Íë2Þãû$Zöå);*.d¥~Ûìß³wˆ—·'ˆâ0³Ëâþ@áû!ZZeÊÿÁÞͺwÓøÏÔÚ‰ù?ØO =\Lâ[òg²dxr0Ð —€¤Rrj·Jž€‘*í.WJN5¨äÉqÈMªÔ[mºÞ•’Sb58™Ä¼RB5½¥•’SRus[2<ÙÄ %·˜˜•²V'˜ê+%§$fv˜ØÄºR»«Kó$ ¡¥C 4ã+xº˜£½sQÙ}f¶ðÀ[²vôZ €ç6c}”½!,Lt×ï<ÂÅ«µ°dx†H)/ÎÙfí襧¥C«1¶v£ôº[~– ÏÑåÅ9%DÏDKgžrN}M9úY««3*/Îi謷%ÓU^œ#¶vôr'p²=]ÌÑ_§7®ßy„ìS¸ª½ëkÊaÉð´-/Î!E²vôâà902œíÁÉ–FæŸ*¸Å,ý­– O!1k>QÓÓ³¦°dx¦X:ûð¼=GÃÂD×ï<ÂþÃ'¸fvRªKó‚UZjbóièþ¤`èõýˆtº9cùœ‘xÕÚªV W­­°sžabóièw1ó1x%îæhŒ¹Þ¶¸9׉>oÕ®hkG¯~¥—Nl°sž"^™ÀdŽ2%sw…ø¨•¼W­­‹ìœ§D¸z¯àí W †Æç˜8c>‚í1”ô‡m·Bvêî«ÖÖ8܉ÞAˆZò þT…u—r­½ª´th9kÂÖRêåŸSfÛþ/d§–°‰¾äœ1kçb„A.ܸ@ø“+;:j ÛÚÑË«ôÒ‰|#­Ýp4i®â¨]¼â߯óV~éØÇŒ…xfv$Õ¥y| S[ö;BOK‡V“ÅßÖàÎÌa 4x0¶Ï:ÂßDN54>Çgœõxp÷ªo;Z:´¬œÃÉ”º€ÕÇðë™ïbÛ‡ªöü|Ñ^TŠ7=$4)L!Ü/åuü’#)9/rqÃ%îØÅï¬~a”çŽÅ-à¸poE ‚”®,|gŽ¥m /9/ŠsÃâ˜Ø|šœ±c Ó/åu¨ü Êë€P\…aÁÂ’ó¢‡1,¦¥Ó¢Ã;ueòyªKó\ä…°üÃ"7-K!3>õ2ÊËËamm åÚÈr7M.(~[2ÓÝÉ„Œ]©¨C<¿í»b9Ç[)v[~Ñ,_º@\|î8ËqÜ´{· Ð}QÞ”ugr7àÛÈJ]|Úe¤ïÚ`ƒ–­æçÿ¤à™4s5Ü+µÕÒ¡•©Æ\§áéãû¶Ù•ýxàJ,ûÌudùùs&@yŽõI…eD…Ÿ;ç8nZÁž={ʘfóQU|X ÞØÚ)ض˜"ÞtîVÜ-ÏwÐo¨ãç¢ý‰œöJy>¶6è°¹ ÌFrÊf¥ÑÍú’ KbÏà¼(!@~»ó³) F¹{€í€Ave'3£Hÿ£¦˜î»Íu @³¯Aò±¬$èj÷"s&û…½&ób~¶t”»w¢ÿ¼¼¥þŠ·öQÓ J~Iå âJÚö½˜Ÿ]=ÊÝ;=|S{ºû™Éç‘“nçÊÜ9ôË¿ÈõË„.{ù®‰Ü´`Œb³ßÅÊå ÅâÚž)†j\Þ€ÔΕ›ÞY_ÂE_¸â.gÚ0uõ‹‘Ÿ‰2ݪiDàWËÐÜX'ÖìkÀÌÿº©ü–ñqýòV¶gDO³¯Ý„¦âÁÔôçE 6È ä1cZŒ¦ÄÄ—n£¹±NXxú(¿] ±ãgL_ºM!ÓÐb4Ü+e´´Ê¤âŽdüƒç62[é£]Am­ž,b÷@Jáé£Õ„ÿð‘Ü_Ù,Wºˆr€‘®Îèr_g8ÕÕ&(ÁQAäÛ4·­Ÿò.«ö—¯­ajëAïghS–öÝFJËÛhheg©‹³;Lýcs é/¼RƒÈõËÄ¢ì,‘—¾84†íõ‰9™óõ:n–œ`‰²³Ä,o_ï~†6YIqaÐÑî¥vÊèã¸v>=V”E¹æXÞ¾5™é=uu›^À/ °A”eD䆸ÍX¹j®S¬‘#§Ï^Ëžç3œŒÇì-ÂÙ£[Ã@µövmæÏ ’X ÊÎÊW¤×vú9šÚúѽµõQ_{ͽ3žäW\ø¦æØ:p¤ajëeIÉ)tšâîŽåáܱ8Iû£>xødÆöEóöëd:ÛŒ4µõk¾OŽƒNI¼‰¨½q>m•á1!)[©›Vàb47ýa @æšṉ̃ p…%5Pþ~üä¾Z‚æ¦?| 3³•0DN  á}® Unû¬@ú® » 3¹ÌÁÃ'‹Tç(,©ÁÏ—ïÂÁÊ^.ŠM¤ÄA8a?šUÙ¾äJ<§à2S÷ þ~…@=hjë3-GÍÄ|ŸÈ8Y.¯—¨®]XRƒèËIT9X²A€›¿ž$ÚéÇÛÈõ™hIPvã!ÀvHÿ°}Úo)Ͷ‡8rŠßš ¶=…Ч*^÷˜éiEïŸÂ«8‘"<˜Ìö Ht™¶œ·"Б²æ–͘á¿Êx.üZ‹˜M!b~ƒé Ã!c ’bwÀ·zëqT\È L*a.ˆŒÙÁP7:Û*(FÁñøpáÁô8¶O@â¿5<å9•17>yö“1z¸a‡zs{/Q†9æ‘ ´j}S¹vYD*n]Í!rÐhyakÔj ™Ê„«úgúÍ‘ d¦©­_¾*llé]^&}ˆ˜¨ÍhnúÃÛpȨèí[¨ä.Y»µ7..ÐÔÖOŽÚ²ÆµÉX|Úeœ%¤ÈL%äL¿9e ‰Étå¼ÇO^ (ˆÛp 3U±%ßär ‡ŒJŽ ›§vÎ2éCÊ Äzá2SãfúÍ1êÃ]Ïõ™@ÝÈ™¼€ÄÜn’èÛp%®Ö"nËJR µß2GÛ+Z™Š[¥?’@„½[PèâÙcÐWKþÂÕZìÛó=’â×Q÷ŸšiøÏäôîÓ?yê¬E`3‡ª+Wá‡ý;ñìÉÃŽöîÓ¿fóæHŠÛÒ%¸x2!%#Mì?;p)î°™*à²u;p_zÉ%#M !pˆ‚WÇR†Š«phϦÝi‚Eª8ügFôîÓ?ÔÁíKÈïü²ëp)_+Ç©XÀPÅž‘&ˆ#jðÌí&q=˜n˜0ÚLí¬×n>Dá•\Ê¢á÷J[ts»I¢è5³)¼&~J ¤:Úè´µAB„î@‹PKÆ´×doCú)ñÑaSteLgÓ.㦶襩›Àÿ?MàÙ¿|Ö¸bÙšs+s’¤Ÿ¸†ÑtïÙ›À@€<öòyÓ¶_=ï ‡žok®Ô‡Û¶½ÚžŸ¿x¾Œª¢Ã=ä_C?ÝlÐßB™«WŠp·òœ‰ÙcK3=hh(b%ùÐ7u@}mEû»ÃtØxØØØâRÁ)ÔUÿ¢%“2™ ݺ)©Ø™¢;¸œŸnÝ{†®ÃÆÎ†‰¡î_2Ÿ´úªŠ ý‘ýLKϲַÆöEe÷¡A(ô¤ù%ž?iÀÓÆßÓ¸›`N·zýàëÑ,ñðÞo´w¯ÊNõ{elЧ‡òÉ«}ð·êq¥ì&ªKsñüÉÃän=>º`á°±³Ýÿ*q:½âht§¿Õw_Z”ÞòòÙ^š:cå¾nÝ{âùÓ†‹Ýº÷Ì`N£;‘×›Üj*ÿµ½¥å¥K¯Þ}^4?&ý=zi¡—¦zkõCcýPBht'×ÿÑ|UE‡ä1 ý;ž&5v›øßõëÛµ]@kS}ðÿpŽªª¢ÃâÕ¥y &þ>Ø{fÝ>Pð~ÛÿÞžk˜^œIEND®B`‚geographiclib-1.21/doc/html/ConicProj.1.html0000644000175000017500000001761111745620414020512 0ustar frankiefrankie ConicProj -- perform conic projections


NAME

ConicProj -- perform conic projections


SYNOPSIS

ConicProj ( -c | -a ) lat1 lat2 [ -l lon0 ] [ -k k1 ] [ -r ] [ -e a f ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

Perform one of two conic projections geodesics. Convert geodetic coordinates to either Lambert conformal conic or Albers equal area coordinates. The standard latitudes lat1 and lat2 are specified by that the -c option (for Lambert conformal conic) or the -a option (for Albers equal area). At least one of these options must be given (the last one given is used). Specify lat1 = lat2, to obtain the case with a single standard parallel. The central meridian is given by lon0. The longitude of origin is given by the latitude of minimum (azimuthal) scale for Lambert conformal conic (Albers equal area). The (azimuthal) scale on the standard parallels is k1.

Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) latitude and longitude (decimal degrees or degrees, minutes, seconds). For each set of geodetic coordinates, the corresponding projected easting, x, and northing, y, (meters) are printed on standard output together with the meridian convergence gamma (degrees) and (azimuthal) scale k. For Albers equal area, the radial scale is 1/k. The meridian convergence is the bearing of the y axis measured clockwise from true north.

Special cases of the Lambert conformal projection are the Mercator projection (the standard latitudes equal and opposite) and the polar stereographic projection (both standard latitudes correspond to the same pole). Special cases of the Albers equal area projection are the cylindrical equal area projection (the standard latitudes equal and opposite), the Lambert azimuthal equal area projection (both standard latitude corresponds to the same pole), and the Lambert equal area conic projection (one standard parallel is at a pole).


OPTIONS

-c

use the Lambert conformal conic projection with standard parallels lat1 and lat2.

-a

use the Albers equal area projection with standard parallels lat1 and lat2.

-l

specify the longitude of origin lon0 (degrees, default 0).

-k

specify the (azimuthal) scale k1 on the standard parallels (default 1).

-r

perform the reverse projection. x and y are given on standard input and each line of standard output gives latitude, longitude, gamma, and k.

-e

specify the ellipsoid via a f; the equatorial radius is a and the flattening is f. Setting f = 0 results in a sphere. Specify f < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


EXAMPLES

   echo 39.95N 75.17W | ConicProj -c 40d58 39d56 -l 77d45W
   => 220445 -52372 1.67 1.0
   echo 220445 -52372 | ConicProj -c 40d58 39d56 -l 77d45W -r
   => 39.95 -75.17 1.67 1.0


ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes ConicProj to return an exit code of 1. However, an error does not cause ConicProj to terminate; following lines will be converted.


AUTHOR

ConicProj was written by Charles Karney.


HISTORY

ConicProj was added to GeographicLib, http://geographiclib.sf.net, in version 1.9.

geographiclib-1.21/doc/html/Geoid_8hpp.html0000644000175000017500000001463211745620414020453 0ustar frankiefrankie GeographicLib: Geoid.hpp File Reference
Geoid.hpp File Reference

Header for GeographicLib::Geoid class. More...

#include <string>
#include <vector>
#include <fstream>
#include <GeographicLib/Constants.hpp>

Go to the source code of this file.

Classes

class  GeographicLib::Geoid
 Looking up the height of the geoid. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_GEOID_HPP   "$Id: 4e4eb5941d16ad00416798703d246a6f7ef5fe46 $"
#define PGM_PIXEL_WIDTH   2

Detailed Description

Header for GeographicLib::Geoid class.

Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file Geoid.hpp.


Define Documentation

#define GEOGRAPHICLIB_GEOID_HPP   "$Id: 4e4eb5941d16ad00416798703d246a6f7ef5fe46 $"

Definition at line 11 of file Geoid.hpp.

#define PGM_PIXEL_WIDTH   2

The size of the pixel data in the pgm data files for the geoids. 2 is the standard size corresponding to a maxval 2^16-1. Setting it to 4 uses a maxval of 2^32-1 and changes the extension for the data files from .pgm to .pgm4. Note that the format of these pgm4 files is a non-standard extension of the pgm format.

Definition at line 33 of file Geoid.hpp.

geographiclib-1.21/doc/html/functions_0x64.html0000644000175000017500000002223411745620414021253 0ustar frankiefrankie GeographicLib: Class Members
Here is a list of all class members with links to the classes they belong to:

- d -

geographiclib-1.21/doc/html/classGeographicLib_1_1DMS-members.html0000644000175000017500000001755111745620414024651 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::DMS Member List
This is the complete list of members for GeographicLib::DMS, including all inherited members.
AZIMUTH enum valueGeographicLib::DMS
component enum nameGeographicLib::DMS
Decode(const std::string &dms, flag &ind)GeographicLib::DMS [static]
Decode(real d, real m=0, real s=0)GeographicLib::DMS [inline, static]
DecodeAngle(const std::string &angstr)GeographicLib::DMS [static]
DecodeAzimuth(const std::string &azistr)GeographicLib::DMS [static]
DecodeLatLon(const std::string &dmsa, const std::string &dmsb, real &lat, real &lon, bool swaplatlong=false)GeographicLib::DMS [static]
DEGREE enum valueGeographicLib::DMS
Encode(real angle, component trailing, unsigned prec, flag ind, char dmssep)GeographicLib::DMS [static]
Encode(real angle, component trailing, unsigned prec, flag ind=NONE)GeographicLib::DMS [static]
Encode(real angle, unsigned prec, flag ind=NONE, char dmssep=char(0))GeographicLib::DMS [inline, static]
Encode(real ang, real &d, real &m)GeographicLib::DMS [inline, static]
Encode(real ang, real &d, real &m, real &s)GeographicLib::DMS [inline, static]
flag enum nameGeographicLib::DMS
LATITUDE enum valueGeographicLib::DMS
LONGITUDE enum valueGeographicLib::DMS
MINUTE enum valueGeographicLib::DMS
NONE enum valueGeographicLib::DMS
NUMBER enum valueGeographicLib::DMS
SECOND enum valueGeographicLib::DMS
geographiclib-1.21/doc/html/classGeographicLib_1_1LocalCartesian.html0000644000175000017500000010717111745620415025461 0ustar frankiefrankie GeographicLib: GeographicLib::LocalCartesian Class Reference
GeographicLib::LocalCartesian Class Reference

Local Cartesian coordinates. More...

#include <GeographicLib/LocalCartesian.hpp>

List of all members.

Public Member Functions

 LocalCartesian (real lat0, real lon0, real h0=0, const Geocentric &earth=Geocentric::WGS84) throw ()
 LocalCartesian (const Geocentric &earth=Geocentric::WGS84) throw ()
void Reset (real lat0, real lon0, real h0=0) throw ()
void Forward (real lat, real lon, real h, real &x, real &y, real &z) const throw ()
void Forward (real lat, real lon, real h, real &x, real &y, real &z, std::vector< real > &M) const throw ()
void Reverse (real x, real y, real z, real &lat, real &lon, real &h) const throw ()
void Reverse (real x, real y, real z, real &lat, real &lon, real &h, std::vector< real > &M) const throw ()
Inspector functions
Math::real LatitudeOrigin () const throw ()
Math::real LongitudeOrigin () const throw ()
Math::real HeightOrigin () const throw ()
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()

Detailed Description

Local Cartesian coordinates.

Convert between geodetic coordinates latitude = lat, longitude = lon, height = h (measured vertically from the surface of the ellipsoid) to local cartesian coordinates (x, y, z). The origin of local cartesian coordinate system is at lat = lat0, lon = lon0, h = h0. The z axis is normal to the ellipsoid; the y axis points due north. The plane z = - h0 is tangent to the ellipsoid.

The conversions all take place via geocentric coordinates using a Geocentric object (by default Geocentric::WGS84).

Example of use:

// Example of using the GeographicLib::LocalCartesian class
// $Id: 0fd182a359b17d3b76ccd55f405b272a327a42e8 $

#include <iostream>
#include <exception>
#include <cmath>
#include <GeographicLib/Geocentric.hpp>
#include <GeographicLib/LocalCartesian.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    Geocentric earth(Constants::WGS84_a(), Constants::WGS84_f());
    // Alternatively: const Geocentric& earth = Geocentric::WGS84;
    const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris
    LocalCartesian proj(lat0, lon0, 0, earth);
    {
      // Sample forward calculation
      double lat = 50.9, lon = 1.8, h = 0; // Calais
      double x, y, z;
      proj.Forward(lat, lon, h, x, y, z);
      cout << x << " " << y << " " << z << "\n";
    }
    {
      // Sample reverse calculation
      double x = -38e3, y = 230e3, z = -4e3;
      double lat, lon, h;
      proj.Reverse(x, y, z, lat, lon, h);
      cout << lat << " " << lon << " " << h << "\n";
    }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

CartConvert is a command-line utility providing access to the functionality of Geocentric and LocalCartesian.


Constructor & Destructor Documentation

GeographicLib::LocalCartesian::LocalCartesian ( real  lat0,
real  lon0,
real  h0 = 0,
const Geocentric earth = Geocentric::WGS84 
) throw () [inline]

Constructor setting the origin.

Parameters:
[in]lat0latitude at origin (degrees).
[in]lon0longitude at origin (degrees).
[in]h0height above ellipsoid at origin (meters); default 0.
[in]earthGeocentric object for the transformation; default Geocentric::WGS84.

Definition at line 63 of file LocalCartesian.hpp.

GeographicLib::LocalCartesian::LocalCartesian ( const Geocentric earth = Geocentric::WGS84) throw () [inline, explicit]

Default constructor.

Parameters:
[in]earthGeocentric object for the transformation; default Geocentric::WGS84.

Sets lat0 = 0, lon0 = 0, h0 = 0.

Definition at line 76 of file LocalCartesian.hpp.


Member Function Documentation

void GeographicLib::LocalCartesian::Reset ( real  lat0,
real  lon0,
real  h0 = 0 
) throw ()

Reset the origin.

Parameters:
[in]lat0latitude at origin (degrees).
[in]lon0longitude at origin (degrees).
[in]h0height above ellipsoid at origin (meters); default 0.

Definition at line 22 of file LocalCartesian.cpp.

void GeographicLib::LocalCartesian::Forward ( real  lat,
real  lon,
real  h,
real &  x,
real &  y,
real &  z 
) const throw () [inline]

Convert from geodetic to local cartesian coordinates.

Parameters:
[in]latlatitude of point (degrees).
[in]lonlongitude of point (degrees).
[in]hheight of point above the ellipsoid (meters).
[out]xlocal cartesian coordinate (meters).
[out]ylocal cartesian coordinate (meters).
[out]zlocal cartesian coordinate (meters).

lat should be in the range [-90, 90]; lon and lon0 should be in the range [-180, 360].

Definition at line 104 of file LocalCartesian.hpp.

Referenced by main().

void GeographicLib::LocalCartesian::Forward ( real  lat,
real  lon,
real  h,
real &  x,
real &  y,
real &  z,
std::vector< real > &  M 
) const throw () [inline]

Convert from geodetic to local cartesian coordinates and return rotation matrix.

Parameters:
[in]latlatitude of point (degrees).
[in]lonlongitude of point (degrees).
[in]hheight of point above the ellipsoid (meters).
[out]xlocal cartesian coordinate (meters).
[out]ylocal cartesian coordinate (meters).
[out]zlocal cartesian coordinate (meters).
[out]Mif the length of the vector is 9, fill with the rotation matrix in row-major order.

Let v be a unit vector located at (lat, lon, h). We can express v as column vectors in one of two ways

  • in east, north, up coordinates (where the components are relative to a local coordinate system at (lat, lon, h)); call this representation v1.
  • in x, y, z coordinates (where the components are relative to the local coordinate system at (lat0, lon0, h0)); call this representation v0.

Then we have v0 = M . v1.

Definition at line 133 of file LocalCartesian.hpp.

void GeographicLib::LocalCartesian::Reverse ( real  x,
real  y,
real  z,
real &  lat,
real &  lon,
real &  h 
) const throw () [inline]

Convert from local cartesian to geodetic coordinates.

Parameters:
[in]xlocal cartesian coordinate (meters).
[in]ylocal cartesian coordinate (meters).
[in]zlocal cartesian coordinate (meters).
[out]latlatitude of point (degrees).
[out]lonlongitude of point (degrees).
[out]hheight of point above the ellipsoid (meters).

The value of lon returned is in the range [-180, 180).

Definition at line 156 of file LocalCartesian.hpp.

Referenced by main().

void GeographicLib::LocalCartesian::Reverse ( real  x,
real  y,
real  z,
real &  lat,
real &  lon,
real &  h,
std::vector< real > &  M 
) const throw () [inline]

Convert from local cartesian to geodetic coordinates and return rotation matrix.

Parameters:
[in]xlocal cartesian coordinate (meters).
[in]ylocal cartesian coordinate (meters).
[in]zlocal cartesian coordinate (meters).
[out]latlatitude of point (degrees).
[out]lonlongitude of point (degrees).
[out]hheight of point above the ellipsoid (meters).
[out]Mif the length of the vector is 9, fill with the rotation matrix in row-major order.

Let v be a unit vector located at (lat, lon, h). We can express v as column vectors in one of two ways

  • in east, north, up coordinates (where the components are relative to a local coordinate system at (lat, lon, h)); call this representation v1.
  • in x, y, z coordinates (where the components are relative to the local coordinate system at (lat0, lon0, h0)); call this representation v0.

Then we have v1 = M^T . v0, where M^T is the transpose of M.

Definition at line 186 of file LocalCartesian.hpp.

Math::real GeographicLib::LocalCartesian::LatitudeOrigin ( ) const throw () [inline]
Returns:
latitude of the origin (degrees).

Definition at line 203 of file LocalCartesian.hpp.

Math::real GeographicLib::LocalCartesian::LongitudeOrigin ( ) const throw () [inline]
Returns:
longitude of the origin (degrees).

Definition at line 208 of file LocalCartesian.hpp.

Math::real GeographicLib::LocalCartesian::HeightOrigin ( ) const throw () [inline]
Returns:
height of the origin (meters).

Definition at line 213 of file LocalCartesian.hpp.

Math::real GeographicLib::LocalCartesian::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value of a inherited from the Geocentric object used in the constructor.

Definition at line 220 of file LocalCartesian.hpp.

Math::real GeographicLib::LocalCartesian::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid. This is the value inherited from the Geocentric object used in the constructor.

Definition at line 226 of file LocalCartesian.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/namespaceGeographicLib.html0000644000175000017500000003770611745620415023051 0ustar frankiefrankie GeographicLib: GeographicLib Namespace Reference
GeographicLib Namespace Reference

Namespace for GeographicLib. More...

Classes

class  Accumulator
 An accumulator for sums. More...
class  AlbersEqualArea
 Albers Equal Area Conic Projection. More...
class  AzimuthalEquidistant
 Azimuthal Equidistant Projection. More...
class  CassiniSoldner
 Cassini-Soldner Projection. More...
class  CircularEngine
 Spherical Harmonic sums for a circle. More...
class  Constants
 Constants needed by GeographicLib More...
class  GeographicErr
 Exception handling for GeographicLib. More...
class  DMS
 Convert between degrees and DMS representation. More...
class  EllipticFunction
 Elliptic functions needed for TransverseMercatorExact. More...
class  Geocentric
 Geocentric coordinates More...
class  GeoCoords
 Conversion between geographic coordinates. More...
class  Geodesic
 Geodesic calculations More...
class  GeodesicLine
 A geodesic line. More...
class  Geoid
 Looking up the height of the geoid. More...
class  Gnomonic
 Gnomonic Projection. More...
class  GravityCircle
 Gravity on a circle of latitude. More...
class  GravityModel
 Model of the earth's gravity field. More...
class  LambertConformalConic
 Lambert Conformal Conic Projection. More...
class  LocalCartesian
 Local Cartesian coordinates. More...
class  MagneticCircle
 Geomagnetic field on a circle of latitude. More...
class  MagneticModel
 Model of the earth's magnetic field. More...
class  Math
 Mathematical functions needed by GeographicLib. More...
class  MGRS
 Convert between UTM/UPS and MGRS. More...
class  NormalGravity
 The normal gravity of the earth. More...
class  OSGB
 Ordnance Survey grid system for Great Britain. More...
class  PolarStereographic
 Polar Stereographic Projection. More...
class  PolygonArea
 Polygon Areas. More...
class  SphericalEngine
 The evaluation engine for SphericalHarmonic. More...
class  SphericalHarmonic
 Spherical Harmonic series. More...
class  SphericalHarmonic1
 Spherical Harmonic series with a correction to the coefficients. More...
class  SphericalHarmonic2
 Spherical Harmonic series with two corrections to the coefficients. More...
class  TransverseMercator
 Transverse Mercator Projection. More...
class  TransverseMercatorExact
 An exact implementation of the Transverse Mercator Projection. More...
class  Utility
 Some utility routines for GeographicLib. More...
class  UTMUPS
 Convert between Geographic coordinates and UTM/UPS. More...

Detailed Description

Namespace for GeographicLib.

All of GeographicLib is defined within the GeographicLib namespace. In addition all the header files are included via GeographicLib/filename. This minimizes the likelihood of conflicts with other packages.

geographiclib-1.21/doc/html/Geoid_8cpp.html0000644000175000017500000001535611745620415020453 0ustar frankiefrankie GeographicLib: Geoid.cpp File Reference
Geoid.cpp File Reference

Implementation for GeographicLib::Geoid class. More...

#include <GeographicLib/Geoid.hpp>
#include <sstream>
#include <cstdlib>
#include <algorithm>
#include <GeographicLib/Utility.hpp>

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_GEOID_CPP   "$Id: 5c3c23dd877485af9c9e298ddb28c5aac12b5e6a $"
#define GEOGRAPHICLIB_DATA   "/usr/local/share/GeographicLib"
#define GEOID_DEFAULT_NAME   "egm96-5"

Detailed Description

Implementation for GeographicLib::Geoid class.

Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file Geoid.cpp.


Define Documentation

#define GEOGRAPHICLIB_GEOID_CPP   "$Id: 5c3c23dd877485af9c9e298ddb28c5aac12b5e6a $"

Definition at line 16 of file Geoid.cpp.

#define GEOGRAPHICLIB_DATA   "/usr/local/share/GeographicLib"

Definition at line 27 of file Geoid.cpp.

Referenced by GeographicLib::Geoid::DefaultGeoidPath().

#define GEOID_DEFAULT_NAME   "egm96-5"

Definition at line 32 of file Geoid.cpp.

Referenced by GeographicLib::Geoid::DefaultGeoidName().

geographiclib-1.21/doc/html/functions_0x65.html0000644000175000017500000001422411745620414021254 0ustar frankiefrankie GeographicLib: Class Members
Here is a list of all class members with links to the classes they belong to:

- e -

geographiclib-1.21/doc/html/classGeographicLib_1_1AlbersEqualArea-members.html0000644000175000017500000001603411745620414027212 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::AlbersEqualArea Member List
This is the complete list of members for GeographicLib::AlbersEqualArea, including all inherited members.
AlbersEqualArea(real a, real f, real stdlat, real k0)GeographicLib::AlbersEqualArea
AlbersEqualArea(real a, real f, real stdlat1, real stdlat2, real k1)GeographicLib::AlbersEqualArea
AlbersEqualArea(real a, real f, real sinlat1, real coslat1, real sinlat2, real coslat2, real k1)GeographicLib::AlbersEqualArea
AzimuthalEqualAreaNorthGeographicLib::AlbersEqualArea [static]
AzimuthalEqualAreaSouthGeographicLib::AlbersEqualArea [static]
CentralScale() const GeographicLib::AlbersEqualArea [inline]
CylindricalEqualAreaGeographicLib::AlbersEqualArea [static]
Flattening() const GeographicLib::AlbersEqualArea [inline]
Forward(real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const GeographicLib::AlbersEqualArea
Forward(real lon0, real lat, real lon, real &x, real &y) const GeographicLib::AlbersEqualArea [inline]
MajorRadius() const GeographicLib::AlbersEqualArea [inline]
OriginLatitude() const GeographicLib::AlbersEqualArea [inline]
Reverse(real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const GeographicLib::AlbersEqualArea
Reverse(real lon0, real x, real y, real &lat, real &lon) const GeographicLib::AlbersEqualArea [inline]
SetScale(real lat, real k=real(1))GeographicLib::AlbersEqualArea
geographiclib-1.21/doc/html/functions.html0000644000175000017500000002161711745620414020476 0ustar frankiefrankie GeographicLib: Class Members
Here is a list of all class members with links to the classes they belong to:

- a -

geographiclib-1.21/doc/html/DMS_8cpp_source.html0000644000175000017500000011011011745620415021407 0ustar frankiefrankie GeographicLib: DMS.cpp Source File
DMS.cpp
Go to the documentation of this file.
00001 /**
00002  * \file DMS.cpp
00003  * \brief Implementation for GeographicLib::DMS class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/DMS.hpp>
00011 #include <algorithm>
00012 #include <GeographicLib/Utility.hpp>
00013 
00014 #define GEOGRAPHICLIB_DMS_CPP "$Id: db38ddc05f7c27732da3aa820191a51200ce92ac $"
00015 
00016 RCSID_DECL(GEOGRAPHICLIB_DMS_CPP)
00017 RCSID_DECL(GEOGRAPHICLIB_DMS_HPP)
00018 RCSID_DECL(GEOGRAPHICLIB_CONSTANTS_HPP)
00019 RCSID_DECL(GEOGRAPHICLIB_MATH_HPP)
00020 
00021 namespace GeographicLib {
00022 
00023   using namespace std;
00024 
00025   const string DMS::hemispheres_ = "SNWE";
00026   const string DMS::signs_ = "-+";
00027   const string DMS::digits_ = "0123456789";
00028   const string DMS::dmsindicators_ = "D'\":";
00029   const string DMS::components_[] = {"degrees", "minutes", "seconds"};
00030 
00031   Math::real DMS::Decode(const std::string& dms, flag& ind) {
00032     string errormsg;
00033     string dmsa = dms;
00034     replace(dmsa, "\xc2\xb0", 'd'); // degree symbol (U+00b0 = UTF-8 c2 b0)
00035     replace(dmsa, "\xc2\xba", 'd'); // alt symbol (U+00ba = UTF-8 c2 ba)
00036     replace(dmsa, "\xe2\x81\xb0", 'd');  // sup zero (U+2070 = UTF-8 e2 81 b0)
00037     replace(dmsa, "\xe2\x80\xb2", '\''); // prime (U+2032 = UTF-8 e2 80 b2)
00038     replace(dmsa, "\xc2\xb4", '\'');     // acute accent (U+00b4 = UTF-8 c2 b4)
00039     replace(dmsa, "\xe2\x80\xb3", '"');  // dbl prime (U+2033 = UTF-8 e2 80 b3)
00040     replace(dmsa, "\xb0", 'd');          // bare degree symbol (b0)
00041     replace(dmsa, "\xba", 'd');          // bare alt symbol (ba)
00042     replace(dmsa, "\xb4", 'd');          // bare acute accent (b4)
00043     replace(dmsa, "''", '"');            // '' -> "
00044     do {                       // Executed once (provides the ability to break)
00045       int sign = 1;
00046       unsigned
00047         beg = 0,
00048         end = unsigned(dmsa.size());
00049       while (beg < end && isspace(dmsa[beg]))
00050         ++beg;
00051       while (beg < end && isspace(dmsa[end - 1]))
00052         --end;
00053       flag ind1 = NONE;
00054       int k = -1;
00055       if (end > beg && (k = Utility::lookup(hemispheres_, dmsa[beg])) >= 0) {
00056         ind1 = (k / 2) ? LONGITUDE : LATITUDE;
00057         sign = k % 2 ? 1 : -1;
00058         ++beg;
00059       }
00060       if (end > beg && (k = Utility::lookup(hemispheres_, dmsa[end-1])) >= 0) {
00061         if (k >= 0) {
00062           if (ind1 != NONE) {
00063             if (toupper(dmsa[beg - 1]) == toupper(dmsa[end - 1]))
00064               errormsg = "Repeated hemisphere indicators "
00065                 + Utility::str(dmsa[beg - 1])
00066                 + " in " + dmsa.substr(beg - 1, end - beg + 1);
00067             else
00068               errormsg = "Contradictory hemisphere indicators "
00069                 + Utility::str(dmsa[beg - 1]) + " and "
00070                 + Utility::str(dmsa[end - 1]) + " in "
00071                 + dmsa.substr(beg - 1, end - beg + 1);
00072             break;
00073           }
00074           ind1 = (k / 2) ? LONGITUDE : LATITUDE;
00075           sign = k % 2 ? 1 : -1;
00076           --end;
00077         }
00078       }
00079       if (end > beg && (k = Utility::lookup(signs_, dmsa[beg])) >= 0) {
00080         if (k >= 0) {
00081           sign *= k ? 1 : -1;
00082           ++beg;
00083         }
00084       }
00085       if (end == beg) {
00086         errormsg = "Empty or incomplete DMS string " + dmsa;
00087         break;
00088       }
00089       real ipieces[] = {0, 0, 0};
00090       real fpieces[] = {0, 0, 0};
00091       unsigned npiece = 0;
00092       real icurrent = 0;
00093       real fcurrent = 0;
00094       unsigned ncurrent = 0, p = beg;
00095       bool pointseen = false;
00096       unsigned digcount = 0;
00097       while (p < end) {
00098         char x = dmsa[p++];
00099         if ((k = Utility::lookup(digits_, x)) >= 0) {
00100           ++ncurrent;
00101           if (digcount > 0)
00102             ++digcount;         // Count of decimal digits
00103           else
00104             icurrent = 10 * icurrent + k;
00105         } else if (x == '.') {
00106           if (pointseen) {
00107             errormsg = "Multiple decimal points in "
00108               + dmsa.substr(beg, end - beg);
00109             break;
00110           }
00111           pointseen = true;
00112           digcount = 1;
00113         } else if ((k = Utility::lookup(dmsindicators_, x)) >= 0) {
00114           if (k >= 3) {
00115             if (p == end) {
00116               errormsg = "Illegal for : to appear at the end of " +
00117                 dmsa.substr(beg, end - beg);
00118               break;
00119             }
00120             k = npiece;
00121           }
00122           if (unsigned(k) == npiece - 1) {
00123             errormsg = "Repeated " + components_[k] +
00124               " component in " + dmsa.substr(beg, end - beg);
00125             break;
00126           } else if (unsigned(k) < npiece) {
00127             errormsg = components_[k] + " component follows "
00128               + components_[npiece - 1] + " component in "
00129               + dmsa.substr(beg, end - beg);
00130             break;
00131           }
00132           if (ncurrent == 0) {
00133             errormsg = "Missing numbers in " + components_[k] +
00134               " component of " + dmsa.substr(beg, end - beg);
00135             break;
00136           }
00137           if (digcount > 1) {
00138             istringstream s(dmsa.substr(p - digcount - 1, digcount));
00139             s >> fcurrent;
00140           }
00141           ipieces[k] = icurrent;
00142           fpieces[k] = icurrent + fcurrent;
00143           if (p < end) {
00144             npiece = k + 1;
00145             icurrent = fcurrent = 0;
00146             ncurrent = digcount = 0;
00147           }
00148         } else if (Utility::lookup(signs_, x) >= 0) {
00149           errormsg = "Internal sign in DMS string "
00150             + dmsa.substr(beg, end - beg);
00151           break;
00152         } else {
00153           errormsg = "Illegal character " + Utility::str(x) + " in DMS string "
00154             + dmsa.substr(beg, end - beg);
00155           break;
00156         }
00157       }
00158       if (!errormsg.empty())
00159         break;
00160       if (Utility::lookup(dmsindicators_, dmsa[p - 1]) < 0) {
00161         if (npiece >= 3) {
00162           errormsg = "Extra text following seconds in DMS string "
00163             + dmsa.substr(beg, end - beg);
00164           break;
00165         }
00166         if (ncurrent == 0) {
00167           errormsg = "Missing numbers in trailing component of "
00168             + dmsa.substr(beg, end - beg);
00169           break;
00170         }
00171         if (digcount > 1) {
00172           istringstream s(dmsa.substr(p - digcount, digcount));
00173           s >> fcurrent;
00174         }
00175         ipieces[npiece] = icurrent;
00176         fpieces[npiece] = icurrent + fcurrent;
00177       }
00178       if (pointseen && digcount == 0) {
00179         errormsg = "Decimal point in non-terminal component of "
00180           + dmsa.substr(beg, end - beg);
00181         break;
00182       }
00183       // Note that we accept 59.999999... even though it rounds to 60.
00184       if (ipieces[1] >= 60) {
00185         errormsg = "Minutes " + Utility::str(fpieces[1])
00186           + " not in range [0, 60)";
00187         break;
00188       }
00189       if (ipieces[2] >= 60) {
00190         errormsg = "Seconds " + Utility::str(fpieces[2])
00191           + " not in range [0, 60)";
00192         break;
00193       }
00194       ind = ind1;
00195       // Assume check on range of result is made by calling routine (which
00196       // might be able to offer a better diagnostic).
00197       return real(sign) * (fpieces[0] + (fpieces[1] + fpieces[2] / 60) / 60);
00198     } while (false);
00199     real val = Utility::nummatch<real>(dmsa);
00200     if (val == 0)
00201       throw GeographicErr(errormsg);
00202     else
00203       ind = NONE;
00204     return val;
00205   }
00206 
00207   void DMS::DecodeLatLon(const std::string& stra, const std::string& strb,
00208                          real& lat, real& lon, bool swaplatlong) {
00209     real a, b;
00210     flag ia, ib;
00211     a = Decode(stra, ia);
00212     b = Decode(strb, ib);
00213     if (ia == NONE && ib == NONE) {
00214       // Default to lat, long unless swaplatlong
00215       ia = swaplatlong ? LONGITUDE : LATITUDE;
00216       ib = swaplatlong ? LATITUDE : LONGITUDE;
00217     } else if (ia == NONE)
00218       ia = flag(LATITUDE + LONGITUDE - ib);
00219     else if (ib == NONE)
00220       ib = flag(LATITUDE + LONGITUDE - ia);
00221     if (ia == ib)
00222       throw GeographicErr("Both " + stra + " and "
00223                           + strb + " interpreted as "
00224                           + (ia == LATITUDE ? "latitudes" : "longitudes"));
00225     real
00226       lat1 = ia == LATITUDE ? a : b,
00227       lon1 = ia == LATITUDE ? b : a;
00228     if (lat1 < -90 || lat1 > 90)
00229       throw GeographicErr("Latitude " + Utility::str(lat1)
00230                           + "d not in [-90d, 90d]");
00231     if (lon1 < -180 || lon1 > 360)
00232       throw GeographicErr("Longitude " + Utility::str(lon1)
00233                           + "d not in [-180d, 360d]");
00234     if (lon1 >= 180)
00235       lon1 -= 360;
00236     lat = lat1;
00237     lon = lon1;
00238   }
00239 
00240   Math::real DMS::DecodeAngle(const std::string& angstr) {
00241     flag ind;
00242     real ang = Decode(angstr, ind);
00243     if (ind != NONE)
00244       throw GeographicErr("Arc angle " + angstr
00245                           + " includes a hemisphere, N/E/W/S");
00246     return ang;
00247   }
00248 
00249   Math::real DMS::DecodeAzimuth(const std::string& azistr) {
00250     flag ind;
00251     real azi = Decode(azistr, ind);
00252     if (ind == LATITUDE)
00253       throw GeographicErr("Azimuth " + azistr
00254                           + " has a latitude hemisphere, N/S");
00255     if (azi < -180 || azi > 360)
00256       throw GeographicErr("Azimuth " + azistr + " not in range [-180d, 360d]");
00257     if (azi >= 180) azi -= 360;
00258     return azi;
00259   }
00260 
00261   string DMS::Encode(real angle, component trailing, unsigned prec, flag ind,
00262                      char dmssep) {
00263     // Assume check on range of input angle has been made by calling
00264     // routine (which might be able to offer a better diagnostic).
00265     if (!Math::isfinite(angle))
00266       return angle < 0 ? string("-inf") :
00267         (angle > 0 ? string("inf") : string("nan"));
00268 
00269     // 15 - 2 * trailing = ceiling(log10(2^53/90/60^trailing)).
00270     // This suffices to give full real precision for numbers in [-90,90]
00271     prec = min(15 - 2 * unsigned(trailing), prec);
00272     real scale = 1;
00273     for (unsigned i = 0; i < unsigned(trailing); ++i)
00274       scale *= 60;
00275     for (unsigned i = 0; i < prec; ++i)
00276       scale *= 10;
00277     if (ind == AZIMUTH)
00278       angle -= floor(angle/360) * 360;
00279     int sign = angle < 0 ? -1 : 1;
00280     angle *= sign;
00281 
00282     // Break off integer part to preserve precision in manipulation of
00283     // fractional part.
00284     real
00285       idegree = floor(angle),
00286       fdegree = floor((angle - idegree) * scale + real(0.5)) / scale;
00287     if (fdegree >= 1) {
00288       idegree += 1;
00289       fdegree -= 1;
00290     }
00291     real pieces[3] = {fdegree, 0, 0};
00292     for (unsigned i = 1; i <= unsigned(trailing); ++i) {
00293       real
00294         ip = floor(pieces[i - 1]),
00295         fp = pieces[i - 1] - ip;
00296       pieces[i] = fp * 60;
00297       pieces[i - 1] = ip;
00298     }
00299     pieces[0] += idegree;
00300     ostringstream s;
00301     s << fixed << setfill('0');
00302     if (ind == NONE && sign < 0)
00303       s << '-';
00304     switch (trailing) {
00305     case DEGREE:
00306       if (ind != NONE)
00307         s << setw(1 + min(int(ind), 2) + prec + (prec ? 1 : 0));
00308       s << setprecision(prec) << pieces[0];
00309       // Don't include degree designator (d) if it is the trailing component.
00310       break;
00311     default:
00312       if (ind != NONE)
00313         s << setw(1 + min(int(ind), 2));
00314       s << setprecision(0) << pieces[0]
00315         << (dmssep ? dmssep : char(tolower(dmsindicators_[0])));
00316       switch (trailing) {
00317       case MINUTE:
00318         s << setw(2 + prec + (prec ? 1 : 0)) << setprecision(prec) << pieces[1];
00319         if (!dmssep)
00320           s << char(tolower(dmsindicators_[1]));
00321         break;
00322       case SECOND:
00323         s << setw(2)
00324           << pieces[1] << (dmssep ? dmssep : char(tolower(dmsindicators_[1])))
00325           << setw(2 + prec + (prec ? 1 : 0)) << setprecision(prec) << pieces[2];
00326         if (!dmssep)
00327           s << char(tolower(dmsindicators_[2]));
00328         break;
00329       default:
00330         break;
00331       }
00332     }
00333     if (ind != NONE && ind != AZIMUTH)
00334       s << hemispheres_[(ind == LATITUDE ? 0 : 2) + (sign < 0 ? 0 : 1)];
00335     return s.str();
00336   }
00337 
00338   string DMS::Encode(real angle, component trailing, unsigned prec, flag ind)
00339   { return Encode(angle, trailing, prec, ind, char(0)); }
00340 
00341 } // namespace GeographicLib
geographiclib-1.21/doc/html/LocalCartesian_8cpp_source.html0000644000175000017500000002312111745620414023654 0ustar frankiefrankie GeographicLib: LocalCartesian.cpp Source File
LocalCartesian.cpp
Go to the documentation of this file.
00001 /**
00002  * \file LocalCartesian.cpp
00003  * \brief Implementation for GeographicLib::LocalCartesian class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/LocalCartesian.hpp>
00011 
00012 #define GEOGRAPHICLIB_LOCALCARTESIAN_CPP \
00013   "$Id: 4d15764c089e07855bf6db300271e18f4fa89624 $"
00014 
00015 RCSID_DECL(GEOGRAPHICLIB_LOCALCARTESIAN_CPP)
00016 RCSID_DECL(GEOGRAPHICLIB_LOCALCARTESIAN_HPP)
00017 
00018 namespace GeographicLib {
00019 
00020   using namespace std;
00021 
00022   void LocalCartesian::Reset(real lat0, real lon0, real h0) throw() {
00023     _lat0 = lat0;
00024     _lon0 = lon0 >= 180 ? lon0 - 360 : (lon0 < -180 ? lon0 + 360 : lon0);
00025     _h0 = h0;
00026     _earth.Forward(_lat0, _lon0, _h0, _x0, _y0, _z0);
00027     real
00028       phi = lat0 * Math::degree<real>(),
00029       sphi = sin(phi),
00030       cphi = abs(_lat0) == 90 ? 0 : cos(phi),
00031       lam = lon0 * Math::degree<real>(),
00032       slam = _lon0 == -180 ? 0 : sin(lam),
00033       clam = abs(_lon0) == 90 ? 0 : cos(lam);
00034     _earth.Rotation(sphi, cphi, slam, clam, _r);
00035   }
00036 
00037   void LocalCartesian::MatrixMultiply(real M[dim2_]) const throw() {
00038     real t[dim2_];
00039     copy(M, M + dim2_, t);
00040     for (size_t i = 0; i < dim2_; ++i) {
00041       size_t row = i / dim_, col = i % dim_;
00042       M[i] = _r[row] * t[col] + _r[row+3] * t[col+3] + _r[row+6] * t[col+6];
00043     }
00044   }
00045 
00046   void LocalCartesian::IntForward(real lat, real lon, real h,
00047                                   real& x, real& y, real& z,
00048                                   real M[dim2_]) const throw() {
00049     real xc, yc, zc;
00050     _earth.IntForward(lat, lon, h, xc, yc, zc, M);
00051     xc -= _x0; yc -= _y0; zc -= _z0;
00052     x = _r[0] * xc + _r[3] * yc + _r[6] * zc;
00053     y = _r[1] * xc + _r[4] * yc + _r[7] * zc;
00054     z = _r[2] * xc + _r[5] * yc + _r[8] * zc;
00055     if (M)
00056       MatrixMultiply(M);
00057   }
00058 
00059   void LocalCartesian::IntReverse(real x, real y, real z,
00060                                   real& lat, real& lon, real& h,
00061                                   real M[dim2_]) const throw() {
00062     real
00063       xc = _x0 + _r[0] * x + _r[1] * y + _r[2] * z,
00064       yc = _y0 + _r[3] * x + _r[4] * y + _r[5] * z,
00065       zc = _z0 + _r[6] * x + _r[7] * y + _r[8] * z;
00066     _earth.IntReverse(xc, yc, zc, lat, lon, h, M);
00067     if (M)
00068       MatrixMultiply(M);
00069   }
00070 
00071 } // namespace GeographicLib
geographiclib-1.21/doc/html/MGRS_8hpp.html0000644000175000017500000001250311745620414020167 0ustar frankiefrankie GeographicLib: MGRS.hpp File Reference
MGRS.hpp File Reference

Header for GeographicLib::MGRS class. More...

#include <sstream>
#include <GeographicLib/Constants.hpp>
#include <GeographicLib/UTMUPS.hpp>

Go to the source code of this file.

Classes

class  GeographicLib::MGRS
 Convert between UTM/UPS and MGRS. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_MGRS_HPP   "$Id: 80e08da6eca9d9cf92c5adad148c64302df2573d $"

Detailed Description

Header for GeographicLib::MGRS class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file MGRS.hpp.


Define Documentation

#define GEOGRAPHICLIB_MGRS_HPP   "$Id: 80e08da6eca9d9cf92c5adad148c64302df2573d $"

Definition at line 11 of file MGRS.hpp.

geographiclib-1.21/doc/html/functions_0x66.html0000644000175000017500000003033011745620414021251 0ustar frankiefrankie GeographicLib: Class Members
Here is a list of all class members with links to the classes they belong to:

- f -

geographiclib-1.21/doc/html/UTMUPS_8hpp_source.html0000644000175000017500000012171511745620414022042 0ustar frankiefrankie GeographicLib: UTMUPS.hpp Source File
UTMUPS.hpp
Go to the documentation of this file.
00001 /**
00002  * \file UTMUPS.hpp
00003  * \brief Header for GeographicLib::UTMUPS class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_UTMUPS_HPP)
00011 #define GEOGRAPHICLIB_UTMUPS_HPP \
00012   "$Id: a529ed8aeaeffb02994254bbc7eb1209aa41b9ca $"
00013 
00014 #include <sstream>
00015 #include <GeographicLib/Constants.hpp>
00016 
00017 namespace GeographicLib {
00018 
00019   /**
00020    * \brief Convert between Geographic coordinates and UTM/UPS
00021    *
00022    * UTM and UPS are defined
00023    * - J. W. Hager, J. F. Behensky, and B. W. Drew,
00024    *   <a href="http://earth-info.nga.mil/GandG/publications/tm8358.2/TM8358_2.pdf">
00025    *   The Universal Grids: Universal Transverse Mercator (UTM) and Universal
00026    *   Polar Stereographic (UPS)</a>, Defense Mapping Agency, Technical Manual
00027    *   TM8358.2 (1989).
00028    * .
00029    * Section 2-3 defines UTM and section 3-2.4 defines UPS.  This document also
00030    * includes approximate algorithms for the computation of the underlying
00031    * transverse Mercator and polar stereographic projections.  Here we
00032    * substitute much more accurate algorithms given by
00033    * GeographicLib:TransverseMercator and GeographicLib:PolarStereographic.
00034    *
00035    * In this implementation, the conversions are closed, i.e., output from
00036    * Forward is legal input for Reverse and vice versa.  The error is about 5nm
00037    * in each direction.  However, the conversion from legal UTM/UPS coordinates
00038    * to geographic coordinates and back might throw an error if the initial
00039    * point is within 5nm of the edge of the allowed range for the UTM/UPS
00040    * coordinates.
00041    *
00042    * The simplest way to guarantee the closed property is to define allowed
00043    * ranges for the eastings and northings for UTM and UPS coordinates.  The
00044    * UTM boundaries are the same for all zones.  (The only place the
00045    * exceptional nature of the zone boundaries is evident is when converting to
00046    * UTM/UPS coordinates requesting the standard zone.)  The MGRS lettering
00047    * scheme imposes natural limits on UTM/UPS coordinates which may be
00048    * converted into MGRS coordinates.  For the conversion to/from geographic
00049    * coordinates these ranges have been extended by 100km in order to provide a
00050    * generous overlap between UTM and UPS and between UTM zones.
00051    *
00052    * The <a href="http://www.nga.mil">NGA</a> software package
00053    * <a href="http://earth-info.nga.mil/GandG/geotrans/index.html">geotrans</a>
00054    * also provides conversions to and from UTM and UPS.  Version 2.4.2 (and
00055    * earlier) suffers from some drawbacks:
00056    * - Inconsistent rules are used to determine the whether a particular UTM or
00057    *   UPS coordinate is legal.  A more systematic approach is taken here.
00058    * - The underlying projections are not very accurately implemented.
00059    *
00060    * Example of use:
00061    * \include example-UTMUPS.cpp
00062    **********************************************************************/
00063   class GEOGRAPHIC_EXPORT UTMUPS {
00064   private:
00065     typedef Math::real real;
00066     static const real falseeasting_[4];
00067     static const real falsenorthing_[4];
00068     static const real mineasting_[4];
00069     static const real maxeasting_[4];
00070     static const real minnorthing_[4];
00071     static const real maxnorthing_[4];
00072     static real CentralMeridian(int zone) throw()
00073     { return real(6 * zone - 183); }
00074     static void CheckLatLon(real lat, real lon);
00075     // Throw an error if easting or northing are outside standard ranges.  If
00076     // throwp = false, return bool instead.
00077     static bool CheckCoords(bool utmp, bool northp, real x, real y,
00078                             bool msgrlimits = false, bool throwp = true);
00079     UTMUPS();                   // Disable constructor
00080 
00081   public:
00082 
00083     /**
00084      * In this class we bring together the UTM and UPS coordinates systems.
00085      * The UTM divides the earth between latitudes -80 and 84 into 60 zones
00086      * numbered 1 thru 60.  Zone assign zone number 0 to the UPS regions,
00087      * covering the two poles.  Within UTMUPS, non-negative zone numbers refer
00088      * to one of the "physical" zones, 0 for UPS and [1, 60] for UTM.  Negative
00089      * "pseudo-zone" numbers are used to select one of the physical zones.
00090      **********************************************************************/
00091     enum zonespec {
00092       /**
00093        * The smallest pseudo-zone number.
00094        **********************************************************************/
00095       MINPSEUDOZONE = -4,
00096       /**
00097        * A marker for an undefined or invalid zone.  Equivalent to NaN.
00098        **********************************************************************/
00099       INVALID = -4,
00100       /**
00101        * If a coordinate already include zone information (e.g., it is an MGRS
00102        * coordinate), use that, otherwise apply the UTMUPS::STANDARD rules.
00103        **********************************************************************/
00104       MATCH = -3,
00105       /**
00106        * Apply the standard rules for UTM zone assigment extending the UTM zone
00107        * to each pole to give a zone number in [1, 60].  For example, use UTM
00108        * zone 38 for longitude in [42, 48).  The rules include the Norway and
00109        * Svalbard exceptions.
00110        **********************************************************************/
00111       UTM = -2,
00112       /**
00113        * Apply the standard rules for zone assignment to give a zone number in
00114        * [0, 60].  If the latitude is not in [-80, 84), then use UTMUPS::UPS =
00115        * 0, otherwise apply the rules for UTMUPS::UTM.  The tests on latitudes
00116        * and longitudes are all closed on the lower end open on the upper.
00117        * Thus for UTM zone 38, latitude is in [-80, 84) and longitude is in
00118        * [42, 48).
00119        **********************************************************************/
00120       STANDARD = -1,
00121       /**
00122        * The largest pseudo-zone number.
00123        **********************************************************************/
00124       MAXPSEUDOZONE = -1,
00125       /**
00126        * The smallest physical zone number.
00127        **********************************************************************/
00128       MINZONE = 0,
00129       /**
00130        * The zone number used for UPS
00131        **********************************************************************/
00132       UPS = 0,
00133       /**
00134        * The smallest UTM zone number.
00135        **********************************************************************/
00136       MINUTMZONE = 1,
00137       /**
00138        * The largest UTM zone number.
00139        **********************************************************************/
00140       MAXUTMZONE = 60,
00141       /**
00142        * The largest physical zone number.
00143        **********************************************************************/
00144       MAXZONE = 60,
00145     };
00146 
00147     /**
00148      * The standard zone.
00149      *
00150      * @param[in] lat latitude (degrees).
00151      * @param[in] lon longitude (degrees).
00152      * @param[in] setzone zone override (optional).
00153      *
00154      * This is exact.  If the optional argument \e setzone is given then use
00155      * that zone if it is non-negative, otherwise apply the rules given in
00156      * UTMUPS::zonespec.  Throws an error if \e setzone is outsize the range
00157      * [UTMUPS::MINPSEUDOZONE, UTMUPS::MAXZONE] = [-4, 60].
00158      **********************************************************************/
00159     static int StandardZone(real lat, real lon, int setzone = STANDARD);
00160 
00161     /**
00162      * Forward projection, from geographic to UTM/UPS.
00163      *
00164      * @param[in] lat latitude of point (degrees).
00165      * @param[in] lon longitude of point (degrees).
00166      * @param[out] zone the UTM zone (zero means UPS).
00167      * @param[out] northp hemisphere (true means north, false means south).
00168      * @param[out] x easting of point (meters).
00169      * @param[out] y northing of point (meters).
00170      * @param[out] gamma meridian convergence at point (degrees).
00171      * @param[out] k scale of projection at point.
00172      * @param[in] setzone zone override.
00173      * @param[in] mgrslimits if true enforce the stricter MGRS limits on the
00174      *   coordinates (default = false).
00175      *
00176      * The preferred zone for the result can be specified with \e setzone, see
00177      * UTMUPS::StandardZone.  Throw error if the resulting easting or northing
00178      * is outside the allowed range (see Reverse), in which case the arguments
00179      * are unchanged.  This also returns meridian convergence \e gamma
00180      * (degrees) and scale \e k.  The accuracy of the conversion is about 5nm.
00181      **********************************************************************/
00182     static void Forward(real lat, real lon,
00183                         int& zone, bool& northp, real& x, real& y,
00184                         real& gamma, real& k,
00185                         int setzone = STANDARD, bool mgrslimits = false);
00186 
00187     /**
00188      * Reverse projection, from  UTM/UPS to geographic.
00189      *
00190      * @param[in] zone the UTM zone (zero means UPS).
00191      * @param[in] northp hemisphere (true means north, false means south).
00192      * @param[in] x easting of point (meters).
00193      * @param[in] y northing of point (meters).
00194      * @param[out] lat latitude of point (degrees).
00195      * @param[out] lon longitude of point (degrees).
00196      * @param[out] gamma meridian convergence at point (degrees).
00197      * @param[out] k scale of projection at point.
00198      * @param[in] mgrslimits if true enforce the stricter MGRS limits on the
00199      *   coordinates (default = false).
00200      *
00201      * Throw error if easting or northing is outside the allowed range (see
00202      * below), in which case the arguments are unchanged.  The accuracy of the
00203      * conversion is about 5nm.
00204      *
00205      * UTM eastings are allowed to be in the range [0km, 1000km], northings are
00206      * allowed to be in in [0km, 9600km] for the northern hemisphere and in
00207      * [900km, 10000km] for the southern hemisphere.  (However UTM northings
00208      * can be continued across the equator.  So the actual limits on the
00209      * northings are [-9100km, 9600km] for the "northern" hemisphere and
00210      * [900km, 19600km] for the "southern" hemisphere.)
00211      *
00212      * UPS eastings and northings are allowed to be in the range [1200km,
00213      * 2800km] in the northern hemisphere and in [700km, 3100km] in the
00214      * southern hemisphere.
00215      *
00216      * These ranges are 100km larger than allowed for the conversions to MGRS.
00217      * (100km is the maximum extra padding consistent with eastings remaining
00218      * non-negative.)  This allows generous overlaps between zones and UTM and
00219      * UPS.  If \e mgrslimits = true, then all the ranges are shrunk by 100km
00220      * so that they agree with the stricter MGRS ranges.  No checks are
00221      * performed besides these (e.g., to limit the distance outside the
00222      * standard zone boundaries).
00223      **********************************************************************/
00224     static void Reverse(int zone, bool northp, real x, real y,
00225                         real& lat, real& lon, real& gamma, real& k,
00226                         bool mgrslimits = false);
00227 
00228     /**
00229      * UTMUPS::Forward without returning convergence and scale.
00230      **********************************************************************/
00231     static void Forward(real lat, real lon,
00232                         int& zone, bool& northp, real& x, real& y,
00233                         int setzone = STANDARD, bool mgrslimits = false) {
00234       real gamma, k;
00235       Forward(lat, lon, zone, northp, x, y, gamma, k, setzone, mgrslimits);
00236     }
00237 
00238     /**
00239      * UTMUPS::Reverse without returning convergence and scale.
00240      **********************************************************************/
00241     static void Reverse(int zone, bool northp, real x, real y,
00242                         real& lat, real& lon, bool mgrslimits = false) {
00243       real gamma, k;
00244       Reverse(zone, northp, x, y, lat, lon, gamma, k, mgrslimits);
00245     }
00246 
00247     /**
00248      * Decode a UTM/UPS zone string.
00249      *
00250      * @param[in] zonestr string representation of zone and hemisphere.
00251      * @param[out] zone the UTM zone (zero means UPS).
00252      * @param[out] northp hemisphere (true means north, false means south).
00253      *
00254      * For UTM, \e zonestr has the form of a zone number in the range
00255      * [UTMUPS::MINUTMZONE, UTMUPS::MAXUTMZONE] = [1, 60] followed by a
00256      * hemisphere letter, N or S.  For UPS, it consists just of the hemisphere
00257      * letter.  The returned value of \e zone is UTMUPS::UPS = 0 for UPS.  Note
00258      * well that "38S" indicates the southern hemisphere of zone 38 and not
00259      * latitude band S, [32, 40].  N, 01S, 2N, 38S are legal.  0N, 001S, 61N,
00260      * 38P are illegal.  INV is a special value for which the returned value of
00261      * \e is UTMUPS::INVALID.  Throws an error is the zone string is malformed.
00262      **********************************************************************/
00263     static void DecodeZone(const std::string& zonestr, int& zone, bool& northp);
00264 
00265     /**
00266      * Encode a UTM/UPS zone string.
00267      *
00268      * @param[out] zone the UTM zone (zero means UPS).
00269      * @param[out] northp hemisphere (true means north, false means south).
00270      * @return string representation of zone and hemisphere.
00271      *
00272      * \e zone must be in the range [UTMUPS::MINZONE, UTMUPS::MAXZONE] = [0,
00273      * 60] with \e zone = UTMUPS::UPS, 0, indicating UPS (but the resulting
00274      * string does not contain "0").  \e zone may also be UTMUPS::INVALID, in
00275      * which case the returned string is "INV".  This reverses
00276      * UTMUPS::DecodeZone.
00277      **********************************************************************/
00278     static std::string EncodeZone(int zone, bool northp);
00279 
00280     /**
00281      * @return shift (meters) necessary to align N and S halves of a UTM zone
00282      * (10<sup>7</sup>).
00283      **********************************************************************/
00284     static Math::real UTMShift() throw();
00285 
00286     /** \name Inspector functions
00287      **********************************************************************/
00288     ///@{
00289     /**
00290      * @return \e a the equatorial radius of the WGS84 ellipsoid (meters).
00291      *
00292      * (The WGS84 value is returned because the UTM and UPS projections are
00293      * based on this ellipsoid.)
00294      **********************************************************************/
00295     static Math::real MajorRadius() throw()
00296     { return Constants::WGS84_a<real>(); }
00297 
00298     /**
00299      * @return \e f the flattening of the WGS84 ellipsoid.
00300      *
00301      * (The WGS84 value is returned because the UTM and UPS projections are
00302      * based on this ellipsoid.)
00303      **********************************************************************/
00304     static Math::real Flattening() throw()
00305     { return Constants::WGS84_f<real>(); }
00306     ///@}
00307 
00308     /// \cond SKIP
00309     /**
00310      * <b>DEPRECATED</b>
00311      * @return \e r the inverse flattening of the WGS84 ellipsoid.
00312      **********************************************************************/
00313     static Math::real InverseFlattening() throw()
00314     { return 1/Constants::WGS84_f<real>(); }
00315     /// \endcond
00316   };
00317 
00318 } // namespace GeographicLib
00319 
00320 #endif  // GEOGRAPHICLIB_UTMUPS_HPP
geographiclib-1.21/doc/html/MGRS_8cpp.html0000644000175000017500000001127011745620414020162 0ustar frankiefrankie GeographicLib: MGRS.cpp File Reference
MGRS.cpp File Reference

Implementation for GeographicLib::MGRS class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_MGRS_CPP   "$Id: e4e6b419c8cd8544b3edab85b3352add0d1dd7cb $"

Detailed Description

Implementation for GeographicLib::MGRS class.

Copyright (c) Charles Karney (2008-2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file MGRS.cpp.


Define Documentation

#define GEOGRAPHICLIB_MGRS_CPP   "$Id: e4e6b419c8cd8544b3edab85b3352add0d1dd7cb $"

Definition at line 13 of file MGRS.cpp.

geographiclib-1.21/doc/html/functions_0x67.html0000644000175000017500000002504211745620414021256 0ustar frankiefrankie GeographicLib: Class Members
Here is a list of all class members with links to the classes they belong to:

- g -

geographiclib-1.21/doc/html/GeodesicProj_8cpp_source.html0000644000175000017500000006377411745620415023370 0ustar frankiefrankie GeographicLib: GeodesicProj.cpp Source File
GeodesicProj.cpp
Go to the documentation of this file.
00001 /**
00002  * \file GeodesicProj.cpp
00003  * \brief Command line utility for geodesic projections
00004  *
00005  * Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  *
00009  * Compile and link with
00010  *   g++ -g -O3 -I../include -I../man -o GeodesicProj \
00011  *       GeodesicProj.cpp \
00012  *       ../src/AzimuthalEquidistant.cpp \
00013  *       ../src/CassiniSoldner.cpp \
00014  *       ../src/DMS.cpp \
00015  *       ../src/Geodesic.cpp \
00016  *       ../src/GeodesicLine.cpp \
00017  *       ../src/Gnomonic.cpp
00018  *
00019  * See the <a href="GeodesicProj.1.html">man page</a> for usage
00020  * information.
00021  **********************************************************************/
00022 
00023 #include <iostream>
00024 #include <sstream>
00025 #include <string>
00026 #include <sstream>
00027 #include <fstream>
00028 #include <GeographicLib/Geodesic.hpp>
00029 #include <GeographicLib/AzimuthalEquidistant.hpp>
00030 #include <GeographicLib/CassiniSoldner.hpp>
00031 #include <GeographicLib/Gnomonic.hpp>
00032 #include <GeographicLib/DMS.hpp>
00033 #include <GeographicLib/Utility.hpp>
00034 
00035 #include "GeodesicProj.usage"
00036 
00037 int main(int argc, char* argv[]) {
00038   try {
00039     using namespace GeographicLib;
00040     typedef Math::real real;
00041     bool azimuthal = false, cassini = false, gnomonic = false, reverse = false;
00042     real lat0 = 0, lon0 = 0;
00043     real
00044       a = Constants::WGS84_a<real>(),
00045       f = Constants::WGS84_f<real>();
00046     std::string istring, ifile, ofile, cdelim;
00047     char lsep = ';';
00048 
00049     for (int m = 1; m < argc; ++m) {
00050       std::string arg(argv[m]);
00051       if (arg == "-r")
00052         reverse = true;
00053       else if (arg == "-c" || arg == "-z" || arg == "-g") {
00054         cassini = arg == "-c";
00055         azimuthal = arg == "-z";
00056         gnomonic = arg == "-g";
00057         if (m + 2 >= argc) return usage(1, true);
00058         try {
00059           DMS::DecodeLatLon(std::string(argv[m + 1]), std::string(argv[m + 2]),
00060                             lat0, lon0);
00061         }
00062         catch (const std::exception& e) {
00063           std::cerr << "Error decoding arguments of " << arg << ": "
00064                     << e.what() << "\n";
00065           return 1;
00066         }
00067         m += 2;
00068       } else if (arg == "-e") {
00069         if (m + 2 >= argc) return usage(1, true);
00070         try {
00071           a = Utility::num<real>(std::string(argv[m + 1]));
00072           f = Utility::fract<real>(std::string(argv[m + 2]));
00073         }
00074         catch (const std::exception& e) {
00075           std::cerr << "Error decoding arguments of -e: " << e.what() << "\n";
00076           return 1;
00077         }
00078         m += 2;
00079       } else if (arg == "--input-string") {
00080         if (++m == argc) return usage(1, true);
00081         istring = argv[m];
00082       } else if (arg == "--input-file") {
00083         if (++m == argc) return usage(1, true);
00084         ifile = argv[m];
00085       } else if (arg == "--output-file") {
00086         if (++m == argc) return usage(1, true);
00087         ofile = argv[m];
00088       } else if (arg == "--line-separator") {
00089         if (++m == argc) return usage(1, true);
00090         if (std::string(argv[m]).size() != 1) {
00091           std::cerr << "Line separator must be a single character\n";
00092           return 1;
00093         }
00094         lsep = argv[m][0];
00095       } else if (arg == "--comment-delimiter") {
00096         if (++m == argc) return usage(1, true);
00097         cdelim = argv[m];
00098       } else if (arg == "--version") {
00099         std::cout
00100           << argv[0]
00101           << ": $Id: d6745c19af3da288a8f95b4c6a9003906409800c $\n"
00102           << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n";
00103         return 0;
00104       } else
00105         return usage(!(arg == "-h" || arg == "--help"), arg != "--help");
00106     }
00107 
00108     if (!ifile.empty() && !istring.empty()) {
00109       std::cerr << "Cannot specify --input-string and --input-file together\n";
00110       return 1;
00111     }
00112     if (ifile == "-") ifile.clear();
00113     std::ifstream infile;
00114     std::istringstream instring;
00115     if (!ifile.empty()) {
00116       infile.open(ifile.c_str());
00117       if (!infile.is_open()) {
00118         std::cerr << "Cannot open " << ifile << " for reading\n";
00119         return 1;
00120       }
00121     } else if (!istring.empty()) {
00122       std::string::size_type m = 0;
00123       while (true) {
00124         m = istring.find(lsep, m);
00125         if (m == std::string::npos)
00126           break;
00127         istring[m] = '\n';
00128       }
00129       instring.str(istring);
00130     }
00131     std::istream* input = !ifile.empty() ? &infile :
00132       (!istring.empty() ? &instring : &std::cin);
00133 
00134     std::ofstream outfile;
00135     if (ofile == "-") ofile.clear();
00136     if (!ofile.empty()) {
00137       outfile.open(ofile.c_str());
00138       if (!outfile.is_open()) {
00139         std::cerr << "Cannot open " << ofile << " for writing\n";
00140         return 1;
00141       }
00142     }
00143     std::ostream* output = !ofile.empty() ? &outfile : &std::cout;
00144 
00145     if (!(azimuthal || cassini || gnomonic)) {
00146       std::cerr << "Must specify \"-z lat0 lon0\" or "
00147                 << "\"-c lat0 lon0\" or \"-g lat0 lon0\"\n";
00148       return 1;
00149     }
00150 
00151     const Geodesic geod(a, f);
00152     const CassiniSoldner cs = cassini ?
00153       CassiniSoldner(lat0, lon0, geod) : CassiniSoldner(geod);
00154     const AzimuthalEquidistant az(geod);
00155     const Gnomonic gn(geod);
00156 
00157     std::string s;
00158     int retval = 0;
00159     std::cout << std::fixed;
00160     while (std::getline(*input, s)) {
00161       try {
00162         std::string eol("\n");
00163         if (!cdelim.empty()) {
00164           std::string::size_type m = s.find(cdelim);
00165           if (m != std::string::npos) {
00166             eol = " " + s.substr(m) + "\n";
00167             s = s.substr(0, m);
00168           }
00169         }
00170         std::istringstream str(s);
00171         real lat, lon, x, y, azi, rk;
00172         std::string stra, strb;
00173         if (!(str >> stra >> strb))
00174           throw GeographicErr("Incomplete input: " + s);
00175         if (reverse) {
00176           x = Utility::num<real>(stra);
00177           y = Utility::num<real>(strb);
00178         } else
00179           DMS::DecodeLatLon(stra, strb, lat, lon);
00180         std::string strc;
00181         if (str >> strc)
00182           throw GeographicErr("Extraneous input: " + strc);
00183         if (reverse) {
00184           if (cassini)
00185             cs.Reverse(x, y, lat, lon, azi, rk);
00186           else if (azimuthal)
00187             az.Reverse(lat0, lon0, x, y, lat, lon, azi, rk);
00188           else
00189             gn.Reverse(lat0, lon0, x, y, lat, lon, azi, rk);
00190           *output << Utility::str<real>(lat, 15) << " "
00191                   << Utility::str<real>(lon, 15) << " "
00192                   << Utility::str<real>(azi, 15) << " "
00193                   << Utility::str<real>(rk, 16) << eol;
00194         } else {
00195           if (cassini)
00196             cs.Forward(lat, lon, x, y, azi, rk);
00197           else if (azimuthal)
00198             az.Forward(lat0, lon0, lat, lon, x, y, azi, rk);
00199           else
00200             gn.Forward(lat0, lon0, lat, lon, x, y, azi, rk);
00201           *output << Utility::str<real>(x, 10) << " "
00202                   << Utility::str<real>(y, 10) << " "
00203                   << Utility::str<real>(azi, 15) << " "
00204                   << Utility::str<real>(rk, 16) << eol;
00205         }
00206       }
00207       catch (const std::exception& e) {
00208         *output << "ERROR: " << e.what() << "\n";
00209         retval = 1;
00210       }
00211     }
00212     return retval;
00213   }
00214   catch (const std::exception& e) {
00215     std::cerr << "Caught exception: " << e.what() << "\n";
00216     return 1;
00217   }
00218   catch (...) {
00219     std::cerr << "Caught unknown exception\n";
00220     return 1;
00221   }
00222 }
geographiclib-1.21/doc/html/functions_0x68.html0000644000175000017500000001213611745620415021260 0ustar frankiefrankie GeographicLib: Class Members
Here is a list of all class members with links to the classes they belong to:

- h -

geographiclib-1.21/doc/html/classGeographicLib_1_1MagneticModel-members.html0000644000175000017500000002046311745620415026733 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::MagneticModel Member List
This is the complete list of members for GeographicLib::MagneticModel, including all inherited members.
Circle(real t, real lat, real h) const GeographicLib::MagneticModel
DateTime() const GeographicLib::MagneticModel [inline]
DefaultMagneticName()GeographicLib::MagneticModel [static]
DefaultMagneticPath()GeographicLib::MagneticModel [static]
Description() const GeographicLib::MagneticModel [inline]
FieldComponents(real Bx, real By, real Bz, real &H, real &F, real &D, real &I)GeographicLib::MagneticModel [inline, static]
FieldComponents(real Bx, real By, real Bz, real Bxt, real Byt, real Bzt, real &H, real &F, real &D, real &I, real &Ht, real &Ft, real &Dt, real &It)GeographicLib::MagneticModel [static]
Flattening() const GeographicLib::MagneticModel [inline]
MagneticFile() const GeographicLib::MagneticModel [inline]
MagneticModel(const std::string &name, const std::string &path="", const Geocentric &earth=Geocentric::WGS84)GeographicLib::MagneticModel [explicit]
MagneticModelDirectory() const GeographicLib::MagneticModel [inline]
MagneticModelName() const GeographicLib::MagneticModel [inline]
MajorRadius() const GeographicLib::MagneticModel [inline]
MaxHeight() const GeographicLib::MagneticModel [inline]
MaxTime() const GeographicLib::MagneticModel [inline]
MinHeight() const GeographicLib::MagneticModel [inline]
MinTime() const GeographicLib::MagneticModel [inline]
operator()(real t, real lat, real lon, real h, real &Bx, real &By, real &Bz) const GeographicLib::MagneticModel [inline]
operator()(real t, real lat, real lon, real h, real &Bx, real &By, real &Bz, real &Bxt, real &Byt, real &Bzt) const GeographicLib::MagneticModel [inline]
geographiclib-1.21/doc/html/classGeographicLib_1_1MGRS-members.html0000644000175000017500000001013411745620415024765 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::MGRS Member List
This is the complete list of members for GeographicLib::MGRS, including all inherited members.
Flattening()GeographicLib::MGRS [inline, static]
Forward(int zone, bool northp, real x, real y, int prec, std::string &mgrs)GeographicLib::MGRS [static]
Forward(int zone, bool northp, real x, real y, real lat, int prec, std::string &mgrs)GeographicLib::MGRS [static]
MajorRadius()GeographicLib::MGRS [inline, static]
Reverse(const std::string &mgrs, int &zone, bool &northp, real &x, real &y, int &prec, bool centerp=true)GeographicLib::MGRS [static]
UTMUPS classGeographicLib::MGRS [friend]
geographiclib-1.21/doc/html/MGRS_8hpp_source.html0000644000175000017500000010554411745620414021557 0ustar frankiefrankie GeographicLib: MGRS.hpp Source File
MGRS.hpp
Go to the documentation of this file.
00001 /**
00002  * \file MGRS.hpp
00003  * \brief Header for GeographicLib::MGRS class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_MGRS_HPP)
00011 #define GEOGRAPHICLIB_MGRS_HPP "$Id: 80e08da6eca9d9cf92c5adad148c64302df2573d $"
00012 
00013 #include <sstream>
00014 #include <GeographicLib/Constants.hpp>
00015 #include <GeographicLib/UTMUPS.hpp>
00016 
00017 #if defined(_MSC_VER)
00018 // Squelch warnings about dll vs string
00019 #pragma warning (push)
00020 #pragma warning (disable: 4251)
00021 #endif
00022 
00023 namespace GeographicLib {
00024 
00025   /**
00026    * \brief Convert between UTM/UPS and %MGRS
00027    *
00028    * MGRS is defined in Chapter 3 of
00029    * - J. W. Hager, L. L. Fry, S. S. Jacks, D. R. Hill,
00030    *   <a href="http://earth-info.nga.mil/GandG/publications/tm8358.1/pdf/TM8358_1.pdf">
00031 
00032    *   Datums, Ellipsoids, Grids, and Grid Reference Systems</a>,
00033    *   Defense Mapping Agency, Technical Manual TM8358.1 (1990).
00034    *
00035    * This implementation has the following properties:
00036    * - The conversions are closed, i.e., output from Forward is legal input for
00037    *   Reverse and vice versa.  Conversion in both directions preserve the
00038    *   UTM/UPS selection and the UTM zone.
00039    * - Forward followed by Reverse and vice versa is approximately the
00040    *   identity.  (This is affected in predictable ways by errors in
00041    *   determining the latitude band and by loss of precision in the MGRS
00042    *   coordinates.)
00043    * - All MGRS coordinates truncate to legal 100 km blocks.  All MGRS
00044    *   coordinates with a legal 100 km block prefix are legal (even though the
00045    *   latitude band letter may now belong to a neighboring band).
00046    * - The range of UTM/UPS coordinates allowed for conversion to MGRS
00047    *   coordinates is the maximum consistent with staying within the letter
00048    *   ranges of the MGRS scheme.
00049    * - All the transformations are implemented as static methods in the MGRS
00050    *   class.
00051    *
00052    * The <a href="http://www.nga.mil">NGA</a> software package
00053    * <a href="http://earth-info.nga.mil/GandG/geotrans/index.html">geotrans</a>
00054    * also provides conversions to and from MGRS.  Version 3.0 (and earlier)
00055    * suffers from some drawbacks:
00056    * - Inconsistent rules are used to determine the whether a particular MGRS
00057    *   coordinate is legal.  A more systematic approach is taken here.
00058    * - The underlying projections are not very accurately implemented.
00059    *
00060    * Example of use:
00061    * \include example-MGRS.cpp
00062    **********************************************************************/
00063   class GEOGRAPHIC_EXPORT MGRS {
00064   private:
00065     typedef Math::real real;
00066     // The smallest length s.t., 1.0e7 - eps_ < 1.0e7 (approx 1.9 nm)
00067     static const real eps_;
00068     // The smallest angle s.t., 90 - eps_ < 90 (approx 50e-12 arcsec)
00069     static const real angeps_;
00070     static const std::string hemispheres_;
00071     static const std::string utmcols_[3];
00072     static const std::string utmrow_;
00073     static const std::string upscols_[4];
00074     static const std::string upsrows_[2];
00075     static const std::string latband_;
00076     static const std::string upsband_;
00077     static const std::string digits_;
00078 
00079     static const int mineasting_[4];
00080     static const int maxeasting_[4];
00081     static const int minnorthing_[4];
00082     static const int maxnorthing_[4];
00083     enum {
00084       base_ = 10,
00085       // Top-level tiles are 10^5 m = 100 km on a side
00086       tilelevel_ = 5,
00087       // Period of UTM row letters
00088       utmrowperiod_ = 20,
00089       // Row letters are shifted by 5 for even zones
00090       utmevenrowshift_ = 5,
00091       // Maximum precision is um
00092       maxprec_ = 5 + 6,
00093     };
00094     static void CheckCoords(bool utmp, bool& northp, real& x, real& y);
00095     static int UTMRow(int iband, int icol, int irow) throw();
00096 
00097     friend class UTMUPS;        // UTMUPS::StandardZone calls LatitudeBand
00098     // Return latitude band number [-10, 10) for the give latitude (degrees).
00099     // The bands are reckoned in include their southern edges.
00100     static int LatitudeBand(real lat) throw() {
00101       int ilat = int(std::floor(lat));
00102       return (std::max)(-10, (std::min)(9, (ilat + 80)/8 - 10));
00103     }
00104     // UTMUPS access these enums
00105     enum {
00106       tile_ = 100000,            // Size MGRS blocks
00107       minutmcol_ = 1,
00108       maxutmcol_ = 9,
00109       minutmSrow_ = 10,
00110       maxutmSrow_ = 100,         // Also used for UTM S false northing
00111       minutmNrow_ = 0,           // Also used for UTM N false northing
00112       maxutmNrow_ = 95,
00113       minupsSind_ = 8,           // These 4 ind's apply to easting and northing
00114       maxupsSind_ = 32,
00115       minupsNind_ = 13,
00116       maxupsNind_ = 27,
00117       upseasting_ = 20,          // Also used for UPS false northing
00118       utmeasting_ = 5,           // UTM false easting
00119       // Difference between S hemisphere northing and N hemisphere northing
00120       utmNshift_ = (maxutmSrow_ - minutmNrow_) * tile_
00121     };
00122     MGRS();                     // Disable constructor
00123 
00124   public:
00125 
00126     /**
00127      * Convert UTM or UPS coordinate to an MGRS coordinate.
00128      *
00129      * @param[in] zone UTM zone (zero means UPS).
00130      * @param[in] northp hemisphere (true means north, false means south).
00131      * @param[in] x easting of point (meters).
00132      * @param[in] y northing of point (meters).
00133      * @param[in] prec precision relative to 100 km.
00134      * @param[out] mgrs MGRS string.
00135      *
00136      * \e prec specifies the precision of the MGRS string as follows:
00137      * - prec = 0 (min), 100 km
00138      * - prec = 1, 10 km
00139      * - prec = 2, 1 km
00140      * - prec = 3, 100 m
00141      * - prec = 4, 10 m
00142      * - prec = 5, 1 m
00143      * - prec = 6, 0.1 m
00144      * - prec = 11 (max), 1 um
00145      *
00146      * UTM eastings are allowed to be in the range [100 km, 900 km], northings
00147      * are allowed to be in in [0 km, 9500 km] for the northern hemisphere and
00148      * in [1000 km, 10000 km] for the southern hemisphere.  (However UTM
00149      * northings can be continued across the equator.  So the actual limits on
00150      * the northings are [-9000 km, 9500 km] for the "northern" hemisphere and
00151      * [1000 km, 19500 km] for the "southern" hemisphere.)
00152      *
00153      * UPS eastings/northings are allowed to be in the range [1300 km, 2700 km]
00154      * in the northern hemisphere and in [800 km, 3200 km] in the southern
00155      * hemisphere.
00156      *
00157      * The ranges are 100 km more restrictive that for the conversion between
00158      * geographic coordinates and UTM and UPS given by UTMUPS.  These
00159      * restrictions are dictated by the allowed letters in MGRS coordinates.
00160      * The choice of 9500 km for the maximum northing for northern hemisphere
00161      * and of 1000 km as the minimum northing for southern hemisphere provide
00162      * at least 0.5 degree extension into standard UPS zones.  The upper ends
00163      * of the ranges for the UPS coordinates is dictated by requiring symmetry
00164      * about the meridians 0E and 90E.
00165      *
00166      * All allowed UTM and UPS coordinates may now be converted to legal MGRS
00167      * coordinates with the proviso that eastings and northings on the upper
00168      * boundaries are silently reduced by about 4 nm (4 nanometers) to place
00169      * them \e within the allowed range.  (This includes reducing a southern
00170      * hemisphere northing of 10000 km by 4 nm so that it is placed in latitude
00171      * band M.)  The UTM or UPS coordinates are truncated to requested
00172      * precision to determine the MGRS coordinate.  Thus in UTM zone 38N, the
00173      * square area with easting in [444 km, 445 km) and northing in [3688 km,
00174      * 3689 km) maps to MGRS coordinate 38SMB4488 (at \e prec = 2, 1 km),
00175      * Khulani Sq., Baghdad.
00176      *
00177      * The UTM/UPS selection and the UTM zone is preserved in the conversion to
00178      * MGRS coordinate.  Thus for \e zone > 0, the MGRS coordinate begins with
00179      * the zone number followed by one of [C&ndash;M] for the southern
00180      * hemisphere and [N&ndash;X] for the northern hemisphere.  For \e zone =
00181      * 0, the MGRS coordinates begins with one of [AB] for the southern
00182      * hemisphere and [XY] for the northern hemisphere.
00183      *
00184      * The conversion to the MGRS is exact for prec in [0, 5] except that a
00185      * neighboring latitude band letter may be given if the point is within 5nm
00186      * of a band boundary.  For prec in [6, 11], the conversion is accurate to
00187      * roundoff.
00188      *
00189      * If \e x or \e y is NaN or if \e zone is UTMUPS::INVALID, the returned
00190      * MGRS string is "INVALID".
00191      *
00192      * Return the result via a reference argument to avoid the overhead of
00193      * allocating a potentially large number of small strings.  If an error is
00194      * thrown, then \e mgrs is unchanged.
00195      **********************************************************************/
00196     static void Forward(int zone, bool northp, real x, real y,
00197                         int prec, std::string& mgrs);
00198 
00199     /**
00200      * Convert UTM or UPS coordinate to an MGRS coordinate when the latitude is
00201      * known.
00202      *
00203      * @param[in] zone UTM zone (zero means UPS).
00204      * @param[in] northp hemisphere (true means north, false means south).
00205      * @param[in] x easting of point (meters).
00206      * @param[in] y northing of point (meters).
00207      * @param[in] lat latitude (degrees).
00208      * @param[in] prec precision relative to 100 km.
00209      * @param[out] mgrs MGRS string.
00210      *
00211      * The latitude is ignored for \e zone = 0 (UPS); otherwise the latitude is
00212      * used to determine the latitude band and this is checked for consistency
00213      * using the same tests as Reverse.
00214      **********************************************************************/
00215     static void Forward(int zone, bool northp, real x, real y, real lat,
00216                         int prec, std::string& mgrs);
00217 
00218     /**
00219      * Convert a MGRS coordinate to UTM or UPS coordinates.
00220      *
00221      * @param[in] mgrs MGRS string.
00222      * @param[out] zone UTM zone (zero means UPS).
00223      * @param[out] northp hemisphere (true means north, false means south).
00224      * @param[out] x easting of point (meters).
00225      * @param[out] y northing of point (meters).
00226      * @param[out] prec precision relative to 100 km.
00227      * @param[in] centerp if true (default), return center of the MGRS square,
00228      *   else return SW (lower left) corner.
00229      *
00230      * All conversions from MGRS to UTM/UPS are permitted provided the MGRS
00231      * coordinate is a possible result of a conversion in the other direction.
00232      * (The leading 0 may be dropped from an input MGRS coordinate for UTM
00233      * zones 1&ndash;9.)  In addition, MGRS coordinates with a neighboring
00234      * latitude band letter are permitted provided that some portion of the
00235      * 100 km block is within the given latitude band.  Thus
00236      *   - 38VLS and 38WLS are allowed (latitude 64N intersects the square
00237      *     38[VW]LS); but 38VMS is not permitted (all of 38VMS is north of 64N)
00238      *   - 38MPE and 38NPF are permitted (they straddle the equator); but 38NPE
00239      *     and 38MPF are not permitted (the equator does not intersect either
00240      *     block).
00241      *   - Similarly ZAB and YZB are permitted (they straddle the prime
00242      *     meridian); but YAB and ZZB are not (the prime meridian does not
00243      *     intersect either block).
00244      *
00245      * The UTM/UPS selection and the UTM zone is preserved in the conversion
00246      * from MGRS coordinate.  The conversion is exact for prec in [0, 5].  With
00247      * centerp = true the conversion from MGRS to geographic and back is
00248      * stable.  This is not assured if \e centerp = false.
00249      *
00250      * If an error is thrown, then the arguments are unchanged.
00251      **********************************************************************/
00252     static void Reverse(const std::string& mgrs,
00253                         int& zone, bool& northp, real& x, real& y,
00254                         int& prec, bool centerp = true);
00255 
00256     /** \name Inspector functions
00257      **********************************************************************/
00258     ///@{
00259     /**
00260      * @return \e a the equatorial radius of the WGS84 ellipsoid (meters).
00261      *
00262      * (The WGS84 value is returned because the UTM and UPS projections are
00263      * based on this ellipsoid.)
00264      **********************************************************************/
00265     static Math::real MajorRadius() throw() { return UTMUPS::MajorRadius(); }
00266 
00267     /**
00268      * @return \e f the flattening of the WGS84 ellipsoid.
00269      *
00270      * (The WGS84 value is returned because the UTM and UPS projections are
00271      * based on this ellipsoid.)
00272      **********************************************************************/
00273     static Math::real Flattening() throw() { return UTMUPS::Flattening(); }
00274     ///@}
00275 
00276     /// \cond SKIP
00277     /**
00278      * <b>DEPRECATED</b>
00279      * @return \e r the inverse flattening of the WGS84 ellipsoid.
00280      **********************************************************************/
00281     static Math::real InverseFlattening() throw()
00282     { return UTMUPS::InverseFlattening(); }
00283     /// \endcond
00284   };
00285 
00286 } // namespace GeographicLib
00287 
00288 #if defined(_MSC_VER)
00289 #pragma warning (pop)
00290 #endif
00291 
00292 #endif  // GEOGRAPHICLIB_MGRS_HPP
geographiclib-1.21/doc/html/Planimeter_8cpp.html0000644000175000017500000001340111745620414021510 0ustar frankiefrankie GeographicLib: Planimeter.cpp File Reference
Planimeter.cpp File Reference

Command line utility for measuring the area of geodesic polygons. More...

#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
#include <GeographicLib/PolygonArea.hpp>
#include <GeographicLib/DMS.hpp>
#include <GeographicLib/Utility.hpp>
#include <GeographicLib/GeoCoords.hpp>
#include "Planimeter.usage"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Detailed Description

Command line utility for measuring the area of geodesic polygons.

Copyright (c) Charles Karney (2010-2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Compile and link with g++ -g -O3 -I../include -I../man -o Planimeter \ Planimeter.cpp \ ../src/DMS.cpp \ ../src/GeoCoords.cpp \ ../src/Geodesic.cpp \ ../src/GeodesicLine.cpp \ ../src/MGRS.cpp \ ../src/PolarStereographic.cpp \ ../src/PolygonArea.cpp \ ../src/TransverseMercator.cpp \ ../src/UTMUPS.cpp

See the man page for usage information.

Definition in file Planimeter.cpp.


Function Documentation

geographiclib-1.21/doc/html/index.html0000644000175000017500000001371311745620415017574 0ustar frankiefrankie GeographicLib: Geographic library
Geographic library
Author:
Charles Karney <charles@karney.com>
Version:
1.21
Date:
2012-04-25

Abstract

GeographicLib is a small set of C++ classes for performing conversions between geographic, UTM, UPS, MGRS, geocentric, and local cartesian coordinates, for gravity (e.g., EGM2008), geoid height and geomagnetic field (e.g., WMM2010) calculations, and for solving geodesic problems. The emphasis is on returning accurate results with errors close to round-off (about 5–15 nanometers). New accurate algorithms for Geodesics on the ellipsoid and Transverse Mercator projection have been developed for this library. The functionality of the library can be accessed from user code, from the Utility programs provided, or via the Other interfaces (Javascript, Python, Matlab, Octave). For a sample of the geodesic capabilities in Javascript, check out the online geodesic calculator and the script for displaying geodesics in Google Maps

This library is not a general purpose projection library; use proj.4 for that. On the other hand, it does provide the core functionality offered by geotrans and it cures several of the defects of that package.

Download

The main project page is at

The code is available for download at

as either a compressed tar file (tar.gz) or a zip file. (The two archives have identical contents.) Alternatively you can get the latest stable release using git

  git clone git://geographiclib.git.sf.net/gitroot/geographiclib/geographiclib-release geographiclib
  cd geographiclib; git checkout stable

There are also a binary installers for Windows available at

It is licensed under the MIT/X11 License; see LICENSE.txt for the terms. For more information, see http://geographiclib.sourceforge.net/.

Contents

Forward to Introduction.
geographiclib-1.21/doc/html/functions_0x69.html0000644000175000017500000001403211745620414021255 0ustar frankiefrankie GeographicLib: Class Members geographiclib-1.21/doc/html/GravityModel_8cpp_source.html0000644000175000017500000013637011745620414023411 0ustar frankiefrankie GeographicLib: GravityModel.cpp Source File
GravityModel.cpp
Go to the documentation of this file.
00001 /**
00002  * \file GravityModel.cpp
00003  * \brief Implementation for GeographicLib::GravityModel class
00004  *
00005  * Copyright (c) Charles Karney (2011, 2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/GravityModel.hpp>
00011 #include <fstream>
00012 #include <GeographicLib/SphericalEngine.hpp>
00013 #include <GeographicLib/GravityCircle.hpp>
00014 #include <GeographicLib/Utility.hpp>
00015 #define GEOGRAPHICLIB_GRAVITYMODEL_CPP \
00016   "$Id: 1897d0d53c7339ecdf20b1348637340e9f687f30 $"
00017 
00018 RCSID_DECL(GEOGRAPHICLIB_GRAVITYMODEL_CPP)
00019 RCSID_DECL(GEOGRAPHICLIB_GRAVITYMODEL_HPP)
00020 
00021 #if !defined(GEOGRAPHICLIB_DATA)
00022 #  if defined(_MSC_VER)
00023 #    define GEOGRAPHICLIB_DATA \
00024   "C:/Documents and Settings/All Users/Application Data/GeographicLib"
00025 #  else
00026 #    define GEOGRAPHICLIB_DATA "/usr/local/share/GeographicLib"
00027 #  endif
00028 #endif
00029 
00030 #if !defined(GRAVITY_DEFAULT_NAME)
00031 #  define GRAVITY_DEFAULT_NAME "egm96"
00032 #endif
00033 
00034 #if defined(_MSC_VER)
00035 // Squelch warnings about unsafe use of getenv
00036 #pragma warning (disable: 4996)
00037 #endif
00038 
00039 namespace GeographicLib {
00040 
00041   using namespace std;
00042 
00043   GravityModel::GravityModel(const std::string& name,const std::string& path)
00044     : _name(name)
00045     , _dir(path)
00046     , _description("NONE")
00047     , _date("UNKNOWN")
00048     , _amodel(Math::NaN<real>())
00049     , _GMmodel(Math::NaN<real>())
00050     , _zeta0(0)
00051     , _corrmult(1)
00052     , _norm(SphericalHarmonic::FULL)
00053   {
00054     if (_dir.empty())
00055       _dir = DefaultGravityPath();
00056     ReadMetadata(_name);
00057     {
00058       string coeff = _filename + ".cof";
00059       ifstream coeffstr(coeff.c_str(), ios::binary);
00060       if (!coeffstr.good())
00061         throw GeographicErr("Error opening " + coeff);
00062       char id[idlength_ + 1];
00063       coeffstr.read(id, idlength_);
00064       if (!coeffstr.good())
00065         throw GeographicErr("No header in " + coeff);
00066       id[idlength_] = '\0';
00067       if (_id != string(id))
00068         throw GeographicErr("ID mismatch: " + _id + " vs " + id);
00069       int N, M;
00070       SphericalEngine::coeff::readcoeffs(coeffstr, N, M, _C, _S);
00071       if (!(M < 0 || _C[0] == 0))
00072         throw GeographicErr("A degree 0 term should be zero");
00073       _C[0] = 1;                // Include the 1/r term in the sum
00074       _gravitational = SphericalHarmonic(_C, _S, N, N, M, _amodel, _norm);
00075       SphericalEngine::coeff::readcoeffs(coeffstr, N, M, _CC, _CS);
00076       if (N < 0) {
00077         N = M = 0;
00078         _CC.resize(1, real(0));
00079       }
00080       _CC[0] += _zeta0 / _corrmult;
00081       _correction = SphericalHarmonic(_CC, _CS, N, N, M, real(1), _norm);
00082       int pos = int(coeffstr.tellg());
00083       coeffstr.seekg(0, ios::end);
00084       if (pos != coeffstr.tellg())
00085         throw GeographicErr("Extra data in " + coeff);
00086     }
00087     int nmx = _gravitational.Coefficients().nmx();
00088     // Adjust the normalization of the normal potential to match the model.
00089     real mult = _earth._GM / _GMmodel;
00090     real amult = Math::sq(_earth._a / _amodel);
00091     // The 0th term in _zonal should be is 1 + _dzonal0.  Instead set it to 1
00092     // to give exact cancellation with the (0,0) term in the model and account
00093     // for _dzonal0 separately.
00094     _zonal.clear(); _zonal.push_back(1);
00095     _dzonal0 = (_earth.MassConstant() - _GMmodel) / _GMmodel;
00096     for (int n = 2; n <= nmx; n += 2) {
00097       // Only include as many normal zonal terms as matter.  Figuring the limit
00098       // in this way works because the coefficients of the normal potential
00099       // (which is smooth) decay much more rapidly that the corresponding
00100       // coefficient of the model potential (which is bumpy).  Typically this
00101       // goes out to n = 18.
00102       mult *= amult;
00103       real
00104         r = _C[n],                                         // the model term
00105         s = - mult * _earth.Jn(n) / sqrt(real(2 * n + 1)), // the normal term
00106         t = r - s;                                         // the difference
00107       if (t == r)               // the normal term is negligible
00108         break;
00109       _zonal.push_back(0);      // index = n - 1; the odd terms are 0
00110       _zonal.push_back(s);
00111     }
00112     int nmx1 = int(_zonal.size()) - 1;
00113     _disturbing = SphericalHarmonic1(_C, _S,
00114                                      _gravitational.Coefficients().N(),
00115                                      nmx, _gravitational.Coefficients().mmx(),
00116                                      _zonal,
00117                                      _zonal, // This is not accessed!
00118                                      nmx1, nmx1, 0,
00119                                      _amodel,
00120                                      SphericalHarmonic1::normalization(_norm));
00121   }
00122 
00123   void GravityModel::ReadMetadata(const std::string& name) {
00124     const char* spaces = " \t\n\v\f\r";
00125     _filename = _dir + "/" + name + ".egm";
00126     ifstream metastr(_filename.c_str());
00127     if (!metastr.good())
00128       throw GeographicErr("Cannot open " + _filename);
00129     string line;
00130     getline(metastr, line);
00131     if (!(line.size() >= 6 && line.substr(0,5) == "EGMF-"))
00132       throw GeographicErr(_filename + " does not contain EGMF-n signature");
00133     string::size_type n = line.find_first_of(spaces, 5);
00134     if (n != string::npos)
00135       n -= 5;
00136     string version = line.substr(5, n);
00137     if (version != "1")
00138       throw GeographicErr("Unknown version in " + _filename + ": " + version);
00139     string key, val;
00140     real a = Math::NaN<real>(), GM = a, omega = a, f = a, J2 = a;
00141     while (getline(metastr, line)) {
00142       if (!Utility::ParseLine(line, key, val))
00143         continue;
00144       // Process key words
00145       if (key == "Name")
00146         _name = val;
00147       else if (key == "Description")
00148         _description = val;
00149       else if (key == "ReleaseDate")
00150         _date = val;
00151       else if (key == "ModelRadius")
00152         _amodel = Utility::num<real>(val);
00153       else if (key == "ModelMass")
00154         _GMmodel = Utility::num<real>(val);
00155       else if (key == "AngularVelocity")
00156         omega = Utility::num<real>(val);
00157       else if (key == "ReferenceRadius")
00158         a = Utility::num<real>(val);
00159       else if (key == "ReferenceMass")
00160         GM = Utility::num<real>(val);
00161       else if (key == "Flattening")
00162         f = Utility::fract<real>(val);
00163       else if (key == "DynamicalFormFactor")
00164         J2 = Utility::fract<real>(val);
00165       else if (key == "HeightOffset")
00166         _zeta0 = Utility::fract<real>(val);
00167       else if (key == "CorrectionMultiplier")
00168         _corrmult = Utility::fract<real>(val);
00169       else if (key == "Normalization") {
00170         if (val == "FULL" || val == "Full" || val == "full")
00171           _norm = SphericalHarmonic::FULL;
00172         else if (val == "SCHMIDT" || val == "Schmidt" || val == "schmidt")
00173           _norm = SphericalHarmonic::SCHMIDT;
00174         else
00175           throw GeographicErr("Unknown normalization " + val);
00176       } else if (key == "ByteOrder") {
00177         if (val == "Big" || val == "big")
00178           throw GeographicErr("Only little-endian ordering is supported");
00179         else if (!(val == "Little" || val == "little"))
00180           throw GeographicErr("Unknown byte ordering " + val);
00181       } else if (key == "ID")
00182         _id = val;
00183       // else unrecognized keywords are skipped
00184     }
00185     // Check values
00186     if (!(Math::isfinite(_amodel) && _amodel > 0))
00187       throw GeographicErr("Model radius must be positive");
00188     if (!(Math::isfinite(_GMmodel) && _GMmodel > 0))
00189       throw GeographicErr("Model mass constant must be positive");
00190     if (!(Math::isfinite(_corrmult) && _corrmult > 0))
00191       throw GeographicErr("Correction multiplier must be positive");
00192     if (!(Math::isfinite(_zeta0)))
00193       throw GeographicErr("Height offset must be finite");
00194     if (int(_id.size()) != idlength_)
00195       throw GeographicErr("Invalid ID");
00196     _earth = NormalGravity(a, GM, omega, f, J2);
00197   }
00198 
00199   Math::real GravityModel::InternalT(real X, real Y, real Z,
00200                                      real& deltaX, real& deltaY, real& deltaZ,
00201                                      bool gradp, bool correct) const throw() {
00202     // If correct, then produce the correct T = W - U.  Otherwise, neglect the
00203     // n = 0 term (which is proportial to the difference in the model and
00204     // reference values of GM).
00205     if (_dzonal0 == 0)
00206       // No need to do the correction
00207       correct = false;
00208     real
00209       invR = correct ? 1 / Math::hypot(Math::hypot(X, Y), Z) : 1,
00210       T = (gradp
00211            ? _disturbing(-1, X, Y, Z, deltaX, deltaY, deltaZ)
00212            : _disturbing(-1, X, Y, Z));
00213     T = (T / _amodel - (correct ? _dzonal0 : 0) * invR) * _GMmodel;
00214     if (gradp) {
00215       real f = _GMmodel / _amodel;
00216       deltaX *= f;
00217       deltaY *= f;
00218       deltaZ *= f;
00219       if (correct) {
00220         invR = _GMmodel * _dzonal0 * invR * invR * invR;
00221         deltaX += X * invR;
00222         deltaY += Y * invR;
00223         deltaZ += Z * invR;
00224       }
00225     }
00226     return T;
00227   }
00228 
00229   Math::real GravityModel::V(real X, real Y, real Z,
00230                              real& GX, real& GY, real& GZ) const throw() {
00231     real
00232       Vres = _gravitational(X, Y, Z, GX, GY, GZ),
00233       f = _GMmodel / _amodel;
00234     Vres *= f;
00235     GX *= f;
00236     GY *= f;
00237     GZ *= f;
00238     return Vres;
00239   }
00240 
00241   Math::real GravityModel::W(real X, real Y, real Z,
00242                              real& gX, real& gY, real& gZ) const throw() {
00243     real fX, fY,
00244       Wres = V(X, Y, Z, gX, gY, gZ) + _earth.Phi(X, Y, fX, fY);
00245     gX += fX;
00246     gY += fY;
00247     return Wres;
00248   }
00249 
00250   void GravityModel::SphericalAnomaly(real lat, real lon, real h,
00251                                       real& Dg01, real& xi, real& eta)
00252     const throw() {
00253     real X, Y, Z, M[Geocentric::dim2_];
00254     _earth.Earth().IntForward(lat, lon, h, X, Y, Z, M);
00255     real
00256       deltax, deltay, deltaz,
00257       T = InternalT(X, Y, Z, deltax, deltay, deltaz, true, false),
00258       clam = M[3], slam = -M[0],
00259       P = Math::hypot(X, Y),
00260       R = Math::hypot(P, Z),
00261       // psi is geocentric latitude
00262       cpsi = R ? P / R : M[7],
00263       spsi = R ? Z / R : M[8];
00264     // Rotate cartesian into spherical coordinates
00265     real MC[Geocentric::dim2_];
00266     Geocentric::Rotation(spsi, cpsi, slam, clam, MC);
00267     Geocentric::Unrotate(MC, deltax, deltay, deltaz, deltax, deltay, deltaz);
00268     // H+M, Eq 2-151c
00269     Dg01 = - deltaz - 2 * T / R;
00270     real gammaX, gammaY, gammaZ;
00271     _earth.U(X, Y, Z, gammaX, gammaY, gammaZ);
00272     real gamma = Math::hypot( Math::hypot(gammaX, gammaY), gammaZ);
00273     xi  = -(deltay/gamma) / Math::degree<real>();
00274     eta = -(deltax/gamma) / Math::degree<real>();
00275   }
00276 
00277   Math::real GravityModel::GeoidHeight(real lat, real lon) const throw()
00278   {
00279     real X, Y, Z;
00280     _earth.Earth().IntForward(lat, lon, 0, X, Y, Z, NULL);
00281     real
00282       gamma0 = _earth.SurfaceGravity(lat),
00283       dummy,
00284       T = InternalT(X, Y, Z, dummy, dummy, dummy, false, false),
00285       invR = 1 / Math::hypot(Math::hypot(X, Y), Z),
00286       correction = _corrmult * _correction(invR * X, invR * Y, invR * Z);
00287     // _zeta0 has been included in _correction
00288     return T/gamma0 + correction;
00289   }
00290 
00291   Math::real GravityModel::Gravity(real lat, real lon, real h,
00292                                    real& gx, real& gy, real& gz) const throw() {
00293     real X, Y, Z, M[Geocentric::dim2_];
00294     _earth.Earth().IntForward(lat, lon, h, X, Y, Z, M);
00295     real Wres = W(X, Y, Z, gx, gy, gz);
00296     Geocentric::Unrotate(M, gx, gy, gz, gx, gy, gz);
00297     return Wres;
00298   }
00299   Math::real GravityModel::Disturbance(real lat, real lon, real h,
00300                                        real& deltax, real& deltay, real& deltaz)
00301     const throw() {
00302     real X, Y, Z, M[Geocentric::dim2_];
00303     _earth.Earth().IntForward(lat, lon, h, X, Y, Z, M);
00304     real Tres = InternalT(X, Y, Z, deltax, deltay, deltaz, true, true);
00305     Geocentric::Unrotate(M, deltax, deltay, deltaz, deltax, deltay, deltaz);
00306     return Tres;
00307   }
00308 
00309   GravityCircle GravityModel::Circle(real lat, real h, unsigned caps) const {
00310     if (h != 0)
00311       // Disallow invoking GeoidHeight unless h is zero.
00312       caps &= ~(CAP_GAMMA0 | CAP_C);
00313     real X, Y, Z, M[Geocentric::dim2_];
00314     _earth.Earth().IntForward(lat, 0, h, X, Y, Z, M);
00315     // Y = 0, cphi = M[7], sphi = M[8];
00316     real
00317       invR = 1 / Math::hypot(X, Z),
00318       gamma0 = (caps & CAP_GAMMA0 ?_earth.SurfaceGravity(lat)
00319                 : Math::NaN<real>()),
00320       fx, fy, fz, gamma;
00321     if (caps & CAP_GAMMA) {
00322       _earth.U(X, Y, Z, fx, fy, fz); // fy = 0
00323       gamma = Math::hypot(fx, fz);
00324     } else
00325       gamma = Math::NaN<real>();
00326     _earth.Phi(X, Y, fx, fy);
00327     return GravityCircle(GravityCircle::mask(caps),
00328                          _earth._a, _earth._f, lat, h, Z, X, M[7], M[8],
00329                          _amodel, _GMmodel, _dzonal0, _corrmult,
00330                          gamma0, gamma, fx,
00331                          caps & CAP_G ?
00332                          _gravitational.Circle(X, Z, true) :
00333                          CircularEngine(),
00334                          // N.B. If CAP_DELTA is set then CAP_T should be too.
00335                          caps & CAP_T ?
00336                          _disturbing.Circle(-1, X, Z, (caps & CAP_DELTA) != 0) :
00337                          CircularEngine(),
00338                          caps & CAP_C ?
00339                          _correction.Circle(invR * X, invR * Z, false) :
00340                          CircularEngine());
00341   }
00342 
00343   std::string GravityModel::DefaultGravityPath() {
00344     string path;
00345     char* gravitypath = getenv("GRAVITY_PATH");
00346     if (gravitypath)
00347       path = string(gravitypath);
00348     if (path.length())
00349       return path;
00350     char* datapath = getenv("GEOGRAPHICLIB_DATA");
00351     if (datapath)
00352       path = string(datapath);
00353     return (path.length() ? path : string(GEOGRAPHICLIB_DATA)) + "/gravity";
00354   }
00355 
00356   std::string GravityModel::DefaultGravityName() {
00357     string name;
00358     char* gravityname = getenv("GRAVITY_NAME");
00359     if (gravityname)
00360       name = string(gravityname);
00361     return name.length() ? name : string(GRAVITY_DEFAULT_NAME);
00362   }
00363 
00364 } // namespace GeographicLib
geographiclib-1.21/doc/html/globals.html0000644000175000017500000003711711745620414020113 0ustar frankiefrankie GeographicLib: File Members
Here is a list of all file members with links to the files they belong to:

- a -

- d -

- g -

- l -

- m -

- p -

- r -

- s -

- t -

- w -

geographiclib-1.21/doc/html/install.html0000644000175000017500000005610111745620414020130 0ustar frankiefrankie GeographicLib: Installing %GeographicLib
Installing GeographicLib
Back to Introduction. Forward to Getting started. Up to Contents.

GeographicLib has been developed under Linux with the g++ compiler (versions 4.0 and later) and under Windows with Visual Studio 2005, 2008, and 2010. Earlier versions were tested also under Darwin and Solaris. It should compile on a wide range of other systems. First download either GeographicLib-1.21.tar.gz or GeographicLib-1.21.zip (or GeographicLib-1.21-win32.exe or GeographicLib-1.21-win64.exe for binary installation under Windows). Then pick one of the first five options below:

This section documents only how to install the software. If you wish to use GeographicLib to evaluate geoid heights or the earth's gravitational or magnetic fields, then you must also install the relevant data files. See Installing the geoid datasets, Installing the gravity models, and Installing the magnetic field models for instructions.

The first two installation methods use two important techniques which make software maintanence simpler

  • Out-of-source builds: This means that you create a separate directory for compiling the code. In the description here the directories are called BUILD and are located in the top-level of the source tree. You might want to use a suffix to denote the type of build, e.g., BUILD-vc9 for Visual Studio 9, or BUILD-shared for a build which creates a shared library. The advantages of out-of-source builds are:
    • You don't mess up the source tree, so it's easy to "clean up". Indeed the source tree might be on a read-only file system.
    • Builds for multiple platforms or compilers don't interfere with each other.
  • The library is installed: After compilation, there is a separate install step which copies the headers, libraries, tools, and documentation to a "central" location. You may at this point delete the source and build directories. If you have administrative privileges, you can install GeographicLib for the use of all users (e.g., in /usr/local). Otherwise, you can install it for your personal use (e.g., in $HOME/packages).

Installation with cmake

This is the recommended method of installation; however it requires that cmake be installed on your system. This permits GeographicLib to be built either as a shared or a static library on a wide variety of systems. cmake can also determine the capabilities of your system and adjust the compilation of the libraries and examples appropriately.

cmake is available for most computer platforms. On Linux systems cmake will typically one of the standard packages and can be installed by a command like

  yum install cmake 

(executed as root). On other systems, download a binary installer from http://www.cmake.org click on download, and save and run the appropriate installer. Run the cmake command with no arguments to get help. Other useful tools are ccmake and cmake-gui which offer curses and graphical interfaces to cmake. Building under cmake depends on whether it is targeting an IDE (interactive development environment) or generating Unix-style makefiles. The instructions below have been tested with makefiles and g++ on Linux and with the Visual Studio IDE on Windows.

Here are the steps to compile and install GeographicLib:

  • Unpack the source, running one of
      tar xfpz GeographicLib-1.21.tar.gz
      unzip -q GeographicLib-1.21.zip 
    then enter the directory created with one of
      cd GeographicLib-1.21 
  • Create a separate build directory and enter it, for example,
      mkdir BUILD
      cd BUILD
  • Run cmake, pointing it to the source directory (..). On Linux, Unix, and MacOSX systems, the command is
      cmake .. 
    For Windows, the command is typically one of
      cmake -G "Visual Studio 10" -D CMAKE_INSTALL_PREFIX=C:/pkg-vc10/GeographicLib ..
      cmake -G "Visual Studio 9 2008" -D CMAKE_INSTALL_PREFIX=C:/pkg-vc9/GeographicLib ..
      cmake -G "Visual Studio 8 2005" -D CMAKE_INSTALL_PREFIX=C:/pkg-vc8/GeographicLib ..
    
    Instead of setting CMAKE_INSTALL_PREFIX, you can (on Windows) set CMAKE_PREFIX_PATH to point to its parent directory, e.g.,
      cmake -G "Visual Studio 10" -D CMAKE_PREFIX_PATH=C:/pkg-vc10 ..
    
    The definitions of CMAKE_INSTALL_PREFIX are optional (see below). The settings given above are recommended to ensure that packages that use GeographicLib use the version compiled with the right compiler. If you need to rerun cmake, use
      cmake . 
    possibly including some options via -D (see the next step).
  • cmake allows you to configure how GeographicLib is built and installed by supplying options, for example
      cmake -D CMAKE_INSTALL_PREFIX=/tmp/geographic . 
    The options you might need to change are
    • CMAKE_INSTALL_PREFIX (default: /usr/local on non-Windows systems, C:/Program Files/GeographicLib on Windows systems) specifies where the library will be installed. For windows systems, it is recommended to use a prefix which includes the compiler version, as shown above (and also, possibly, whether this is a 64-bit build, e.g., cmake -G "Visual Studio 10 Win64" -D CMAKE_INSTALL_PREFIX=C:/pkg-vc10-x64/GeographicLib ..) If you just want to try the library to see if it suits your needs, pick CMAKE_INSTALL_PREFIX=/tmp/geographic, for example, and set GEOGRAPHIC_SHARED_LIB=OFF.
    • GEOGRAPHICLIB_DATA (default: /usr/local/share/GeographicLib for non-Windows systems, C:/Documents and Settings/All Users/Application Data/GeographicLib for Windows systems) specifies the default location for the various datasets for use by GeographicLib::Geoid, GeographicLib::GravityModel, and GeographicLib::MagneticModel. See Installing the geoid datasets, Installing the gravity models, and Installing the magnetic field models for more information.
    • GEOGRAPHIC_SHARED_LIB (default: ON for non-Windows systems, OFF for Windows systems) determines whether a shared or static library is built. The default is OFF for Windows because there's no standard place to install the dlls.
    • CMAKE_BUILD_TYPE (default: Release). This flags only affects non-IDE compile environments (like make + g++). The default is actually blank, but this is treated as Release. Choose one of
        Debug
        Release
        RelWithDebInfo
        MinSizeRel
      
      (With IDE compile environments, you get to select the build type in the IDE.)
    • MATLAB_COMPILER (default: OFF). Set this to either "mex" (for Matlab) or "mkoctfile" (for Octave) to specify the compiler to use for the Matlab/Octave interface. See Matlab and Octave interfaces for more information.
    • MAINTAINER (default: ON for non-Windows environments provided doxygen, pod2man, and pod2html are found). This affects whether the targets for creating source packages are activated. See Maintainer tasks for details.
    • GEOGRAPHICLIB_EXAMPLES (default: ON for the maintainer and OFF otherwise). If set to ON, then the short example programs in the examples directory are built.
  • Build and install the software. In non-IDE environments, run
      make         # compile the library and the examples
      make test    # run some tests
      make install # as root, if CMAKE_INSTALL_PREFIX is a system directory
    
    On IDE environments, run your IDE (e.g., Visual Studio), load GeographicLib.sln, pick the build type (e.g., Release), and select "Build Solution". If this succeeds, select "RUN_TESTS" to build. Finally, select "INSTALL" to build.
  • The headers, library, and utilities are installed in the include/GeographicLib, lib, and bin directories under CMAKE_INSTALL_PREFIX. (dll dynamic libraries are installed in bin.) The Matlab/Octave interface is installed in libexec/GeographicLib/matlab. For documentation, open share/doc/GeographicLib/html/index.html in a web browser.

Installation using the autoconfigure tools

The method works on most Unix-like systems including Linux and Mac OS X. Here are the steps to compile and install GeographicLib:

  • Unpack the source, running
      tar xfpz GeographicLib-1.21.tar.gz 
    then enter the directory created
      cd GeographicLib-1.21 
  • Create a separate build directory and enter it, for example,
      mkdir BUILD
      cd BUILD
  • Configure the software, specifing the path of the source directory, with
      ../configure 
  • By default GeographicLib will be installed under /usr/local. You can change this with, for example
      ../configure --prefix=/tmp/geographic 
  • Compile and install the software with
      make
      make install 
  • The headers, library, and utilities are installed in the include/GeographicLib, lib, and bin directories under prefix. This installation method does not compile the Matlab/Octave interface; however the source for the interface is installed in libexec/GeographicLib/matlab, see Matlab and Octave interfaces of instructions on compiling the interface. For documentation, open share/doc/GeographicLib/html/index.html in a web browser.

Installation with GNU compiler and Make

This method requires the standard GNU suite of tools, in particular make and g++. This builds a static library and the examples.

Here are the steps to compile and install GeographicLib:

  • Unpack the source, running
      tar xfpz GeographicLib-1.21.tar.gz 
    then enter the directory created
      cd GeographicLib-1.21 
  • Edit
      include/GeographicLib/Config.h 
    If your C++ compiler does not recognize the long double type (unlikely), insert
      #undef HAVE_LONG_DOUBLE 
    
    If you machine using big endian ordering, then insert
      #define WORDS_BIGENDIAN 1 
    
  • Build and install the software:
      make             # compile the library and the examples
      make install     # as root 
    The installation is in directories under /usr/local. You can specify a different installation directory with, for example,
      make PREFIX=/tmp/geographic install 
  • The headers, library, and utilities are installed in the include/GeographicLib, lib, and bin directories under PREFIX. This installation method does not compile the Matlab/Octave interface; however the source for the interface is installed in libexec/GeographicLib/matlab, see Matlab and Octave interfaces of instructions on compiling the interface. For documentation, open share/doc/GeographicLib/html/index.html in a web browser.

Installation on Windows

This method requires Visual Studio 2005, 2008, or 2010. This builds a static library and the utilities. If you only have Visual Studio 2003, use cmake to create the necessary solution file, see Installation with cmake. (cmake is needed to build the Matlab interface and to run the tests.)

  • Unpack the source, running
      unzip -q GeographicLib-1.21.zip 
  • Open GeographicLib-1.21/windows/GeographicLib-vc10.sln in Visual Studio 2010 (for Visual Studio 2005 and 2008, replace -vc10 by -vc8 or -vc9).
  • Pick the build type (e.g., Release), and select "Build Solution".
  • The library and the compiled examples are in the windows/Release.
  • Copy the library windows/Release/Geographic.lib and the headers in include/GeographicLib somewhere convenient. The headers should remain in a directory named GeographicLib. If you expect to use the Matlab/Octave interface, copy matlab/*.m and matlab/*.cpp to a directory in your matlab/octave path, see Matlab and Octave interfaces for instructions on compiling the interface. For documentation, open doc/html/index.html in a web browser.

Using a binary installer for Windows

Use this method if you only need to use the GeographicLib utilities. The header files and static library are provided, but can only be used by Visual Studio 2010 in release mode. However, if you plan to use the library, it is advisable to build it with the compiler you are using for your own code using either Installation with cmake or Installation on Windows.

Download and run GeographicLib-1.21-win32.exe or GeographicLib-1.21-win64.exe:

  • read the MIT/X11 License agreement,
  • select whether you want your PATH modified,
  • select the installation folder, by default C:\pkg-vc10\GeographicLib-1.21 or C:\pkg-vc10-x64\GeographicLib-1.21,
  • select the start menu folder,
  • and install.

(Note that the default installation folder adheres the the convention given in Installation with cmake.) The start menu will now include links to the documentation for the library and for the utilities (and a link for uninstalling the library). If you ask for your PATH to be modified, it will include C:/pkg-vc10/GeographicLib-1.21/bin where the utilities are installed. The headers and library are installed in the include/GeographicLib and lib folders. With the 64-bit installer, the Matlab interface is installed in the libexec/GeographicLib/matlab folder. Add this to your path in Matlab to access this interface. The binaries were built using Visual Studio 10 (2010) in Release mode. The Matlab interface was compiled with Matlab R2010b 64-bit, however it may work with some other 64-bit versions of Matlab.

Building the library for use with Qt

If Qt is using a standard compiler, then build GeographicLib with that same compiler (and optimization flags) as Qt.

If you are using the mingw compiler on Windows for Qt, then you need to build GeographicLib with mingw. You can accomplish this with cmake under cygwin with, for example,

  export PATH="`cygpath -m c:/QtSDK/mingw/bin`:$PATH"
  mkdir BUILD
  cd BUILD
  cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX=C:/pkg-mingw/GeographicLib ..
  mingw32-make
  mingw32-make install 

If cmake complains that sh mustn't be in your path, invoke cmake with

  env PATH="$( echo $PATH | tr : '\n' |
  while read d; do test -f "$d/sh.exe" || echo -n "$d:"; done |
  sed 's/:$//' )" cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX=C:/pkg-mingw/GeographicLib ..

If cmake is not available, there is a simple project file that compiles the GeographicLib library only with the Qt compiler:

  cd src
  qmake Geographic.pro   # configure the project
  make                   # build the library 

The library will be in the src directory (or the src/release or src/debug directory under Windows). The headers are in include/GeographicLib.

Maintainer tasks

Check the code out of git with

  git clone git://geographiclib.git.sf.net/gitroot/geographiclib/geographiclib

The autoconf configuration script, the html version of the documentation, and the formatted man pages not checked into git. In order to create the autoconf configuration script, run

  sh autogen.sh 

in the top level directory. Provided you are running on a system with doxygen, pod2man, and pod2html installed, then you can create the documentation and the man pages by building the system using cmake (the MAINTAINER configuration variable set to ON, if the necessary tools are found) or configure.

In the case of cmake, you then run

  make dist 

which will copy the documentation and man pages from the build directory back into the source tree and package the resulting source tree for distribution as

  GeographicLib-1.21.tar.gz
  GeographicLib-1.21.zip 

Finally,

  make package 

or building PACKAGE in Visual Studio will create a binary installer for GeographicLib. For Windows, this requires in the installation of NSIS.

With configure, run

  make dist-gzip 

which will create the additional files and packages the results ready for distribution as

  geographiclib-1.21.tar.gz 
Back to Introduction. Forward to Getting started. Up to Contents.
geographiclib-1.21/doc/html/Gravity_8cpp.html0000644000175000017500000001542311745620414021043 0ustar frankiefrankie GeographicLib: Gravity.cpp File Reference
Gravity.cpp File Reference

Command line utility for evaluating gravity fields. More...

#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
#include <GeographicLib/GravityModel.hpp>
#include <GeographicLib/GravityCircle.hpp>
#include <GeographicLib/DMS.hpp>
#include <GeographicLib/Utility.hpp>
#include "Gravity.usage"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Detailed Description

Command line utility for evaluating gravity fields.

Copyright (c) Charles Karney (2011, 2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Compile and link with g++ -g -O3 -I../include -I../man -o Gravity \ Gravity.cpp \ ../src/CircularEngine.cpp \ ../src/DMS.cpp \ ../src/Geocentric.cpp \ ../src/GravityCircle.cpp \ ../src/GravityModel.cpp \ ../src/NormalGravity.cpp \ ../src/SphericalEngine.cpp \ ../src/Utility.cpp

See the man page for usage information.

Definition in file Gravity.cpp.


Function Documentation

geographiclib-1.21/doc/html/LambertConformalConic_8hpp_source.html0000644000175000017500000013175711745620414025217 0ustar frankiefrankie GeographicLib: LambertConformalConic.hpp Source File
LambertConformalConic.hpp
Go to the documentation of this file.
00001 /**
00002  * \file LambertConformalConic.hpp
00003  * \brief Header for GeographicLib::LambertConformalConic class
00004  *
00005  * Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP)
00011 #define GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP \
00012   "$Id: 9aef04f77098543818681966f13ef97ea47dedb4 $"
00013 
00014 #include <algorithm>
00015 #include <GeographicLib/Constants.hpp>
00016 
00017 namespace GeographicLib {
00018 
00019   /**
00020    * \brief Lambert Conformal Conic Projection
00021    *
00022    * Implementation taken from the report,
00023    * - J. P. Snyder,
00024    *   <a href="http://pubs.er.usgs.gov/usgspubs/pp/pp1395"> Map Projections: A
00025    *   Working Manual</a>, USGS Professional Paper 1395 (1987),
00026    *   pp. 107&ndash;109.
00027    *
00028    * This is a implementation of the equations in Snyder except that divided
00029    * differences have been used to transform the expressions into ones which
00030    * may be evaluated accurately and that Newton's method is used to invert the
00031    * projection.  In this implementation, the projection correctly becomes the
00032    * Mercator projection or the polar stereographic projection when the
00033    * standard latitude is the equator or a pole.  The accuracy of the
00034    * projections is about 10 nm (10 nanometers).
00035    *
00036    * The ellipsoid parameters, the standard parallels, and the scale on the
00037    * standard parallels are set in the constructor.  Internally, the case with
00038    * two standard parallels is converted into a single standard parallel, the
00039    * latitude of tangency (also the latitude of minimum scale), with a scale
00040    * specified on this parallel.  This latitude is also used as the latitude of
00041    * origin which is returned by LambertConformalConic::OriginLatitude.  The
00042    * scale on the latitude of origin is given by
00043    * LambertConformalConic::CentralScale.  The case with two distinct standard
00044    * parallels where one is a pole is singular and is disallowed.  The central
00045    * meridian (which is a trivial shift of the longitude) is specified as the
00046    * \e lon0 argument of the LambertConformalConic::Forward and
00047    * LambertConformalConic::Reverse functions.  There is no provision in this
00048    * class for specifying a false easting or false northing or a different
00049    * latitude of origin.  However these are can be simply included by the
00050    * calling function.  For example the Pennsylvania South state coordinate
00051    * system (<a href="http://www.spatialreference.org/ref/epsg/3364/">
00052    * EPSG:3364</a>) is obtained by:
00053    * \include example-LambertConformalConic.cpp
00054    *
00055    * <a href="ConicProj.1.html">ConicProj</a> is a command-line utility
00056    * providing access to the functionality of LambertConformalConic and
00057    * AlbersEqualArea.
00058    **********************************************************************/
00059   class GEOGRAPHIC_EXPORT LambertConformalConic {
00060   private:
00061     typedef Math::real real;
00062     real _a, _f, _fm, _e2, _e, _e2m;
00063     real _sign, _n, _nc, _t0nm1, _scale, _lat0, _k0;
00064     real _scbet0, _tchi0, _scchi0, _psi0, _nrho0;
00065     static const real eps_;
00066     static const real epsx_;
00067     static const real tol_;
00068     static const real ahypover_;
00069     static const int numit_ = 5;
00070     static inline real hyp(real x) throw() { return Math::hypot(real(1), x); }
00071     // e * atanh(e * x) = log( ((1 + e*x)/(1 - e*x))^(e/2) ) if f >= 0
00072     // - sqrt(-e2) * atan( sqrt(-e2) * x)                    if f < 0
00073     inline real eatanhe(real x) const throw() {
00074       return _f >= 0 ? _e * Math::atanh(_e * x) : - _e * std::atan(_e * x);
00075     }
00076     // Divided differences
00077     // Definition: Df(x,y) = (f(x)-f(y))/(x-y)
00078     // See: W. M. Kahan and R. J. Fateman,
00079     // Symbolic computation of divided differences,
00080     // SIGSAM Bull. 33(3), 7-28 (1999)
00081     // http://dx.doi.org/10.1145/334714.334716
00082     // http://www.cs.berkeley.edu/~fateman/papers/divdiff.pdf
00083     //
00084     // General rules
00085     // h(x) = f(g(x)): Dh(x,y) = Df(g(x),g(y))*Dg(x,y)
00086     // h(x) = f(x)*g(x):
00087     //        Dh(x,y) = Df(x,y)*g(x) + Dg(x,y)*f(y)
00088     //                = Df(x,y)*g(y) + Dg(x,y)*f(x)
00089     //                = Df(x,y)*(g(x)+g(y))/2 + Dg(x,y)*(f(x)+f(y))/2
00090     //
00091     // hyp(x) = sqrt(1+x^2): Dhyp(x,y) = (x+y)/(hyp(x)+hyp(y))
00092     static inline real Dhyp(real x, real y, real hx, real hy) throw()
00093     // hx = hyp(x)
00094     { return (x + y) / (hx + hy); }
00095     // sn(x) = x/sqrt(1+x^2): Dsn(x,y) = (x+y)/((sn(x)+sn(y))*(1+x^2)*(1+y^2))
00096     static inline real Dsn(real x, real y, real sx, real sy) throw() {
00097       // sx = x/hyp(x)
00098       real t = x * y;
00099       return t > 0 ? (x + y) * Math::sq( (sx * sy)/t ) / (sx + sy) :
00100         (x - y != 0 ? (sx - sy) / (x - y) : 1);
00101     }
00102     // Dlog1p(x,y) = log1p((x-y)/(1+y)/(x-y)
00103     static inline real Dlog1p(real x, real y) throw() {
00104       real t = x - y; if (t < 0) { t = -t; y = x; }
00105       return t != 0 ? Math::log1p(t / (1 + y)) / t : 1 / (1 + x);
00106     }
00107     // Dexp(x,y) = exp((x+y)/2) * 2*sinh((x-y)/2)/(x-y)
00108     static inline real Dexp(real x, real y) throw() {
00109       real t = (x - y)/2;
00110       return (t != 0 ? sinh(t)/t : real(1)) * exp((x + y)/2);
00111     }
00112     // Dsinh(x,y) = 2*sinh((x-y)/2)/(x-y) * cosh((x+y)/2)
00113     //   cosh((x+y)/2) = (c+sinh(x)*sinh(y)/c)/2
00114     //   c=sqrt((1+cosh(x))*(1+cosh(y)))
00115     //   cosh((x+y)/2) = sqrt( (sinh(x)*sinh(y) + cosh(x)*cosh(y) + 1)/2 )
00116     static inline real Dsinh(real x, real y, real sx, real sy, real cx, real cy)
00117       // sx = sinh(x), cx = cosh(x)
00118       throw() {
00119       // real t = (x - y)/2, c = sqrt((1 + cx) * (1 + cy));
00120       // return (t != 0 ? sinh(t)/t : real(1)) * (c + sx * sy / c) /2;
00121       real t = (x - y)/2;
00122       return (t != 0 ? sinh(t)/t : real(1)) * sqrt((sx * sy + cx * cy + 1) /2);
00123     }
00124     // Dasinh(x,y) = asinh((x-y)*(x+y)/(x*sqrt(1+y^2)+y*sqrt(1+x^2)))/(x-y)
00125     //             = asinh((x*sqrt(1+y^2)-y*sqrt(1+x^2)))/(x-y)
00126     static inline real Dasinh(real x, real y, real hx, real hy) throw() {
00127       // hx = hyp(x)
00128       real t = x - y;
00129       return t != 0 ?
00130         Math::asinh(x*y > 0 ? t * (x+y) / (x*hy + y*hx) : x*hy - y*hx) / t :
00131         1/hx;
00132     }
00133     // Deatanhe(x,y) = eatanhe((x-y)/(1-e^2*x*y))/(x-y)
00134     inline real Deatanhe(real x, real y) const throw() {
00135       real t = x - y, d = 1 - _e2 * x * y;
00136       return t != 0 ? eatanhe(t / d) / t : _e2 / d;
00137     }
00138     void Init(real sphi1, real cphi1, real sphi2, real cphi2, real k1) throw();
00139   public:
00140 
00141     /**
00142      * Constructor with a single standard parallel.
00143      *
00144      * @param[in] a equatorial radius of ellipsoid (meters).
00145      * @param[in] f flattening of ellipsoid.  Setting \e f = 0 gives a sphere.
00146      *   Negative \e f gives a prolate ellipsoid.  If \e f > 1, set flattening
00147      *   to 1/\e f.
00148      * @param[in] stdlat standard parallel (degrees), the circle of tangency.
00149      * @param[in] k0 scale on the standard parallel.
00150      *
00151      * An exception is thrown if \e a or \e k0 is not positive or if \e stdlat
00152      * is not in the range [-90, 90].
00153      **********************************************************************/
00154     LambertConformalConic(real a, real f, real stdlat, real k0);
00155 
00156     /**
00157      * Constructor with two standard parallels.
00158      *
00159      * @param[in] a equatorial radius of ellipsoid (meters).
00160      * @param[in] f flattening of ellipsoid.  Setting \e f = 0 gives a sphere.
00161      *   Negative \e f gives a prolate ellipsoid.  If \e f > 1, set flattening
00162      *   to 1/\e f.
00163      * @param[in] stdlat1 first standard parallel (degrees).
00164      * @param[in] stdlat2 second standard parallel (degrees).
00165      * @param[in] k1 scale on the standard parallels.
00166      *
00167      * An exception is thrown if \e a or \e k0 is not positive or if \e stdlat1
00168      * or \e stdlat2 is not in the range [-90, 90].  In addition, if either \e
00169      * stdlat1 or \e stdlat2 is a pole, then an exception is thrown if \e
00170      * stdlat1 is not equal \e stdlat2.
00171      **********************************************************************/
00172     LambertConformalConic(real a, real f, real stdlat1, real stdlat2, real k1);
00173 
00174     /**
00175      * Constructor with two standard parallels specified by sines and cosines.
00176      *
00177      * @param[in] a equatorial radius of ellipsoid (meters).
00178      * @param[in] f flattening of ellipsoid.  Setting \e f = 0 gives a sphere.
00179      *   Negative \e f gives a prolate ellipsoid.  If \e f > 1, set flattening
00180      *   to 1/\e f.
00181      * @param[in] sinlat1 sine of first standard parallel.
00182      * @param[in] coslat1 cosine of first standard parallel.
00183      * @param[in] sinlat2 sine of second standard parallel.
00184      * @param[in] coslat2 cosine of second standard parallel.
00185      * @param[in] k1 scale on the standard parallels.
00186      *
00187      * This allows parallels close to the poles to be specified accurately.
00188      * This routine computes the latitude of origin and the scale at this
00189      * latitude.  In the case where \e lat1 and \e lat2 are different, the
00190      * errors in this routines are as follows: if \e dlat = abs(\e lat2 - \e
00191      * lat1) <= 160<sup>o</sup> and max(abs(\e lat1), abs(\e lat2)) <= 90 -
00192      * min(0.0002, 2.2e-6(180 - \e dlat), 6e-8 <i>dlat</i><sup>2</sup>) (in
00193      * degrees), then the error in the latitude of origin is less than
00194      * 4.5e-14<sup>o</sup> and the relative error in the scale is less than
00195      * 7e-15.
00196      **********************************************************************/
00197     LambertConformalConic(real a, real f,
00198                           real sinlat1, real coslat1,
00199                           real sinlat2, real coslat2,
00200                           real k1);
00201 
00202     /**
00203      * Set the scale for the projection.
00204      *
00205      * @param[in] lat (degrees).
00206      * @param[in] k scale at latitude \e lat (default 1).
00207      *
00208      * This allows a "latitude of true scale" to be specified.  An exception is
00209      * thrown if \e k is not positive or if \e stdlat is not in the range [-90,
00210      * 90]
00211      **********************************************************************/
00212     void SetScale(real lat, real k = real(1));
00213 
00214     /**
00215      * Forward projection, from geographic to Lambert conformal conic.
00216      *
00217      * @param[in] lon0 central meridian longitude (degrees).
00218      * @param[in] lat latitude of point (degrees).
00219      * @param[in] lon longitude of point (degrees).
00220      * @param[out] x easting of point (meters).
00221      * @param[out] y northing of point (meters).
00222      * @param[out] gamma meridian convergence at point (degrees).
00223      * @param[out] k scale of projection at point.
00224      *
00225      * The latitude origin is given by LambertConformalConic::LatitudeOrigin().
00226      * No false easting or northing is added and \e lat should be in the range
00227      * [-90, 90]; \e lon and \e lon0 should be in the range [-180, 360].  The
00228      * error in the projection is less than about 10 nm (10 nanometers), true
00229      * distance, and the errors in the meridian convergence and scale are
00230      * consistent with this.  The values of \e x and \e y returned for points
00231      * which project to infinity (i.e., one or both of the poles) will be large
00232      * but finite.
00233      **********************************************************************/
00234     void Forward(real lon0, real lat, real lon,
00235                  real& x, real& y, real& gamma, real& k) const throw();
00236 
00237     /**
00238      * Reverse projection, from Lambert conformal conic to geographic.
00239      *
00240      * @param[in] lon0 central meridian longitude (degrees).
00241      * @param[in] x easting of point (meters).
00242      * @param[in] y northing of point (meters).
00243      * @param[out] lat latitude of point (degrees).
00244      * @param[out] lon longitude of point (degrees).
00245      * @param[out] gamma meridian convergence at point (degrees).
00246      * @param[out] k scale of projection at point.
00247      *
00248      * The latitude origin is given by LambertConformalConic::LatitudeOrigin().
00249      * No false easting or northing is added.  \e lon0 should be in the range
00250      * [-180, 360].  The value of \e lon returned is in the range [-180, 180).
00251      * The error in the projection is less than about 10 nm (10 nanometers),
00252      * true distance, and the errors in the meridian convergence and scale are
00253      * consistent with this.
00254      **********************************************************************/
00255     void Reverse(real lon0, real x, real y,
00256                  real& lat, real& lon, real& gamma, real& k) const throw();
00257 
00258     /**
00259      * LambertConformalConic::Forward without returning the convergence and
00260      * scale.
00261      **********************************************************************/
00262     void Forward(real lon0, real lat, real lon,
00263                  real& x, real& y) const throw() {
00264       real gamma, k;
00265       Forward(lon0, lat, lon, x, y, gamma, k);
00266     }
00267 
00268     /**
00269      * LambertConformalConic::Reverse without returning the convergence and
00270      * scale.
00271      **********************************************************************/
00272     void Reverse(real lon0, real x, real y,
00273                  real& lat, real& lon) const throw() {
00274       real gamma, k;
00275       Reverse(lon0, x, y, lat, lon, gamma, k);
00276     }
00277 
00278     /** \name Inspector functions
00279      **********************************************************************/
00280     ///@{
00281     /**
00282      * @return \e a the equatorial radius of the ellipsoid (meters).  This is
00283      *   the value used in the constructor.
00284      **********************************************************************/
00285     Math::real MajorRadius() const throw() { return _a; }
00286 
00287     /**
00288      * @return \e f the flattening of the ellipsoid.  This is the
00289      *   value used in the constructor.
00290      **********************************************************************/
00291     Math::real Flattening() const throw() { return _f; }
00292 
00293     /// \cond SKIP
00294     /**
00295      * <b>DEPRECATED</b>
00296      * @return \e r the inverse flattening of the ellipsoid.
00297      **********************************************************************/
00298     Math::real InverseFlattening() const throw() { return 1/_f; }
00299     /// \endcond
00300 
00301     /**
00302      * @return latitude of the origin for the projection (degrees).
00303      *
00304      * This is the latitude of minimum scale and equals the \e stdlat in the
00305      * 1-parallel constructor and lies between \e stdlat1 and \e stdlat2 in the
00306      * 2-parallel constructors.
00307      **********************************************************************/
00308     Math::real OriginLatitude() const throw() { return _lat0; }
00309 
00310     /**
00311      * @return central scale for the projection.  This is the scale on the
00312      *   latitude of origin.
00313      **********************************************************************/
00314     Math::real CentralScale() const throw() { return _k0; }
00315     ///@}
00316 
00317     /**
00318      * A global instantiation of LambertConformalConic with the WGS84
00319      * ellipsoid, \e stdlat = 0, and \e k0 = 1.  This degenerates to the
00320      * Mercator projection.
00321      **********************************************************************/
00322     static const LambertConformalConic Mercator;
00323   };
00324 
00325 } // namespace GeographicLib
00326 
00327 #endif  // GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP
geographiclib-1.21/doc/html/OSGB_8cpp_source.html0000644000175000017500000004176311745620414021536 0ustar frankiefrankie GeographicLib: OSGB.cpp Source File
OSGB.cpp
Go to the documentation of this file.
00001 /**
00002  * \file OSGB.cpp
00003  * \brief Implementation for GeographicLib::OSGB class
00004  *
00005  * Copyright (c) Charles Karney (2010-2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/OSGB.hpp>
00011 #include <GeographicLib/Utility.hpp>
00012 
00013 #define GEOGRAPHICLIB_OSGB_CPP "$Id: 4bfb35c88866ed936faad797f3cef6f4ece36196 $"
00014 
00015 RCSID_DECL(GEOGRAPHICLIB_OSGB_CPP)
00016 RCSID_DECL(GEOGRAPHICLIB_OSGB_HPP)
00017 
00018 namespace GeographicLib {
00019 
00020   using namespace std;
00021 
00022   const string OSGB::letters_ = "ABCDEFGHJKLMNOPQRSTUVWXYZ";
00023   const string OSGB::digits_ = "0123456789";
00024 
00025   const TransverseMercator
00026   OSGB::OSGBTM_(MajorRadius(), Flattening(), CentralScale());
00027 
00028   Math::real OSGB::computenorthoffset() throw() {
00029     real x, y;
00030     OSGBTM_.Forward(real(0), OriginLatitude(), real(0), x, y);
00031     return FalseNorthing() - y;
00032   }
00033 
00034   const Math::real OSGB::northoffset_ = computenorthoffset();
00035 
00036   void OSGB::GridReference(real x, real y, int prec, std::string& gridref) {
00037     CheckCoords(x, y);
00038     if (!(prec >= 0 && prec <= maxprec_))
00039       throw GeographicErr("OSGB precision " + Utility::str(prec)
00040                           + " not in [0, "
00041                           + Utility::str(int(maxprec_)) + "]");
00042     char grid[2 + 2 * maxprec_];
00043     int
00044       xh = int(floor(x)) / tile_,
00045       yh = int(floor(y)) / tile_;
00046     real
00047       xf = x - tile_ * xh,
00048       yf = y - tile_ * yh;
00049     xh += tileoffx_;
00050     yh += tileoffy_;
00051     int z = 0;
00052     grid[z++] = letters_[(tilegrid_ - (yh / tilegrid_) - 1)
00053                         * tilegrid_ + (xh / tilegrid_)];
00054     grid[z++] = letters_[(tilegrid_ - (yh % tilegrid_) - 1)
00055                         * tilegrid_ + (xh % tilegrid_)];
00056     real mult = pow(real(base_), max(tilelevel_ - prec, 0));
00057     int
00058       ix = int(floor(xf / mult)),
00059       iy = int(floor(yf / mult));
00060     for (int c = min(prec, int(tilelevel_)); c--;) {
00061       grid[z + c] = digits_[ ix % base_ ];
00062       ix /= base_;
00063       grid[z + c + prec] = digits_[ iy % base_ ];
00064       iy /= base_;
00065     }
00066     if (prec > tilelevel_) {
00067       xf -= floor(xf / mult);
00068       yf -= floor(yf / mult);
00069       mult = pow(real(base_), prec - tilelevel_);
00070       ix = int(floor(xf * mult));
00071       iy = int(floor(yf * mult));
00072       for (int c = prec - tilelevel_; c--;) {
00073         grid[z + c + tilelevel_] = digits_[ ix % base_ ];
00074         ix /= base_;
00075         grid[z + c + tilelevel_ + prec] = digits_[ iy % base_ ];
00076         iy /= base_;
00077       }
00078     }
00079     int mlen = z + 2 * prec;
00080     gridref.resize(mlen);
00081     copy(grid, grid + mlen, gridref.begin());
00082   }
00083 
00084   void OSGB::GridReference(const std::string& gridref,
00085                            real& x, real& y, int& prec,
00086                            bool centerp) {
00087     int
00088       len = int(gridref.size()),
00089       p = 0;
00090     char grid[2 + 2 * maxprec_];
00091     for (int i = 0; i < len; ++i) {
00092       if (!isspace(gridref[i])) {
00093         if (p >= 2 + 2 * maxprec_)
00094           throw GeographicErr("OSGB string " + gridref + " too long");
00095         grid[p++] = gridref[i];
00096       }
00097     }
00098     len = p;
00099     p = 0;
00100     if (len < 2)
00101       throw GeographicErr("OSGB string " + gridref + " too short");
00102     if (len % 2)
00103       throw GeographicErr("OSGB string " + gridref +
00104                           " has odd number of characters");
00105     int
00106       xh = 0,
00107       yh = 0;
00108     while (p < 2) {
00109       int i = Utility::lookup(letters_, grid[p++]);
00110       if (i < 0)
00111         throw GeographicErr("Illegal prefix character " + gridref);
00112       yh = yh * tilegrid_ + tilegrid_ - (i / tilegrid_) - 1;
00113       xh = xh * tilegrid_ + (i % tilegrid_);
00114     }
00115     xh -= tileoffx_;
00116     yh -= tileoffy_;
00117 
00118     int prec1 = (len - p)/2;
00119     real
00120       unit = tile_,
00121       x1 = unit * xh,
00122       y1 = unit * yh;
00123     for (int i = 0; i < prec1; ++i) {
00124       unit /= base_;
00125       int
00126         ix = Utility::lookup(digits_, grid[p + i]),
00127         iy = Utility::lookup(digits_, grid[p + i + prec1]);
00128       if (ix < 0 || iy < 0)
00129         throw GeographicErr("Encountered a non-digit in " + gridref);
00130       x1 += unit * ix;
00131       y1 += unit * iy;
00132     }
00133     if (centerp) {
00134       x1 += unit/2;
00135       y1 += unit/2;
00136     }
00137     x = x1;
00138     y = y1;
00139     prec = prec1;
00140   }
00141 
00142   void OSGB::CheckCoords(real x, real y) {
00143     // Limits are all multiples of 100km and are all closed on the lower end
00144     // and open on the upper end -- and this is reflected in the error
00145     // messages.
00146     if (! (x >= minx_ && x < maxx_) )
00147       throw GeographicErr("Easting " + Utility::str(int(floor(x/1000)))
00148                           + "km not in OSGB range ["
00149                           + Utility::str(minx_/1000) + "km, "
00150                           + Utility::str(maxx_/1000) + "km)");
00151     if (! (y >= miny_ && y < maxy_) )
00152       throw GeographicErr("Northing " + Utility::str(int(floor(y/1000)))
00153                           + "km not in OSGB range ["
00154                           + Utility::str(miny_/1000) + "km, "
00155                           + Utility::str(maxy_/1000) + "km)");
00156   }
00157 
00158 } // namespace GeographicLib
geographiclib-1.21/doc/html/functions_0x70.html0000644000175000017500000001262711745620414021255 0ustar frankiefrankie GeographicLib: Class Members
Here is a list of all class members with links to the classes they belong to:

- p -

geographiclib-1.21/doc/html/GeodesicProj.1.html0000644000175000017500000001736611745620415021211 0ustar frankiefrankie GeodesicProj -- perform projections based on geodesics


NAME

GeodesicProj -- perform projections based on geodesics


SYNOPSIS

GeodesicProj ( -z | -c | -g ) lat0 lon0 [ -r ] [ -e a f ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

Perform projections based on geodesics. Convert geodetic coordinates to either azimuthal equidistant, Cassini-Soldner, or gnomonic coordinates. The center of the projection (lat0, lon0) is specified by either the -c option (for Cassini-Soldner), the -z option (for azimuthal equidistant), or the -g option (for gnomonic). At least one of these options must be given (the last one given is used).

Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) latitude and longitude (decimal degrees or degrees, minutes, seconds). For each set of geodetic coordinates, the corresponding projected coordinates x, y (meters) are printed on standard output together with the azimuth azi (degrees) and reciprocal scale rk. For Cassini-Soldner, azi is the bearing of the easting direction and the scale in the easting direction is 1 and the scale in the northing direction is 1/rk. For azimuthal equidistant and gnomonic, azi is the bearing of the radial direction and the scale in the azimuthal direction is 1/rk. For azimuthal equidistant and gnomonic, the scales in the radial direction are 1 and 1/rk^2, respectively.


OPTIONS

-z

use the azimuthal equidistant projection centered at latitude = lat0, longitude = lon0.

-c

use the Cassini-Soldner projection centered at latitude = lat0, longitude = lon0.

-g

use the ellipsoidal gnomonic projection centered at latitude = lat0, longitude = lon0.

-r

perform the reverse projection. x and y are given on standard input and each line of standard output gives latitude, longitude, azi, and rk.

-e

specify the ellipsoid via a f; the equatorial radius is a and the flattening is f. Setting f = 0 results in a sphere. Specify f < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


EXAMPLES

   echo 48.648 -2.007 | GeodesicProj -c 48.836 2.337
   => -319919 -11791 86.7 0.999
   echo -319919 -11791 | GeodesicProj -c 48.836 2.337 -r
   => 48.648 -2.007 86.7 0.999


ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes GeodesicProj to return an exit code of 1. However, an error does not cause GeodesicProj to terminate; following lines will be converted.


SEE ALSO

The ellipsoidal gnomonic projection is derived in Section 13 of C. F. F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011; preprint http://arxiv.org/abs/1102.1215. See also Section 8 of C. F. F. Karney, Algorithms for geodesics, Sept. 2011; preprint http://arxiv.org/abs/1109.4448.


AUTHOR

GeodesicProj was written by Charles Karney.


HISTORY

GeodesicProj was added to GeographicLib, http://geographiclib.sf.net, in 2009-08. Prior to version 1.9 it was called EquidistantTest.

geographiclib-1.21/doc/html/AzimuthalEquidistant_8hpp.html0000644000175000017500000001313411745620414023571 0ustar frankiefrankie GeographicLib: AzimuthalEquidistant.hpp File Reference
AzimuthalEquidistant.hpp File Reference

Header for GeographicLib::AzimuthalEquidistant class. More...

Go to the source code of this file.

Classes

class  GeographicLib::AzimuthalEquidistant
 Azimuthal Equidistant Projection. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP   "$Id: 95a1d6e7a8c4613be25ec32550231601202da1e5 $"

Detailed Description

Header for GeographicLib::AzimuthalEquidistant class.

Copyright (c) Charles Karney (2009-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file AzimuthalEquidistant.hpp.


Define Documentation

#define GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP   "$Id: 95a1d6e7a8c4613be25ec32550231601202da1e5 $"

Definition at line 11 of file AzimuthalEquidistant.hpp.

geographiclib-1.21/doc/html/GeodesicLine_8hpp.html0000644000175000017500000001261111745620414021751 0ustar frankiefrankie GeographicLib: GeodesicLine.hpp File Reference
GeodesicLine.hpp File Reference

Header for GeographicLib::GeodesicLine class. More...

Go to the source code of this file.

Classes

class  GeographicLib::GeodesicLine
 A geodesic line. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_GEODESICLINE_HPP   "$Id: 4bbc611bc3837d78456bc227e17bea39cb443745 $"

Detailed Description

Header for GeographicLib::GeodesicLine class.

Copyright (c) Charles Karney (2009-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file GeodesicLine.hpp.


Define Documentation

#define GEOGRAPHICLIB_GEODESICLINE_HPP   "$Id: 4bbc611bc3837d78456bc227e17bea39cb443745 $"

Definition at line 11 of file GeodesicLine.hpp.

geographiclib-1.21/doc/html/AzimuthalEquidistant_8cpp.html0000644000175000017500000001157111745620414023567 0ustar frankiefrankie GeographicLib: AzimuthalEquidistant.cpp File Reference
AzimuthalEquidistant.cpp File Reference

Implementation for GeographicLib::AzimuthalEquidistant class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_CPP   "$Id: 324fc318b35a411f024cfd5046ba58b8ef819df7 $"

Detailed Description

Implementation for GeographicLib::AzimuthalEquidistant class.

Copyright (c) Charles Karney (2009-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file AzimuthalEquidistant.cpp.


Define Documentation

#define GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_CPP   "$Id: 324fc318b35a411f024cfd5046ba58b8ef819df7 $"

Definition at line 12 of file AzimuthalEquidistant.cpp.

geographiclib-1.21/doc/html/geod.mac0000644000175000017500000004335011745620415017177 0ustar frankiefrankie/* Compute the series expansions for the spheroidal geodesic problem. Written by Charles Karney http://geographiclib.sourceforge.net/ $Id: 35d5f547992b5bd4e6a53ef7060f6fbfc23b2e25 $ References: Charles F. F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011. preprint http://arxiv.org/abs/1102.1215 resource page http://geographiclib.sf.net/geod.html Charles F. F. Karney, Algorithms for geodesics, Sept. 2011. preprint http://arxiv.org/abs/1109.4448 There are 4 sections in this file (1) Functions to compute the expansions (2) Functions to print C++ code (3) Functions to display the results (4) Calls to the above. Edit the section at the end, to modify what is done. As distributed this code computes the 8th order series. This takes less that 10 secs. To run the code, start Maxima and enter load("geod.mac")$ */ /* EXPANSIONS FOR INTEGRALS */ taylordepth:5$ ataylor(expr,var,ord):=expand(ratdisrep(taylor(expr,var,0,ord)))$ jtaylor(expr,var1,var2,ord):=expand(subst([zz=1], ratdisrep(taylor(subst([var1=zz*var1,var2=zz*var2],expr),zz,0,ord))))$ /* Express I1 = integrate( sqrt(1+k2*sin(sigma1)^2), sigma1, 0, sigma ) as a series A1 * ( sigma + sum(C1[l] * sin(2*l*sigma), l, 1, maxpow) ) valid for k2 small. It is convenient to write k2 = 4 * eps / (1 - eps)^2 and to expand (1 - eps) * I1 retaining terms up to order eps^maxpow in A1 and C1[l]. This leads to a series where half the terms drop out. */ computeI1(maxpow):=block([sintegrand,sintegrandexp,s,sigma,tau1,k2,eps], sintegrand:sqrt(1+k2*sin(sigma)^2), /* Multiplicative factor 1/(1-eps) */ sintegrandexp:ataylor( (1-eps)*subst([k2=4*eps/(1-eps)^2],sintegrand), eps,maxpow), s:trigreduce(integrate(sintegrandexp,sigma)), s:s-subst(sigma=0,s), A1:expand(subst(sigma=2*%pi,s)/(2*%pi)), tau1:ataylor(s/A1,eps,maxpow), for i:1 thru maxpow do C1[i]:coeff(tau1,sin(2*i*sigma)), if expand(tau1-sigma-sum(C1[i]*sin(2*i*sigma),i,1,maxpow)) # 0 then error("left over terms in B1"), A1:A1/(1-eps), 'done)$ /* Write tau1 = sigma + sum(C1[l] * sin(2*l*sigma), l, 1, maxpow) and revert this to obtain sigma = tau1 + sum(C1p[l] * sin(2*tau1), l, 1, maxpow) retaining terms up to order eps^maxpow in tp[l]. Write tau = sigma + B1(sigma) sigma = tau + B1p(tau) B1(sigma) = sum(C1[l] * sin(2*l*sigma), l, 1, inf) B1p(tau) = sum(C1p[l] * sin(2*tau), l, 1, inf) Then the Lagrange Inversion Theorem J. L. Lagrange, Nouvelle methode pour resoudre les equations litterales par le moyen des series, Mem. de l'Acad. Roy. des Sciences de Berlin 24, 251-326 (1768, publ. 1770), Sec. 16, http://books.google.com/books?id=YywPAAAAIAAJ&pg=PA25 gives B1p(tau) = sum( (-1)^n/n! * diff( B1(tau)^n, tau, n-1 ), n, 1, inf) Call this after computeI1(maxpow)$ */ revertI1(maxpow):=block([tau,eps,tauacc:1,sigacc:0], for n:1 thru maxpow do ( tauacc:trigreduce(ataylor( -sum(C1[j]*sin(2*j*tau),j,1,maxpow-n+1)*tauacc/n, eps,maxpow)), sigacc:sigacc+expand(diff(tauacc,tau,n-1))), for i:1 thru maxpow do C1p[i]:coeff(sigacc,sin(2*i*tau)), if expand(sigacc-sum(C1p[i]*sin(2*i*tau),i,1,maxpow)) # 0 then error("left over terms in B1p"), 'done)$ /* Express I2 = integrate( 1/sqrt(1+k2*sin(sigma1)^2), sigma1, 0, sigma ) as a series A2 * ( sigma + sum(C2[l] * sin(2*l*sigma), l, 1, maxpow) ) valid for k2 small. It is convenient to write k2 = 4 * eps / (1 - eps)^2 and to expand 1/(1 - eps) * I2 retaining terms up to order eps^maxpow in A2 and C2[l]. This leads to a series where half the terms drop out. */ computeI2(maxpow):=block([sintegrand,sintegrandexp,s,sigma,tau1,k2,eps], sintegrand:1/sqrt(1+k2*sin(sigma)^2), /* Multiplicative factor (1-eps) */ sintegrandexp:ataylor( 1/(1-eps)*subst([k2=4*eps/(1-eps)^2],sintegrand), eps,maxpow), s:trigreduce(integrate(sintegrandexp,sigma)), s:s-subst(sigma=0,s), A2:expand(subst(sigma=2*%pi,s)/(2*%pi)), tau1:ataylor(s/A2,eps,maxpow), for i:1 thru maxpow do C2[i]:coeff(tau1,sin(2*i*sigma)), if expand(tau1-sigma-sum(C2[i]*sin(2*i*sigma),i,1,maxpow)) # 0 then error("left over terms in B2"), A2:A2*(1-eps), 'done)$ /* Express I3 = integrate( (2-f)/(1+(1-f)*sqrt(1+k2*sin(sigma1)^2)), sigma1, 0, sigma ) as a series A3 * ( sigma + sum(C3[l] * sin(2*l*sigma), l, 1, maxpow-1) ) valid for f and k2 small. It is convenient to write k2 = 4 * eps / (1 - eps)^2 and f = 2*n/(1+n) and expand in eps and n. This procedure leads to a series where the coefficients of eps^j are terminating series in n. */ computeI3(maxpow):=block([int,intexp,dlam,eta,del,eps,nu,f,z,n], maxpow:maxpow-1, int:subst([k2=4*eps/(1-eps)^2], (2-f)/(1+(1-f)*sqrt(1+k2*sin(sigma)^2))), int:subst([f=2*n/(1+n)],int), intexp:jtaylor(int,n,eps,maxpow), dlam:trigreduce(integrate(intexp,sigma)), dlam:dlam-subst(sigma=0,dlam), A3:expand(subst(sigma=2*%pi,dlam)/(2*%pi)), eta:jtaylor(dlam/A3,n,eps,maxpow), A3:jtaylor(A3,n,eps,maxpow), for i:1 thru maxpow do C3[i]:coeff(eta,sin(2*i*sigma)), if expand(eta-sigma-sum(C3[i]*sin(2*i*sigma),i,1,maxpow)) # 0 then error("left over terms in B3"), 'done)$ /* Express I4 = -integrate( (t(ep2) - t(k2*sin(sigma1)^2)) / (ep2 - k2*sin(sigma1)^2) * sin(sigma1)/2, sigma1, pi/2, sigma ) where t(x) = sqrt(1+1/x)*asinh(sqrt(x)) + x as a series sum(C4[l] * cos((2*l+1)*sigma), l, 0, maxpow-1) ) valid for ep2 and k2 small. */ computeI4(maxpow):=block([int,t,intexp,area, x,ep2,k2], maxpow:maxpow-1, t : sqrt(1+1/x) * asinh(sqrt(x)) + x, int:-(tf(ep2) - tf(k2*sin(sigma)^2)) / (ep2 - k2*sin(sigma)^2) * sin(sigma)/2, int:subst([tf(ep2)=subst([x=ep2],t), tf(k2*sin(sigma)^2)=subst([x=k2*sin(sigma)^2],t)], int), int:subst([abs(sin(sigma))=sin(sigma)],int), intexp:jtaylor(int,ep2,k2,maxpow), area:trigreduce(integrate(intexp,sigma)), area:expand(area-subst(sigma=%pi/2,area)), for i:0 thru maxpow do C4[i]:coeff(area,cos((2*i+1)*sigma)), if expand(area-sum(C4[i]*cos((2*i+1)*sigma),i,0,maxpow)) # 0 then error("left over terms in I4"), 'done)$ /* Call all of the above */ computeall():=( computeI1(maxpow), revertI1(maxpow), computeI2(maxpow), computeI3(maxpow), computeI4(maxpow))$ /* FORMAT FOR C++ */ /* If nA1, nC1, nC1p, nA2, nA3, nC3 are compile-time constants indicating the required order, the compiler will include only the needed code. STATIC_ASSERT is a macro to cause a compile-time error if the assertion is false. */ codeA1(maxpow):=block([tab2:" ",tab3:" "], print(" // The scale factor A1-1 = mean value of I1-1 Math::real Geodesic::A1m1f(real eps) throw() { real eps2 = sq(eps), t; switch (nA1/2) {"), for n:0 thru entier(maxpow/2) do block([ q:horner(ataylor(subst([eps=sqrt(eps2)],A1*(1-eps)-1),eps2,n)), linel:600], print(concat(tab2,"case ",string(n),":")), print(concat(tab3,"t = ",string(q),";")), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"STATIC_ASSERT(nA1 >= ",string(0), " && nA1 <= ",string(maxpow),", \"Bad value of nA1\");")), print(concat(tab3,"t = 0;")), print(" } return (t + eps) / (1 - eps); }"), 'done)$ codeC1(maxpow):=block([tab2:" ",tab3:" "], print(" // The coefficients C1[l] in the Fourier expansion of B1 void Geodesic::C1f(real eps, real c[]) throw() { real eps2 = sq(eps), d = eps; switch (nC1) {"), for n:0 thru maxpow do ( print(concat(tab2,"case ",string(n),":")), for m:1 thru n do block([q:d*horner( subst([eps=sqrt(eps2)],ataylor(C1[m],eps,n)/eps^m)), linel:600], if m>1 then print(concat(tab3,"d *= eps;")), print(concat(tab3,"c[",string(m),"] = ",string(q),";"))), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"STATIC_ASSERT(nC1 >= ",string(0), " && nC1 <= ",string(maxpow),", \"Bad value of nC1\");")), print(" } }"), 'done)$ codeC1p(maxpow):=block([tab2:" ",tab3:" "], print(" // The coefficients C1p[l] in the Fourier expansion of B1p void Geodesic::C1pf(real eps, real c[]) throw() { real eps2 = sq(eps), d = eps; switch (nC1p) {"), for n:0 thru maxpow do ( print(concat(tab2,"case ",string(n),":")), for m:1 thru n do block([q:d*horner( subst([eps=sqrt(eps2)],ataylor(C1p[m],eps,n)/eps^m)), linel:600], if m>1 then print(concat(tab3,"d *= eps;")), print(concat(tab3,"c[",string(m),"] = ",string(q),";"))), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"STATIC_ASSERT(nC1p >= ",string(0), " && nC1p <= ",string(maxpow),", \"Bad value of nC1p\");")), print(" } }"), 'done)$ codeA2(maxpow):=block([tab2:" ",tab3:" "], print(" // The scale factor A2-1 = mean value of I2-1 Math::real Geodesic::A2m1f(real eps) throw() { real eps2 = sq(eps), t; switch (nA2/2) {"), for n:0 thru entier(maxpow/2) do block([ q:horner(ataylor(subst([eps=sqrt(eps2)],A2/(1-eps)-1),eps2,n)), linel:600], print(concat(tab2,"case ",string(n),":")), print(concat(tab3,"t = ",string(q),";")), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"STATIC_ASSERT(nA2 >= ",string(0), " && nA2 <= ",string(maxpow),", \"Bad value of nA2\");")), print(concat(tab3,"t = 0;")), print(" } return t * (1 - eps) - eps; }"), 'done)$ codeC2(maxpow):=block([tab2:" ",tab3:" "], print(" // The coefficients C2[l] in the Fourier expansion of B2 void Geodesic::C2f(real eps, real c[]) throw() { real eps2 = sq(eps), d = eps; switch (nC2) {"), for n:0 thru maxpow do ( print(concat(tab2,"case ",string(n),":")), for m:1 thru n do block([q:d*horner( subst([eps=sqrt(eps2)],ataylor(C2[m],eps,n)/eps^m)), linel:600], if m>1 then print(concat(tab3,"d *= eps;")), print(concat(tab3,"c[",string(m),"] = ",string(q),";"))), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"STATIC_ASSERT(nC2 >= ",string(0), " && nC2 <= ",string(maxpow),", \"Bad value of nC2\");")), print(" } }"), 'done)$ codeA3(maxpow):=block([tab2:" ",tab3:" "], print(" // The scale factor A3 = mean value of I3 void Geodesic::A3coeff() throw() { switch (nA3) {"), for nn:0 thru maxpow do block( [q:if nn=0 then 0 else jtaylor(subst([n=_n],A3),_n,eps,nn-1), linel:600], print(concat(tab2,"case ",string(nn),":")), for i : 0 thru nn-1 do print(concat(tab3,"_A3x[",i,"] = ", string(horner(coeff(q,eps,i))),";")), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"STATIC_ASSERT(nA3 >= ",string(0), " && nA3 <= ",string(maxpow),", \"Bad value of nA3\");")), print(" } }"), 'done)$ codeC3(maxpow):=block([tab2:" ",tab3:" "], print(" // The coefficients C3[l] in the Fourier expansion of B3 void Geodesic::C3coeff() throw() { switch (nC3) {"), for nn:0 thru maxpow do block([c], print(concat(tab2,"case ",string(nn),":")), c:0, for m:1 thru nn-1 do block( [q:if nn = 0 then 0 else jtaylor(subst([n=_n],C3[m]),_n,eps,nn-1), linel:600], for j:m thru nn-1 do ( print(concat(tab3,"_C3x[",c,"] = ", string(horner(coeff(q,eps,j))),";")), c:c+1) ), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"STATIC_ASSERT(nC3 >= ",string(0), " && nC3 <= ",string(maxpow),", \"Bad value of nC3\");")), print(" } }"), 'done)$ codeC4(maxpow):=block([tab2:" ",tab3:" "], print(" // The coefficients C4[l] in the Fourier expansion of I4 void Geodesic::C4coeff() throw() { switch (nC4) {"), for nn:0 thru maxpow do block([c], print(concat(tab2,"case ",string(nn),":")), c:0, for m:0 thru nn-1 do block( [q:jtaylor(subst([ep2=_ep2],C4[m]),_ep2,k2,nn-1), linel:600], for j:m thru nn-1 do ( print(concat(tab3,"_C4x[",c,"] = ", string(horner(coeff(q,k2,j))),";")), c:c+1) ), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"STATIC_ASSERT(nC3 >= ",string(0), " && nC4 <= ",string(maxpow),", \"Bad value of nC4\");")), print(" } }"), 'done)$ printcode():=( print(""), print(concat(" // Generated by Maxima on ",timedate())), print(""), codeA1(maxpow), print(""), codeC1(maxpow), print(""), codeC1p(maxpow), print(""), codeA2(maxpow), print(""), codeC2(maxpow), print(""), codeA3(maxpow), print(""), codeC3(maxpow), print(""), codeC4(maxpow))$ /* FORMAT FOR DISPLAY */ dispA1(ord):=block( [tt:ataylor(A1*(1-eps),eps,ord),ttt,linel:600], for j:2 step 2 thru ord do (ttt:coeff(tt,eps,j), print(concat(if j = 2 then "A1 = (1 " else " ", if ttt>0 then "+ " else "- ", string(abs(ttt)), " * ", string(eps^j), if j=ord or j = ord-1 then ") / (1 - eps);" else ""))))$ dispC1(ord):=for i:1 thru ord do block([tt:ataylor(C1[i],eps,ord),ttt,linel:600], print(), for j:i step 2 thru ord do (ttt:coeff(tt,eps,j), print(concat( if j = i then concat("C1[",string(i),"] = ") else " ", if ttt>0 then "+ " else "- ", string(abs(ttt)), " * ", string(eps^j), if j=ord or j=ord-1 then ";" else ""))))$ dispC1p(ord):=for i:1 thru ord do block([tt:ataylor(C1p[i],eps,ord),ttt,linel:600], print(), for j:i step 2 thru ord do (ttt:coeff(tt,eps,j), print(concat( if j = i then concat("C1p[",string(i),"] = ") else " ", if ttt>0 then "+ " else "- ", string(abs(ttt)), " * ", string(eps^j), if j=ord or j=ord-1 then ";" else ""))))$ dispA2(ord):=block( [tt:ataylor(A2/(1-eps),eps,ord),ttt,linel:600], for j:2 step 2 thru ord do (ttt:coeff(tt,eps,j), print(concat(if j = 2 then "A2 = (1 " else " ", if ttt>0 then "+ " else "- ", string(abs(ttt)), " * ", string(eps^j), if j=ord or j = ord-1 then ") * (1 - eps);" else ""))))$ dispC2(ord):=for i:1 thru ord do block([tt:ataylor(C2[i],eps,ord),ttt,linel:600], print(), for j:i step 2 thru ord do (ttt:coeff(tt,eps,j), print(concat( if j = i then concat("C2[",string(i),"] = ") else " ", if ttt>0 then "+ " else "- ", string(abs(ttt)), " * ", string(eps^j), if j=ord or j=ord-1 then ";" else ""))))$ dispA3(ord):=(ord:ord-1,block( [tt:jtaylor(A3,n,eps,ord),ttt,t4,linel:600,s], for j:1 thru ord do (ttt:expand(coeff(tt,eps,j)), if ttt # 0 then block([a:taylor(ttt+n^(ord+1),n,0,ord+1),paren,s], paren : is(length(a) > 2), s:if j=1 then "A3 = 1" else " ", if subst([n=1],part(a,1)) > 0 then s:concat(s," + ") else (s:concat(s," - "), a:-a), if paren then s:concat(s,"("), for k:1 thru length(a)-1 do block([term:part(a,k),nn], nn:subst([n=1],term), term:term/nn, if nn > 0 and k > 1 then s:concat(s," + ") else if nn < 0 then (s:concat(s," - "), nn:-nn), if lopow(term,n) = 0 then s:concat(s,string(nn)) else ( if nn # 1 then s:concat(s,string(nn)," * "), s:concat(s,string(term)) )), if paren then s:concat(s,")"), s:concat(s," * ", string(eps^j)), print(concat(s,if j = ord then ";" else ""))))))$ dispC3(ord):=(ord:ord-1,for i:1 thru ord do block([tt:jtaylor(C3[i],eps,n,ord), ttt,t4,linel:600], for j:i thru ord do ( ttt:coeff(tt,eps,j), if ttt # 0 then block([a:taylor(ttt+n^(ord+1),n,0,ord+1),paren,s], paren : is(length(a) > 2), s:if j = i then concat("C3[",i,"] = ") else " ", if subst([n=1],part(a,1)) > 0 then s:concat(s,"+ ") else (s:concat(s,"- "), a:-a), if paren then s:concat(s,"("), for k:1 thru length(a)-1 do block([term:part(a,k),nn], nn:subst([n=1],term), term:term/nn, if nn > 0 and k > 1 then s:concat(s," + ") else if nn < 0 then (s:concat(s," - "), nn:-nn), if lopow(term,n) = 0 then s:concat(s,string(nn)) else ( if nn # 1 then s:concat(s,string(nn)," * "), s:concat(s,string(term)) )), if paren then s:concat(s,")"), s:concat(s," * ", string(eps^j)), print(concat(s,if j = ord then ";" else ""))))))$ dispC4(ord):=(ord:ord-1,for i:0 thru ord do block([tt:jtaylor(C4[i],ep2,k2,ord), ttt,t4,linel:600], tt:expand(subst([z=1],tt)), for j:i thru ord do ( ttt:coeff(tt,k2,j), if ttt # 0 then block([a:taylor(ttt+ep2^(ord+1),ep2,0,ord+1),paren,s], paren : is(length(a) > 2), s:if j = i then concat("C4[",i,"] = ") else " ", if subst([ep2=1],part(a,1)) > 0 then s:concat(s,"+ ") else (s:concat(s,"- "), a:-a), if paren then s:concat(s,"("), for k:1 thru length(a)-1 do block([term:part(a,k),nn], nn:subst([ep2=1],term), term:term/nn, if nn > 0 and k > 1 then s:concat(s," + ") else if nn < 0 then (s:concat(s," - "), nn:-nn), if lopow(term,ep2) = 0 then s:concat(s,string(nn)) else ( if nn # 1 then s:concat(s,string(nn)," * "), s:concat(s,string(term)) )), if paren then s:concat(s,")"), if j>0 then s:concat(s," * ", string(k2^j)), print(concat(s,if j = ord then ";" else ""))))))$ dispseries():=( print(""), print(concat("// Generated by Maxima on ",timedate())), print(""), dispA1(maxpow), print(""), dispC1(maxpow), print(""), dispC1p(maxpow), print(""), dispA2(maxpow), print(""), dispC2(maxpow), print(""), dispA3(maxpow), print(""), dispC3(maxpow), print(""), dispC4(maxpow), print(""))$ /* CALL THE FUNCTIONS */ /* Timings for computeall(n) n time(s) 8 4 10 8 12 16 20 128 30 771 (13m) */ maxpow:8$ computeall()$ printcode()$ dispseries()$ geographiclib-1.21/doc/html/functions_0x72.html0000644000175000017500000002141611745620414021253 0ustar frankiefrankie GeographicLib: Class Members geographiclib-1.21/doc/html/classGeographicLib_1_1AzimuthalEquidistant-members.html0000644000175000017500000001153011745620414030366 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::AzimuthalEquidistant Member List
This is the complete list of members for GeographicLib::AzimuthalEquidistant, including all inherited members.
AzimuthalEquidistant(const Geodesic &earth=Geodesic::WGS84)GeographicLib::AzimuthalEquidistant [inline, explicit]
Flattening() const GeographicLib::AzimuthalEquidistant [inline]
Forward(real lat0, real lon0, real lat, real lon, real &x, real &y, real &azi, real &rk) const GeographicLib::AzimuthalEquidistant
Forward(real lat0, real lon0, real lat, real lon, real &x, real &y) const GeographicLib::AzimuthalEquidistant [inline]
MajorRadius() const GeographicLib::AzimuthalEquidistant [inline]
Reverse(real lat0, real lon0, real x, real y, real &lat, real &lon, real &azi, real &rk) const GeographicLib::AzimuthalEquidistant
Reverse(real lat0, real lon0, real x, real y, real &lat, real &lon) const GeographicLib::AzimuthalEquidistant [inline]
geographiclib-1.21/doc/html/classGeographicLib_1_1GeoCoords-members.html0000644000175000017500000002611711745620414026110 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::GeoCoords Member List
This is the complete list of members for GeographicLib::GeoCoords, including all inherited members.
AltConvergence() const GeographicLib::GeoCoords [inline]
AltEasting() const GeographicLib::GeoCoords [inline]
AltMGRSRepresentation(int prec=0) const GeographicLib::GeoCoords
AltNorthing() const GeographicLib::GeoCoords [inline]
AltScale() const GeographicLib::GeoCoords [inline]
AltUTMUPSRepresentation(int prec=0) const GeographicLib::GeoCoords
AltZone() const GeographicLib::GeoCoords [inline]
Convergence() const GeographicLib::GeoCoords [inline]
DMSRepresentation(int prec, bool swaplatlong, char dmssep) const GeographicLib::GeoCoords
DMSRepresentation(int prec=0, bool swaplatlong=false) const GeographicLib::GeoCoords
Easting() const GeographicLib::GeoCoords [inline]
Flattening() const GeographicLib::GeoCoords [inline]
GeoCoords()GeographicLib::GeoCoords [inline]
GeoCoords(const std::string &s, bool centerp=true, bool swaplatlong=false)GeographicLib::GeoCoords [inline, explicit]
GeoCoords(real latitude, real longitude, int zone=UTMUPS::STANDARD)GeographicLib::GeoCoords [inline]
GeoCoords(int zone, bool northp, real easting, real northing)GeographicLib::GeoCoords [inline]
GeoRepresentation(int prec=0, bool swaplatlong=false) const GeographicLib::GeoCoords
Hemisphere() const GeographicLib::GeoCoords [inline]
Latitude() const GeographicLib::GeoCoords [inline]
Longitude() const GeographicLib::GeoCoords [inline]
MajorRadius() const GeographicLib::GeoCoords [inline]
MGRSRepresentation(int prec=0) const GeographicLib::GeoCoords
Northing() const GeographicLib::GeoCoords [inline]
Northp() const GeographicLib::GeoCoords [inline]
Reset(const std::string &s, bool centerp=true, bool swaplatlong=false)GeographicLib::GeoCoords
Reset(real latitude, real longitude, int zone=UTMUPS::STANDARD)GeographicLib::GeoCoords [inline]
Reset(int zone, bool northp, real easting, real northing)GeographicLib::GeoCoords [inline]
Scale() const GeographicLib::GeoCoords [inline]
SetAltZone(int zone=UTMUPS::STANDARD) const GeographicLib::GeoCoords [inline]
UTMUPSRepresentation(int prec=0) const GeographicLib::GeoCoords
Zone() const GeographicLib::GeoCoords [inline]
geographiclib-1.21/doc/html/functions_func_0x63.html0000644000175000017500000002362011745620414022265 0ustar frankiefrankie GeographicLib: Class Members - Functions
 

- c -

geographiclib-1.21/doc/html/GeodesicLine_8cpp.html0000644000175000017500000001264011745620414021746 0ustar frankiefrankie GeographicLib: GeodesicLine.cpp File Reference
GeodesicLine.cpp File Reference

Implementation for GeographicLib::GeodesicLine class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_GEODESICLINE_CPP   "$Id: d95fea8e73fd86fdc558e5b0397a97241cfe40c2 $"

Detailed Description

Implementation for GeographicLib::GeodesicLine class.

Copyright (c) Charles Karney (2009-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

This is a reformulation of the geodesic problem. The notation is as follows:

  • at a general point (no suffix or 1 or 2 as suffix)
    • phi = latitude
    • beta = latitude on auxiliary sphere
    • omega = longitude on auxiliary sphere
    • lambda = longitude
    • alpha = azimuth of great circle
    • sigma = arc length along great circle
    • s = distance
    • tau = scaled distance (= sigma at multiples of pi/2)
  • at northwards equator crossing
    • beta = phi = 0
    • omega = lambda = 0
    • alpha = alpha0
    • sigma = s = 0
  • a 12 suffix means a difference, e.g., s12 = s2 - s1.
  • s and c prefixes mean sin and cos

Definition in file GeodesicLine.cpp.


Define Documentation

#define GEOGRAPHICLIB_GEODESICLINE_CPP   "$Id: d95fea8e73fd86fdc558e5b0397a97241cfe40c2 $"

Definition at line 31 of file GeodesicLine.cpp.

geographiclib-1.21/doc/html/classGeographicLib_1_1EllipticFunction.html0000644000175000017500000005206711745620415026053 0ustar frankiefrankie GeographicLib: GeographicLib::EllipticFunction Class Reference
GeographicLib::EllipticFunction Class Reference

Elliptic functions needed for TransverseMercatorExact. More...

#include <GeographicLib/EllipticFunction.hpp>

List of all members.

Public Member Functions

 EllipticFunction (real m) throw ()
Math::real m () const throw ()
Math::real m1 () const throw ()
Math::real K () const throw ()
Math::real E () const throw ()
Math::real KE () const throw ()
void sncndn (real x, real &sn, real &cn, real &dn) const throw ()
Math::real E (real phi) const throw ()
Math::real E (real sn, real cn, real dn) const throw ()

Detailed Description

Elliptic functions needed for TransverseMercatorExact.

This provides the subset of elliptic functions needed for TransverseMercatorExact. For a given ellipsoid, only parameters e2 and 1 - e2 are needed. This class taken the parameter as a constructor parameters and caches the values of the required complete integrals. A method is provided for Jacobi elliptic functions and for the incomplete elliptic integral of the second kind in terms of the amplitude.

The computation of the elliptic integrals uses the algorithms given in

The computation of the Jacobi elliptic functions uses the algorithm given in

The notation follows Abramowitz and Stegun, Chapters 16 and 17.

Example of use:

// Example of using the GeographicLib::EllipticFunction class
// $Id: 304e818254ce2fd366c2efa4f7ef93643e8c208c $

#include <iostream>
#include <cmath>
#include <GeographicLib/Math.hpp>
#include <GeographicLib/EllipticFunction.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    EllipticFunction ell(0.1);  // parameter m = 0.1
    // See Abramowitz and Stegun, table 17.1
    cout << ell.K() << " " << ell.E() << "\n";
    double phi = 20 * Math::degree();
    // See Abramowitz and Stegun, table 17.6 with
    // alpha = asin(sqrt(m)) = 18.43 deg and phi = 20 deg
    cout << ell.E(phi) << " "
         << ell.E(sin(phi), cos(phi), sqrt(1 - ell.m() * Math::sq(sin(phi))))
         << "\n";
  }
  catch (const GeographicErr& e) {
    cout << "Caught exception: " << e.what() << "\n";
  }
  return 0;
}

Constructor & Destructor Documentation

GeographicLib::EllipticFunction::EllipticFunction ( real  m) throw () [explicit]

Constructor.

Parameters:
[in]mthe parameter which must lie in [0, 1]. (No checking is done.)

Definition at line 125 of file EllipticFunction.cpp.


Member Function Documentation

Math::real GeographicLib::EllipticFunction::m ( ) const throw () [inline]
Returns:
the parameter m.

Definition at line 76 of file EllipticFunction.hpp.

Math::real GeographicLib::EllipticFunction::m1 ( ) const throw () [inline]
Returns:
the complementary parameter m' = (1 - m).

Definition at line 81 of file EllipticFunction.hpp.

Math::real GeographicLib::EllipticFunction::K ( ) const throw () [inline]
Returns:
the complete integral of first kind, K(m).

Definition at line 86 of file EllipticFunction.hpp.

Math::real GeographicLib::EllipticFunction::E ( ) const throw () [inline]
Returns:
the complete integral of second kind, E(m).

Definition at line 91 of file EllipticFunction.hpp.

Math::real GeographicLib::EllipticFunction::KE ( ) const throw () [inline]
Returns:
the difference K(m) - E(m) (which can be computed directly).

Definition at line 97 of file EllipticFunction.hpp.

void GeographicLib::EllipticFunction::sncndn ( real  x,
real &  sn,
real &  cn,
real &  dn 
) const throw ()

The Jacobi elliptic functions.

Parameters:
[in]xthe argument.
[out]snsn(x|m).
[out]cncn(x|m).
[out]dndn(x|m).

Definition at line 151 of file EllipticFunction.cpp.

Math::real GeographicLib::EllipticFunction::E ( real  phi) const throw ()

The incomplete integral of the second kind.

Parameters:
[in]phi
Returns:
int sqrt(1 - m sin2(phi)) dphi.

Definition at line 213 of file EllipticFunction.cpp.

Math::real GeographicLib::EllipticFunction::E ( real  sn,
real  cn,
real  dn 
) const throw ()

The incomplete integral of the second kind in terms of Jacobi elliptic functions

Parameters:
[in]sn
[in]cn
[in]dn
Returns:
int dn(w)2 dw (A+S 17.2.10).

Instead of specifying the amplitude phi, we provide sn = sin(phi), cn = cos(phi), dn = sqrt(1 - m sin2(phi)).

Definition at line 198 of file EllipticFunction.cpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/functions_0x73.html0000644000175000017500000002340611745620414021255 0ustar frankiefrankie GeographicLib: Class Members
Here is a list of all class members with links to the classes they belong to:

- s -

geographiclib-1.21/doc/html/functions_func_0x64.html0000644000175000017500000001765711745620414022303 0ustar frankiefrankie GeographicLib: Class Members - Functions geographiclib-1.21/doc/html/AzimuthalEquidistant_8cpp_source.html0000644000175000017500000001551511745620414025151 0ustar frankiefrankie GeographicLib: AzimuthalEquidistant.cpp Source File
AzimuthalEquidistant.cpp
Go to the documentation of this file.
00001 /**
00002  * \file AzimuthalEquidistant.cpp
00003  * \brief Implementation for GeographicLib::AzimuthalEquidistant class
00004  *
00005  * Copyright (c) Charles Karney (2009-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/AzimuthalEquidistant.hpp>
00011 
00012 #define GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_CPP \
00013   "$Id: 324fc318b35a411f024cfd5046ba58b8ef819df7 $"
00014 
00015 RCSID_DECL(GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_CPP)
00016 RCSID_DECL(GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP)
00017 
00018 namespace GeographicLib {
00019 
00020   using namespace std;
00021 
00022   const Math::real AzimuthalEquidistant::eps_ =
00023     real(0.01) * sqrt(numeric_limits<real>::min());
00024 
00025   void AzimuthalEquidistant::Forward(real lat0, real lon0, real lat, real lon,
00026                                      real& x, real& y, real& azi, real& rk)
00027     const throw() {
00028     real sig, s, azi0, m;
00029     sig = _earth.Inverse(lat0, lon0, lat, lon, s, azi0, azi, m);
00030     azi0 *= Math::degree<real>();
00031     x = s * sin(azi0);
00032     y = s * cos(azi0);
00033     rk = !(sig <= eps_) ? m / s : 1;
00034   }
00035 
00036   void AzimuthalEquidistant::Reverse(real lat0, real lon0, real x, real y,
00037                                      real& lat, real& lon, real& azi, real& rk)
00038     const throw() {
00039     real
00040       azi0 = atan2(x, y) / Math::degree<real>(),
00041       s = Math::hypot(x, y);
00042     real sig, m;
00043     sig = _earth.Direct(lat0, lon0, azi0, s, lat, lon, azi, m);
00044     rk = !(sig <= eps_) ? m / s : 1;
00045   }
00046 
00047 } // namespace GeographicLib
geographiclib-1.21/doc/html/functions_0x74.html0000644000175000017500000001246111745620414021255 0ustar frankiefrankie GeographicLib: Class Members
Here is a list of all class members with links to the classes they belong to:

- t -

geographiclib-1.21/doc/html/GravityCircle_8hpp_source.html0000644000175000017500000011330111745620414023544 0ustar frankiefrankie GeographicLib: GravityCircle.hpp Source File
GravityCircle.hpp
Go to the documentation of this file.
00001 /**
00002  * \file GravityCircle.hpp
00003  * \brief Header for GeographicLib::GravityCircle class
00004  *
00005  * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under
00006  * the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_GRAVITYCIRCLE_HPP)
00011 #define GEOGRAPHICLIB_GRAVITYCIRCLE_HPP \
00012   "$Id: 6ae0869411185a48c9f55016e6d1fb14e69aaac1 $"
00013 
00014 #include <string>
00015 #include <vector>
00016 #include <GeographicLib/Constants.hpp>
00017 #include <GeographicLib/CircularEngine.hpp>
00018 #include <GeographicLib/GravityModel.hpp>
00019 
00020 namespace GeographicLib {
00021 
00022   /**
00023    * \brief Gravity on a circle of latitude
00024    *
00025    * Evaluate the earth's gravity field on a circle of constant height and
00026    * latitude.  This uses a CircleEngine to pre-evaluate the inner sum of the
00027    * spherical harmonic sum, allowing the values of the field at several
00028    * different longitudes to be evaluated rapidly.
00029    *
00030    * Use GravityModel::Circle to create a GravityCircle object.  (The
00031    * constructor for this class is private.)
00032    *
00033    * See \ref gravityparallel for an example of using GravityCircle (together
00034    * with OpenMP) to speed up the computation of geoid heights.
00035    *
00036    * Example of use:
00037    * \include example-GravityCircle.cpp
00038    *
00039    * <a href="Gravity.1.html">Gravity</a> is a command-line utility providing
00040    * access to the functionality of GravityModel and GravityCircle.
00041    **********************************************************************/
00042 
00043   class GEOGRAPHIC_EXPORT GravityCircle {
00044   private:
00045     typedef Math::real real;
00046     enum mask {
00047       NONE                 = GravityModel::NONE,
00048       GRAVITY              = GravityModel::GRAVITY,
00049       DISTURBANCE          = GravityModel::DISTURBANCE,
00050       DISTURBING_POTENTIAL = GravityModel::DISTURBING_POTENTIAL,
00051       GEOID_HEIGHT         = GravityModel::GEOID_HEIGHT,
00052       SPHERICAL_ANOMALY    = GravityModel::SPHERICAL_ANOMALY,
00053       ALL                  = GravityModel::ALL,
00054     };
00055 
00056     unsigned _caps;
00057     real _a, _f, _lat, _h, _Z, _P, _invR, _cpsi, _spsi,
00058       _cphi, _sphi, _amodel, _GMmodel, _dzonal0,
00059       _corrmult, _gamma0, _gamma, _frot;
00060     CircularEngine _gravitational, _disturbing, _correction;
00061 
00062     GravityCircle(mask caps, real a, real f, real lat, real h,
00063                   real Z, real P, real cphi, real sphi,
00064                   real amodel, real GMmodel, real dzonal0, real corrmult,
00065                   real gamma0, real gamma, real frot,
00066                   const CircularEngine& gravitational,
00067                   const CircularEngine& disturbing,
00068                   const CircularEngine& correction)
00069       : _caps(caps)
00070       , _a(a)
00071       , _f(f)
00072       , _lat(lat)
00073       , _h(h)
00074       , _Z(Z)
00075       , _P(P)
00076       , _invR(Math::hypot(_P, _Z))
00077       , _cpsi(_P * _invR)
00078       , _spsi(_Z * _invR)
00079       , _cphi(cphi)
00080       , _sphi(sphi)
00081       , _amodel(amodel)
00082       , _GMmodel(GMmodel)
00083       , _dzonal0(dzonal0)
00084       , _corrmult(corrmult)
00085       , _gamma0(gamma0)
00086       , _gamma(gamma)
00087       , _frot(frot)
00088       , _gravitational(gravitational)
00089       , _disturbing(disturbing)
00090       , _correction(correction)
00091     {}
00092 
00093     friend class GravityModel; // GravityModel calls the private constructor
00094     Math::real W(real clam, real slam,
00095                  real& gX, real& gY, real& gZ) const throw();
00096     Math::real V(real clam, real slam,
00097                  real& gX, real& gY, real& gZ) const throw();
00098     Math::real InternalT(real clam, real slam,
00099                          real& deltaX, real& deltaY, real& deltaZ,
00100                          bool gradp, bool correct) const throw();
00101   public:
00102     /**
00103      * A default constructor for the normal gravity.  This sets up an
00104      * uninitialized object which can be later replaced by the
00105      * GravityModel::Circle.
00106      **********************************************************************/
00107     GravityCircle() : _a(-1) {}
00108 
00109     /** \name Compute the gravitational field
00110      **********************************************************************/
00111     ///@{
00112     /**
00113      * Evaluate the gravity.
00114      *
00115      * @param[in] lon the geographic longitude (degrees).
00116      * @param[out] gx the easterly component of the acceleration
00117      *   (m s<sup>-2</sup>).
00118      * @param[out] gy the northerly component of the acceleration
00119      *   (m s<sup>-2</sup>).
00120      * @param[out] gz the upward component of the acceleration
00121      *   (m s<sup>-2</sup>); this is usually negative.
00122      * @return \e W the sum of the gravitational and centrifugal potentials.
00123      *
00124      * The function includes the effects of the earth's rotation.
00125      **********************************************************************/
00126     Math::real Gravity(real lon, real& gx, real& gy, real& gz) const throw();
00127 
00128     /**
00129      * Evaluate the gravity disturbance vector.
00130      *
00131      * @param[in] lon the geographic longitude (degrees).
00132      * @param[out] deltax the easterly component of the disturbance vector
00133      *   (m s<sup>-2</sup>).
00134      * @param[out] deltay the northerly component of the disturbance vector
00135      *   (m s<sup>-2</sup>).
00136      * @param[out] deltaz the upward component of the disturbance vector
00137      *   (m s<sup>-2</sup>).
00138      * @return \e T the corresponding disturbing potential.
00139      **********************************************************************/
00140     Math::real Disturbance(real lon, real& deltax, real& deltay, real& deltaz)
00141       const throw();
00142 
00143     /**
00144      * Evaluate the geoid height.
00145      *
00146      * @param[in] lon the geographic longitude (degrees).
00147      * @return \e N the height of the geoid above the reference ellipsoid
00148      *   (meters).
00149      *
00150      * Some approximations are made in computing the geoid height so that the
00151      * results of the NGA codes are reproduced accurately.  Details are given
00152      * in \ref gravitygeoid.
00153      **********************************************************************/
00154     Math::real GeoidHeight(real lon) const throw();
00155 
00156     /**
00157      * Evaluate the components of the gravity anomaly vector using the
00158      * spherical approximation.
00159      *
00160      * @param[in] lon the geographic longitude (degrees).
00161      * @param[out] Dg01 the gravity anomaly (m s<sup>-2</sup>).
00162      * @param[out] xi the northerly component of the deflection of the vertical
00163      *  (degrees).
00164      * @param[out] eta the easterly component of the deflection of the vertical
00165      *  (degrees).
00166      *
00167      * The spherical approximation (see Heiskanen and Moritz, Sec 2-14) is used
00168      * so that the results of the NGA codes are reproduced accurately.
00169      * approximations used here.  Details are given in \ref gravitygeoid.
00170      **********************************************************************/
00171     void SphericalAnomaly(real lon, real& Dg01, real& xi, real& eta)
00172       const throw();
00173 
00174     /**
00175      * Evaluate the components of the acceleration due to gravity and the
00176      * centrifugal acceleration in geocentric coordinates.
00177      *
00178      * @param[in] lon the geographic longitude (degrees).
00179      * @param[out] gX the \e X component of the acceleration
00180      *   (m s<sup>-2</sup>).
00181      * @param[out] gY the \e Y component of the acceleration
00182      *   (m s<sup>-2</sup>).
00183      * @param[out] gZ the \e Z component of the acceleration
00184      *   (m s<sup>-2</sup>).
00185      * @return \e W = \e V + \e Phi the sum of the gravitational and
00186      *   centrifugal potentials (m<sup>2</sup> s<sup>-2</sup>).
00187      **********************************************************************/
00188     Math::real W(real lon, real& gX, real& gY, real& gZ) const throw() {
00189       real clam, slam;
00190       CircularEngine::cossin(lon, clam, slam);
00191       return W(clam, slam, gX, gY, gZ);
00192     }
00193 
00194     /**
00195      * Evaluate the components of the acceleration due to gravity in geocentric
00196      * coordinates.
00197      *
00198      * @param[in] lon the geographic longitude (degrees).
00199      * @param[out] GX the \e X component of the acceleration
00200      *   (m s<sup>-2</sup>).
00201      * @param[out] GY the \e Y component of the acceleration
00202      *   (m s<sup>-2</sup>).
00203      * @param[out] GZ the \e Z component of the acceleration
00204      *   (m s<sup>-2</sup>).
00205      * @return \e V = \e W - \e Phi the gravitational potential
00206      *   (m<sup>2</sup> s<sup>-2</sup>).
00207      **********************************************************************/
00208     Math::real V(real lon, real& GX, real& GY, real& GZ) const throw() {
00209       real clam, slam;
00210       CircularEngine::cossin(lon, clam, slam);
00211       return V(clam, slam, GX, GY, GZ);
00212     }
00213 
00214 
00215     /**
00216      * Evaluate the components of the gravity disturbance in geocentric
00217      * coordinates.
00218      *
00219      * @param[in] lon the geographic longitude (degrees).
00220      * @param[out] deltaX the \e X component of the gravity disturbance
00221      *   (m s<sup>-2</sup>).
00222      * @param[out] deltaY the \e Y component of the gravity disturbance
00223      *   (m s<sup>-2</sup>).
00224      * @param[out] deltaZ the \e Z component of the gravity disturbance
00225      *   (m s<sup>-2</sup>).
00226      * @return \e T = \e W - \e U the disturbing potential (also called the
00227      *   anomalous potential) (m<sup>2</sup> s<sup>-2</sup>).
00228      **********************************************************************/
00229     Math::real T(real lon, real& deltaX, real& deltaY, real& deltaZ)
00230       const throw() {
00231       real clam, slam;
00232       CircularEngine::cossin(lon, clam, slam);
00233       return InternalT(clam, slam, deltaX, deltaY, deltaZ, true, true);
00234     }
00235 
00236     /**
00237      * Evaluate disturbing potential in geocentric coordinates.
00238      *
00239      * @param[in] lon the geographic longitude (degrees).
00240      * @return \e T = \e W - \e U the disturbing potential (also called the
00241      *   anomalous potential) (m<sup>2</sup> s<sup>-2</sup>).
00242      **********************************************************************/
00243     Math::real T(real lon) const throw() {
00244       real clam, slam, dummy;
00245       CircularEngine::cossin(lon, clam, slam);
00246       return InternalT(clam, slam, dummy, dummy, dummy, false, true);
00247     }
00248 
00249     ///@}
00250 
00251     /** \name Inspector functions
00252      **********************************************************************/
00253     ///@{
00254     /**
00255      * @return true if the object has been initialized.
00256      **********************************************************************/
00257     bool Init() const throw() { return _a > 0; }
00258 
00259     /**
00260      * @return \e a the equatorial radius of the ellipsoid (meters).  This is
00261      *   the value inherited from the GravityModel object used in the
00262      *   constructor.
00263      **********************************************************************/
00264     Math::real MajorRadius() const throw()
00265     { return Init() ? _a : Math::NaN<real>(); }
00266 
00267     /**
00268      * @return \e f the flattening of the ellipsoid.  This is the value
00269      *   inherited from the GravityModel object used in the constructor.
00270      **********************************************************************/
00271     Math::real Flattening() const throw()
00272     { return Init() ? _f : Math::NaN<real>(); }
00273 
00274     /**
00275      * @return the latitude of the circle (degrees).
00276      **********************************************************************/
00277     Math::real Latitude() const throw()
00278     { return Init() ? _lat : Math::NaN<real>(); }
00279 
00280     /**
00281      * @return the height of the circle (meters).
00282      **********************************************************************/
00283     Math::real Height() const throw()
00284     { return Init() ? _h : Math::NaN<real>(); }
00285 
00286     /**
00287      * @return \e caps the computational capabilities that this object was
00288      *   constructed with.
00289      **********************************************************************/
00290     unsigned Capabilities() const throw() { return _caps; }
00291 
00292     /**
00293      * @param[in] testcaps a set of bitor'ed GeodesicLine::mask values.
00294      * @return true if the GeodesicLine object has all these capabilities.
00295      **********************************************************************/
00296     bool Capabilities(unsigned testcaps) const throw() {
00297       return (_caps & testcaps) == testcaps;
00298     }
00299     ///@}
00300   };
00301 
00302 } // namespace GeographicLib
00303 
00304 #endif  // GEOGRAPHICLIB_GRAVITYCIRCLE_HPP
geographiclib-1.21/doc/html/functions_func_0x65.html0000644000175000017500000001345711745620414022276 0ustar frankiefrankie GeographicLib: Class Members - Functions
 

- e -

geographiclib-1.21/doc/html/functions_0x75.html0000644000175000017500000001372011745620414021255 0ustar frankiefrankie GeographicLib: Class Members geographiclib-1.21/doc/html/classGeographicLib_1_1SphericalHarmonic2-members.html0000644000175000017500000001543511745620415027703 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::SphericalHarmonic2 Member List
This is the complete list of members for GeographicLib::SphericalHarmonic2, including all inherited members.
Circle(real tau1, real tau2, real p, real z, bool gradp) const GeographicLib::SphericalHarmonic2 [inline]
Coefficients() const GeographicLib::SphericalHarmonic2 [inline]
Coefficients1() const GeographicLib::SphericalHarmonic2 [inline]
Coefficients2() const GeographicLib::SphericalHarmonic2 [inline]
FULL enum valueGeographicLib::SphericalHarmonic2
normalization enum nameGeographicLib::SphericalHarmonic2
operator()(real tau1, real tau2, real x, real y, real z) const GeographicLib::SphericalHarmonic2 [inline]
operator()(real tau1, real tau2, real x, real y, real z, real &gradx, real &grady, real &gradz) const GeographicLib::SphericalHarmonic2 [inline]
SCHMIDT enum valueGeographicLib::SphericalHarmonic2
SphericalHarmonic2(const std::vector< real > &C, const std::vector< real > &S, int N, const std::vector< real > &C1, const std::vector< real > &S1, int N1, const std::vector< real > &C2, const std::vector< real > &S2, int N2, real a, unsigned norm=FULL)GeographicLib::SphericalHarmonic2 [inline]
SphericalHarmonic2(const std::vector< real > &C, const std::vector< real > &S, int N, int nmx, int mmx, const std::vector< real > &C1, const std::vector< real > &S1, int N1, int nmx1, int mmx1, const std::vector< real > &C2, const std::vector< real > &S2, int N2, int nmx2, int mmx2, real a, unsigned norm=FULL)GeographicLib::SphericalHarmonic2 [inline]
SphericalHarmonic2()GeographicLib::SphericalHarmonic2 [inline]
geographiclib-1.21/doc/html/dir_27ad12676aedce3065ab152db424ea04.html0000644000175000017500000001312311745620414023725 0ustar frankiefrankie GeographicLib: tools/ Directory Reference
tools Directory Reference

Files

file  CartConvert.cpp [code]
 

Command line utility for geodetic to cartesian coordinate conversions.


file  ConicProj.cpp [code]
 

Command line utility for conical projections.


file  GeoConvert.cpp [code]
 

Command line utility for geographic coordinate conversions.


file  Geod.cpp [code]
 

Command line utility for geodesic calculations.


file  GeodesicProj.cpp [code]
 

Command line utility for geodesic projections.


file  GeoidEval.cpp [code]
 

Command line utility for evaluating geoid heights.


file  Gravity.cpp [code]
 

Command line utility for evaluating gravity fields.


file  MagneticField.cpp [code]
 

Command line utility for evaluating magnetic fields.


file  Planimeter.cpp [code]
 

Command line utility for measuring the area of geodesic polygons.


file  TransverseMercatorProj.cpp [code]
 

Command line utility for transverse Mercator projections.


geographiclib-1.21/doc/html/namespaces.html0000644000175000017500000000412411745620414020577 0ustar frankiefrankie GeographicLib: Namespace List
Namespace List
Here is a list of all namespaces with brief descriptions:
GeographicLibNamespace for GeographicLib
geographiclib-1.21/doc/html/classGeographicLib_1_1Constants.html0000644000175000017500000014675611745620414024564 0ustar frankiefrankie GeographicLib: GeographicLib::Constants Class Reference
GeographicLib::Constants Class Reference

Constants needed by GeographicLib More...

#include <GeographicLib/Constants.hpp>

List of all members.

Static Public Member Functions

static Math::real degree () throw ()
static Math::real arcminute () throw ()
static Math::real arcsecond () throw ()
Ellipsoid parameters
template<typename T >
static T WGS84_a () throw ()
static Math::real WGS84_a () throw ()
template<typename T >
static T WGS84_f () throw ()
static Math::real WGS84_f () throw ()
template<typename T >
static T WGS84_GM () throw ()
template<typename T >
static T WGS84_omega () throw ()
static Math::real WGS84_r () throw ()
template<typename T >
static T GRS80_a () throw ()
template<typename T >
static T GRS80_GM () throw ()
template<typename T >
static T GRS80_omega () throw ()
template<typename T >
static T GRS80_J2 () throw ()
template<typename T >
static T UTM_k0 () throw ()
static Math::real UTM_k0 () throw ()
template<typename T >
static T UPS_k0 () throw ()
static Math::real UPS_k0 () throw ()
SI units
template<typename T >
static T meter () throw ()
static Math::real meter () throw ()
static Math::real kilometer () throw ()
static Math::real nauticalmile () throw ()
template<typename T >
static T square_meter () throw ()
static Math::real square_meter () throw ()
static Math::real hectare () throw ()
static Math::real square_kilometer () throw ()
static Math::real square_nauticalmile () throw ()
Anachronistic British units
static Math::real foot () throw ()
static Math::real yard () throw ()
static Math::real fathom () throw ()
static Math::real chain () throw ()
static Math::real furlong () throw ()
static Math::real mile () throw ()
static Math::real acre () throw ()
static Math::real square_mile () throw ()
Anachronistic US units
static Math::real surveyfoot () throw ()

Detailed Description

Constants needed by GeographicLib

Define constants specifying the WGS84 ellipsoid, the UTM and UPS projections, and various unit conversions.

Example of use:

// Example of using the GeographicLib::Constants class
// $Id: c32f14d43abd9e969043dd0506b00c2458763419 $

#include <iostream>
#include <exception>
#include <GeographicLib/Constants.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    cout << Constants::WGS84_a() << " 1/" << 1/Constants::WGS84_f() << "\n";
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Member Function Documentation

static Math::real GeographicLib::Constants::degree ( ) throw () [inline, static]

A synonym for Math::degree<real>().

Definition at line 81 of file Constants.hpp.

static Math::real GeographicLib::Constants::arcminute ( ) throw () [inline, static]
Returns:
the number of radians in an arcminute.

Definition at line 85 of file Constants.hpp.

static Math::real GeographicLib::Constants::arcsecond ( ) throw () [inline, static]
Returns:
the number of radians in an arcsecond.

Definition at line 90 of file Constants.hpp.

template<typename T >
static T GeographicLib::Constants::WGS84_a ( ) throw () [inline, static]
Template Parameters:
Tthe type of the returned value.
Returns:
the equatorial radius of WGS84 ellipsoid (6378137 m).

Definition at line 100 of file Constants.hpp.

static Math::real GeographicLib::Constants::WGS84_a ( ) throw () [inline, static]

A synonym for WGS84_a<real>().

Definition at line 105 of file Constants.hpp.

template<typename T >
static T GeographicLib::Constants::WGS84_f ( ) throw () [inline, static]
Template Parameters:
Tthe type of the returned value.
Returns:
the flattening of WGS84 ellipsoid (1/298.257223563).

Definition at line 110 of file Constants.hpp.

static Math::real GeographicLib::Constants::WGS84_f ( ) throw () [inline, static]

A synonym for WGS84_f<real>().

Definition at line 115 of file Constants.hpp.

template<typename T >
static T GeographicLib::Constants::WGS84_GM ( ) throw () [inline, static]
Template Parameters:
Tthe type of the returned value.
Returns:
the gravitational constant of the WGS84 ellipsoid, GM, in m3 s-2.

Definition at line 121 of file Constants.hpp.

template<typename T >
static T GeographicLib::Constants::WGS84_omega ( ) throw () [inline, static]
Template Parameters:
Tthe type of the returned value.
Returns:
the angular velocity of the the WGS84 ellipsoid, omega, in rad s-1.

Definition at line 128 of file Constants.hpp.

static Math::real GeographicLib::Constants::WGS84_r ( ) throw () [inline, static]

Definition at line 142 of file Constants.hpp.

template<typename T >
static T GeographicLib::Constants::GRS80_a ( ) throw () [inline, static]
Template Parameters:
Tthe type of the returned value.
Returns:
the equatorial radius of GRS80 ellipsoid, a, in m.

Definition at line 147 of file Constants.hpp.

template<typename T >
static T GeographicLib::Constants::GRS80_GM ( ) throw () [inline, static]
Template Parameters:
Tthe type of the returned value.
Returns:
the gravitational constant of the GRS80 ellipsoid, GM, in m3 s-2.

Definition at line 154 of file Constants.hpp.

template<typename T >
static T GeographicLib::Constants::GRS80_omega ( ) throw () [inline, static]
Template Parameters:
Tthe type of the returned value.
Returns:
the angular velocity of the the GRS80 ellipsoid, omega, in rad s-1.

This is about 2*pi*366.25 / (365.25*24*3600) rad s-1. 365.25 is the number of days in a Julian year and 365.35/366.25 converts from solar days to sidereal days. Using the number of days in a Gregorian year (365.2425) results in a worse approximation (because the Gregorian year includes the precession of the earth's axis).

Definition at line 167 of file Constants.hpp.

template<typename T >
static T GeographicLib::Constants::GRS80_J2 ( ) throw () [inline, static]
Template Parameters:
Tthe type of the returned value.
Returns:
the dynamical form factor of the GRS80 ellipsoid, J2.

Definition at line 174 of file Constants.hpp.

template<typename T >
static T GeographicLib::Constants::UTM_k0 ( ) throw () [inline, static]
Template Parameters:
Tthe type of the returned value.
Returns:
the central scale factor for UTM (0.9996).

Definition at line 180 of file Constants.hpp.

static Math::real GeographicLib::Constants::UTM_k0 ( ) throw () [inline, static]

A synonym for UTM_k0<real>().

Definition at line 185 of file Constants.hpp.

template<typename T >
static T GeographicLib::Constants::UPS_k0 ( ) throw () [inline, static]
Template Parameters:
Tthe type of the returned value.
Returns:
the central scale factor for UPS (0.994).

Definition at line 190 of file Constants.hpp.

static Math::real GeographicLib::Constants::UPS_k0 ( ) throw () [inline, static]

A synonym for UPS_k0<real>().

Definition at line 195 of file Constants.hpp.

template<typename T >
static T GeographicLib::Constants::meter ( ) throw () [inline, static]
Template Parameters:
Tthe type of the returned value.
Returns:
the number of meters in a meter.

This is unity, but this lets the internal system of units be changed if necessary.

Definition at line 208 of file Constants.hpp.

static Math::real GeographicLib::Constants::meter ( ) throw () [inline, static]

A synonym for meter<real>().

Definition at line 212 of file Constants.hpp.

static Math::real GeographicLib::Constants::kilometer ( ) throw () [inline, static]
Returns:
the number of meters in a kilometer.

Definition at line 216 of file Constants.hpp.

static Math::real GeographicLib::Constants::nauticalmile ( ) throw () [inline, static]
Returns:
the number of meters in a nautical mile (approximately 1 arc minute)

Definition at line 222 of file Constants.hpp.

template<typename T >
static T GeographicLib::Constants::square_meter ( ) throw () [inline, static]
Template Parameters:
Tthe type of the returned value.
Returns:
the number of square meters in a square meter.

This is unity, but this lets the internal system of units be changed if necessary.

Definition at line 232 of file Constants.hpp.

static Math::real GeographicLib::Constants::square_meter ( ) throw () [inline, static]

A synonym for square_meter<real>().

Definition at line 237 of file Constants.hpp.

static Math::real GeographicLib::Constants::hectare ( ) throw () [inline, static]
Returns:
the number of square meters in a hectare.

Definition at line 242 of file Constants.hpp.

static Math::real GeographicLib::Constants::square_kilometer ( ) throw () [inline, static]
Returns:
the number of square meters in a square kilometer.

Definition at line 247 of file Constants.hpp.

static Math::real GeographicLib::Constants::square_nauticalmile ( ) throw () [inline, static]
Returns:
the number of square meters in a square nautical mile.

Definition at line 252 of file Constants.hpp.

static Math::real GeographicLib::Constants::foot ( ) throw () [inline, static]
Returns:
the number of meters in an international foot.

Definition at line 262 of file Constants.hpp.

static Math::real GeographicLib::Constants::yard ( ) throw () [inline, static]
Returns:
the number of meters in a yard.

Definition at line 267 of file Constants.hpp.

static Math::real GeographicLib::Constants::fathom ( ) throw () [inline, static]
Returns:
the number of meters in a fathom.

Definition at line 271 of file Constants.hpp.

static Math::real GeographicLib::Constants::chain ( ) throw () [inline, static]
Returns:
the number of meters in a chain.

Definition at line 275 of file Constants.hpp.

static Math::real GeographicLib::Constants::furlong ( ) throw () [inline, static]
Returns:
the number of meters in a furlong.

Definition at line 279 of file Constants.hpp.

static Math::real GeographicLib::Constants::mile ( ) throw () [inline, static]
Returns:
the number of meters in a statute mile.

Definition at line 283 of file Constants.hpp.

static Math::real GeographicLib::Constants::acre ( ) throw () [inline, static]
Returns:
the number of square meters in an acre.

Definition at line 287 of file Constants.hpp.

static Math::real GeographicLib::Constants::square_mile ( ) throw () [inline, static]
Returns:
the number of square meters in a square statute mile.

Definition at line 291 of file Constants.hpp.

static Math::real GeographicLib::Constants::surveyfoot ( ) throw () [inline, static]
Returns:
the number of meters in a US survey foot.

Definition at line 300 of file Constants.hpp.


The documentation for this class was generated from the following file:
geographiclib-1.21/doc/html/functions_func_0x66.html0000644000175000017500000002657111745620414022300 0ustar frankiefrankie GeographicLib: Class Members - Functions
 

- f -

geographiclib-1.21/doc/html/classGeographicLib_1_1AzimuthalEquidistant.html0000644000175000017500000006367211745620414026754 0ustar frankiefrankie GeographicLib: GeographicLib::AzimuthalEquidistant Class Reference
GeographicLib::AzimuthalEquidistant Class Reference

Azimuthal Equidistant Projection. More...

#include <GeographicLib/AzimuthalEquidistant.hpp>

List of all members.

Public Member Functions

 AzimuthalEquidistant (const Geodesic &earth=Geodesic::WGS84) throw ()
void Forward (real lat0, real lon0, real lat, real lon, real &x, real &y, real &azi, real &rk) const throw ()
void Reverse (real lat0, real lon0, real x, real y, real &lat, real &lon, real &azi, real &rk) const throw ()
void Forward (real lat0, real lon0, real lat, real lon, real &x, real &y) const throw ()
void Reverse (real lat0, real lon0, real x, real y, real &lat, real &lon) const throw ()
Inspector functions
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()

Detailed Description

Azimuthal Equidistant Projection.

Azimuthal equidistant projection centered at an arbitrary position on the ellipsoid. For a point in projected space (x, y), the geodesic distance from the center position is hypot(x, y) and the azimuth of the geodesic from the center point is atan2(x, y). The Forward and Reverse methods also return the azimuth azi of the geodesic at (x, y) and reciprocal scale rk in the azimuthal direction which, together with the basic properties of the projection, serve to specify completely the local affine transformation between geographic and projected coordinates.

The conversions all take place using a Geodesic object (by default Geodesic::WGS84). For more information on geodesics see Geodesics on the ellipsoid.

Example of use:

// Example of using the GeographicLib::AzimuthalEquidistant class
// $Id: d018fda4dc3289b06b9e6fe8cda16638430d9213 $

#include <iostream>
#include <exception>
#include <GeographicLib/Geodesic.hpp>
#include <GeographicLib/AzimuthalEquidistant.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    Geodesic geod(Constants::WGS84_a(), Constants::WGS84_f());
    // Alternatively: const Geodesic& geod = Geodesic::WGS84;
    const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris
    AzimuthalEquidistant proj(geod);
    {
      // Sample forward calculation
      double lat = 50.9, lon = 1.8; // Calais
      double x, y;
      proj.Forward(lat0, lon0, lat, lon, x, y);
      cout << x << " " << y << "\n";
    }
    {
      // Sample reverse calculation
      double x = -38e3, y = 230e3;
      double lat, lon;
      proj.Reverse(lat0, lon0, x, y, lat, lon);
      cout << lat << " " << lon << "\n";
    }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

GeodesicProj is a command-line utility providing access to the functionality of AzimuthalEquidistant, Gnomonic, and CassiniSoldner.


Constructor & Destructor Documentation

GeographicLib::AzimuthalEquidistant::AzimuthalEquidistant ( const Geodesic earth = Geodesic::WGS84) throw () [inline, explicit]

Constructor for AzimuthalEquidistant.

Parameters:
[in]earththe Geodesic object to use for geodesic calculations. By default this uses the WGS84 ellipsoid.

Definition at line 56 of file AzimuthalEquidistant.hpp.


Member Function Documentation

void GeographicLib::AzimuthalEquidistant::Forward ( real  lat0,
real  lon0,
real  lat,
real  lon,
real &  x,
real &  y,
real &  azi,
real &  rk 
) const throw ()

Forward projection, from geographic to azimuthal equidistant.

Parameters:
[in]lat0latitude of center point of projection (degrees).
[in]lon0longitude of center point of projection (degrees).
[in]latlatitude of point (degrees).
[in]lonlongitude of point (degrees).
[out]xeasting of point (meters).
[out]ynorthing of point (meters).
[out]aziazimuth of geodesic at point (degrees).
[out]rkreciprocal of azimuthal scale at point.

lat0 and lat should be in the range [-90, 90] and lon0 and lon should be in the range [-180, 360]. The scale of the projection is 1 in the "radial" direction, azi clockwise from true north, and is 1/rk in the direction perpendicular to this. A call to Forward followed by a call to Reverse will return the original (lat, lon) (to within roundoff).

Definition at line 25 of file AzimuthalEquidistant.cpp.

Referenced by main().

void GeographicLib::AzimuthalEquidistant::Reverse ( real  lat0,
real  lon0,
real  x,
real  y,
real &  lat,
real &  lon,
real &  azi,
real &  rk 
) const throw ()

Reverse projection, from azimuthal equidistant to geographic.

Parameters:
[in]lat0latitude of center point of projection (degrees).
[in]lon0longitude of center point of projection (degrees).
[in]xeasting of point (meters).
[in]ynorthing of point (meters).
[out]latlatitude of point (degrees).
[out]lonlongitude of point (degrees).
[out]aziazimuth of geodesic at point (degrees).
[out]rkreciprocal of azimuthal scale at point.

lat0 should be in the range [-90, 90] and lon0 should be in the range [-180, 360]. lat will be in the range [-90, 90] and lon will be in the range [-180, 180). The scale of the projection is 1 in the "radial" direction, azi clockwise from true north, and is 1/rk in the direction perpendicular to this. A call to Reverse followed by a call to Forward will return the original (x, y) (to roundoff) only if the geodesic to (x, y) is a shortest path.

Definition at line 36 of file AzimuthalEquidistant.cpp.

Referenced by main().

void GeographicLib::AzimuthalEquidistant::Forward ( real  lat0,
real  lon0,
real  lat,
real  lon,
real &  x,
real &  y 
) const throw () [inline]

AzimuthalEquidistant::Forward without returning the azimuth and scale.

Definition at line 107 of file AzimuthalEquidistant.hpp.

void GeographicLib::AzimuthalEquidistant::Reverse ( real  lat0,
real  lon0,
real  x,
real  y,
real &  lat,
real &  lon 
) const throw () [inline]

AzimuthalEquidistant::Reverse without returning the azimuth and scale.

Definition at line 116 of file AzimuthalEquidistant.hpp.

Math::real GeographicLib::AzimuthalEquidistant::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value inherited from the Geodesic object used in the constructor.

Definition at line 129 of file AzimuthalEquidistant.hpp.

Math::real GeographicLib::AzimuthalEquidistant::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid. This is the value inherited from the Geodesic object used in the constructor.

Definition at line 135 of file AzimuthalEquidistant.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/TransverseMercatorProj_8cpp_source.html0000644000175000017500000006656511745620414025477 0ustar frankiefrankie GeographicLib: TransverseMercatorProj.cpp Source File
TransverseMercatorProj.cpp
Go to the documentation of this file.
00001 /**
00002  * \file TransverseMercatorProj.cpp
00003  * \brief Command line utility for transverse Mercator projections
00004  *
00005  * Copyright (c) Charles Karney (2008-2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  *
00009  * Compile and link with
00010  *   g++ -g -O3 -I../include -I../man -o TransverseMercatorProj \
00011  *       TransverseMercatorProj.cpp \
00012  *       ../src/DMS.cpp \
00013  *       ../src/EllipticFunction.cpp \
00014  *       ../src/TransverseMercator.cpp \
00015  *       ../src/TransverseMercatorExact.cpp
00016  *
00017  * See the <a href="TransverseMercatorProj.1.html">man page</a> for usage
00018  * information.
00019  **********************************************************************/
00020 
00021 #include <iostream>
00022 #include <sstream>
00023 #include <string>
00024 #include <sstream>
00025 #include <fstream>
00026 #include <GeographicLib/EllipticFunction.hpp>
00027 #include <GeographicLib/TransverseMercatorExact.hpp>
00028 #include <GeographicLib/TransverseMercator.hpp>
00029 #include <GeographicLib/DMS.hpp>
00030 #include <GeographicLib/Utility.hpp>
00031 
00032 #include "TransverseMercatorProj.usage"
00033 
00034 int main(int argc, char* argv[]) {
00035   try {
00036     using namespace GeographicLib;
00037     typedef Math::real real;
00038     bool exact = true, extended = false, series = false, reverse = false;
00039     real
00040       a = Constants::WGS84_a<real>(),
00041       f = Constants::WGS84_f<real>(),
00042       k0 = Constants::UTM_k0<real>(),
00043       lon0 = 0;
00044     std::string istring, ifile, ofile, cdelim;
00045     char lsep = ';';
00046 
00047     for (int m = 1; m < argc; ++m) {
00048       std::string arg(argv[m]);
00049       if (arg == "-r")
00050         reverse = true;
00051       else if (arg == "-t") {
00052         exact = true;
00053         extended = true;
00054         series = false;
00055       } else if (arg == "-s") {
00056         exact = false;
00057         extended = false;
00058         series = true;
00059       } else if (arg == "-l") {
00060         if (++m >= argc) return usage(1, true);
00061         try {
00062           DMS::flag ind;
00063           lon0 = DMS::Decode(std::string(argv[m]), ind);
00064           if (ind == DMS::LATITUDE)
00065             throw GeographicErr("Bad hemisphere");
00066           if (!(lon0 >= -180 && lon0 <= 360))
00067             throw GeographicErr("Bad longitude");
00068           if (lon0 >= 180) lon0 -= 360;
00069         }
00070         catch (const std::exception& e) {
00071           std::cerr << "Error decoding argument of " << arg << ": "
00072                     << e.what() << "\n";
00073           return 1;
00074         }
00075       } else if (arg == "-k") {
00076         if (++m >= argc) return usage(1, true);
00077         try {
00078           k0 = Utility::num<real>(std::string(argv[m]));
00079         }
00080         catch (const std::exception& e) {
00081           std::cerr << "Error decoding argument of " << arg << ": "
00082                     << e.what() << "\n";
00083           return 1;
00084         }
00085       } else if (arg == "-e") {
00086         if (m + 2 >= argc) return usage(1, true);
00087         try {
00088           a = Utility::num<real>(std::string(argv[m + 1]));
00089           f = Utility::fract<real>(std::string(argv[m + 2]));
00090         }
00091         catch (const std::exception& e) {
00092           std::cerr << "Error decoding arguments of -e: " << e.what() << "\n";
00093           return 1;
00094         }
00095         m += 2;
00096       } else if (arg == "--input-string") {
00097         if (++m == argc) return usage(1, true);
00098         istring = argv[m];
00099       } else if (arg == "--input-file") {
00100         if (++m == argc) return usage(1, true);
00101         ifile = argv[m];
00102       } else if (arg == "--output-file") {
00103         if (++m == argc) return usage(1, true);
00104         ofile = argv[m];
00105       } else if (arg == "--line-separator") {
00106         if (++m == argc) return usage(1, true);
00107         if (std::string(argv[m]).size() != 1) {
00108           std::cerr << "Line separator must be a single character\n";
00109           return 1;
00110         }
00111         lsep = argv[m][0];
00112       } else if (arg == "--comment-delimiter") {
00113         if (++m == argc) return usage(1, true);
00114         cdelim = argv[m];
00115       } else if (arg == "--version") {
00116         std::cout
00117           << argv[0]
00118           << ": $Id: dd2a53288a82171129091d16bec6d1457568eb4d $\n"
00119           << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n";
00120         return 0;
00121       } else
00122         return usage(!(arg == "-h" || arg == "--help"), arg != "--help");
00123     }
00124 
00125     if (!ifile.empty() && !istring.empty()) {
00126       std::cerr << "Cannot specify --input-string and --input-file together\n";
00127       return 1;
00128     }
00129     if (ifile == "-") ifile.clear();
00130     std::ifstream infile;
00131     std::istringstream instring;
00132     if (!ifile.empty()) {
00133       infile.open(ifile.c_str());
00134       if (!infile.is_open()) {
00135         std::cerr << "Cannot open " << ifile << " for reading\n";
00136         return 1;
00137       }
00138     } else if (!istring.empty()) {
00139       std::string::size_type m = 0;
00140       while (true) {
00141         m = istring.find(lsep, m);
00142         if (m == std::string::npos)
00143           break;
00144         istring[m] = '\n';
00145       }
00146       instring.str(istring);
00147     }
00148     std::istream* input = !ifile.empty() ? &infile :
00149       (!istring.empty() ? &instring : &std::cin);
00150 
00151     std::ofstream outfile;
00152     if (ofile == "-") ofile.clear();
00153     if (!ofile.empty()) {
00154       outfile.open(ofile.c_str());
00155       if (!outfile.is_open()) {
00156         std::cerr << "Cannot open " << ofile << " for writing\n";
00157         return 1;
00158       }
00159     }
00160     std::ostream* output = !ofile.empty() ? &outfile : &std::cout;
00161 
00162     const TransverseMercator& TMS =
00163       series ? TransverseMercator(a, f, k0) : TransverseMercator(1, 0, 1);
00164 
00165     const TransverseMercatorExact& TME =
00166       exact ? TransverseMercatorExact(a, f, k0, extended)
00167       : TransverseMercatorExact(1, real(0.1), 1, false);
00168 
00169     std::string s;
00170     int retval = 0;
00171     std::cout << std::fixed;
00172     while (std::getline(*input, s)) {
00173       try {
00174         std::string eol("\n");
00175         if (!cdelim.empty()) {
00176           std::string::size_type m = s.find(cdelim);
00177           if (m != std::string::npos) {
00178             eol = " " + s.substr(m) + "\n";
00179             s = s.substr(0, m);
00180           }
00181         }
00182         std::istringstream str(s);
00183         real lat, lon, x, y;
00184         std::string stra, strb;
00185         if (!(str >> stra >> strb))
00186           throw GeographicErr("Incomplete input: " + s);
00187         if (reverse) {
00188           x = Utility::num<real>(stra);
00189           y = Utility::num<real>(strb);
00190         } else
00191           DMS::DecodeLatLon(stra, strb, lat, lon);
00192         std::string strc;
00193         if (str >> strc)
00194           throw GeographicErr("Extraneous input: " + strc);
00195         real gamma, k;
00196         if (reverse) {
00197           if (series)
00198             TMS.Reverse(lon0, x, y, lat, lon, gamma, k);
00199           else
00200             TME.Reverse(lon0, x, y, lat, lon, gamma, k);
00201           *output << Utility::str<real>(lat, 15) << " "
00202                   << Utility::str<real>(lon, 15) << " "
00203                   << Utility::str<real>(gamma, 16) << " "
00204                   << Utility::str<real>(k, 16) << eol;
00205         } else {
00206           if (series)
00207             TMS.Forward(lon0, lat, lon, x, y, gamma, k);
00208           else
00209             TME.Forward(lon0, lat, lon, x, y, gamma, k);
00210           *output << Utility::str<real>(x, 10) << " "
00211                   << Utility::str<real>(y, 10) << " "
00212                   << Utility::str<real>(gamma, 16) << " "
00213                   << Utility::str<real>(k, 16) << eol;
00214         }
00215       }
00216       catch (const std::exception& e) {
00217         *output << "ERROR: " << e.what() << "\n";
00218         retval = 1;
00219       }
00220     }
00221     return retval;
00222   }
00223   catch (const std::exception& e) {
00224     std::cerr << "Caught exception: " << e.what() << "\n";
00225     return 1;
00226   }
00227   catch (...) {
00228     std::cerr << "Caught unknown exception\n";
00229     return 1;
00230   }
00231 }
geographiclib-1.21/doc/html/functions_0x76.html0000644000175000017500000001147611745620415021265 0ustar frankiefrankie GeographicLib: Class Members
Here is a list of all class members with links to the classes they belong to:

- v -

geographiclib-1.21/doc/html/Geodesic_8cpp_source.html0000644000175000017500000040503111745620414022516 0ustar frankiefrankie GeographicLib: Geodesic.cpp Source File
Geodesic.cpp
Go to the documentation of this file.
00001 /**
00002  * \file Geodesic.cpp
00003  * \brief Implementation for GeographicLib::Geodesic class
00004  *
00005  * Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  *
00009  * This is a reformulation of the geodesic problem.  The notation is as
00010  * follows:
00011  * - at a general point (no suffix or 1 or 2 as suffix)
00012  *   - phi = latitude
00013  *   - beta = latitude on auxiliary sphere
00014  *   - omega = longitude on auxiliary sphere
00015  *   - lambda = longitude
00016  *   - alpha = azimuth of great circle
00017  *   - sigma = arc length along great circle
00018  *   - s = distance
00019  *   - tau = scaled distance (= sigma at multiples of pi/2)
00020  * - at northwards equator crossing
00021  *   - beta = phi = 0
00022  *   - omega = lambda = 0
00023  *   - alpha = alpha0
00024  *   - sigma = s = 0
00025  * - a 12 suffix means a difference, e.g., s12 = s2 - s1.
00026  * - s and c prefixes mean sin and cos
00027  **********************************************************************/
00028 
00029 #include <GeographicLib/Geodesic.hpp>
00030 #include <GeographicLib/GeodesicLine.hpp>
00031 
00032 #define GEOGRAPHICLIB_GEODESIC_CPP \
00033   "$Id: dd137806b8a5ba58211a37eb87e163b8a9bd7aa7 $"
00034 
00035 RCSID_DECL(GEOGRAPHICLIB_GEODESIC_CPP)
00036 RCSID_DECL(GEOGRAPHICLIB_GEODESIC_HPP)
00037 
00038 namespace GeographicLib {
00039 
00040   using namespace std;
00041 
00042   // Underflow guard.  We require
00043   //   tiny_ * epsilon() > 0
00044   //   tiny_ + epsilon() == epsilon()
00045   const Math::real Geodesic::tiny_ = sqrt(numeric_limits<real>::min());
00046   const Math::real Geodesic::tol0_ = numeric_limits<real>::epsilon();
00047   // Increase multiplier in defn of tol1_ from 100 to 200 to fix inverse case
00048   // 52.784459512564 0 -52.784459512563990912 179.634407464943777557
00049   // which otherwise failed for Visual Studio 10 (Release and Debug)
00050   const Math::real Geodesic::tol1_ = 200 * tol0_;
00051   const Math::real Geodesic::tol2_ = sqrt(numeric_limits<real>::epsilon());
00052   const Math::real Geodesic::xthresh_ = 1000 * tol2_;
00053 
00054   Geodesic::Geodesic(real a, real f)
00055     : _a(a)
00056     , _f(f <= 1 ? f : 1/f)
00057     , _f1(1 - _f)
00058     , _e2(_f * (2 - _f))
00059     , _ep2(_e2 / Math::sq(_f1))       // e2 / (1 - e2)
00060     , _n(_f / ( 2 - _f))
00061     , _b(_a * _f1)
00062     , _c2((Math::sq(_a) + Math::sq(_b) *
00063            (_e2 == 0 ? 1 :
00064             (_e2 > 0 ? Math::atanh(sqrt(_e2)) : atan(sqrt(-_e2))) /
00065             sqrt(abs(_e2))))/2) // authalic radius squared
00066       // The sig12 threshold for "really short"
00067     , _etol2(10 * tol2_ / max(real(0.1), sqrt(abs(_e2))))
00068   {
00069     if (!(Math::isfinite(_a) && _a > 0))
00070       throw GeographicErr("Major radius is not positive");
00071     if (!(Math::isfinite(_b) && _b > 0))
00072       throw GeographicErr("Minor radius is not positive");
00073     A3coeff();
00074     C3coeff();
00075     C4coeff();
00076   }
00077 
00078   const Geodesic Geodesic::WGS84(Constants::WGS84_a<real>(),
00079                                  Constants::WGS84_f<real>());
00080 
00081   Math::real Geodesic::SinCosSeries(bool sinp,
00082                                     real sinx, real cosx,
00083                                     const real c[], int n) throw() {
00084     // Evaluate
00085     // y = sinp ? sum(c[i] * sin( 2*i    * x), i, 1, n) :
00086     //            sum(c[i] * cos((2*i+1) * x), i, 0, n-1) :
00087     // using Clenshaw summation.  N.B. c[0] is unused for sin series
00088     // Approx operation count = (n + 5) mult and (2 * n + 2) add
00089     c += (n + sinp);            // Point to one beyond last element
00090     real
00091       ar = 2 * (cosx - sinx) * (cosx + sinx), // 2 * cos(2 * x)
00092       y0 = n & 1 ? *--c : 0, y1 = 0;          // accumulators for sum
00093     // Now n is even
00094     n /= 2;
00095     while (n--) {
00096       // Unroll loop x 2, so accumulators return to their original role
00097       y1 = ar * y0 - y1 + *--c;
00098       y0 = ar * y1 - y0 + *--c;
00099     }
00100     return sinp
00101       ? 2 * sinx * cosx * y0    // sin(2 * x) * y0
00102       : cosx * (y0 - y1);       // cos(x) * (y0 - y1)
00103   }
00104 
00105   GeodesicLine Geodesic::Line(real lat1, real lon1, real azi1, unsigned caps)
00106     const throw() {
00107     return GeodesicLine(*this, lat1, lon1, azi1, caps);
00108   }
00109 
00110   Math::real Geodesic::GenDirect(real lat1, real lon1, real azi1,
00111                                  bool arcmode, real s12_a12, unsigned outmask,
00112                                  real& lat2, real& lon2, real& azi2,
00113                                  real& s12, real& m12, real& M12, real& M21,
00114                                  real& S12) const throw() {
00115     return GeodesicLine(*this, lat1, lon1, azi1,
00116                         // Automatically supply DISTANCE_IN if necessary
00117                         outmask | (arcmode ? NONE : DISTANCE_IN))
00118       .                         // Note the dot!
00119       GenPosition(arcmode, s12_a12, outmask,
00120                   lat2, lon2, azi2, s12, m12, M12, M21, S12);
00121   }
00122 
00123   Math::real Geodesic::GenInverse(real lat1, real lon1, real lat2, real lon2,
00124                                   unsigned outmask,
00125                                   real& s12, real& azi1, real& azi2,
00126                                   real& m12, real& M12, real& M21, real& S12)
00127     const throw() {
00128     outmask &= OUT_ALL;
00129     lon1 = AngNormalize(lon1);
00130     real lon12 = AngNormalize(AngNormalize(lon2) - lon1);
00131     // If very close to being on the same meridian, then make it so.
00132     // Not sure this is necessary...
00133     lon12 = AngRound(lon12);
00134     // Make longitude difference positive.
00135     int lonsign = lon12 >= 0 ? 1 : -1;
00136     lon12 *= lonsign;
00137     if (lon12 == 180)
00138       lonsign = 1;
00139     // If really close to the equator, treat as on equator.
00140     lat1 = AngRound(lat1);
00141     lat2 = AngRound(lat2);
00142     // Swap points so that point with higher (abs) latitude is point 1
00143     int swapp = abs(lat1) >= abs(lat2) ? 1 : -1;
00144     if (swapp < 0) {
00145       lonsign *= -1;
00146       swap(lat1, lat2);
00147     }
00148     // Make lat1 <= 0
00149     int latsign = lat1 < 0 ? 1 : -1;
00150     lat1 *= latsign;
00151     lat2 *= latsign;
00152     // Now we have
00153     //
00154     //     0 <= lon12 <= 180
00155     //     -90 <= lat1 <= 0
00156     //     lat1 <= lat2 <= -lat1
00157     //
00158     // longsign, swapp, latsign register the transformation to bring the
00159     // coordinates to this canonical form.  In all cases, 1 means no change was
00160     // made.  We make these transformations so that there are few cases to
00161     // check, e.g., on verifying quadrants in atan2.  In addition, this
00162     // enforces some symmetries in the results returned.
00163 
00164     real phi, sbet1, cbet1, sbet2, cbet2, s12x, m12x;
00165 
00166     phi = lat1 * Math::degree<real>();
00167     // Ensure cbet1 = +epsilon at poles
00168     sbet1 = _f1 * sin(phi);
00169     cbet1 = lat1 == -90 ? tiny_ : cos(phi);
00170     SinCosNorm(sbet1, cbet1);
00171 
00172     phi = lat2 * Math::degree<real>();
00173     // Ensure cbet2 = +epsilon at poles
00174     sbet2 = _f1 * sin(phi);
00175     cbet2 = abs(lat2) == 90 ? tiny_ : cos(phi);
00176     SinCosNorm(sbet2, cbet2);
00177 
00178     // If cbet1 < -sbet1, then cbet2 - cbet1 is a sensitive measure of the
00179     // |bet1| - |bet2|.  Alternatively (cbet1 >= -sbet1), abs(sbet2) + sbet1 is
00180     // a better measure.  This logic is used in assigning calp2 in Lambda12.
00181     // Sometimes these quantities vanish and in that case we force bet2 = +/-
00182     // bet1 exactly.  An example where is is necessary is the inverse problem
00183     // 48.522876735459 0 -48.52287673545898293 179.599720456223079643
00184     // which failed with Visual Studio 10 (Release and Debug)
00185 
00186     if (cbet1 < -sbet1) {
00187       if (cbet2 == cbet1)
00188         sbet2 = sbet2 < 0 ? sbet1 : -sbet1;
00189     } else {
00190       if (abs(sbet2) == -sbet1)
00191         cbet2 = cbet1;
00192     }
00193 
00194     real
00195       lam12 = lon12 * Math::degree<real>(),
00196       slam12 = lon12 == 180 ? 0 : sin(lam12),
00197       clam12 = cos(lam12);      // lon12 == 90 isn't interesting
00198 
00199     real a12, sig12, calp1, salp1, calp2, salp2;
00200     // index zero elements of these arrays are unused
00201     real C1a[nC1_ + 1], C2a[nC2_ + 1], C3a[nC3_];
00202 
00203     bool meridian = lat1 == -90 || slam12 == 0;
00204 
00205     if (meridian) {
00206 
00207       // Endpoints are on a single full meridian, so the geodesic might lie on
00208       // a meridian.
00209 
00210       calp1 = clam12; salp1 = slam12; // Head to the target longitude
00211       calp2 = 1; salp2 = 0;           // At the target we're heading north
00212 
00213       real
00214         // tan(bet) = tan(sig) * cos(alp)
00215         ssig1 = sbet1, csig1 = calp1 * cbet1,
00216         ssig2 = sbet2, csig2 = calp2 * cbet2;
00217 
00218       // sig12 = sig2 - sig1
00219       sig12 = atan2(max(csig1 * ssig2 - ssig1 * csig2, real(0)),
00220                     csig1 * csig2 + ssig1 * ssig2);
00221       {
00222         real dummy;
00223         Lengths(_n, sig12, ssig1, csig1, ssig2, csig2,
00224                 cbet1, cbet2, s12x, m12x, dummy,
00225                 (outmask & GEODESICSCALE) != 0U, M12, M21, C1a, C2a);
00226       }
00227       // Add the check for sig12 since zero length geodesics might yield m12 <
00228       // 0.  Test case was
00229       //
00230       //    echo 20.001 0 20.001 0 | Geod -i
00231       //
00232       // In fact, we will have sig12 > pi/2 for meridional geodesic which is
00233       // not a shortest path.
00234       if (sig12 < 1 || m12x >= 0) {
00235         m12x *= _a;
00236         s12x *= _b;
00237         a12 = sig12 / Math::degree<real>();
00238       } else
00239         // m12 < 0, i.e., prolate and too close to anti-podal
00240         meridian = false;
00241     }
00242 
00243     real omg12;
00244     if (!meridian &&
00245         sbet1 == 0 &&   // and sbet2 == 0
00246         // Mimic the way Lambda12 works with calp1 = 0
00247         (_f <= 0 || lam12 <= Math::pi<real>() - _f * Math::pi<real>())) {
00248 
00249       // Geodesic runs along equator
00250       calp1 = calp2 = 0; salp1 = salp2 = 1;
00251       s12x = _a * lam12;
00252       m12x = _b * sin(lam12 / _f1);
00253       if (outmask & GEODESICSCALE)
00254         M12 = M21 = cos(lam12 / _f1);
00255       a12 = lon12 / _f1;
00256       sig12 = omg12 = lam12 / _f1;
00257 
00258     } else if (!meridian) {
00259 
00260       // Now point1 and point2 belong within a hemisphere bounded by a
00261       // meridian and geodesic is neither meridional or equatorial.
00262 
00263       // Figure a starting point for Newton's method
00264       sig12 = InverseStart(sbet1, cbet1, sbet2, cbet2,
00265                            lam12,
00266                            salp1, calp1, salp2, calp2,
00267                            C1a, C2a);
00268 
00269       if (sig12 >= 0) {
00270         // Short lines (InverseStart sets salp2, calp2)
00271         real wm = sqrt(1 - _e2 * Math::sq((cbet1 + cbet2) / 2));
00272         s12x = sig12 * _a * wm;
00273         m12x = Math::sq(wm) * _a / _f1 * sin(sig12 * _f1 / wm);
00274         if (outmask & GEODESICSCALE)
00275           M12 = M21 = cos(sig12 * _f1 / wm);
00276         a12 = sig12 / Math::degree<real>();
00277         omg12 = lam12 / wm;
00278       } else {
00279 
00280         // Newton's method
00281         real ssig1, csig1, ssig2, csig2, eps;
00282         real ov = 0;
00283         unsigned numit = 0;
00284         for (unsigned trip = 0; numit < maxit_; ++numit) {
00285           real dv;
00286           real v = Lambda12(sbet1, cbet1, sbet2, cbet2, salp1, calp1,
00287                             salp2, calp2, sig12, ssig1, csig1, ssig2, csig2,
00288                             eps, omg12, trip < 1, dv, C1a, C2a, C3a) - lam12;
00289           if (!(abs(v) > tiny_) || !(trip < 1)) {
00290             if (!(abs(v) <= max(tol1_, ov)))
00291               numit = maxit_;
00292             break;
00293           }
00294           real
00295             dalp1 = -v/dv;
00296           real
00297             sdalp1 = sin(dalp1), cdalp1 = cos(dalp1),
00298             nsalp1 = salp1 * cdalp1 + calp1 * sdalp1;
00299           calp1 = calp1 * cdalp1 - salp1 * sdalp1;
00300           salp1 = max(real(0), nsalp1);
00301           SinCosNorm(salp1, calp1);
00302           // In some regimes we don't get quadratic convergence because slope
00303           // -> 0.  So use convergence conditions based on epsilon instead of
00304           // sqrt(epsilon).  The first criterion is a test on abs(v) against
00305           // 100 * epsilon.  The second takes credit for an anticipated
00306           // reduction in abs(v) by v/ov (due to the latest update in alp1) and
00307           // checks this against epsilon.
00308           if (!(abs(v) >= tol1_ && Math::sq(v) >= ov * tol0_)) ++trip;
00309           ov = abs(v);
00310         }
00311 
00312         if (numit >= maxit_) {
00313           // Signal failure.
00314           if (outmask & DISTANCE)
00315             s12 = Math::NaN<real>();
00316           if (outmask & AZIMUTH)
00317             azi1 = azi2 = Math::NaN<real>();
00318           if (outmask & REDUCEDLENGTH)
00319             m12 = Math::NaN<real>();
00320           if (outmask & GEODESICSCALE)
00321             M12 = M21 = Math::NaN<real>();
00322           if (outmask & AREA)
00323             S12 = Math::NaN<real>();
00324           return Math::NaN<real>();
00325         }
00326 
00327         {
00328           real dummy;
00329           Lengths(eps, sig12, ssig1, csig1, ssig2, csig2,
00330                   cbet1, cbet2, s12x, m12x, dummy,
00331                   (outmask & GEODESICSCALE) != 0U, M12, M21, C1a, C2a);
00332         }
00333         m12x *= _a;
00334         s12x *= _b;
00335         a12 = sig12 / Math::degree<real>();
00336         omg12 = lam12 - omg12;
00337       }
00338     }
00339 
00340     if (outmask & DISTANCE)
00341       s12 = 0 + s12x;           // Convert -0 to 0
00342 
00343     if (outmask & REDUCEDLENGTH)
00344       m12 = 0 + m12x;           // Convert -0 to 0
00345 
00346     if (outmask & AREA) {
00347       real
00348         // From Lambda12: sin(alp1) * cos(bet1) = sin(alp0)
00349         salp0 = salp1 * cbet1,
00350         calp0 = Math::hypot(calp1, salp1 * sbet1); // calp0 > 0
00351       real alp12;
00352       if (calp0 != 0 && salp0 != 0) {
00353         real
00354           // From Lambda12: tan(bet) = tan(sig) * cos(alp)
00355           ssig1 = sbet1, csig1 = calp1 * cbet1,
00356           ssig2 = sbet2, csig2 = calp2 * cbet2,
00357           k2 = Math::sq(calp0) * _ep2,
00358           // Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0).
00359           A4 = Math::sq(_a) * calp0 * salp0 * _e2;
00360         SinCosNorm(ssig1, csig1);
00361         SinCosNorm(ssig2, csig2);
00362         real C4a[nC4_];
00363         C4f(k2, C4a);
00364         real
00365           B41 = SinCosSeries(false, ssig1, csig1, C4a, nC4_),
00366           B42 = SinCosSeries(false, ssig2, csig2, C4a, nC4_);
00367         S12 = A4 * (B42 - B41);
00368       } else
00369         // Avoid problems with indeterminate sig1, sig2 on equator
00370         S12 = 0;
00371 
00372       if (!meridian &&
00373           omg12 < real(0.75) * Math::pi<real>() && // Long difference too big
00374           sbet2 - sbet1 < real(1.75)) {            // Lat difference too big
00375         // Use tan(Gamma/2) = tan(omg12/2)
00376         // * (tan(bet1/2)+tan(bet2/2))/(1+tan(bet1/2)*tan(bet2/2))
00377         // with tan(x/2) = sin(x)/(1+cos(x))
00378         real
00379           somg12 = sin(omg12), domg12 = 1 + cos(omg12),
00380           dbet1 = 1 + cbet1, dbet2 = 1 + cbet2;
00381         alp12 = 2 * atan2( somg12 * ( sbet1 * dbet2 + sbet2 * dbet1 ),
00382                            domg12 * ( sbet1 * sbet2 + dbet1 * dbet2 ) );
00383       } else {
00384         // alp12 = alp2 - alp1, used in atan2 so no need to normalize
00385         real
00386           salp12 = salp2 * calp1 - calp2 * salp1,
00387           calp12 = calp2 * calp1 + salp2 * salp1;
00388         // The right thing appears to happen if alp1 = +/-180 and alp2 = 0, viz
00389         // salp12 = -0 and alp12 = -180.  However this depends on the sign
00390         // being attached to 0 correctly.  The following ensures the correct
00391         // behavior.
00392         if (salp12 == 0 && calp12 < 0) {
00393           salp12 = tiny_ * calp1;
00394           calp12 = -1;
00395         }
00396         alp12 = atan2(salp12, calp12);
00397       }
00398       S12 += _c2 * alp12;
00399       S12 *= swapp * lonsign * latsign;
00400       // Convert -0 to 0
00401       S12 += 0;
00402     }
00403 
00404     // Convert calp, salp to azimuth accounting for lonsign, swapp, latsign.
00405     if (swapp < 0) {
00406       swap(salp1, salp2);
00407       swap(calp1, calp2);
00408       if (outmask & GEODESICSCALE)
00409         swap(M12, M21);
00410     }
00411 
00412     salp1 *= swapp * lonsign; calp1 *= swapp * latsign;
00413     salp2 *= swapp * lonsign; calp2 *= swapp * latsign;
00414 
00415     if (outmask & AZIMUTH) {
00416       // minus signs give range [-180, 180). 0- converts -0 to +0.
00417       azi1 = 0 - atan2(-salp1, calp1) / Math::degree<real>();
00418       azi2 = 0 - atan2(-salp2, calp2) / Math::degree<real>();
00419     }
00420 
00421     // Returned value in [0, 180]
00422     return a12;
00423   }
00424 
00425   void Geodesic::Lengths(real eps, real sig12,
00426                          real ssig1, real csig1, real ssig2, real csig2,
00427                          real cbet1, real cbet2,
00428                          real& s12b, real& m12a, real& m0,
00429                          bool scalep, real& M12, real& M21,
00430                          // Scratch areas of the right size
00431                          real C1a[], real C2a[]) const throw() {
00432     // Return m12a = (reduced length)/_a; also calculate s12b = distance/_b,
00433     // and m0 = coefficient of secular term in expression for reduced length.
00434     C1f(eps, C1a);
00435     C2f(eps, C2a);
00436     real
00437       A1m1 = A1m1f(eps),
00438       AB1 = (1 + A1m1) * (SinCosSeries(true, ssig2, csig2, C1a, nC1_) -
00439                           SinCosSeries(true, ssig1, csig1, C1a, nC1_)),
00440       A2m1 = A2m1f(eps),
00441       AB2 = (1 + A2m1) * (SinCosSeries(true, ssig2, csig2, C2a, nC2_) -
00442                           SinCosSeries(true, ssig1, csig1, C2a, nC2_)),
00443       cbet1sq = Math::sq(cbet1),
00444       cbet2sq = Math::sq(cbet2),
00445       w1 = sqrt(1 - _e2 * cbet1sq),
00446       w2 = sqrt(1 - _e2 * cbet2sq),
00447       // Make sure it's OK to have repeated dummy arguments
00448       m0x = A1m1 - A2m1,
00449       J12 = m0x * sig12 + (AB1 - AB2);
00450     m0 = m0x;
00451     // Missing a factor of _a.
00452     // Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure accurate
00453     // cancellation in the case of coincident points.
00454     m12a = (w2 * (csig1 * ssig2) - w1 * (ssig1 * csig2))
00455       - _f1 * csig1 * csig2 * J12;
00456     // Missing a factor of _b
00457     s12b = (1 + A1m1) * sig12 + AB1;
00458     if (scalep) {
00459       real csig12 = csig1 * csig2 + ssig1 * ssig2;
00460       J12 *= _f1;
00461       M12 = csig12 + (_e2 * (cbet1sq - cbet2sq) * ssig2 / (w1 + w2)
00462                       - csig2 * J12) * ssig1 / w1;
00463       M21 = csig12 - (_e2 * (cbet1sq - cbet2sq) * ssig1 / (w1 + w2)
00464                       - csig1 * J12) * ssig2 / w2;
00465     }
00466   }
00467 
00468   Math::real Geodesic::Astroid(real x, real y) throw() {
00469     // Solve k^4+2*k^3-(x^2+y^2-1)*k^2-2*y^2*k-y^2 = 0 for positive root k.
00470     // This solution is adapted from Geocentric::Reverse.
00471     real k;
00472     real
00473       p = Math::sq(x),
00474       q = Math::sq(y),
00475       r = (p + q - 1) / 6;
00476     if ( !(q == 0 && r <= 0) ) {
00477       real
00478         // Avoid possible division by zero when r = 0 by multiplying equations
00479         // for s and t by r^3 and r, resp.
00480         S = p * q / 4,            // S = r^3 * s
00481         r2 = Math::sq(r),
00482         r3 = r * r2,
00483         // The discrimant of the quadratic equation for T3.  This is zero on
00484         // the evolute curve p^(1/3)+q^(1/3) = 1
00485         disc = S * (S + 2 * r3);
00486       real u = r;
00487       if (disc >= 0) {
00488         real T3 = S + r3;
00489         // Pick the sign on the sqrt to maximize abs(T3).  This minimizes loss
00490         // of precision due to cancellation.  The result is unchanged because
00491         // of the way the T is used in definition of u.
00492         T3 += T3 < 0 ? -sqrt(disc) : sqrt(disc); // T3 = (r * t)^3
00493         // N.B. cbrt always returns the real root.  cbrt(-8) = -2.
00494         real T = Math::cbrt(T3); // T = r * t
00495         // T can be zero; but then r2 / T -> 0.
00496         u += T + (T != 0 ? r2 / T : 0);
00497       } else {
00498         // T is complex, but the way u is defined the result is real.
00499         real ang = atan2(sqrt(-disc), -(S + r3));
00500         // There are three possible cube roots.  We choose the root which
00501         // avoids cancellation.  Note that disc < 0 implies that r < 0.
00502         u += 2 * r * cos(ang / 3);
00503       }
00504       real
00505         v = sqrt(Math::sq(u) + q),    // guaranteed positive
00506         // Avoid loss of accuracy when u < 0.
00507         uv = u < 0 ? q / (v - u) : u + v, // u+v, guaranteed positive
00508         w = (uv - q) / (2 * v);           // positive?
00509       // Rearrange expression for k to avoid loss of accuracy due to
00510       // subtraction.  Division by 0 not possible because uv > 0, w >= 0.
00511       k = uv / (sqrt(uv + Math::sq(w)) + w);   // guaranteed positive
00512     } else {               // q == 0 && r <= 0
00513       // y = 0 with |x| <= 1.  Handle this case directly.
00514       // for y small, positive root is k = abs(y)/sqrt(1-x^2)
00515       k = 0;
00516     }
00517     return k;
00518   }
00519 
00520   Math::real Geodesic::InverseStart(real sbet1, real cbet1,
00521                                     real sbet2, real cbet2,
00522                                     real lam12,
00523                                     real& salp1, real& calp1,
00524                                     // Only updated if return val >= 0
00525                                     real& salp2, real& calp2,
00526                                     // Scratch areas of the right size
00527                                     real C1a[], real C2a[]) const throw() {
00528     // Return a starting point for Newton's method in salp1 and calp1 (function
00529     // value is -1).  If Newton's method doesn't need to be used, return also
00530     // salp2 and calp2 and function value is sig12.
00531     real
00532       sig12 = -1,               // Return value
00533       // bet12 = bet2 - bet1 in [0, pi); bet12a = bet2 + bet1 in (-pi, 0]
00534       sbet12 = sbet2 * cbet1 - cbet2 * sbet1,
00535       cbet12 = cbet2 * cbet1 + sbet2 * sbet1;
00536 #if defined(__GNUC__) && __GNUC__ == 4 && \
00537   (__GNUC_MINOR__ < 6 || defined(__MINGW32__))
00538     // Volatile declaration needed to fix inverse cases
00539     // 88.202499451857 0 -88.202499451857 179.981022032992859592
00540     // 89.262080389218 0 -89.262080389218 179.992207982775375662
00541     // 89.333123580033 0 -89.333123580032997687 179.99295812360148422
00542     // which otherwise fail with g++ 4.4.4 x86 -O3 (Linux)
00543     // and g++ 4.4.0 (mingw) and g++ 4.6.1 (tdm mingw).
00544     real sbet12a;
00545     {
00546       volatile real xx1 = sbet2 * cbet1;
00547       volatile real xx2 = cbet2 * sbet1;
00548       sbet12a = xx1 + xx2;
00549     }
00550 #else
00551     real sbet12a = sbet2 * cbet1 + cbet2 * sbet1;
00552 #endif
00553     bool shortline = cbet12 >= 0 && sbet12 < real(0.5) &&
00554       lam12 <= Math::pi<real>() / 6;
00555     real
00556       omg12 = (!shortline ? lam12 :
00557                lam12 / sqrt(1 - _e2 * Math::sq((cbet1 + cbet2) / 2))),
00558       somg12 = sin(omg12), comg12 = cos(omg12);
00559 
00560     salp1 = cbet2 * somg12;
00561     calp1 = comg12 >= 0 ?
00562       sbet12 + cbet2 * sbet1 * Math::sq(somg12) / (1 + comg12) :
00563       sbet12a - cbet2 * sbet1 * Math::sq(somg12) / (1 - comg12);
00564 
00565     real
00566       ssig12 = Math::hypot(salp1, calp1),
00567       csig12 = sbet1 * sbet2 + cbet1 * cbet2 * comg12;
00568 
00569     if (shortline && ssig12 < _etol2) {
00570       // really short lines
00571       salp2 = cbet1 * somg12;
00572       calp2 = sbet12 - cbet1 * sbet2 * Math::sq(somg12) / (1 + comg12);
00573       SinCosNorm(salp2, calp2);
00574       // Set return value
00575       sig12 = atan2(ssig12, csig12);
00576     } else if (csig12 >= 0 ||
00577                ssig12 >= 3 * abs(_f) * Math::pi<real>() * Math::sq(cbet1)) {
00578       // Nothing to do, zeroth order spherical approximation is OK
00579     } else {
00580       // Scale lam12 and bet2 to x, y coordinate system where antipodal point
00581       // is at origin and singular point is at y = 0, x = -1.
00582       real y, lamscale, betscale;
00583       // Volatile declaration needed to fix inverse case
00584       // 56.320923501171 0 -56.320923501171 179.664747671772880215
00585       // which otherwise fails with g++ 4.4.4 x86 -O3
00586       volatile real x;
00587       if (_f >= 0) {            // In fact f == 0 does not get here
00588         // x = dlong, y = dlat
00589         {
00590           real
00591             k2 = Math::sq(sbet1) * _ep2,
00592             eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2);
00593           lamscale = _f * cbet1 * A3f(eps) * Math::pi<real>();
00594         }
00595         betscale = lamscale * cbet1;
00596 
00597         x = (lam12 - Math::pi<real>()) / lamscale;
00598         y = sbet12a / betscale;
00599       } else {                  // _f < 0
00600         // x = dlat, y = dlong
00601         real
00602           cbet12a = cbet2 * cbet1 - sbet2 * sbet1,
00603           bet12a = atan2(sbet12a, cbet12a);
00604         real m12a, m0, dummy;
00605         // In the case of lon12 = 180, this repeats a calculation made in
00606         // Inverse.
00607         Lengths(_n, Math::pi<real>() + bet12a, sbet1, -cbet1, sbet2, cbet2,
00608                 cbet1, cbet2, dummy, m12a, m0, false,
00609                 dummy, dummy, C1a, C2a);
00610         x = -1 + m12a/(_f1 * cbet1 * cbet2 * m0 * Math::pi<real>());
00611         betscale = x < -real(0.01) ? sbet12a / x :
00612           -_f * Math::sq(cbet1) * Math::pi<real>();
00613         lamscale = betscale / cbet1;
00614         y = (lam12 - Math::pi<real>()) / lamscale;
00615       }
00616 
00617       if (y > -tol1_ && x > -1 - xthresh_) {
00618         // strip near cut
00619         if (_f >= 0) {
00620           salp1 = min(real(1), -real(x)); calp1 = - sqrt(1 - Math::sq(salp1));
00621         } else {
00622           calp1 = max(real(x > -tol1_ ? 0 : -1), real(x));
00623           salp1 = sqrt(1 - Math::sq(calp1));
00624         }
00625       } else {
00626         // Estimate alp1, by solving the astroid problem.
00627         //
00628         // Could estimate alpha1 = theta + pi/2, directly, i.e.,
00629         //   calp1 = y/k; salp1 = -x/(1+k);  for _f >= 0
00630         //   calp1 = x/(1+k); salp1 = -y/k;  for _f < 0 (need to check)
00631         //
00632         // However, it's better to estimate omg12 from astroid and use
00633         // spherical formula to compute alp1.  This reduces the mean number of
00634         // Newton iterations for astroid cases from 2.24 (min 0, max 6) to 2.12
00635         // (min 0 max 5).  The changes in the number of iterations are as
00636         // follows:
00637         //
00638         // change percent
00639         //    1       5
00640         //    0      78
00641         //   -1      16
00642         //   -2       0.6
00643         //   -3       0.04
00644         //   -4       0.002
00645         //
00646         // The histogram of iterations is (m = number of iterations estimating
00647         // alp1 directly, n = number of iterations estimating via omg12, total
00648         // number of trials = 148605):
00649         //
00650         //  iter    m      n
00651         //    0   148    186
00652         //    1 13046  13845
00653         //    2 93315 102225
00654         //    3 36189  32341
00655         //    4  5396      7
00656         //    5   455      1
00657         //    6    56      0
00658         //
00659         // Because omg12 is near pi, estimate work with omg12a = pi - omg12
00660         real k = Astroid(x, y);
00661         real
00662           omg12a = lamscale * ( _f >= 0 ? -x * k/(1 + k) : -y * (1 + k)/k ),
00663           somg12 = sin(omg12a), comg12 = -cos(omg12a);
00664         // Update spherical estimate of alp1 using omg12 instead of lam12
00665         salp1 = cbet2 * somg12;
00666         calp1 = sbet12a - cbet2 * sbet1 * Math::sq(somg12) / (1 - comg12);
00667       }
00668     }
00669     SinCosNorm(salp1, calp1);
00670     return sig12;
00671   }
00672 
00673   Math::real Geodesic::Lambda12(real sbet1, real cbet1, real sbet2, real cbet2,
00674                                 real salp1, real calp1,
00675                                 real& salp2, real& calp2,
00676                                 real& sig12,
00677                                 real& ssig1, real& csig1,
00678                                 real& ssig2, real& csig2,
00679                                 real& eps, real& domg12,
00680                                 bool diffp, real& dlam12,
00681                                 // Scratch areas of the right size
00682                                 real C1a[], real C2a[], real C3a[]) const
00683     throw() {
00684 
00685     if (sbet1 == 0 && calp1 == 0)
00686       // Break degeneracy of equatorial line.  This case has already been
00687       // handled.
00688       calp1 = -tiny_;
00689 
00690     real
00691       // sin(alp1) * cos(bet1) = sin(alp0)
00692       salp0 = salp1 * cbet1,
00693       calp0 = Math::hypot(calp1, salp1 * sbet1); // calp0 > 0
00694 
00695     real somg1, comg1, somg2, comg2, omg12, lam12;
00696     // tan(bet1) = tan(sig1) * cos(alp1)
00697     // tan(omg1) = sin(alp0) * tan(sig1) = tan(omg1)=tan(alp1)*sin(bet1)
00698     ssig1 = sbet1; somg1 = salp0 * sbet1;
00699     csig1 = comg1 = calp1 * cbet1;
00700     SinCosNorm(ssig1, csig1);
00701     // SinCosNorm(somg1, comg1); -- don't need to normalize!
00702 
00703     // Enforce symmetries in the case abs(bet2) = -bet1.  Need to be careful
00704     // about this case, since this can yield singularities in the Newton
00705     // iteration.
00706     // sin(alp2) * cos(bet2) = sin(alp0)
00707     salp2 = cbet2 != cbet1 ? salp0 / cbet2 : salp1;
00708     // calp2 = sqrt(1 - sq(salp2))
00709     //       = sqrt(sq(calp0) - sq(sbet2)) / cbet2
00710     // and subst for calp0 and rearrange to give (choose positive sqrt
00711     // to give alp2 in [0, pi/2]).
00712     calp2 = cbet2 != cbet1 || abs(sbet2) != -sbet1 ?
00713       sqrt(Math::sq(calp1 * cbet1) +
00714            (cbet1 < -sbet1 ?
00715             (cbet2 - cbet1) * (cbet1 + cbet2) :
00716             (sbet1 - sbet2) * (sbet1 + sbet2))) / cbet2 :
00717       abs(calp1);
00718     // tan(bet2) = tan(sig2) * cos(alp2)
00719     // tan(omg2) = sin(alp0) * tan(sig2).
00720     ssig2 = sbet2; somg2 = salp0 * sbet2;
00721     csig2 = comg2 = calp2 * cbet2;
00722     SinCosNorm(ssig2, csig2);
00723     // SinCosNorm(somg2, comg2); -- don't need to normalize!
00724 
00725     // sig12 = sig2 - sig1, limit to [0, pi]
00726     sig12 = atan2(max(csig1 * ssig2 - ssig1 * csig2, real(0)),
00727                   csig1 * csig2 + ssig1 * ssig2);
00728 
00729     // omg12 = omg2 - omg1, limit to [0, pi]
00730     omg12 = atan2(max(comg1 * somg2 - somg1 * comg2, real(0)),
00731                   comg1 * comg2 + somg1 * somg2);
00732     real B312, h0;
00733     real k2 = Math::sq(calp0) * _ep2;
00734     eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2);
00735     C3f(eps, C3a);
00736     B312 = (SinCosSeries(true, ssig2, csig2, C3a, nC3_-1) -
00737             SinCosSeries(true, ssig1, csig1, C3a, nC3_-1));
00738     h0 = -_f * A3f(eps);
00739     domg12 = salp0 * h0 * (sig12 + B312);
00740     lam12 = omg12 + domg12;
00741 
00742     if (diffp) {
00743       if (calp2 == 0)
00744         dlam12 = - 2 * sqrt(1 - _e2 * Math::sq(cbet1)) / sbet1;
00745       else {
00746         real dummy;
00747         Lengths(eps, sig12, ssig1, csig1, ssig2, csig2,
00748                 cbet1, cbet2, dummy, dlam12, dummy,
00749                 false, dummy, dummy, C1a, C2a);
00750         dlam12 /= calp2 * cbet2;
00751       }
00752     }
00753 
00754     return lam12;
00755   }
00756 
00757   Math::real Geodesic::A3f(real eps) const throw() {
00758     // Evaluation sum(_A3c[k] * eps^k, k, 0, nA3x_-1) by Horner's method
00759     real v = 0;
00760     for (int i = nA3x_; i; )
00761       v = eps * v + _A3x[--i];
00762     return v;
00763   }
00764 
00765   void Geodesic::C3f(real eps, real c[]) const throw() {
00766     // Evaluation C3 coeffs by Horner's method
00767     // Elements c[1] thru c[nC3_ - 1] are set
00768     for (int j = nC3x_, k = nC3_ - 1; k; ) {
00769       real t = 0;
00770       for (int i = nC3_ - k; i; --i)
00771         t = eps * t + _C3x[--j];
00772       c[k--] = t;
00773     }
00774 
00775     real mult = 1;
00776     for (int k = 1; k < nC3_; ) {
00777       mult *= eps;
00778       c[k++] *= mult;
00779     }
00780   }
00781 
00782   void Geodesic::C4f(real k2, real c[]) const throw() {
00783     // Evaluation C4 coeffs by Horner's method
00784     // Elements c[0] thru c[nC4_ - 1] are set
00785     for (int j = nC4x_, k = nC4_; k; ) {
00786       real t = 0;
00787       for (int i = nC4_ - k + 1; i; --i)
00788         t = k2 * t + _C4x[--j];
00789       c[--k] = t;
00790     }
00791 
00792     real mult = 1;
00793     for (int k = 1; k < nC4_; ) {
00794       mult *= k2;
00795       c[k++] *= mult;
00796     }
00797   }
00798 
00799   // Generated by Maxima on 2010-09-04 10:26:17-04:00
00800 
00801   // The scale factor A1-1 = mean value of I1-1
00802   Math::real Geodesic::A1m1f(real eps) throw() {
00803     real
00804       eps2 = Math::sq(eps),
00805       t;
00806     switch (nA1_/2) {
00807     case 0:
00808       t = 0;
00809       break;
00810     case 1:
00811       t = eps2/4;
00812       break;
00813     case 2:
00814       t = eps2*(eps2+16)/64;
00815       break;
00816     case 3:
00817       t = eps2*(eps2*(eps2+4)+64)/256;
00818       break;
00819     case 4:
00820       t = eps2*(eps2*(eps2*(25*eps2+64)+256)+4096)/16384;
00821       break;
00822     default:
00823       STATIC_ASSERT(nA1_ >= 0 && nA1_ <= 8, "Bad value of nA1_");
00824       t = 0;
00825     }
00826     return (t + eps) / (1 - eps);
00827   }
00828 
00829   // The coefficients C1[l] in the Fourier expansion of B1
00830   void Geodesic::C1f(real eps, real c[]) throw() {
00831     real
00832       eps2 = Math::sq(eps),
00833       d = eps;
00834     switch (nC1_) {
00835     case 0:
00836       break;
00837     case 1:
00838       c[1] = -d/2;
00839       break;
00840     case 2:
00841       c[1] = -d/2;
00842       d *= eps;
00843       c[2] = -d/16;
00844       break;
00845     case 3:
00846       c[1] = d*(3*eps2-8)/16;
00847       d *= eps;
00848       c[2] = -d/16;
00849       d *= eps;
00850       c[3] = -d/48;
00851       break;
00852     case 4:
00853       c[1] = d*(3*eps2-8)/16;
00854       d *= eps;
00855       c[2] = d*(eps2-2)/32;
00856       d *= eps;
00857       c[3] = -d/48;
00858       d *= eps;
00859       c[4] = -5*d/512;
00860       break;
00861     case 5:
00862       c[1] = d*((6-eps2)*eps2-16)/32;
00863       d *= eps;
00864       c[2] = d*(eps2-2)/32;
00865       d *= eps;
00866       c[3] = d*(9*eps2-16)/768;
00867       d *= eps;
00868       c[4] = -5*d/512;
00869       d *= eps;
00870       c[5] = -7*d/1280;
00871       break;
00872     case 6:
00873       c[1] = d*((6-eps2)*eps2-16)/32;
00874       d *= eps;
00875       c[2] = d*((64-9*eps2)*eps2-128)/2048;
00876       d *= eps;
00877       c[3] = d*(9*eps2-16)/768;
00878       d *= eps;
00879       c[4] = d*(3*eps2-5)/512;
00880       d *= eps;
00881       c[5] = -7*d/1280;
00882       d *= eps;
00883       c[6] = -7*d/2048;
00884       break;
00885     case 7:
00886       c[1] = d*(eps2*(eps2*(19*eps2-64)+384)-1024)/2048;
00887       d *= eps;
00888       c[2] = d*((64-9*eps2)*eps2-128)/2048;
00889       d *= eps;
00890       c[3] = d*((72-9*eps2)*eps2-128)/6144;
00891       d *= eps;
00892       c[4] = d*(3*eps2-5)/512;
00893       d *= eps;
00894       c[5] = d*(35*eps2-56)/10240;
00895       d *= eps;
00896       c[6] = -7*d/2048;
00897       d *= eps;
00898       c[7] = -33*d/14336;
00899       break;
00900     case 8:
00901       c[1] = d*(eps2*(eps2*(19*eps2-64)+384)-1024)/2048;
00902       d *= eps;
00903       c[2] = d*(eps2*(eps2*(7*eps2-18)+128)-256)/4096;
00904       d *= eps;
00905       c[3] = d*((72-9*eps2)*eps2-128)/6144;
00906       d *= eps;
00907       c[4] = d*((96-11*eps2)*eps2-160)/16384;
00908       d *= eps;
00909       c[5] = d*(35*eps2-56)/10240;
00910       d *= eps;
00911       c[6] = d*(9*eps2-14)/4096;
00912       d *= eps;
00913       c[7] = -33*d/14336;
00914       d *= eps;
00915       c[8] = -429*d/262144;
00916       break;
00917     default:
00918       STATIC_ASSERT(nC1_ >= 0 && nC1_ <= 8, "Bad value of nC1_");
00919     }
00920   }
00921 
00922   // The coefficients C1p[l] in the Fourier expansion of B1p
00923   void Geodesic::C1pf(real eps, real c[]) throw() {
00924     real
00925       eps2 = Math::sq(eps),
00926       d = eps;
00927     switch (nC1p_) {
00928     case 0:
00929       break;
00930     case 1:
00931       c[1] = d/2;
00932       break;
00933     case 2:
00934       c[1] = d/2;
00935       d *= eps;
00936       c[2] = 5*d/16;
00937       break;
00938     case 3:
00939       c[1] = d*(16-9*eps2)/32;
00940       d *= eps;
00941       c[2] = 5*d/16;
00942       d *= eps;
00943       c[3] = 29*d/96;
00944       break;
00945     case 4:
00946       c[1] = d*(16-9*eps2)/32;
00947       d *= eps;
00948       c[2] = d*(30-37*eps2)/96;
00949       d *= eps;
00950       c[3] = 29*d/96;
00951       d *= eps;
00952       c[4] = 539*d/1536;
00953       break;
00954     case 5:
00955       c[1] = d*(eps2*(205*eps2-432)+768)/1536;
00956       d *= eps;
00957       c[2] = d*(30-37*eps2)/96;
00958       d *= eps;
00959       c[3] = d*(116-225*eps2)/384;
00960       d *= eps;
00961       c[4] = 539*d/1536;
00962       d *= eps;
00963       c[5] = 3467*d/7680;
00964       break;
00965     case 6:
00966       c[1] = d*(eps2*(205*eps2-432)+768)/1536;
00967       d *= eps;
00968       c[2] = d*(eps2*(4005*eps2-4736)+3840)/12288;
00969       d *= eps;
00970       c[3] = d*(116-225*eps2)/384;
00971       d *= eps;
00972       c[4] = d*(2695-7173*eps2)/7680;
00973       d *= eps;
00974       c[5] = 3467*d/7680;
00975       d *= eps;
00976       c[6] = 38081*d/61440;
00977       break;
00978     case 7:
00979       c[1] = d*(eps2*((9840-4879*eps2)*eps2-20736)+36864)/73728;
00980       d *= eps;
00981       c[2] = d*(eps2*(4005*eps2-4736)+3840)/12288;
00982       d *= eps;
00983       c[3] = d*(eps2*(8703*eps2-7200)+3712)/12288;
00984       d *= eps;
00985       c[4] = d*(2695-7173*eps2)/7680;
00986       d *= eps;
00987       c[5] = d*(41604-141115*eps2)/92160;
00988       d *= eps;
00989       c[6] = 38081*d/61440;
00990       d *= eps;
00991       c[7] = 459485*d/516096;
00992       break;
00993     case 8:
00994       c[1] = d*(eps2*((9840-4879*eps2)*eps2-20736)+36864)/73728;
00995       d *= eps;
00996       c[2] = d*(eps2*((120150-86171*eps2)*eps2-142080)+115200)/368640;
00997       d *= eps;
00998       c[3] = d*(eps2*(8703*eps2-7200)+3712)/12288;
00999       d *= eps;
01000       c[4] = d*(eps2*(1082857*eps2-688608)+258720)/737280;
01001       d *= eps;
01002       c[5] = d*(41604-141115*eps2)/92160;
01003       d *= eps;
01004       c[6] = d*(533134-2200311*eps2)/860160;
01005       d *= eps;
01006       c[7] = 459485*d/516096;
01007       d *= eps;
01008       c[8] = 109167851*d/82575360;
01009       break;
01010     default:
01011       STATIC_ASSERT(nC1p_ >= 0 && nC1p_ <= 8, "Bad value of nC1p_");
01012     }
01013   }
01014 
01015   // The scale factor A2-1 = mean value of I2-1
01016   Math::real Geodesic::A2m1f(real eps) throw() {
01017     real
01018       eps2 = Math::sq(eps),
01019       t;
01020     switch (nA2_/2) {
01021     case 0:
01022       t = 0;
01023       break;
01024     case 1:
01025       t = eps2/4;
01026       break;
01027     case 2:
01028       t = eps2*(9*eps2+16)/64;
01029       break;
01030     case 3:
01031       t = eps2*(eps2*(25*eps2+36)+64)/256;
01032       break;
01033     case 4:
01034       t = eps2*(eps2*(eps2*(1225*eps2+1600)+2304)+4096)/16384;
01035       break;
01036     default:
01037       STATIC_ASSERT(nA2_ >= 0 && nA2_ <= 8, "Bad value of nA2_");
01038       t = 0;
01039     }
01040     return t * (1 - eps) - eps;
01041   }
01042 
01043   // The coefficients C2[l] in the Fourier expansion of B2
01044   void Geodesic::C2f(real eps, real c[]) throw() {
01045     real
01046       eps2 = Math::sq(eps),
01047       d = eps;
01048     switch (nC2_) {
01049     case 0:
01050       break;
01051     case 1:
01052       c[1] = d/2;
01053       break;
01054     case 2:
01055       c[1] = d/2;
01056       d *= eps;
01057       c[2] = 3*d/16;
01058       break;
01059     case 3:
01060       c[1] = d*(eps2+8)/16;
01061       d *= eps;
01062       c[2] = 3*d/16;
01063       d *= eps;
01064       c[3] = 5*d/48;
01065       break;
01066     case 4:
01067       c[1] = d*(eps2+8)/16;
01068       d *= eps;
01069       c[2] = d*(eps2+6)/32;
01070       d *= eps;
01071       c[3] = 5*d/48;
01072       d *= eps;
01073       c[4] = 35*d/512;
01074       break;
01075     case 5:
01076       c[1] = d*(eps2*(eps2+2)+16)/32;
01077       d *= eps;
01078       c[2] = d*(eps2+6)/32;
01079       d *= eps;
01080       c[3] = d*(15*eps2+80)/768;
01081       d *= eps;
01082       c[4] = 35*d/512;
01083       d *= eps;
01084       c[5] = 63*d/1280;
01085       break;
01086     case 6:
01087       c[1] = d*(eps2*(eps2+2)+16)/32;
01088       d *= eps;
01089       c[2] = d*(eps2*(35*eps2+64)+384)/2048;
01090       d *= eps;
01091       c[3] = d*(15*eps2+80)/768;
01092       d *= eps;
01093       c[4] = d*(7*eps2+35)/512;
01094       d *= eps;
01095       c[5] = 63*d/1280;
01096       d *= eps;
01097       c[6] = 77*d/2048;
01098       break;
01099     case 7:
01100       c[1] = d*(eps2*(eps2*(41*eps2+64)+128)+1024)/2048;
01101       d *= eps;
01102       c[2] = d*(eps2*(35*eps2+64)+384)/2048;
01103       d *= eps;
01104       c[3] = d*(eps2*(69*eps2+120)+640)/6144;
01105       d *= eps;
01106       c[4] = d*(7*eps2+35)/512;
01107       d *= eps;
01108       c[5] = d*(105*eps2+504)/10240;
01109       d *= eps;
01110       c[6] = 77*d/2048;
01111       d *= eps;
01112       c[7] = 429*d/14336;
01113       break;
01114     case 8:
01115       c[1] = d*(eps2*(eps2*(41*eps2+64)+128)+1024)/2048;
01116       d *= eps;
01117       c[2] = d*(eps2*(eps2*(47*eps2+70)+128)+768)/4096;
01118       d *= eps;
01119       c[3] = d*(eps2*(69*eps2+120)+640)/6144;
01120       d *= eps;
01121       c[4] = d*(eps2*(133*eps2+224)+1120)/16384;
01122       d *= eps;
01123       c[5] = d*(105*eps2+504)/10240;
01124       d *= eps;
01125       c[6] = d*(33*eps2+154)/4096;
01126       d *= eps;
01127       c[7] = 429*d/14336;
01128       d *= eps;
01129       c[8] = 6435*d/262144;
01130       break;
01131     default:
01132       STATIC_ASSERT(nC2_ >= 0 && nC2_ <= 8, "Bad value of nC2_");
01133     }
01134   }
01135 
01136   // The scale factor A3 = mean value of I3
01137   void Geodesic::A3coeff() throw() {
01138     switch (nA3_) {
01139     case 0:
01140       break;
01141     case 1:
01142       _A3x[0] = 1;
01143       break;
01144     case 2:
01145       _A3x[0] = 1;
01146       _A3x[1] = -1/real(2);
01147       break;
01148     case 3:
01149       _A3x[0] = 1;
01150       _A3x[1] = (_n-1)/2;
01151       _A3x[2] = -1/real(4);
01152       break;
01153     case 4:
01154       _A3x[0] = 1;
01155       _A3x[1] = (_n-1)/2;
01156       _A3x[2] = (-_n-2)/8;
01157       _A3x[3] = -1/real(16);
01158       break;
01159     case 5:
01160       _A3x[0] = 1;
01161       _A3x[1] = (_n-1)/2;
01162       _A3x[2] = (_n*(3*_n-1)-2)/8;
01163       _A3x[3] = (-3*_n-1)/16;
01164       _A3x[4] = -3/real(64);
01165       break;
01166     case 6:
01167       _A3x[0] = 1;
01168       _A3x[1] = (_n-1)/2;
01169       _A3x[2] = (_n*(3*_n-1)-2)/8;
01170       _A3x[3] = ((-_n-3)*_n-1)/16;
01171       _A3x[4] = (-2*_n-3)/64;
01172       _A3x[5] = -3/real(128);
01173       break;
01174     case 7:
01175       _A3x[0] = 1;
01176       _A3x[1] = (_n-1)/2;
01177       _A3x[2] = (_n*(3*_n-1)-2)/8;
01178       _A3x[3] = (_n*(_n*(5*_n-1)-3)-1)/16;
01179       _A3x[4] = ((-10*_n-2)*_n-3)/64;
01180       _A3x[5] = (-5*_n-3)/128;
01181       _A3x[6] = -5/real(256);
01182       break;
01183     case 8:
01184       _A3x[0] = 1;
01185       _A3x[1] = (_n-1)/2;
01186       _A3x[2] = (_n*(3*_n-1)-2)/8;
01187       _A3x[3] = (_n*(_n*(5*_n-1)-3)-1)/16;
01188       _A3x[4] = (_n*((-5*_n-20)*_n-4)-6)/128;
01189       _A3x[5] = ((-5*_n-10)*_n-6)/256;
01190       _A3x[6] = (-15*_n-20)/1024;
01191       _A3x[7] = -25/real(2048);
01192       break;
01193     default:
01194       STATIC_ASSERT(nA3_ >= 0 && nA3_ <= 8, "Bad value of nA3_");
01195     }
01196   }
01197 
01198   // The coefficients C3[l] in the Fourier expansion of B3
01199   void Geodesic::C3coeff() throw() {
01200     switch (nC3_) {
01201     case 0:
01202       break;
01203     case 1:
01204       break;
01205     case 2:
01206       _C3x[0] = 1/real(4);
01207       break;
01208     case 3:
01209       _C3x[0] = (1-_n)/4;
01210       _C3x[1] = 1/real(8);
01211       _C3x[2] = 1/real(16);
01212       break;
01213     case 4:
01214       _C3x[0] = (1-_n)/4;
01215       _C3x[1] = 1/real(8);
01216       _C3x[2] = 3/real(64);
01217       _C3x[3] = (2-3*_n)/32;
01218       _C3x[4] = 3/real(64);
01219       _C3x[5] = 5/real(192);
01220       break;
01221     case 5:
01222       _C3x[0] = (1-_n)/4;
01223       _C3x[1] = (1-_n*_n)/8;
01224       _C3x[2] = (3*_n+3)/64;
01225       _C3x[3] = 5/real(128);
01226       _C3x[4] = ((_n-3)*_n+2)/32;
01227       _C3x[5] = (3-2*_n)/64;
01228       _C3x[6] = 3/real(128);
01229       _C3x[7] = (5-9*_n)/192;
01230       _C3x[8] = 3/real(128);
01231       _C3x[9] = 7/real(512);
01232       break;
01233     case 6:
01234       _C3x[0] = (1-_n)/4;
01235       _C3x[1] = (1-_n*_n)/8;
01236       _C3x[2] = ((3-_n)*_n+3)/64;
01237       _C3x[3] = (2*_n+5)/128;
01238       _C3x[4] = 3/real(128);
01239       _C3x[5] = ((_n-3)*_n+2)/32;
01240       _C3x[6] = ((-3*_n-2)*_n+3)/64;
01241       _C3x[7] = (_n+3)/128;
01242       _C3x[8] = 5/real(256);
01243       _C3x[9] = (_n*(5*_n-9)+5)/192;
01244       _C3x[10] = (9-10*_n)/384;
01245       _C3x[11] = 7/real(512);
01246       _C3x[12] = (7-14*_n)/512;
01247       _C3x[13] = 7/real(512);
01248       _C3x[14] = 21/real(2560);
01249       break;
01250     case 7:
01251       _C3x[0] = (1-_n)/4;
01252       _C3x[1] = (1-_n*_n)/8;
01253       _C3x[2] = (_n*((-5*_n-1)*_n+3)+3)/64;
01254       _C3x[3] = (_n*(2*_n+2)+5)/128;
01255       _C3x[4] = (11*_n+12)/512;
01256       _C3x[5] = 21/real(1024);
01257       _C3x[6] = ((_n-3)*_n+2)/32;
01258       _C3x[7] = (_n*(_n*(2*_n-3)-2)+3)/64;
01259       _C3x[8] = ((2-9*_n)*_n+6)/256;
01260       _C3x[9] = (_n+5)/256;
01261       _C3x[10] = 27/real(2048);
01262       _C3x[11] = (_n*((5-_n)*_n-9)+5)/192;
01263       _C3x[12] = ((-6*_n-10)*_n+9)/384;
01264       _C3x[13] = (21-4*_n)/1536;
01265       _C3x[14] = 3/real(256);
01266       _C3x[15] = (_n*(10*_n-14)+7)/512;
01267       _C3x[16] = (7-10*_n)/512;
01268       _C3x[17] = 9/real(1024);
01269       _C3x[18] = (21-45*_n)/2560;
01270       _C3x[19] = 9/real(1024);
01271       _C3x[20] = 11/real(2048);
01272       break;
01273     case 8:
01274       _C3x[0] = (1-_n)/4;
01275       _C3x[1] = (1-_n*_n)/8;
01276       _C3x[2] = (_n*((-5*_n-1)*_n+3)+3)/64;
01277       _C3x[3] = (_n*((2-2*_n)*_n+2)+5)/128;
01278       _C3x[4] = (_n*(3*_n+11)+12)/512;
01279       _C3x[5] = (10*_n+21)/1024;
01280       _C3x[6] = 243/real(16384);
01281       _C3x[7] = ((_n-3)*_n+2)/32;
01282       _C3x[8] = (_n*(_n*(2*_n-3)-2)+3)/64;
01283       _C3x[9] = (_n*((-6*_n-9)*_n+2)+6)/256;
01284       _C3x[10] = ((1-2*_n)*_n+5)/256;
01285       _C3x[11] = (69*_n+108)/8192;
01286       _C3x[12] = 187/real(16384);
01287       _C3x[13] = (_n*((5-_n)*_n-9)+5)/192;
01288       _C3x[14] = (_n*(_n*(10*_n-6)-10)+9)/384;
01289       _C3x[15] = ((-77*_n-8)*_n+42)/3072;
01290       _C3x[16] = (12-_n)/1024;
01291       _C3x[17] = 139/real(16384);
01292       _C3x[18] = (_n*((20-7*_n)*_n-28)+14)/1024;
01293       _C3x[19] = ((-7*_n-40)*_n+28)/2048;
01294       _C3x[20] = (72-43*_n)/8192;
01295       _C3x[21] = 127/real(16384);
01296       _C3x[22] = (_n*(75*_n-90)+42)/5120;
01297       _C3x[23] = (9-15*_n)/1024;
01298       _C3x[24] = 99/real(16384);
01299       _C3x[25] = (44-99*_n)/8192;
01300       _C3x[26] = 99/real(16384);
01301       _C3x[27] = 429/real(114688);
01302       break;
01303     default:
01304       STATIC_ASSERT(nC3_ >= 0 && nC3_ <= 8, "Bad value of nC3_");
01305     }
01306   }
01307 
01308   // The coefficients C4[l] in the Fourier expansion of I4
01309   void Geodesic::C4coeff() throw() {
01310     switch (nC4_) {
01311     case 0:
01312       break;
01313     case 1:
01314       _C4x[0] = 2/real(3);
01315       break;
01316     case 2:
01317       _C4x[0] = (10-_ep2)/15;
01318       _C4x[1] = -1/real(20);
01319       _C4x[2] = 1/real(180);
01320       break;
01321     case 3:
01322       _C4x[0] = (_ep2*(4*_ep2-7)+70)/105;
01323       _C4x[1] = (4*_ep2-7)/140;
01324       _C4x[2] = 1/real(42);
01325       _C4x[3] = (7-4*_ep2)/1260;
01326       _C4x[4] = -1/real(252);
01327       _C4x[5] = 1/real(2100);
01328       break;
01329     case 4:
01330       _C4x[0] = (_ep2*((12-8*_ep2)*_ep2-21)+210)/315;
01331       _C4x[1] = ((12-8*_ep2)*_ep2-21)/420;
01332       _C4x[2] = (3-2*_ep2)/126;
01333       _C4x[3] = -1/real(72);
01334       _C4x[4] = (_ep2*(8*_ep2-12)+21)/3780;
01335       _C4x[5] = (2*_ep2-3)/756;
01336       _C4x[6] = 1/real(360);
01337       _C4x[7] = (3-2*_ep2)/6300;
01338       _C4x[8] = -1/real(1800);
01339       _C4x[9] = 1/real(17640);
01340       break;
01341     case 5:
01342       _C4x[0] = (_ep2*(_ep2*(_ep2*(64*_ep2-88)+132)-231)+2310)/3465;
01343       _C4x[1] = (_ep2*(_ep2*(64*_ep2-88)+132)-231)/4620;
01344       _C4x[2] = (_ep2*(16*_ep2-22)+33)/1386;
01345       _C4x[3] = (8*_ep2-11)/792;
01346       _C4x[4] = 1/real(110);
01347       _C4x[5] = (_ep2*((88-64*_ep2)*_ep2-132)+231)/41580;
01348       _C4x[6] = ((22-16*_ep2)*_ep2-33)/8316;
01349       _C4x[7] = (11-8*_ep2)/3960;
01350       _C4x[8] = -1/real(495);
01351       _C4x[9] = (_ep2*(16*_ep2-22)+33)/69300;
01352       _C4x[10] = (8*_ep2-11)/19800;
01353       _C4x[11] = 1/real(1925);
01354       _C4x[12] = (11-8*_ep2)/194040;
01355       _C4x[13] = -1/real(10780);
01356       _C4x[14] = 1/real(124740);
01357       break;
01358     case 6:
01359       _C4x[0] = (_ep2*(_ep2*(_ep2*((832-640*_ep2)*_ep2-1144)+1716)-3003)+
01360                 30030)/45045;
01361       _C4x[1] = (_ep2*(_ep2*((832-640*_ep2)*_ep2-1144)+1716)-3003)/60060;
01362       _C4x[2] = (_ep2*((208-160*_ep2)*_ep2-286)+429)/18018;
01363       _C4x[3] = ((104-80*_ep2)*_ep2-143)/10296;
01364       _C4x[4] = (13-10*_ep2)/1430;
01365       _C4x[5] = -1/real(156);
01366       _C4x[6] = (_ep2*(_ep2*(_ep2*(640*_ep2-832)+1144)-1716)+3003)/540540;
01367       _C4x[7] = (_ep2*(_ep2*(160*_ep2-208)+286)-429)/108108;
01368       _C4x[8] = (_ep2*(80*_ep2-104)+143)/51480;
01369       _C4x[9] = (10*_ep2-13)/6435;
01370       _C4x[10] = 5/real(3276);
01371       _C4x[11] = (_ep2*((208-160*_ep2)*_ep2-286)+429)/900900;
01372       _C4x[12] = ((104-80*_ep2)*_ep2-143)/257400;
01373       _C4x[13] = (13-10*_ep2)/25025;
01374       _C4x[14] = -1/real(2184);
01375       _C4x[15] = (_ep2*(80*_ep2-104)+143)/2522520;
01376       _C4x[16] = (10*_ep2-13)/140140;
01377       _C4x[17] = 5/real(45864);
01378       _C4x[18] = (13-10*_ep2)/1621620;
01379       _C4x[19] = -1/real(58968);
01380       _C4x[20] = 1/real(792792);
01381       break;
01382     case 7:
01383       _C4x[0] = (_ep2*(_ep2*(_ep2*(_ep2*(_ep2*(512*_ep2-640)+832)-1144)+1716)-
01384                 3003)+30030)/45045;
01385       _C4x[1] = (_ep2*(_ep2*(_ep2*(_ep2*(512*_ep2-640)+832)-1144)+1716)-
01386                 3003)/60060;
01387       _C4x[2] = (_ep2*(_ep2*(_ep2*(128*_ep2-160)+208)-286)+429)/18018;
01388       _C4x[3] = (_ep2*(_ep2*(64*_ep2-80)+104)-143)/10296;
01389       _C4x[4] = (_ep2*(8*_ep2-10)+13)/1430;
01390       _C4x[5] = (4*_ep2-5)/780;
01391       _C4x[6] = 1/real(210);
01392       _C4x[7] = (_ep2*(_ep2*(_ep2*((640-512*_ep2)*_ep2-832)+1144)-1716)+
01393                 3003)/540540;
01394       _C4x[8] = (_ep2*(_ep2*((160-128*_ep2)*_ep2-208)+286)-429)/108108;
01395       _C4x[9] = (_ep2*((80-64*_ep2)*_ep2-104)+143)/51480;
01396       _C4x[10] = ((10-8*_ep2)*_ep2-13)/6435;
01397       _C4x[11] = (5-4*_ep2)/3276;
01398       _C4x[12] = -1/real(840);
01399       _C4x[13] = (_ep2*(_ep2*(_ep2*(128*_ep2-160)+208)-286)+429)/900900;
01400       _C4x[14] = (_ep2*(_ep2*(64*_ep2-80)+104)-143)/257400;
01401       _C4x[15] = (_ep2*(8*_ep2-10)+13)/25025;
01402       _C4x[16] = (4*_ep2-5)/10920;
01403       _C4x[17] = 1/real(2520);
01404       _C4x[18] = (_ep2*((80-64*_ep2)*_ep2-104)+143)/2522520;
01405       _C4x[19] = ((10-8*_ep2)*_ep2-13)/140140;
01406       _C4x[20] = (5-4*_ep2)/45864;
01407       _C4x[21] = -1/real(8820);
01408       _C4x[22] = (_ep2*(8*_ep2-10)+13)/1621620;
01409       _C4x[23] = (4*_ep2-5)/294840;
01410       _C4x[24] = 1/real(41580);
01411       _C4x[25] = (5-4*_ep2)/3963960;
01412       _C4x[26] = -1/real(304920);
01413       _C4x[27] = 1/real(4684680);
01414       break;
01415     case 8:
01416       _C4x[0] = (_ep2*(_ep2*(_ep2*(_ep2*(_ep2*((8704-7168*_ep2)*_ep2-10880)+
01417                 14144)-19448)+29172)-51051)+510510)/765765;
01418       _C4x[1] = (_ep2*(_ep2*(_ep2*(_ep2*((8704-7168*_ep2)*_ep2-10880)+14144)-
01419                 19448)+29172)-51051)/1021020;
01420       _C4x[2] = (_ep2*(_ep2*(_ep2*((2176-1792*_ep2)*_ep2-2720)+3536)-4862)+
01421                 7293)/306306;
01422       _C4x[3] = (_ep2*(_ep2*((1088-896*_ep2)*_ep2-1360)+1768)-2431)/175032;
01423       _C4x[4] = (_ep2*((136-112*_ep2)*_ep2-170)+221)/24310;
01424       _C4x[5] = ((68-56*_ep2)*_ep2-85)/13260;
01425       _C4x[6] = (17-14*_ep2)/3570;
01426       _C4x[7] = -1/real(272);
01427       _C4x[8] = (_ep2*(_ep2*(_ep2*(_ep2*(_ep2*(7168*_ep2-8704)+10880)-14144)+
01428                 19448)-29172)+51051)/9189180;
01429       _C4x[9] = (_ep2*(_ep2*(_ep2*(_ep2*(1792*_ep2-2176)+2720)-3536)+4862)-
01430                 7293)/1837836;
01431       _C4x[10] = (_ep2*(_ep2*(_ep2*(896*_ep2-1088)+1360)-1768)+2431)/875160;
01432       _C4x[11] = (_ep2*(_ep2*(112*_ep2-136)+170)-221)/109395;
01433       _C4x[12] = (_ep2*(56*_ep2-68)+85)/55692;
01434       _C4x[13] = (14*_ep2-17)/14280;
01435       _C4x[14] = 7/real(7344);
01436       _C4x[15] = (_ep2*(_ep2*(_ep2*((2176-1792*_ep2)*_ep2-2720)+3536)-4862)+
01437                 7293)/15315300;
01438       _C4x[16] = (_ep2*(_ep2*((1088-896*_ep2)*_ep2-1360)+1768)-2431)/4375800;
01439       _C4x[17] = (_ep2*((136-112*_ep2)*_ep2-170)+221)/425425;
01440       _C4x[18] = ((68-56*_ep2)*_ep2-85)/185640;
01441       _C4x[19] = (17-14*_ep2)/42840;
01442       _C4x[20] = -7/real(20400);
01443       _C4x[21] = (_ep2*(_ep2*(_ep2*(896*_ep2-1088)+1360)-1768)+2431)/42882840;
01444       _C4x[22] = (_ep2*(_ep2*(112*_ep2-136)+170)-221)/2382380;
01445       _C4x[23] = (_ep2*(56*_ep2-68)+85)/779688;
01446       _C4x[24] = (14*_ep2-17)/149940;
01447       _C4x[25] = 1/real(8976);
01448       _C4x[26] = (_ep2*((136-112*_ep2)*_ep2-170)+221)/27567540;
01449       _C4x[27] = ((68-56*_ep2)*_ep2-85)/5012280;
01450       _C4x[28] = (17-14*_ep2)/706860;
01451       _C4x[29] = -7/real(242352);
01452       _C4x[30] = (_ep2*(56*_ep2-68)+85)/67387320;
01453       _C4x[31] = (14*_ep2-17)/5183640;
01454       _C4x[32] = 7/real(1283568);
01455       _C4x[33] = (17-14*_ep2)/79639560;
01456       _C4x[34] = -1/real(1516944);
01457       _C4x[35] = 1/real(26254800);
01458       break;
01459     default:
01460       STATIC_ASSERT(nC3_ >= 0 && nC4_ <= 8, "Bad value of nC4_");
01461     }
01462   }
01463 
01464 } // namespace GeographicLib
geographiclib-1.21/doc/html/classGeographicLib_1_1AlbersEqualArea.html0000644000175000017500000012512411745620415025564 0ustar frankiefrankie GeographicLib: GeographicLib::AlbersEqualArea Class Reference
GeographicLib::AlbersEqualArea Class Reference

Albers Equal Area Conic Projection. More...

#include <GeographicLib/AlbersEqualArea.hpp>

List of all members.

Public Member Functions

 AlbersEqualArea (real a, real f, real stdlat, real k0)
 AlbersEqualArea (real a, real f, real stdlat1, real stdlat2, real k1)
 AlbersEqualArea (real a, real f, real sinlat1, real coslat1, real sinlat2, real coslat2, real k1)
void SetScale (real lat, real k=real(1))
void Forward (real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const throw ()
void Reverse (real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const throw ()
void Forward (real lon0, real lat, real lon, real &x, real &y) const throw ()
void Reverse (real lon0, real x, real y, real &lat, real &lon) const throw ()
Inspector functions
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()
Math::real OriginLatitude () const throw ()
Math::real CentralScale () const throw ()

Static Public Attributes

static const AlbersEqualArea CylindricalEqualArea
static const AlbersEqualArea AzimuthalEqualAreaNorth
static const AlbersEqualArea AzimuthalEqualAreaSouth

Detailed Description

Albers Equal Area Conic Projection.

Implementation taken from the report,

This is a implementation of the equations in Snyder except that divided differences will be [have been] used to transform the expressions into ones which may be evaluated accurately. [In this implementation, the projection correctly becomes the cylindrical equal area or the azimuthal equal area projection when the standard latitude is the equator or a pole.]

The ellipsoid parameters, the standard parallels, and the scale on the standard parallels are set in the constructor. Internally, the case with two standard parallels is converted into a single standard parallel, the latitude of minimum azimuthal scale, with an azimuthal scale specified on this parallel. This latitude is also used as the latitude of origin which is returned by AlbersEqualArea::OriginLatitude. The azimuthal scale on the latitude of origin is given by AlbersEqualArea::CentralScale. The case with two standard parallels at opposite poles is singular and is disallowed. The central meridian (which is a trivial shift of the longitude) is specified as the lon0 argument of the AlbersEqualArea::Forward and AlbersEqualArea::Reverse functions. AlbersEqualArea::Forward and AlbersEqualArea::Reverse also return the meridian convergence, gamma, and azimuthal scale, k. A small square aligned with the cardinal directions is projected to a rectangle with dimensions k (in the E-W direction) and 1/k (in the N-S direction). The E-W sides of the rectangle are oriented gamma degrees counter-clockwise from the x axis. There is no provision in this class for specifying a false easting or false northing or a different latitude of origin.

Example of use:

// Example of using the GeographicLib::AlbersEqualArea class
// $Id: 230027b09ff2dfa7940202913a6d965281818b99 $

#include <iostream>
#include <exception>
#include <GeographicLib/AlbersEqualArea.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
   const double
     a = Constants::WGS84_a<double>(),
     f = Constants::WGS84_f<double>(),
     lat1 = 40 + 58/60.0, lat2 = 39 + 56/60.0, // standard parallels
     k1 = 1,                                   // scale
     lon0 = -77 - 45/60.0;                     // Central meridan
   // Set up basic projection
   const AlbersEqualArea albers(a, f, lat1, lat2, k1);
   {
     // Sample conversion from geodetic to Albers Equal Area
     double lat = 39.95, lon = -75.17;    // Philadelphia
     double x, y;
     albers.Forward(lon0, lat, lon, x, y);
     std::cout << x << " " << y << "\n";
   }
   {
     // Sample conversion from Albers Equal Area grid to geodetic
     double x = 220e3, y = -53e3;
     double lat, lon;
     albers.Reverse(lon0, x, y, lat, lon);
     std::cout << lat << " " << lon << "\n";
   }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

ConicProj is a command-line utility providing access to the functionality of LambertConformalConic and AlbersEqualArea.


Constructor & Destructor Documentation

GeographicLib::AlbersEqualArea::AlbersEqualArea ( real  a,
real  f,
real  stdlat,
real  k0 
)

Constructor with a single standard parallel.

Parameters:
[in]aequatorial radius of ellipsoid (meters).
[in]fflattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid. If f > 1, set flattening to 1/f.
[in]stdlatstandard parallel (degrees), the circle of tangency.
[in]k0azimuthal scale on the standard parallel.

An exception is thrown if a or k0 is not positive or if stdlat is not in the range [-90, 90].

Definition at line 31 of file AlbersEqualArea.cpp.

References GeographicLib::Math::isfinite().

GeographicLib::AlbersEqualArea::AlbersEqualArea ( real  a,
real  f,
real  stdlat1,
real  stdlat2,
real  k1 
)

Constructor with two standard parallels.

Parameters:
[in]aequatorial radius of ellipsoid (meters).
[in]fflattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid. If f > 1, set flattening to 1/f.
[in]stdlat1first standard parallel (degrees).
[in]stdlat2second standard parallel (degrees).
[in]k1azimuthal scale on the standard parallels.

An exception is thrown if a or k0 is not positive or if stdlat1 or stdlat2 is not in the range [-90, 90]. In addition, an exception is thrown if stdlat1 and stdlat2 are opposite poles.

Definition at line 56 of file AlbersEqualArea.cpp.

References GeographicLib::Math::isfinite().

GeographicLib::AlbersEqualArea::AlbersEqualArea ( real  a,
real  f,
real  sinlat1,
real  coslat1,
real  sinlat2,
real  coslat2,
real  k1 
)

Constructor with two standard parallels specified by sines and cosines.

Parameters:
[in]aequatorial radius of ellipsoid (meters).
[in]fflattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid. If f > 1, set flattening to 1/f.
[in]sinlat1sine of first standard parallel.
[in]coslat1cosine of first standard parallel.
[in]sinlat2sine of second standard parallel.
[in]coslat2cosine of second standard parallel.
[in]k1azimuthal scale on the standard parallels.

This allows parallels close to the poles to be specified accurately. This routine computes the latitude of origin and the azimuthal scale at this latitude. If dlat = abs(lat2 - lat1) <= 160o, then the error in the latitude of origin is less than 4.5e-14o.

Definition at line 84 of file AlbersEqualArea.cpp.

References GeographicLib::Math::isfinite().


Member Function Documentation

void GeographicLib::AlbersEqualArea::SetScale ( real  lat,
real  k = real(1) 
)

Set the azimuthal scale for the projection.

Parameters:
[in]lat(degrees).
[in]kazimuthal scale at latitude lat (default 1).

This allows a "latitude of conformality" to be specified. An exception is thrown if k is not positive or if lat is not in the range (-90, 90).

Definition at line 439 of file AlbersEqualArea.cpp.

References GeographicLib::Math::isfinite(), Forward(), and GeographicLib::Math::sq().

void GeographicLib::AlbersEqualArea::Forward ( real  lon0,
real  lat,
real  lon,
real &  x,
real &  y,
real &  gamma,
real &  k 
) const throw ()

Forward projection, from geographic to Lambert conformal conic.

Parameters:
[in]lon0central meridian longitude (degrees).
[in]latlatitude of point (degrees).
[in]lonlongitude of point (degrees).
[out]xeasting of point (meters).
[out]ynorthing of point (meters).
[out]gammameridian convergence at point (degrees).
[out]kazimuthal scale of projection at point; the radial scale is the 1/k.

The latitude origin is given by AlbersEqualArea::LatitudeOrigin(). No false easting or northing is added and lat should be in the range [-90, 90]; lon and lon0 should be in the range [-180, 360]. The values of x and y returned for points which project to infinity (i.e., one or both of the poles) will be large but finite.

Definition at line 379 of file AlbersEqualArea.cpp.

References GeographicLib::Math::sq().

Referenced by SetScale().

void GeographicLib::AlbersEqualArea::Reverse ( real  lon0,
real  x,
real  y,
real &  lat,
real &  lon,
real &  gamma,
real &  k 
) const throw ()

Reverse projection, from Lambert conformal conic to geographic.

Parameters:
[in]lon0central meridian longitude (degrees).
[in]xeasting of point (meters).
[in]ynorthing of point (meters).
[out]latlatitude of point (degrees).
[out]lonlongitude of point (degrees).
[out]gammameridian convergence at point (degrees).
[out]kazimuthal scale of projection at point; the radial scale is the 1/k.

The latitude origin is given by AlbersEqualArea::LatitudeOrigin(). No false easting or northing is added. lon0 should be in the range [-180, 360]. The value of lon returned is in the range [-180, 180). The value of lat returned is in the range [-90,90]. If the input point is outside the legal projected space the nearest pole is returned.

Definition at line 409 of file AlbersEqualArea.cpp.

References GeographicLib::Math::hypot(), and GeographicLib::Math::sq().

void GeographicLib::AlbersEqualArea::Forward ( real  lon0,
real  lat,
real  lon,
real &  x,
real &  y 
) const throw () [inline]

AlbersEqualArea::Forward without returning the convergence and scale.

Definition at line 233 of file AlbersEqualArea.hpp.

void GeographicLib::AlbersEqualArea::Reverse ( real  lon0,
real  x,
real  y,
real &  lat,
real &  lon 
) const throw () [inline]

AlbersEqualArea::Reverse without returning the convergence and scale.

Definition at line 243 of file AlbersEqualArea.hpp.

Math::real GeographicLib::AlbersEqualArea::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value used in the constructor.

Definition at line 256 of file AlbersEqualArea.hpp.

Math::real GeographicLib::AlbersEqualArea::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid. This is the value used in the constructor.

Definition at line 262 of file AlbersEqualArea.hpp.

Math::real GeographicLib::AlbersEqualArea::OriginLatitude ( ) const throw () [inline]
Returns:
latitude of the origin for the projection (degrees).

This is the latitude of minimum azimuthal scale and equals the stdlat in the 1-parallel constructor and lies between stdlat1 and stdlat2 in the 2-parallel constructors.

Definition at line 279 of file AlbersEqualArea.hpp.

Math::real GeographicLib::AlbersEqualArea::CentralScale ( ) const throw () [inline]
Returns:
central scale for the projection. This is the azimuthal scale on the latitude of origin.

Definition at line 285 of file AlbersEqualArea.hpp.


Member Data Documentation

A global instantiation of AlbersEqualArea with the WGS84 ellipsoid, stdlat = 0, and k0 = 1. This degenerates to the cylindrical equal area projection.

Definition at line 293 of file AlbersEqualArea.hpp.

A global instantiation of AlbersEqualArea with the WGS84 ellipsoid, stdlat = 90o, and k0 = 1. This degenerates to the Lambert azimuthal equal area projection.

Definition at line 300 of file AlbersEqualArea.hpp.

A global instantiation of AlbersEqualArea with the WGS84 ellipsoid, stdlat = -90o, and k0 = 1. This degenerates to the Lambert azimuthal equal area projection.

Definition at line 307 of file AlbersEqualArea.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/classGeographicLib_1_1OSGB-members.html0000644000175000017500000001404111745620414024747 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::OSGB Member List
This is the complete list of members for GeographicLib::OSGB, including all inherited members.
CentralScale()GeographicLib::OSGB [inline, static]
FalseEasting()GeographicLib::OSGB [inline, static]
FalseNorthing()GeographicLib::OSGB [inline, static]
Flattening()GeographicLib::OSGB [inline, static]
Forward(real lat, real lon, real &x, real &y, real &gamma, real &k)GeographicLib::OSGB [inline, static]
Forward(real lat, real lon, real &x, real &y)GeographicLib::OSGB [inline, static]
GridReference(real x, real y, int prec, std::string &gridref)GeographicLib::OSGB [static]
GridReference(const std::string &gridref, real &x, real &y, int &prec, bool centerp=true)GeographicLib::OSGB [static]
MajorRadius()GeographicLib::OSGB [inline, static]
OriginLatitude()GeographicLib::OSGB [inline, static]
OriginLongitude()GeographicLib::OSGB [inline, static]
Reverse(real x, real y, real &lat, real &lon, real &gamma, real &k)GeographicLib::OSGB [inline, static]
Reverse(real x, real y, real &lat, real &lon)GeographicLib::OSGB [inline, static]
geographiclib-1.21/doc/html/classGeographicLib_1_1OSGB.html0000644000175000017500000010112311745620414023315 0ustar frankiefrankie GeographicLib: GeographicLib::OSGB Class Reference
GeographicLib::OSGB Class Reference

Ordnance Survey grid system for Great Britain. More...

#include <GeographicLib/OSGB.hpp>

List of all members.

Static Public Member Functions

static void Forward (real lat, real lon, real &x, real &y, real &gamma, real &k) throw ()
static void Reverse (real x, real y, real &lat, real &lon, real &gamma, real &k) throw ()
static void Forward (real lat, real lon, real &x, real &y) throw ()
static void Reverse (real x, real y, real &lat, real &lon) throw ()
static void GridReference (real x, real y, int prec, std::string &gridref)
static void GridReference (const std::string &gridref, real &x, real &y, int &prec, bool centerp=true)
Inspector functions
static Math::real MajorRadius () throw ()
static Math::real Flattening () throw ()
static Math::real CentralScale () throw ()
static Math::real OriginLatitude () throw ()
static Math::real OriginLongitude () throw ()
static Math::real FalseNorthing () throw ()
static Math::real FalseEasting () throw ()

Detailed Description

Ordnance Survey grid system for Great Britain.

The class implements the coordinate system used by the Ordnance Survey for maps of Great Britain and conversions to the grid reference system.

See

WARNING: the latitudes and longitudes for the Ordnance Survey grid system do not use the WGS84 datum. Do not use the values returned by this class in the UTMUPS, MGRS, or Geoid classes without first converting the datum (and vice versa).

Example of use:

// Example of using the GeographicLib::OSGB class
// $Id: 80feea12c2ebb7e594d8e17bf841c1a141cf3c36 $

#include <iostream>
#include <exception>
#include <string>
#include <GeographicLib/OSGB.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    {
      // Sample forward calculation
      double lat = 55.5, lon = -1.64; // Embleton, Northumberland
      double x, y;
      OSGB::Forward(lat, lon, x, y);
      string gridref;
      OSGB::GridReference(x, y, 2, gridref);
      cout << x << " " << y << " " << gridref << "\n";
    }
    {
      // Sample reverse calculation
      string gridref = "NU2222";
      double x, y;
      int prec;
      OSGB::GridReference(gridref, x, y, prec);
      double lat, lon;
      OSGB::Reverse(x, y, lat, lon);
      cout << prec << " " << lat << " " << lon << "\n";
    }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Member Function Documentation

static void GeographicLib::OSGB::Forward ( real  lat,
real  lon,
real &  x,
real &  y,
real &  gamma,
real &  k 
) throw () [inline, static]

Forward projection, from geographic to OSGB coordinates.

Parameters:
[in]latlatitude of point (degrees).
[in]lonlongitude of point (degrees).
[out]xeasting of point (meters).
[out]ynorthing of point (meters).
[out]gammameridian convergence at point (degrees).
[out]kscale of projection at point.

lat should be in the range [-90, 90]; lon and lon0 should be in the range [-180, 360].

Definition at line 86 of file OSGB.hpp.

static void GeographicLib::OSGB::Reverse ( real  x,
real  y,
real &  lat,
real &  lon,
real &  gamma,
real &  k 
) throw () [inline, static]

Reverse projection, from OSGB coordinates to geographic.

Parameters:
[in]xeasting of point (meters).
[in]ynorthing of point (meters).
[out]latlatitude of point (degrees).
[out]lonlongitude of point (degrees).
[out]gammameridian convergence at point (degrees).
[out]kscale of projection at point.

The value of lon returned is in the range [-180, 180).

Definition at line 106 of file OSGB.hpp.

static void GeographicLib::OSGB::Forward ( real  lat,
real  lon,
real &  x,
real &  y 
) throw () [inline, static]

OSGB::Forward without returning the convergence and scale.

Definition at line 116 of file OSGB.hpp.

static void GeographicLib::OSGB::Reverse ( real  x,
real  y,
real &  lat,
real &  lon 
) throw () [inline, static]

OSGB::Reverse without returning the convergence and scale.

Definition at line 124 of file OSGB.hpp.

void GeographicLib::OSGB::GridReference ( real  x,
real  y,
int  prec,
std::string &  gridref 
) [static]

Convert OSGB coordinates to a grid reference.

Parameters:
[in]xeasting of point (meters).
[in]ynorthing of point (meters).
[in]precprecision relative to 100 km.
[out]gridrefNational Grid reference.

prec specifies the precision of the grid reference string as follows:

  • prec = 0 (min), 100km
  • prec = 1, 10km
  • prec = 2, 1km
  • prec = 3, 100m
  • prec = 4, 10m
  • prec = 5, 1m
  • prec = 6, 0.1m
  • prec = 11 (max), 1um

The easting must be in the range [-1000 km, 1500 km) and the northing must be in the range [-500 km, 2000 km). An exception is thrown if either the easting and northing is outside these bounds. These bounds are consistent with rules for the letter designations for the grid system.

Definition at line 36 of file OSGB.cpp.

void GeographicLib::OSGB::GridReference ( const std::string &  gridref,
real &  x,
real &  y,
int &  prec,
bool  centerp = true 
) [static]

Convert OSGB coordinates to a grid reference.

Parameters:
[in]gridrefNational Grid reference.
[out]xeasting of point (meters).
[out]ynorthing of point (meters).
[out]precprecision relative to 100 km.
[in]centerpif true (default), return center of the grid square, else return SW (lower left) corner.

The grid reference must be of the form: two letters (not including I) followed by an even number of digits (up to 22).

Definition at line 84 of file OSGB.cpp.

static Math::real GeographicLib::OSGB::MajorRadius ( ) throw () [inline, static]
Returns:
a the equatorial radius of the Airy 1830 ellipsoid (meters).

This is 20923713 ft converted to meters using the rule 1 ft = 10^(9.48401603-10) m. (The Airy 1830 value is returned because the OSGB projection is based on this ellipsoid.)

Definition at line 182 of file OSGB.hpp.

static Math::real GeographicLib::OSGB::Flattening ( ) throw () [inline, static]
Returns:
f the inverse flattening of the Airy 1830 ellipsoid.

For the Airy 1830 ellipsoid, a = 20923713 ft and b = 20853810 ft; thus the flattening = (20923713 - 20853810)/20923713 = 7767/2324857 = 1/299.32496459... (The Airy 1830 value is returned because the OSGB projection is based on this ellipsoid.)

Definition at line 194 of file OSGB.hpp.

static Math::real GeographicLib::OSGB::CentralScale ( ) throw () [inline, static]
Returns:
k0 central scale for the OSGB projection (0.9996012717).

Definition at line 208 of file OSGB.hpp.

static Math::real GeographicLib::OSGB::OriginLatitude ( ) throw () [inline, static]
Returns:
latitude of the origin for the OSGB projection (49 degrees).

Definition at line 214 of file OSGB.hpp.

static Math::real GeographicLib::OSGB::OriginLongitude ( ) throw () [inline, static]
Returns:
longitude of the origin for the OSGB projection (-2 degrees).

Definition at line 219 of file OSGB.hpp.

static Math::real GeographicLib::OSGB::FalseNorthing ( ) throw () [inline, static]
Returns:
false northing the OSGB projection (-100000 meters).

Definition at line 224 of file OSGB.hpp.

static Math::real GeographicLib::OSGB::FalseEasting ( ) throw () [inline, static]
Returns:
false easting the OSGB projection (400000 meters).

Definition at line 229 of file OSGB.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/functions_func_0x67.html0000644000175000017500000002076311745620414022276 0ustar frankiefrankie GeographicLib: Class Members - Functions geographiclib-1.21/doc/html/classGeographicLib_1_1CassiniSoldner-members.html0000644000175000017500000001411011745620414027132 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::CassiniSoldner Member List
This is the complete list of members for GeographicLib::CassiniSoldner, including all inherited members.
CassiniSoldner(const Geodesic &earth=Geodesic::WGS84)GeographicLib::CassiniSoldner [inline, explicit]
CassiniSoldner(real lat0, real lon0, const Geodesic &earth=Geodesic::WGS84)GeographicLib::CassiniSoldner [inline]
Flattening() const GeographicLib::CassiniSoldner [inline]
Forward(real lat, real lon, real &x, real &y, real &azi, real &rk) const GeographicLib::CassiniSoldner
Forward(real lat, real lon, real &x, real &y) const GeographicLib::CassiniSoldner [inline]
Init() const GeographicLib::CassiniSoldner [inline]
LatitudeOrigin() const GeographicLib::CassiniSoldner [inline]
LongitudeOrigin() const GeographicLib::CassiniSoldner [inline]
MajorRadius() const GeographicLib::CassiniSoldner [inline]
Reset(real lat0, real lon0)GeographicLib::CassiniSoldner
Reverse(real x, real y, real &lat, real &lon, real &azi, real &rk) const GeographicLib::CassiniSoldner
Reverse(real x, real y, real &lat, real &lon) const GeographicLib::CassiniSoldner [inline]
geographiclib-1.21/doc/html/functions_0x77.html0000644000175000017500000001337211745620414021262 0ustar frankiefrankie GeographicLib: Class Members
Here is a list of all class members with links to the classes they belong to:

- w -

geographiclib-1.21/doc/html/Planimeter.1.html0000644000175000017500000002065111745620414020722 0ustar frankiefrankie Planimeter -- compute the area of geodesic polygons


NAME

Planimeter -- compute the area of geodesic polygons


SYNOPSIS

Planimeter [ -r ] [ -s ] [ -l ] [ -e a f ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

Measure the area of a geodesic polygon. Reads polygon vertices from standard input, one per line. Vertices may be given as latitude and longitude, UTM/UPS, or MGRS coordinates, interpreted in the same way as GeoConvert(1). (MGRS coordinates signify the center of the corresponding MGRS square.) The end of input, a blank line, or a line which can't be interpreted as a vertex signals the end of one polygon and the start of the next. For each polygon print a summary line with the number of points, the perimeter (in meters), and the area (in meters^2).

By default, polygons traversed in a counter-clockwise direction return a positive area and those traversed in a clockwise direction return a negative area. This sign convention is reversed if the -r option is given.

Of course, encircling an area in the clockwise direction is equivalent to encircling the rest of the ellipsoid in the counter-clockwise direction. The default interpretation used by Planimeter is the one that results in a smaller magnitude of area; i.e., the magnitude of the area is less than or equal to one half the total area of the ellipsoid. If the -s option is given, then the interpretation used is the one that results in a positive area; i.e., the area is positive and less than the total area of the ellipsoid.

Only simple polygons are supported for the area computation. Polygons may include one or both poles. There is no need to close the polygon.


OPTIONS

-r

toggle whether counter-clockwise traversal of the polygon returns a positive (the default) or negative result.

-s

toggle whether to return a signed result (the default) or not.

-l

toggle whether the vertices represent a polygon (the default) or a polyline. For a polyline, the number of points and the length of the path joining them is returned; the path is not closed and the area is not reported.

-e

specify the ellipsoid via a f; the equatorial radius is a and the flattening is f. Setting f = 0 results in a sphere. Specify f < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563. If entering vertices as UTM/UPS or MGRS coordinates, use the default ellipsoid, since the conversion of these coordinates to latitude and longitude uses the WGS84 parameters.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing. For a given polygon, the last such string found will be appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


EXAMPLES

Example (the area of the 100km MGRS square 18SWK)

   Planimeter <<EOF
   18N 500000 4400000
   18N 600000 4400000
   18N 600000 4500000
   18N 500000 4500000
   EOF
   => 4 400139.53295860 10007388597.1913

The following code takes the output from gdalinfo and reports the area covered by the data (assuming the edges of the image are geodesics).

   #! /bin/sh
   egrep '^((Upper|Lower) (Left|Right)|Center) ' |
   sed -e 's/d /d/g' -e "s/' /'/g" | tr -s '(),\r\t' ' ' | awk '{
       if ($1 $2 == "UpperLeft")
           ul = $6 " " $5;
       else if ($1 $2 == "LowerLeft")
           ll = $6 " " $5;
       else if ($1 $2 == "UpperRight")
           ur = $6 " " $5;
       else if ($1 $2 == "LowerRight")
           lr = $6 " " $5;
       else if ($1 == "Center") {
           printf "%s\n%s\n%s\n%s\n\n", ul, ll, lr, ur;
           ul = ll = ur = lr = "";
       }
   }
   ' | Planimeter | cut -f3 -d' '


SEE ALSO

GeoConvert(1). The algorithm for the area of geodesic polygon is given in Section 15 of C. F. F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011; preprint http://arxiv.org/abs/1102.1215. See also Section 6 of C. F. F. Karney, Algorithms for geodesics, Sept. 2011; preprint http://arxiv.org/abs/1109.4448.


AUTHOR

Planimeter was written by Charles Karney.


HISTORY

Planimeter was added to GeographicLib, http://geographiclib.sf.net, in version 1.4.

geographiclib-1.21/doc/html/files.html0000644000175000017500000006156511745620415017577 0ustar frankiefrankie GeographicLib: File List
File List
Here is a list of all files with brief descriptions:
Accumulator.hpp [code]Header for GeographicLib::Accumulator class
AlbersEqualArea.cpp [code]Implementation for GeographicLib::AlbersEqualArea class
AlbersEqualArea.hpp [code]Header for GeographicLib::AlbersEqualArea class
AzimuthalEquidistant.cpp [code]Implementation for GeographicLib::AzimuthalEquidistant class
AzimuthalEquidistant.hpp [code]Header for GeographicLib::AzimuthalEquidistant class
CartConvert.cpp [code]Command line utility for geodetic to cartesian coordinate conversions
CassiniSoldner.cpp [code]Implementation for GeographicLib::CassiniSoldner class
CassiniSoldner.hpp [code]Header for GeographicLib::CassiniSoldner class
CircularEngine.cpp [code]Implementation for GeographicLib::CircularEngine class
CircularEngine.hpp [code]Header for GeographicLib::CircularEngine class
ConicProj.cpp [code]Command line utility for conical projections
Constants.hpp [code]Header for GeographicLib::Constants class
DMS.cpp [code]Implementation for GeographicLib::DMS class
DMS.hpp [code]Header for GeographicLib::DMS class
EllipticFunction.cpp [code]Implementation for GeographicLib::EllipticFunction class
EllipticFunction.hpp [code]Header for GeographicLib::EllipticFunction class
Geocentric.cpp [code]Implementation for GeographicLib::Geocentric class
Geocentric.hpp [code]Header for GeographicLib::Geocentric class
GeoConvert.cpp [code]Command line utility for geographic coordinate conversions
GeoCoords.cpp [code]Implementation for GeographicLib::GeoCoords class
GeoCoords.hpp [code]Header for GeographicLib::GeoCoords class
Geod.cpp [code]Command line utility for geodesic calculations
Geodesic.cpp [code]Implementation for GeographicLib::Geodesic class
Geodesic.hpp [code]Header for GeographicLib::Geodesic class
GeodesicLine.cpp [code]Implementation for GeographicLib::GeodesicLine class
GeodesicLine.hpp [code]Header for GeographicLib::GeodesicLine class
GeodesicProj.cpp [code]Command line utility for geodesic projections
Geoid.cpp [code]Implementation for GeographicLib::Geoid class
Geoid.hpp [code]Header for GeographicLib::Geoid class
GeoidEval.cpp [code]Command line utility for evaluating geoid heights
Gnomonic.cpp [code]Implementation for GeographicLib::Gnomonic class
Gnomonic.hpp [code]Header for GeographicLib::Gnomonic class
Gravity.cpp [code]Command line utility for evaluating gravity fields
GravityCircle.cpp [code]Implementation for GeographicLib::GravityCircle class
GravityCircle.hpp [code]Header for GeographicLib::GravityCircle class
GravityModel.cpp [code]Implementation for GeographicLib::GravityModel class
GravityModel.hpp [code]Header for GeographicLib::GravityModel class
LambertConformalConic.cpp [code]Implementation for GeographicLib::LambertConformalConic class
LambertConformalConic.hpp [code]Header for GeographicLib::LambertConformalConic class
LocalCartesian.cpp [code]Implementation for GeographicLib::LocalCartesian class
LocalCartesian.hpp [code]Header for GeographicLib::LocalCartesian class
MagneticCircle.cpp [code]Implementation for GeographicLib::MagneticCircle class
MagneticCircle.hpp [code]Header for GeographicLib::MagneticCircle class
MagneticField.cpp [code]Command line utility for evaluating magnetic fields
MagneticModel.cpp [code]Implementation for GeographicLib::MagneticModel class
MagneticModel.hpp [code]Header for GeographicLib::MagneticModel class
Math.hpp [code]Header for GeographicLib::Math class
MGRS.cpp [code]Implementation for GeographicLib::MGRS class
MGRS.hpp [code]Header for GeographicLib::MGRS class
NormalGravity.cpp [code]Implementation for GeographicLib::NormalGravity class
NormalGravity.hpp [code]Header for GeographicLib::NormalGravity class
OSGB.cpp [code]Implementation for GeographicLib::OSGB class
OSGB.hpp [code]Header for GeographicLib::OSGB class
Planimeter.cpp [code]Command line utility for measuring the area of geodesic polygons
PolarStereographic.cpp [code]Implementation for GeographicLib::PolarStereographic class
PolarStereographic.hpp [code]Header for GeographicLib::PolarStereographic class
PolygonArea.cpp [code]Implementation for GeographicLib::PolygonArea class
PolygonArea.hpp [code]Header for GeographicLib::PolygonArea class
SphericalEngine.cpp [code]Implementation for GeographicLib::SphericalEngine class
SphericalEngine.hpp [code]Header for GeographicLib::SphericalEngine class
SphericalHarmonic.hpp [code]Header for GeographicLib::SphericalHarmonic class
SphericalHarmonic1.hpp [code]Header for GeographicLib::SphericalHarmonic1 class
SphericalHarmonic2.hpp [code]Header for GeographicLib::SphericalHarmonic2 class
TransverseMercator.cpp [code]Implementation for GeographicLib::TransverseMercator class
TransverseMercator.hpp [code]Header for GeographicLib::TransverseMercator class
TransverseMercatorExact.cpp [code]Implementation for GeographicLib::TransverseMercatorExact class
TransverseMercatorExact.hpp [code]Header for GeographicLib::TransverseMercatorExact class
TransverseMercatorProj.cpp [code]Command line utility for transverse Mercator projections
Utility.cpp [code]Implementation for GeographicLib::Utility class
Utility.hpp [code]Header for GeographicLib::Utility class
UTMUPS.cpp [code]Implementation for GeographicLib::UTMUPS class
UTMUPS.hpp [code]Header for GeographicLib::UTMUPS class
geographiclib-1.21/doc/html/start.html0000644000175000017500000002530111745620415017616 0ustar frankiefrankie GeographicLib: Getting started
Getting started
Back to Installing GeographicLib. Forward to Utility programs. Up to Contents.

Much (but not all!) of the useful functionality of GeographicLib is available via simple command line utilities. Interfaces to some of them are available via the web. See Utility programs for documentation on these.

In order to use GeographicLib from C++ code, you will need to

  • Include the header files for the GeographicLib classes in your code. E.g.,
  • Include the GeographicLib:: namespace prefix to the GeographicLib classes, or include
      using namespace GeographicLib; 
    
    in your code.
  • Tell the compiler where to find the header files. With g++ and with /usr/local specified as the installation directory, this is accomplished with
      g++ -c -g -O3 -I/usr/local/include testprogram.cpp
    
    With Visual Studio, specify the include directory in the IDE via, e.g.,
    C/C++ -> General -> Additional Include Directories = C:\pkg-vc10\GeographicLib\include
    
  • Tell the linker the name, Geographic, and location of the library. Using g++ as the linker, you would use
      g++ -g -o testprogram testprogram.o -L/usr/local/lib -lGeographic
    
    With Visual Studio, you supply this information in the IDE via, e.g.,
    Linker -> Input -> Additional Dependencies = Geographic.lib
    Linker -> General -> Additional Library Directories = C:\pkg-vc10\GeographicLib\lib
    
    Note that the library name is Geographic and not GeographicLib. If the library was configured and built with cmake, then the debug version of the library is called Geographic_d.lib.
  • Tell the runtime environment where to find the shared library (assuming you compiled GeographicLib as a shared library). With g++, this is accomplished by modifying the link line above to read
      g++ -g -o testprogram testprogram.o -Wl,-rpath=/usr/local/lib -L/usr/local/lib -lGeographic
    
    (There are two other ways to specify the location of shared libraries at runtime: (1) define the environment variable LD_LIBRARY_PATH to be a colon-separated list of directories to search; (2) as root, specify /usr/local/lib as a directory searched by ldconfig(8).) On Windows, you need to ensure that Geographic.dll is in the same directory as your executable or else include the directory containing the dll in your PATH.
  • If you're using cmake to configure and build your project, then instead of the previous three steps, insert
      # Put in your top-level CMakeLists.txt
      find_package (GeographicLib 1.9 REQUIRED)
      # In the top-level CMakeLists.txt or wherever your code is compiled
      include_directories (${GeographicLib_INCLUDE_DIRS})
      # In the CMakeLists.txt where you define your executable targets
      target_link_libraries (program1 ${GeographicLib_LIBRARIES})
      target_link_libraries (program2 ${GeographicLib_LIBRARIES}) 
    in your CMakeLists.txt files (as noted). find_package command should find the library and set the required cmake variables (including GEOGRAPHICLIB_FOUND = TRUE). For find_package to be able to locate GeographicLib, it may be necessary for GeographicLib to be built and installed with cmake (see Installation with cmake) instead of using some other installation method. In addition, on Windows systems, you should specify CMAKE_PREFIX_PATH with, for example,
      cmake -G "Visual Studio 10" -D CMAKE_PREFIX_PATH=C:/pkg-vc10 -D CMAKE_INSTALL_PREFIX=C:/pkg-vc10/XYZProject ..
    
    (If you used some other method of installing GeographicLib, you can try copying cmake/FindGeographicLib.cmake to somewhere in your CMAKE_MODULE_PATH in order for find_package to work. However, this method has not been thoroughly tested.)
  • For Windows, ensure that you build the library with the same version of the compiler and you use for your code. In addition, you have to build a separate debug version of the library when you can compiling your code in debug mode. The configuration of cmake described above ensures that the right version of the compiler is used and, assuming you built and installed GeographicLib in debug mode, the debug version of the library Geographic_d.lib will be used.

Here is a very simple test code, which uses the GeographicLib::Geodesic class:

// Small example of using the GeographicLib::Geodesic class
// $Id: 23959b26e8023e42f76afabf7a2d7b593666a71a $

#include <iostream>
#include <GeographicLib/Geodesic.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  const Geodesic& geod = Geodesic::WGS84;
  // Distance from JFK to LHR
  double
    lat1 = 40.6, lon1 = -73.8, // JFK Airport
    lat2 = 51.6, lon2 = -0.5;  // LHR Airport
  double s12;
  geod.Inverse(lat1, lon1, lat2, lon2, s12);
  cout << s12 / 1000 << " km\n";
  return 0;
}

This example is examples/example-Geodesic-small.cpp. If you compile, link, and run it according to the instructions above, it should print out

  5551.76 km

The next steps are:

  • Learn about and run the Utility programs.
  • Read the section, Code organization, for an overview of the library.
  • Browse the Class List for full documentation on the classes in the library.
  • Look at the example code in the examples directory. Each file provides a very simple standalone example of using one GeographicLib class. These are included in the descriptions of the classes.
  • Look at the source code for the utilities in the tools directory for more examples of using GeographicLib from C++ code, e.g., GeodesicProj.cpp is a program to performing various geodesic projections.

Here's a list of some of the abbreviations used here with links to the corresponding Wikipedia articles:

  • WGS84, World Geodetic System 1984.
  • UTM, Universal Transverse Mercator coordinate system.
  • UPS, Universal Polar Stereographic coordinate system.
  • MGRS, Military Grid Reference System.
  • EGM, Earth Gravity Model.
  • WMM, World Magnetic Model.
  • IGRF, International Geomagnetic Reference Field.
Back to Installing GeographicLib. Forward to Utility programs. Up to Contents.
geographiclib-1.21/doc/html/MagneticCircle_8cpp_source.html0000644000175000017500000001736211745620415023654 0ustar frankiefrankie GeographicLib: MagneticCircle.cpp Source File
MagneticCircle.cpp
Go to the documentation of this file.
00001 /**
00002  * \file MagneticCircle.cpp
00003  * \brief Implementation for GeographicLib::MagneticCircle class
00004  *
00005  * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under
00006  * the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/MagneticCircle.hpp>
00011 #include <fstream>
00012 #include <sstream>
00013 #include <GeographicLib/Geocentric.hpp>
00014 
00015 #define GEOGRAPHICLIB_MAGNETICCIRCLE_CPP \
00016   "$Id: 8cd933c406708a1f8b90e029e89bb99d2eb177b0 $"
00017 
00018 RCSID_DECL(GEOGRAPHICLIB_MAGNETICCIRCLE_CPP)
00019 RCSID_DECL(GEOGRAPHICLIB_MAGNETICCIRCLE_HPP)
00020 
00021 #define MAGNETIC_DEFAULT_PATH "/home/ckarney/geographiclib/magnetic"
00022 
00023 namespace GeographicLib {
00024 
00025   using namespace std;
00026 
00027   void MagneticCircle::Field(real lon, bool diffp,
00028                              real& Bx, real& By, real& Bz,
00029                              real& Bxt, real& Byt, real& Bzt) const throw() {
00030     real clam, slam;
00031     CircularEngine::cossin(lon, clam, slam);
00032     real M[Geocentric::dim2_];
00033     Geocentric::Rotation(_sphi, _cphi, slam, clam, M);
00034     real BX0, BY0, BZ0, BX1, BY1, BZ1; // Components in geocentric basis
00035     _circ0(clam, slam, BX0, BY0, BZ0);
00036     _circ1(clam, slam, BX1, BY1, BZ1);
00037     if (_interpolate) {
00038       BX1 = (BX1 - BX0) / _dt0;
00039       BY1 = (BY1 - BY0) / _dt0;
00040       BZ1 = (BZ1 - BZ0) / _dt0;
00041     }
00042     BX0 += _t1 * BX1;
00043     BY0 += _t1 * BY1;
00044     BZ0 += _t1 * BZ1;
00045     if (diffp) {
00046       Geocentric::Unrotate(M, BX1, BY1, BZ1, Bxt, Byt, Bzt);
00047       Bxt *= - _a;
00048       Byt *= - _a;
00049       Bzt *= - _a;
00050     }
00051     Geocentric::Unrotate(M, BX0, BY0, BZ0, Bx, By, Bz);
00052     Bx *= - _a;
00053     By *= - _a;
00054     Bz *= - _a;
00055   }
00056 
00057 } // namespace GeographicLib
geographiclib-1.21/doc/html/functions_func_0x68.html0000644000175000017500000001205411745620415022272 0ustar frankiefrankie GeographicLib: Class Members - Functions geographiclib-1.21/doc/html/Math_8hpp_source.html0000644000175000017500000015055111745620414021676 0ustar frankiefrankie GeographicLib: Math.hpp Source File
Math.hpp
Go to the documentation of this file.
00001 /**
00002  * \file Math.hpp
00003  * \brief Header for GeographicLib::Math class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 // Constants.hpp includes Math.hpp.  Place this include outside Math.hpp's
00011 // include guard to enforce this ordering.
00012 #include <GeographicLib/Constants.hpp>
00013 
00014 #if !defined(GEOGRAPHICLIB_MATH_HPP)
00015 #define GEOGRAPHICLIB_MATH_HPP "$Id: edd244e4c5c74e696096c2b6d598728957a0d36d $"
00016 
00017 /**
00018  * Are C++11 math functions available?
00019  **********************************************************************/
00020 #if !defined(GEOGRAPHICLIB_CPLUSPLUS11_MATH)
00021 #  if defined(__GXX_EXPERIMENTAL_CXX0X__)
00022 #    define GEOGRAPHICLIB_CPLUSPLUS11_MATH 1
00023 #  else
00024 #    define GEOGRAPHICLIB_CPLUSPLUS11_MATH 0
00025 #  endif
00026 #endif
00027 
00028 #if !defined(WORDS_BIGENDIAN)
00029 # define WORDS_BIGENDIAN 0
00030 #endif
00031 
00032 #if !defined(GEOGRAPHICLIB_PREC)
00033 /**
00034  * The precision of floating point numbers used in %GeographicLib.  0 means
00035  * float; 1 (default) means double; 2 means long double.  Nearly all the
00036  * testing has been carried out with doubles and that's the recommended
00037  * configuration.  In order for long double to be used, HAVE_LONG_DOUBLE needs
00038  * to be defined.  Note that with Microsoft Visual Studio, long double is the
00039  * same as double.
00040  **********************************************************************/
00041 #define GEOGRAPHICLIB_PREC 1
00042 #endif
00043 
00044 #include <cmath>
00045 #include <limits>
00046 #include <algorithm>
00047 #include <vector>
00048 
00049 namespace GeographicLib {
00050 
00051   /**
00052    * \brief Mathematical functions needed by %GeographicLib
00053    *
00054    * Define mathematical functions in order to localize system dependencies and
00055    * to provide generic versions of the functions.  In addition define a real
00056    * type to be used by %GeographicLib.
00057    *
00058    * Example of use:
00059    * \include example-Math.cpp
00060    **********************************************************************/
00061   class GEOGRAPHIC_EXPORT Math {
00062   private:
00063     void dummy() {
00064       STATIC_ASSERT(GEOGRAPHICLIB_PREC >= 0 && GEOGRAPHICLIB_PREC <= 2,
00065                     "Bad value of precision");
00066     }
00067     Math();                     // Disable constructor
00068   public:
00069 
00070 #if defined(HAVE_LONG_DOUBLE)
00071     /**
00072      * The extended precision type for real numbers, used for some testing.
00073      * This is long double on computers with this type; otherwise it is double.
00074      **********************************************************************/
00075     typedef long double extended;
00076 #else
00077     typedef double extended;
00078 #endif
00079 
00080 #if GEOGRAPHICLIB_PREC == 1
00081     /**
00082      * The real type for %GeographicLib. Nearly all the testing has been done
00083      * with \e real = double.  However, the algorithms should also work with
00084      * float and long double (where available).  (<b>CAUTION</b>: reasonable
00085      * accuracy typically cannot be obtained using floats.)
00086      **********************************************************************/
00087     typedef double real;
00088 #elif GEOGRAPHICLIB_PREC == 0
00089     typedef float real;
00090 #elif GEOGRAPHICLIB_PREC == 2
00091     typedef extended real;
00092 #else
00093     typedef double real;
00094 #endif
00095 
00096     /**
00097      * true if the machine is big-endian
00098      **********************************************************************/
00099     static const bool bigendian = WORDS_BIGENDIAN;
00100 
00101     /**
00102      * @tparam T the type of the returned value.
00103      * @return \e pi.
00104      **********************************************************************/
00105     template<typename T> static inline T pi() throw()
00106     { return std::atan2(T(0), -T(1)); }
00107     /**
00108      * A synonym for pi<real>().
00109      **********************************************************************/
00110     static inline real pi() throw() { return pi<real>(); }
00111 
00112     /**
00113      * @tparam T the type of the returned value.
00114      * @return the number of radians in a degree.
00115      **********************************************************************/
00116     template<typename T> static inline T degree() throw()
00117     { return pi<T>() / T(180); }
00118     /**
00119      * A synonym for degree<real>().
00120      **********************************************************************/
00121     static inline real degree() throw() { return degree<real>(); }
00122 
00123     /**
00124      * Square a number.
00125 
00126      * @tparam T the type of the argument and the returned value.
00127      * @param[in] x
00128      * @return <i>x</i><sup>2</sup>.
00129      **********************************************************************/
00130     template<typename T> static inline T sq(T x) throw()
00131     { return x * x; }
00132 
00133 #if defined(DOXYGEN)
00134     /**
00135      * The hypotenuse function avoiding underflow and overflow.
00136      *
00137      * @tparam T the type of the arguments and the returned value.
00138      * @param[in] x
00139      * @param[in] y
00140      * @return sqrt(<i>x</i><sup>2</sup> + <i>y</i><sup>2</sup>).
00141      **********************************************************************/
00142     template<typename T> static inline T hypot(T x, T y) throw() {
00143       x = std::abs(x);
00144       y = std::abs(y);
00145       T a = (std::max)(x, y),
00146         b = (std::min)(x, y) / (a ? a : 1);
00147       return a * std::sqrt(1 + b * b);
00148     }
00149 #elif GEOGRAPHICLIB_CPLUSPLUS11_MATH
00150     template<typename T> static inline T hypot(T x, T y) throw()
00151     { return std::hypot(x, y); }
00152 #elif defined(_MSC_VER)
00153     static inline double hypot(double x, double y) throw()
00154     { return _hypot(x, y); }
00155 #if _MSC_VER < 1400
00156     // Visual C++ 7.1/VS .NET 2003 does not have _hypotf()
00157     static inline float hypot(float x, float y) throw()
00158     { return float(_hypot(x, y)); }
00159 #else
00160     static inline float hypot(float x, float y) throw()
00161     { return _hypotf(x, y); }
00162 #endif
00163 #if defined(HAVE_LONG_DOUBLE)
00164     static inline long double hypot(long double x, long double y) throw()
00165     { return _hypot(x, y); }
00166 #endif
00167 #else
00168     // Use overloading to define generic versions
00169     static inline double hypot(double x, double y) throw()
00170     { return ::hypot(x, y); }
00171     static inline float hypot(float x, float y) throw()
00172     { return ::hypotf(x, y); }
00173 #if defined(HAVE_LONG_DOUBLE)
00174     static inline long double hypot(long double x, long double y) throw()
00175     { return ::hypotl(x, y); }
00176 #endif
00177 #endif
00178 
00179 #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MATH)
00180     /**
00181      * exp(\e x) - 1 accurate near \e x = 0.  This is taken from
00182      * N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd
00183      * Edition (SIAM, 2002), Sec 1.14.1, p 19.
00184      *
00185      * @tparam T the type of the argument and the returned value.
00186      * @param[in] x
00187      * @return exp(\e x) - 1.
00188      **********************************************************************/
00189     template<typename T> static inline T expm1(T x) throw() {
00190       volatile T
00191         y = std::exp(x),
00192         z = y - 1;
00193       // The reasoning here is similar to that for log1p.  The expression
00194       // mathematically reduces to exp(x) - 1, and the factor z/log(y) = (y -
00195       // 1)/log(y) is a slowly varying quantity near y = 1 and is accurately
00196       // computed.
00197       return std::abs(x) > 1 ? z : (z == 0 ? x : x * z / std::log(y));
00198     }
00199 #elif GEOGRAPHICLIB_CPLUSPLUS11_MATH
00200     template<typename T> static inline T expm1(T x) throw()
00201     { return std::expm1(x); }
00202 #else
00203     static inline double expm1(double x) throw() { return ::expm1(x); }
00204     static inline float expm1(float x) throw() { return ::expm1f(x); }
00205 #if defined(HAVE_LONG_DOUBLE)
00206     static inline long double expm1(long double x) throw()
00207     { return ::expm1l(x); }
00208 #endif
00209 #endif
00210 
00211 #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MATH)
00212     /**
00213      * log(1 + \e x) accurate near \e x = 0.
00214      *
00215      * This is taken from D. Goldberg,
00216      * <a href="http://dx.doi.org/10.1145/103162.103163">What every computer
00217      * scientist should know about floating-point arithmetic</a> (1991),
00218      * Theorem 4.  See also, Higham (op. cit.), Answer to Problem 1.5, p 528.
00219      *
00220      * @tparam T the type of the argument and the returned value.
00221      * @param[in] x
00222      * @return log(1 + \e x).
00223      **********************************************************************/
00224     template<typename T> static inline T log1p(T x) throw() {
00225       volatile T
00226         y = 1 + x,
00227         z = y - 1;
00228       // Here's the explanation for this magic: y = 1 + z, exactly, and z
00229       // approx x, thus log(y)/z (which is nearly constant near z = 0) returns
00230       // a good approximation to the true log(1 + x)/x.  The multiplication x *
00231       // (log(y)/z) introduces little additional error.
00232       return z == 0 ? x : x * std::log(y) / z;
00233     }
00234 #elif GEOGRAPHICLIB_CPLUSPLUS11_MATH
00235     template<typename T> static inline T log1p(T x) throw()
00236     { return std::log1p(x); }
00237 #else
00238     static inline double log1p(double x) throw() { return ::log1p(x); }
00239     static inline float log1p(float x) throw() { return ::log1pf(x); }
00240 #if defined(HAVE_LONG_DOUBLE)
00241     static inline long double log1p(long double x) throw()
00242     { return ::log1pl(x); }
00243 #endif
00244 #endif
00245 
00246 #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MATH)
00247     /**
00248      * The inverse hyperbolic sine function.  This is defined in terms of
00249      * Math::log1p(\e x) in order to maintain accuracy near \e x = 0.  In
00250      * addition, the odd parity of the function is enforced.
00251      *
00252      * @tparam T the type of the argument and the returned value.
00253      * @param[in] x
00254      * @return asinh(\e x).
00255      **********************************************************************/
00256     template<typename T> static inline T asinh(T x) throw() {
00257       T y = std::abs(x);     // Enforce odd parity
00258       y = log1p(y * (1 + y/(hypot(T(1), y) + 1)));
00259       return x < 0 ? -y : y;
00260     }
00261 #elif GEOGRAPHICLIB_CPLUSPLUS11_MATH
00262     template<typename T> static inline T asinh(T x) throw()
00263     { return std::asinh(x); }
00264 #else
00265     static inline double asinh(double x) throw() { return ::asinh(x); }
00266     static inline float asinh(float x) throw() { return ::asinhf(x); }
00267 #if defined(HAVE_LONG_DOUBLE)
00268     static inline long double asinh(long double x) throw()
00269     { return ::asinhl(x); }
00270 #endif
00271 #endif
00272 
00273 #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MATH)
00274     /**
00275      * The inverse hyperbolic tangent function.  This is defined in terms of
00276      * Math::log1p(\e x) in order to maintain accuracy near \e x = 0.  In
00277      * addition, the odd parity of the function is enforced.
00278      *
00279      * @tparam T the type of the argument and the returned value.
00280      * @param[in] x
00281      * @return atanh(\e x).
00282      **********************************************************************/
00283     template<typename T> static inline T atanh(T x) throw() {
00284       T y = std::abs(x);     // Enforce odd parity
00285       y = log1p(2 * y/(1 - y))/2;
00286       return x < 0 ? -y : y;
00287     }
00288 #elif GEOGRAPHICLIB_CPLUSPLUS11_MATH
00289     template<typename T> static inline T atanh(T x) throw()
00290     { return std::atanh(x); }
00291 #else
00292     static inline double atanh(double x) throw() { return ::atanh(x); }
00293     static inline float atanh(float x) throw() { return ::atanhf(x); }
00294 #if defined(HAVE_LONG_DOUBLE)
00295     static inline long double atanh(long double x) throw()
00296     { return ::atanhl(x); }
00297 #endif
00298 #endif
00299 
00300 #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MATH)
00301     /**
00302      * The cube root function.
00303      *
00304      * @tparam T the type of the argument and the returned value.
00305      * @param[in] x
00306      * @return the real cube root of \e x.
00307      **********************************************************************/
00308     template<typename T> static inline T cbrt(T x) throw() {
00309       T y = std::pow(std::abs(x), 1/T(3)); // Return the real cube root
00310       return x < 0 ? -y : y;
00311     }
00312 #elif GEOGRAPHICLIB_CPLUSPLUS11_MATH
00313     template<typename T> static inline T cbrt(T x) throw()
00314     { return std::cbrt(x); }
00315 #else
00316     static inline double cbrt(double x) throw() { return ::cbrt(x); }
00317     static inline float cbrt(float x) throw() { return ::cbrtf(x); }
00318 #if defined(HAVE_LONG_DOUBLE)
00319     static inline long double cbrt(long double x) throw() { return ::cbrtl(x); }
00320 #endif
00321 #endif
00322 
00323     /**
00324      * Test for finiteness.
00325      *
00326      * @tparam T the type of the argument.
00327      * @param[in] x
00328      * @return true if number is finite, false if NaN or infinite.
00329      **********************************************************************/
00330     template<typename T> static inline bool isfinite(T x) throw() {
00331 #if defined(DOXYGEN)
00332       return std::abs(x) <= (std::numeric_limits<T>::max)();
00333 #elif (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MATH)
00334       return _finite(x) != 0;
00335 #else
00336       return std::isfinite(x);
00337 #endif
00338     }
00339 
00340     /**
00341      * The NaN (not a number)
00342      *
00343      * @tparam T the type of the returned value.
00344      * @return NaN if available, otherwise return the max real.
00345      **********************************************************************/
00346     template<typename T> static inline T NaN() throw() {
00347       return std::numeric_limits<T>::has_quiet_NaN ?
00348         std::numeric_limits<T>::quiet_NaN() :
00349         (std::numeric_limits<T>::max)();
00350     }
00351     /**
00352      * A synonym for NaN<real>().
00353      **********************************************************************/
00354     static inline real NaN() throw() { return NaN<real>(); }
00355 
00356     /**
00357      * Test for NaN.
00358      *
00359      * @tparam T the type of the argument.
00360      * @param[in] x
00361      * @return true if argument is a NaN.
00362      **********************************************************************/
00363     template<typename T> static inline bool isnan(T x) throw() {
00364 #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MATH)
00365       return x != x;
00366 #else
00367       return std::isnan(x);
00368 #endif
00369     }
00370 
00371     /**
00372      * Infinity
00373      *
00374      * @tparam T the type of the returned value.
00375      * @return infinity if available, otherwise return the max real.
00376      **********************************************************************/
00377     template<typename T> static inline T infinity() throw() {
00378       return std::numeric_limits<T>::has_infinity ?
00379         std::numeric_limits<T>::infinity() :
00380         (std::numeric_limits<T>::max)();
00381     }
00382     /**
00383      * A synonym for infinity<real>().
00384      **********************************************************************/
00385     static inline real infinity() throw() { return infinity<real>(); }
00386 
00387     /**
00388      * Swap the bytes of a quantity
00389      *
00390      * @tparam T the type of the argument and the returned value.
00391      * @param[in] x
00392      * @return x with its bytes swapped.
00393      **********************************************************************/
00394     template<typename T> static inline T swab(T x) {
00395       union {
00396         T r;
00397         unsigned char c[sizeof(T)];
00398       } b;
00399       b.r = x;
00400       for (int i = sizeof(T)/2; i--; )
00401         std::swap(b.c[i], b.c[sizeof(T) - 1 - i]);
00402       return b.r;
00403     }
00404   };
00405 
00406 } // namespace GeographicLib
00407 
00408 #endif  // GEOGRAPHICLIB_MATH_HPP
geographiclib-1.21/doc/html/classGeographicLib_1_1SphericalEngine.html0000644000175000017500000006423611745620414025640 0ustar frankiefrankie GeographicLib: GeographicLib::SphericalEngine Class Reference
GeographicLib::SphericalEngine Class Reference

The evaluation engine for SphericalHarmonic. More...

#include <GeographicLib/SphericalEngine.hpp>

List of all members.

Classes

class  coeff
 Package up coefficients for SphericalEngine. More...

Public Types

enum  normalization { FULL, SCHMIDT }

Static Public Member Functions

template<bool gradp, normalization norm, int L>
static Math::real Value (const coeff c[], const real f[], real x, real y, real z, real a, real &gradx, real &grady, real &gradz) throw ()
template<bool gradp, normalization norm, int L>
static CircularEngine Circle (const coeff c[], const real f[], real p, real z, real a)
static void RootTable (int N)
static void ClearRootTable ()

Friends

class CircularEngine

Detailed Description

The evaluation engine for SphericalHarmonic.

This serves as the backend to SphericalHarmonic, SphericalHarmonic1, and SphericalHarmonic2. Typically end-users will not have to access this class directly.

See SphericalEngine.cpp for more information on the implementation.

Example of use:

// Example of using the GeographicLib::SphericalEngine class
// $Id: 08fe16ba3619311b15fc58956511a88c37886f91 $

#include <iostream>
#include <exception>
#include <vector>
#include <GeographicLib/SphericalEngine.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  // See also example-SphericHarmonic.cpp
  try {
    int N = 3;                  // The maxium degree
    double ca[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients
    vector<double> C(ca, ca + (N + 1) * (N + 2) / 2);
    double sa[] = {6, 5, 4, 3, 2, 1}; // sine coefficients
    vector<double> S(sa, sa + N * (N + 1) / 2);
    SphericalEngine::coeff c[1];
    c[0] = SphericalEngine::coeff(C, S, N);
    double f[] = {1};
    double x = 2, y = 3, z = 1, a = 1;
    double v, vx, vy, vz;
    v = SphericalEngine::Value<true, SphericalEngine::FULL, 1>
      (c, f, x, y, z, a, vx, vy, vz);
    cout << v << " " << vx << " " << vy << " " << vz << "\n";
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Member Enumeration Documentation

Supported normalizations for associated Legendre polynomials.

Enumerator:
FULL 

Fully normalized associated Legendre polynomials. See SphericalHarmonic::FULL for documentation.

SCHMIDT 

Schmidt semi-normalized associated Legendre polynomials. See SphericalHarmonic::SCHMIDT for documentation.

Definition at line 58 of file SphericalEngine.hpp.


Member Function Documentation

template<bool gradp, SphericalEngine::normalization norm, int L>
Math::real GeographicLib::SphericalEngine::Value ( const coeff  c[],
const real  f[],
real  x,
real  y,
real  z,
real  a,
real &  gradx,
real &  grady,
real &  gradz 
) throw () [static]

Evaluate a spherical harmonic sum and its gradient.

Template Parameters:
gradpshould the gradient be calculated.
normthe normalization for the associated Legendre polynomials.
Lthe number of terms in the coefficients.
Parameters:
[in]can array of coeff objects.
[in]farray of coefficient multipliers. f[0] should be 1.
[in]xthe x component of the cartesian position.
[in]ythe y component of the cartesian position.
[in]zthe z component of the cartesian position.
[in]athe normalizing radius.
[out]gradxthe x component of the gradient.
[out]gradythe y component of the gradient.
[out]gradzthe z component of the gradient.
Returns:
the spherical harmonic sum.

See the SphericalHarmonic class for the definition of the sum. The coefficients used by this function are, for example, c[0].Cv + f[1] * c[1].Cv + ... + f[L-1] * c[L-1].Cv. (Note that f[0] is not used.) The upper limits on the sum are determined by c[0].nmx() and c[0].mmx(); these limits apply to all the components of the coefficients. The parameters gradp, norm, and L are template parameters, to allow more optimization to be done at compile time.

Clenshaw summation is used which permits the evaluation of the sum without the need to allocate temporary arrays. Thus this function never throws an exception.

Definition at line 159 of file SphericalEngine.cpp.

References STATIC_ASSERT.

template<bool gradp, SphericalEngine::normalization norm, int L>
CircularEngine GeographicLib::SphericalEngine::Circle ( const coeff  c[],
const real  f[],
real  p,
real  z,
real  a 
) [static]

Create a CircularEngine object

Template Parameters:
gradpshould the gradient be calculated.
normthe normalization for the associated Legendre polynomials.
Lthe number of terms in the coefficients.
Parameters:
[in]can array of coeff objects.
[in]farray of coefficient multipliers. f[0] should be 1.
[in]pthe radius of the circle = sqrt(x2 + y2).
[in]zthe height of the circle.
[in]athe normalizing radius.
Returns:
the CircularEngine object.

If you need to evaluate the spherical harmonic sum for several points with constant f, p = sqrt(x2 + y2), z, and a, it is more efficient to construct call SphericalEngine::Circle to give a CircularEngine object and then call CircularEngine::operator()() with arguments x/p and y/p.

Definition at line 298 of file SphericalEngine.cpp.

References STATIC_ASSERT, GeographicLib::SphericalEngine::coeff::nmx(), GeographicLib::SphericalEngine::coeff::mmx(), GeographicLib::SphericalEngine::coeff::Cv(), and GeographicLib::SphericalEngine::coeff::Sv().

void GeographicLib::SphericalEngine::RootTable ( int  N) [static]

Check that the static table of square roots is big enough and enlarge it if necessary.

Parameters:
[in]Nthe maximum degree to be used in SphericalEngine.

Typically, there's no need for an end-user to call this routine, because the constructors for SphericalEngine::coeff do so. However, since this updates a static table, there's a possible race condition in a multi-threaded environment. Because this routine does nothing if the table is already large enough, one way to avoid race conditions is to call this routine at program start up (when it's still single threaded), supplying the largest degree that your program will use. E.g.,

suffices to accommodate extant magnetic and gravity models.

Definition at line 372 of file SphericalEngine.cpp.

Referenced by GeographicLib::SphericalEngine::coeff::coeff().

static void GeographicLib::SphericalEngine::ClearRootTable ( ) [inline, static]

Clear the static table of square roots and release the memory. Call this only when you are sure you no longer will be using SphericalEngine. Your program will crash if you call SphericalEngine after calling this routine. It's safest not to call this routine at all. (The space used by the table is modest.)

Definition at line 350 of file SphericalEngine.hpp.


Friends And Related Function Documentation

friend class CircularEngine [friend]

Definition at line 46 of file SphericalEngine.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/functions_func_0x69.html0000644000175000017500000001350011745620414022267 0ustar frankiefrankie GeographicLib: Class Members - Functions geographiclib-1.21/doc/html/functions_0x79.html0000644000175000017500000001061511745620415021262 0ustar frankiefrankie GeographicLib: Class Members
Here is a list of all class members with links to the classes they belong to:

- y -

geographiclib-1.21/doc/html/jquery.js0000644000175000017500000024562211745620414017461 0ustar frankiefrankie/* * jQuery JavaScript Library v1.3.2 * http://jquery.com/ * * Copyright (c) 2009 John Resig * Dual licensed under the MIT and GPL licenses. * http://docs.jquery.com/License * * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) * Revision: 6246 */ (function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); /* * Sizzle CSS Selector Engine - v0.9.3 * Copyright 2009, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * More information: http://sizzlejs.com/ */ (function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0) {I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function() {G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); /* * jQuery UI 1.7.2 * * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * http://docs.jquery.com/UI */ jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;/* * jQuery UI Resizable 1.7.2 * * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * http://docs.jquery.com/UI/Resizables * * Depends: * ui.core.js */ (function(c){c.widget("ui.resizable",c.extend({},c.ui.mouse,{_init:function(){var e=this,j=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(j.aspectRatio),aspectRatio:j.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:j.helper||j.ghost||j.animate?j.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css("position"))&&c.browser.opera){this.element.css({position:"relative",top:"auto",left:"auto"})}this.element.wrap(c('
').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=j.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var k=this.handles.split(",");this.handles={};for(var f=0;f
');if(/sw|se|ne|nw/.test(h)){g.css({zIndex:++j.zIndex})}if("se"==h){g.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[h]=".ui-resizable-"+h;this.element.append(g)}}this._renderAxis=function(p){p=p||this.element;for(var m in this.handles){if(this.handles[m].constructor==String){this.handles[m]=c(this.handles[m],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=c(this.handles[m],this.element),o=0;o=/sw|ne|nw|se|n|s/.test(m)?n.outerHeight():n.outerWidth();var l=["padding",/ne|nw|n/.test(m)?"Top":/se|sw|s/.test(m)?"Bottom":/^e$/.test(m)?"Right":"Left"].join("");p.css(l,o);this._proportionallyResize()}if(!c(this.handles[m]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!e.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}e.axis=i&&i[1]?i[1]:"se"}});if(j.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){c(this).removeClass("ui-resizable-autohide");e._handles.show()},function(){if(!e.resizing){c(this).addClass("ui-resizable-autohide");e._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var d=function(f){c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){d(this.element);var e=this.element;e.parent().append(this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")})).end().remove()}this.originalElement.css("resize",this.originalResizeStyle);d(this.originalElement)},_mouseCapture:function(e){var f=false;for(var d in this.handles){if(c(this.handles[d])[0]==e.target){f=true}}return this.options.disabled||!!f},_mouseStart:function(f){var i=this.options,e=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(d.is(".ui-draggable")||(/absolute/).test(d.css("position"))){d.css({position:"absolute",top:e.top,left:e.left})}if(c.browser.opera&&(/relative/).test(d.css("position"))){d.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var j=b(this.helper.css("left")),g=b(this.helper.css("top"));if(i.containment){j+=c(i.containment).scrollLeft()||0;g+=c(i.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:j,top:g};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:j,top:g};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:f.pageX,top:f.pageY};this.aspectRatio=(typeof i.aspectRatio=="number")?i.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var h=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",h=="auto"?this.axis+"-resize":h);d.addClass("ui-resizable-resizing");this._propagate("start",f);return true},_mouseDrag:function(d){var g=this.helper,f=this.options,l={},p=this,i=this.originalMousePosition,m=this.axis;var q=(d.pageX-i.left)||0,n=(d.pageY-i.top)||0;var h=this._change[m];if(!h){return false}var k=h.apply(this,[d,q,n]),j=c.browser.msie&&c.browser.version<7,e=this.sizeDiff;if(this._aspectRatio||d.shiftKey){k=this._updateRatio(k,d)}k=this._respectSize(k,d);this._propagate("resize",d);g.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(k);this._trigger("resize",d,this.ui());return false},_mouseStop:function(g){this.resizing=false;var h=this.options,l=this;if(this._helper){var f=this._proportionallyResizeElements,d=f.length&&(/textarea/i).test(f[0].nodeName),e=d&&c.ui.hasScroll(f[0],"left")?0:l.sizeDiff.height,j=d?0:l.sizeDiff.width;var m={width:(l.size.width-j),height:(l.size.height-e)},i=(parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left))||null,k=(parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top))||null;if(!h.animate){this.element.css(c.extend(m,{top:k,left:i}))}l.helper.height(l.size.height);l.helper.width(l.size.width);if(this._helper&&!h.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",g);if(this._helper){this.helper.remove()}return false},_updateCache:function(d){var e=this.options;this.offset=this.helper.offset();if(a(d.left)){this.position.left=d.left}if(a(d.top)){this.position.top=d.top}if(a(d.height)){this.size.height=d.height}if(a(d.width)){this.size.width=d.width}},_updateRatio:function(g,f){var h=this.options,i=this.position,e=this.size,d=this.axis;if(g.height){g.width=(e.height*this.aspectRatio)}else{if(g.width){g.height=(e.width/this.aspectRatio)}}if(d=="sw"){g.left=i.left+(e.width-g.width);g.top=null}if(d=="nw"){g.top=i.top+(e.height-g.height);g.left=i.left+(e.width-g.width)}return g},_respectSize:function(k,f){var i=this.helper,h=this.options,q=this._aspectRatio||f.shiftKey,p=this.axis,s=a(k.width)&&h.maxWidth&&(h.maxWidthk.width),r=a(k.height)&&h.minHeight&&(h.minHeight>k.height);if(g){k.width=h.minWidth}if(r){k.height=h.minHeight}if(s){k.width=h.maxWidth}if(l){k.height=h.maxHeight}var e=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height;var j=/sw|nw|w/.test(p),d=/nw|ne|n/.test(p);if(g&&j){k.left=e-h.minWidth}if(s&&j){k.left=e-h.maxWidth}if(r&&d){k.top=n-h.minHeight}if(l&&d){k.top=n-h.maxHeight}var m=!k.width&&!k.height;if(m&&!k.left&&k.top){k.top=null}else{if(m&&!k.top&&k.left){k.left=null}}return k},_proportionallyResize:function(){var j=this.options;if(!this._proportionallyResizeElements.length){return}var f=this.helper||this.element;for(var e=0;e');var d=c.browser.msie&&c.browser.version<7,f=(d?1:0),g=(d?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+g,height:this.element.outerHeight()+g,position:"absolute",left:this.elementOffset.left-f+"px",top:this.elementOffset.top-f+"px",zIndex:++h.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(f,e,d){return{width:this.originalSize.width+e}},w:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{left:h.left+e,width:f.width-e}},n:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{top:h.top+d,height:f.height-d}},s:function(f,e,d){return{height:this.originalSize.height+d}},se:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},sw:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[f,e,d]))},ne:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},nw:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[f,e,d]))}},_propagate:function(e,d){c.ui.plugin.call(this,e,[d,this.ui()]);(e!="resize"&&this._trigger(e,d,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));c.extend(c.ui.resizable,{version:"1.7.2",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});c.ui.plugin.add("resizable","alsoResize",{start:function(e,f){var d=c(this).data("resizable"),g=d.options;_store=function(h){c(h).each(function(){c(this).data("resizable-alsoresize",{width:parseInt(c(this).width(),10),height:parseInt(c(this).height(),10),left:parseInt(c(this).css("left"),10),top:parseInt(c(this).css("top"),10)})})};if(typeof(g.alsoResize)=="object"&&!g.alsoResize.parentNode){if(g.alsoResize.length){g.alsoResize=g.alsoResize[0];_store(g.alsoResize)}else{c.each(g.alsoResize,function(h,i){_store(h)})}}else{_store(g.alsoResize)}},resize:function(f,h){var e=c(this).data("resizable"),i=e.options,g=e.originalSize,k=e.originalPosition;var j={height:(e.size.height-g.height)||0,width:(e.size.width-g.width)||0,top:(e.position.top-k.top)||0,left:(e.position.left-k.left)||0},d=function(l,m){c(l).each(function(){var p=c(this),q=c(this).data("resizable-alsoresize"),o={},n=m&&m.length?m:["width","height","top","left"];c.each(n||["width","height","top","left"],function(r,t){var s=(q[t]||0)+(j[t]||0);if(s&&s>=0){o[t]=s||null}});if(/relative/.test(p.css("position"))&&c.browser.opera){e._revertToRelativePosition=true;p.css({position:"absolute",top:"auto",left:"auto"})}p.css(o)})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.nodeType){c.each(i.alsoResize,function(l,m){d(l,m)})}else{d(i.alsoResize)}},stop:function(e,f){var d=c(this).data("resizable");if(d._revertToRelativePosition&&c.browser.opera){d._revertToRelativePosition=false;el.css({position:"relative"})}c(this).removeData("resizable-alsoresize-start")}});c.ui.plugin.add("resizable","animate",{stop:function(h,m){var n=c(this).data("resizable"),i=n.options;var g=n._proportionallyResizeElements,d=g.length&&(/textarea/i).test(g[0].nodeName),e=d&&c.ui.hasScroll(g[0],"left")?0:n.sizeDiff.height,k=d?0:n.sizeDiff.width;var f={width:(n.size.width-k),height:(n.size.height-e)},j=(parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left))||null,l=(parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top))||null;n.element.animate(c.extend(f,l&&j?{top:l,left:j}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var o={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};if(g&&g.length){c(g[0]).css({width:o.width,height:o.height})}n._updateCache(o);n._propagate("resize",h)}})}});c.ui.plugin.add("resizable","containment",{start:function(e,q){var s=c(this).data("resizable"),i=s.options,k=s.element;var f=i.containment,j=(f instanceof c)?f.get(0):(/parent/.test(f))?k.parent().get(0):f;if(!j){return}s.containerElement=c(j);if(/document/.test(f)||f==document){s.containerOffset={left:0,top:0};s.containerPosition={left:0,top:0};s.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var m=c(j),h=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){h[p]=b(m.css("padding"+o))});s.containerOffset=m.offset();s.containerPosition=m.position();s.containerSize={height:(m.innerHeight()-h[3]),width:(m.innerWidth()-h[1])};var n=s.containerOffset,d=s.containerSize.height,l=s.containerSize.width,g=(c.ui.hasScroll(j,"left")?j.scrollWidth:l),r=(c.ui.hasScroll(j)?j.scrollHeight:d);s.parentData={element:j,left:n.left,top:n.top,width:g,height:r}}},resize:function(f,p){var s=c(this).data("resizable"),h=s.options,e=s.containerSize,n=s.containerOffset,l=s.size,m=s.position,q=s._aspectRatio||f.shiftKey,d={top:0,left:0},g=s.containerElement;if(g[0]!=document&&(/static/).test(g.css("position"))){d=n}if(m.left<(s._helper?n.left:0)){s.size.width=s.size.width+(s._helper?(s.position.left-n.left):(s.position.left-d.left));if(q){s.size.height=s.size.width/h.aspectRatio}s.position.left=h.helper?n.left:0}if(m.top<(s._helper?n.top:0)) {s.size.height=s.size.height+(s._helper?(s.position.top-n.top):s.position.top);if(q){s.size.width=s.size.height*h.aspectRatio}s.position.top=s._helper?n.top:0}s.offset.left=s.parentData.left+s.position.left;s.offset.top=s.parentData.top+s.position.top;var k=Math.abs((s._helper?s.offset.left-d.left:(s.offset.left-d.left))+s.sizeDiff.width),r=Math.abs((s._helper?s.offset.top-d.top:(s.offset.top-n.top))+s.sizeDiff.height);var j=s.containerElement.get(0)==s.element.parent().get(0),i=/relative|absolute/.test(s.containerElement.css("position"));if(j&&i){k-=s.parentData.left}if(k+s.size.width>=s.parentData.width){s.size.width=s.parentData.width-k;if(q){s.size.height=s.size.width/s.aspectRatio}}if(r+s.size.height>=s.parentData.height){s.size.height=s.parentData.height-r;if(q){s.size.width=s.size.height*s.aspectRatio}}},stop:function(e,m){var p=c(this).data("resizable"),f=p.options,k=p.position,l=p.containerOffset,d=p.containerPosition,g=p.containerElement;var i=c(p.helper),q=i.offset(),n=i.outerWidth()-p.sizeDiff.width,j=i.outerHeight()-p.sizeDiff.height;if(p._helper&&!f.animate&&(/relative/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}if(p._helper&&!f.animate&&(/static/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}}});c.ui.plugin.add("resizable","ghost",{start:function(f,g){var d=c(this).data("resizable"),h=d.options,e=d.size;d.ghost=d.originalElement.clone();d.ghost.css({opacity:0.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof h.ghost=="string"?h.ghost:"");d.ghost.appendTo(d.helper)},resize:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost){d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})}},stop:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost&&d.helper){d.helper.get(0).removeChild(d.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(d,l){var n=c(this).data("resizable"),g=n.options,j=n.size,h=n.originalSize,i=n.originalPosition,m=n.axis,k=g._aspectRatio||d.shiftKey;g.grid=typeof g.grid=="number"?[g.grid,g.grid]:g.grid;var f=Math.round((j.width-h.width)/(g.grid[0]||1))*(g.grid[0]||1),e=Math.round((j.height-h.height)/(g.grid[1]||1))*(g.grid[1]||1);if(/^(se|s|e)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e}else{if(/^(ne)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e}else{if(/^(sw)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.left=i.left-f}else{n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e;n.position.left=i.left-f}}}}});var b=function(d){return parseInt(d,10)||0};var a=function(d){return !isNaN(parseInt(d,10))}})(jQuery);; /** * jQuery.ScrollTo - Easy element scrolling using jQuery. * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com * Licensed under GPL license (http://www.opensource.org/licenses/gpl-license.php). * Date: 2/8/2008 * @author Ariel Flesler * @version 1.3.2 */ ;(function($){var o=$.scrollTo=function(a,b,c){o.window().scrollTo(a,b,c)};o.defaults={axis:'y',duration:1};o.window=function(){return $($.browser.safari?'body':'html')};$.fn.scrollTo=function(l,m,n){if(typeof m=='object'){n=m;m=0}n=$.extend({},o.defaults,n);m=m||n.speed||n.duration;n.queue=n.queue&&n.axis.length>1;if(n.queue)m/=2;n.offset=j(n.offset);n.over=j(n.over);return this.each(function(){var a=this,b=$(a),t=l,c,d={},w=b.is('html,body');switch(typeof t){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(t)){t=j(t);break}t=$(t,this);case'object':if(t.is||t.style)c=(t=$(t)).offset()}$.each(n.axis.split(''),function(i,f){var P=f=='x'?'Left':'Top',p=P.toLowerCase(),k='scroll'+P,e=a[k],D=f=='x'?'Width':'Height';if(c){d[k]=c[p]+(w?0:e-b.offset()[p]);if(n.margin){d[k]-=parseInt(t.css('margin'+P))||0;d[k]-=parseInt(t.css('border'+P+'Width'))||0}d[k]+=n.offset[p]||0;if(n.over[p])d[k]+=t[D.toLowerCase()]()*n.over[p]}else d[k]=t[p];if(/^\d+$/.test(d[k]))d[k]=d[k]<=0?0:Math.min(d[k],h(D));if(!i&&n.queue){if(e!=d[k])g(n.onAfterFirst);delete d[k]}});g(n.onAfter);function g(a){b.animate(d,m,n.easing,a&&function(){a.call(this,l)})};function h(D){var b=w?$.browser.opera?document.body:document.documentElement:a;return b['scroll'+D]-b['client'+D]}})};function j(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery); geographiclib-1.21/doc/html/tmseries.mac0000644000175000017500000001571211745620414020114 0ustar frankiefrankie/* Compute series approximations for Transverse Mercator Projection Written by Charles Karney http://geographiclib.sourceforge.net/ $Id: c790f624c09d809837ba853444e8f82db01a1665 $ Reference: Charles F. F. Karney, Transverse Mercator with an accuracy of a few nanometers, J. Geodesy 85(8), 475-485 (Aug. 2011). DOI 10.1007/s00190-011-0445-3 preprint http://arxiv.org/abs/1002.1417 resource page http://geographiclib.sf.net/tm.html Compute coefficient for forward and inverse trigonometric series for conversion from conformal latitude to rectifying latitude. This prints out assignments which with minor editing are suitable for insertion into C++ code. (N.B. n^3 in the output means n*n*n; 3/5 means 0.6.) To run, start maxima and enter writefile("tmseries.out")$ load("tmseries.mac")$ closefile()$ With maxpow = 6, the output (after about 5 secs) is A=a/(n+1)*(1+n^2/4+n^4/64+n^6/256); alpha[1]=n/2-2*n^2/3+5*n^3/16+41*n^4/180-127*n^5/288+7891*n^6/37800; alpha[2]=13*n^2/48-3*n^3/5+557*n^4/1440+281*n^5/630-1983433*n^6/1935360; alpha[3]=61*n^3/240-103*n^4/140+15061*n^5/26880+167603*n^6/181440; alpha[4]=49561*n^4/161280-179*n^5/168+6601661*n^6/7257600; alpha[5]=34729*n^5/80640-3418889*n^6/1995840; alpha[6]=+212378941*n^6/319334400; beta[1]=n/2-2*n^2/3+37*n^3/96-n^4/360-81*n^5/512+96199*n^6/604800; beta[2]=n^2/48+n^3/15-437*n^4/1440+46*n^5/105-1118711*n^6/3870720; beta[3]=17*n^3/480-37*n^4/840-209*n^5/4480+5569*n^6/90720; beta[4]=4397*n^4/161280-11*n^5/504-830251*n^6/7257600; beta[5]=4583*n^5/161280-108847*n^6/3991680; beta[6]=+20648693*n^6/638668800; Notation of output matches that of L. Krueger, Konforme Abbildung des Erdellipsoids in der Ebene Royal Prussian Geodetic Institute, New Series 52, 172 pp. (1912). with gamma replaced by alpha. Alter maxpow to generate more or less terms for the series approximations to the forward and reverse projections. This has been tested out to maxpow = 30; but this takes a long time (see below). */ /* Timing: maxpow time 4 2s 6 5s 8 11s 10 24s 12 52s 20 813s = 14m 30 13535s = 226m */ maxpow:6$ /* Max power for forward and reverse projections */ /* Notation e = eccentricity e2 = e^2 = f*(2-f) n = third flattening = f/(2-f) phi = (complex) geodetic latitude zetap = Gauss-Schreiber TM = complex conformal latitude psi = Mercator = complex isometric latitude zeta = scaled UTM projection = complex rectifying latitude */ taylordepth:6$ triginverses:'all$ /* revert var2 = expr(var1) = series in eps to var1 = revertexpr(var2) = series in eps Require that expr(var1) = var1 to order eps^0. This throws in a trigreduce to convert to multiple angle trig functions. */ reverta(expr,var1,var2,eps,pow):=block([tauacc:1,sigacc:0,dsig], dsig:ratdisrep(taylor(expr-var1,eps,0,pow)), dsig:subst([var1=var2],dsig), for n:1 thru pow do (tauacc:trigreduce(ratdisrep(taylor( -dsig*tauacc/n,eps,0,pow))), sigacc:sigacc+expand(diff(tauacc,var2,n-1))), var2+sigacc)$ /* Expansion for atan(x+eps) for small eps. Equivalent to taylor(atan(x + eps), eps, 0, maxpow) but tidied up a bit. */ atanexp(x,eps):=''(ratdisrep(taylor(atan(x+eps),eps,0,maxpow)))$ /* Convert from n to e^2 */ e2:4*n/(1+n)^2$ /* zetap in terms of phi. The expansion of atan(sinh( asinh(tan(phi)) + e * atanh(e * sin(phi)) )) */ zetap_phi:block([psiv,tanzetap,zetapv,qq,e], /* Here qq = atanh(sin(phi)) = asinh(tan(phi)) */ psiv:qq-e*atanh(e*tanh(qq)), psiv:subst([e=sqrt(e2),qq=atanh(sin(phi))], ratdisrep(taylor(psiv,e,0,2*maxpow))) +asinh(sin(phi)/cos(phi))-atanh(sin(phi)), tanzetap:subst([abs(cos(phi))=cos(phi),sqrt(sin(phi)^2+cos(phi)^2)=1], ratdisrep(taylor(sinh(psiv),n,0,maxpow)))+tan(phi)-sin(phi)/cos(phi), zetapv:atanexp(tan(phi),tanzetap-tan(phi)), zetapv:subst([cos(phi)=sqrt(1-sin(phi)^2), tan(phi)=sin(phi)/sqrt(1-sin(phi)^2)], (zetapv-phi)/cos(phi))*cos(phi)+phi, zetapv:ratdisrep(taylor(zetapv,n,0,maxpow)), expand(trigreduce(zetapv)))$ /* phi in terms of zetap */ phi_zetap:reverta(zetap_phi,phi,zetap,n,maxpow)$ /* Mean radius of meridian */ a1:expand(integrate( ratdisrep(taylor((1+n)*(1-e2)/(1-e2*sin(phi)^2)^(3/2), n,0,maxpow)), phi, 0, %pi/2)/(%pi/2))/(1+n)$ /* zeta in terms of phi. The expansion of zeta = pi/(2*a1) * int( (1-e^2)/(1-e^2*sin(phi)^2)^(3/2) ) */ zeta_phi:block([zetav], zetav:integrate(trigreduce(ratdisrep(taylor( (1-e2)/(1-e2*sin(phi)^2)^(3/2)/a1, n,0,maxpow))),phi), expand(zetav))$ /* phi in terms of zeta */ phi_zeta:reverta(zeta_phi,phi,zeta,n,maxpow)$ /* zeta in terms of zetap */ /* This is slow. The next version speeds it up a little. zeta_zetap:expand(trigreduce(ratdisrep( taylor(subst([phi=phi_zetap],zeta_phi),n,0,maxpow))))$ */ zeta_zetap:block([phiv:phi_zetap,zetav:expand(zeta_phi),acc:0], for i:0 thru maxpow do ( phiv:ratdisrep(taylor(phiv,n,0,maxpow-i)), acc:acc + expand(n^i * trigreduce(ratdisrep(taylor( subst([phi=phiv],coeff(zetav,n,i)),n,0,maxpow-i))))), acc)$ /* zetap in terms of zeta */ /* This is slow. The next version speeds it up a little. zetap_zeta:expand(trigreduce(ratdisrep( taylor(subst([phi=phi_zeta],zetap_phi),n,0,maxpow))))$ */ zetap_zeta:block([phiv:phi_zeta,zetapv:expand(zetap_phi),acc:0], for i:0 thru maxpow do ( phiv:ratdisrep(taylor(phiv,n,0,maxpow-i)), acc:acc + expand(n^i * trigreduce(ratdisrep(taylor( subst([phi=phiv],coeff(zetapv,n,i)),n,0,maxpow-i))))), acc)$ printa1():=block([], print(concat("A=",string(a/(n+1)),"*(", string(taylor(a1*(1+n),n,0,maxpow)),");")), 0)$ printtxf():=block([alpha:zeta_zetap,t], for i:1 thru maxpow do (t:coeff(alpha,sin(2*i*zetap)), print(concat("alpha[",i,"]=",string(taylor(t,n,0,maxpow)),";")), alpha:alpha-expand(t*sin(2*i*zetap))), /* should return zero */ alpha:alpha-zetap)$ printtxr():=block([beta:zetap_zeta,t], for i:1 thru maxpow do (t:coeff(beta,sin(2*i*zeta)), print(concat("beta[",i,"]=",string(taylor(-t,n,0,maxpow)),";")), beta:beta-expand(t*sin(2*i*zeta))), /* should return zero */ beta:beta-zeta)$ printseries():=[printa1(),printtxf(),printtxr()]$ /* Define array functions which are be read by tm.mac */ defarrayfuns():=block([aa:a1*(1+n),alpha:zeta_zetap,beta:zetap_zeta,t], for i:1 thru maxpow do ( define(a1_a[i](n),ratdisrep(taylor(aa,n,0,i))/(1+n)), t:expand(ratdisrep(taylor(alpha,n,0,i))), define(zeta_a[i](zp,n), zp+sum(coeff(t,sin(2*k*zetap))*sin(2*k*zp),k,1,i)), t:diff(t,zetap), define(zeta_d[i](zp,n), 1+sum(coeff(t,cos(2*k*zetap))*cos(2*k*zp),k,1,i)), t:expand(ratdisrep(taylor(beta,n,0,i))), define(zetap_a[i](z,n), z+sum(coeff(t,sin(2*k*zeta))*sin(2*k*z),k,1,i)), t:diff(t,zeta), define(zetap_d[i](z,n), 1+sum(coeff(t,cos(2*k*zeta))*cos(2*k*z),k,1,i))))$ printseries()$ /* defarrayfuns()$ save("tmseries.lsp",maxpow,arrays)$ */ geographiclib-1.21/doc/html/geodseries30.html0000644000175000017500000104227511745620414020766 0ustar frankiefrankie Series for geodesic calculations

Series for geodesic calculations

This extends the series given here to 30th order in the flattening. See
Charles F. F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011; preprint arxiv:1102.1215; resource page geod.html.
// Generated by Maxima on 2010-05-01 06:36:46-04:00

A1 = (1 + 1/4 * eps^2
        + 1/64 * eps^4
        + 1/256 * eps^6
        + 25/16384 * eps^8
        + 49/65536 * eps^10
        + 441/1048576 * eps^12
        + 1089/4194304 * eps^14
        + 184041/1073741824 * eps^16
        + 511225/4294967296 * eps^18
        + 5909761/68719476736 * eps^20
        + 17631601/274877906944 * eps^22
        + 863948449/17592186044416 * eps^24
        + 2704312009/70368744177664 * eps^26
        + 34493775625/1125899906842624 * eps^28
        + 111759833025/4503599627370496 * eps^30) / (1 - eps);

C1[1] = - 1/2 * eps
        + 3/16 * eps^3
        - 1/32 * eps^5
        + 19/2048 * eps^7
        - 3/4096 * eps^9
        + 53/65536 * eps^11
        + 29/131072 * eps^13
        + 13827/67108864 * eps^15
        + 17321/134217728 * eps^17
        + 205579/2147483648 * eps^19
        + 302847/4294967296 * eps^21
        + 29656189/549755813888 * eps^23
        + 46250107/1099511627776 * eps^25
        + 588536103/17592186044416 * eps^27
        + 951224759/35184372088832 * eps^29;
C1[2] = - 1/16 * eps^2
        + 1/32 * eps^4
        - 9/2048 * eps^6
        + 7/4096 * eps^8
        + 1/65536 * eps^10
        + 27/131072 * eps^12
        + 5735/67108864 * eps^14
        + 8995/134217728 * eps^16
        + 96543/2147483648 * eps^18
        + 142801/4294967296 * eps^20
        + 13684121/549755813888 * eps^22
        + 21112497/1099511627776 * eps^24
        + 265707563/17592186044416 * eps^26
        + 425659393/35184372088832 * eps^28
        + 1417935787335/144115188075855872 * eps^30;
C1[3] = - 1/48 * eps^3
        + 3/256 * eps^5
        - 3/2048 * eps^7
        + 17/24576 * eps^9
        + 3/65536 * eps^11
        + 843/8388608 * eps^13
        + 9719/201326592 * eps^15
        + 9801/268435456 * eps^17
        + 54189/2147483648 * eps^19
        + 3873871/206158430208 * eps^21
        + 7822227/549755813888 * eps^23
        + 24333681/2199023255552 * eps^25
        + 462823139/52776558133248 * eps^27
        + 127352837355/18014398509481984 * eps^29;
C1[4] = - 5/512 * eps^4
        + 3/512 * eps^6
        - 11/16384 * eps^8
        + 3/8192 * eps^10
        + 651/16777216 * eps^12
        + 1009/16777216 * eps^14
        + 16763/536870912 * eps^16
        + 1569/67108864 * eps^18
        + 2263733/137438953472 * eps^20
        + 1698897/137438953472 * eps^22
        + 41547591/4398046511104 * eps^24
        + 16273415/2199023255552 * eps^26
        + 212683932395/36028797018963968 * eps^28
        + 172435304205/36028797018963968 * eps^30;
C1[5] = - 7/1280 * eps^5
        + 7/2048 * eps^7
        - 3/8192 * eps^9
        + 117/524288 * eps^11
        + 253/8388608 * eps^13
        + 13419/335544320 * eps^15
        + 5855/268435456 * eps^17
        + 70025/4294967296 * eps^19
        + 800595/68719476736 * eps^21
        + 4842105/549755813888 * eps^23
        + 74591411/10995116277760 * eps^25
        + 6021893805/1125899906842624 * eps^27
        + 77302095005/18014398509481984 * eps^29;
C1[6] = - 7/2048 * eps^6
        + 9/4096 * eps^8
        - 117/524288 * eps^10
        + 467/3145728 * eps^12
        + 1569/67108864 * eps^14
        + 3813/134217728 * eps^16
        + 206677/12884901888 * eps^18
        + 103137/8589934592 * eps^20
        + 4770087/549755813888 * eps^22
        + 21782093/3298534883328 * eps^24
        + 5765474835/1125899906842624 * eps^26
        + 9142699905/2251799813685248 * eps^28
        + 1415580640915/432345564227567616 * eps^30;
C1[7] = - 33/14336 * eps^7
        + 99/65536 * eps^9
        - 77/524288 * eps^11
        + 55/524288 * eps^13
        + 1233/67108864 * eps^15
        + 11345/536870912 * eps^17
        + 52591/4294967296 * eps^19
        + 552591/60129542144 * eps^21
        + 3685111/549755813888 * eps^23
        + 722278195/140737488355328 * eps^25
        + 4507296795/1125899906842624 * eps^27
        + 1795935355/562949953421312 * eps^29;
C1[8] = - 429/262144 * eps^8
        + 143/131072 * eps^10
        - 429/4194304 * eps^12
        + 325/4194304 * eps^14
        + 31525/2147483648 * eps^16
        + 8733/536870912 * eps^18
        + 165251/17179869184 * eps^20
        + 124411/17179869184 * eps^22
        + 2996969235/562949953421312 * eps^24
        + 1153418845/281474976710656 * eps^26
        + 28941724625/9007199254740992 * eps^28
        + 23168297355/9007199254740992 * eps^30;
C1[9] = - 715/589824 * eps^9
        + 429/524288 * eps^11
        - 39/524288 * eps^13
        + 11921/201326592 * eps^15
        + 6399/536870912 * eps^17
        + 55233/4294967296 * eps^19
        + 199205/25769803776 * eps^21
        + 25677825/4398046511104 * eps^23
        + 608155005/140737488355328 * eps^25
        + 33866001805/10133099161583616 * eps^27
        + 1482164085/562949953421312 * eps^29;
C1[10] = - 2431/2621440 * eps^10
        + 663/1048576 * eps^12
        - 3757/67108864 * eps^14
        + 6239/134217728 * eps^16
        + 42177/4294967296 * eps^18
        + 446131/42949672960 * eps^20
        + 27835817/4398046511104 * eps^22
        + 42180321/8796093022208 * eps^24
        + 4019599397/1125899906842624 * eps^26
        + 6244603111/2251799813685248 * eps^28
        + 316153750539/144115188075855872 * eps^30;
C1[11] = - 4199/5767168 * eps^11
        + 4199/8388608 * eps^13
        - 2907/67108864 * eps^15
        + 10013/268435456 * eps^17
        + 35207/4294967296 * eps^19
        + 4694805/549755813888 * eps^21
        + 23148175/4398046511104 * eps^23
        + 70365265/17592186044416 * eps^25
        + 3370190355/1125899906842624 * eps^27
        + 42049539055/18014398509481984 * eps^29;
C1[12] = - 29393/50331648 * eps^12
        + 6783/16777216 * eps^14
        - 18411/536870912 * eps^16
        + 6137/201326592 * eps^18
        + 7611495/1099511627776 * eps^20
        + 7835163/1099511627776 * eps^22
        + 468146111/105553116266496 * eps^24
        + 59462469/17592186044416 * eps^26
        + 91557125181/36028797018963968 * eps^28
        + 214950398465/108086391056891904 * eps^30;
C1[13] = - 52003/109051904 * eps^13
        + 22287/67108864 * eps^15
        - 7429/268435456 * eps^17
        + 869193/34359738368 * eps^19
        + 3247347/549755813888 * eps^21
        + 26486133/4398046511104 * eps^23
        + 66500935/17592186044416 * eps^25
        + 12703797/4398046511104 * eps^27
        + 39283195529/18014398509481984 * eps^29;
C1[14] = - 185725/469762048 * eps^14
        + 37145/134217728 * eps^16
        - 780045/34359738368 * eps^18
        + 1461765/68719476736 * eps^20
        + 22372215/4398046511104 * eps^22
        + 45260895/8796093022208 * eps^24
        + 57244355/17592186044416 * eps^26
        + 306953515/123145302310912 * eps^28
        + 272204273085/144115188075855872 * eps^30;
C1[15] = - 22287/67108864 * eps^15
        + 1002915/4294967296 * eps^17
        - 648945/34359738368 * eps^19
        + 1243265/68719476736 * eps^21
        + 19425915/4398046511104 * eps^23
        + 78089301/17592186044416 * eps^25
        + 12427015/4398046511104 * eps^27
        + 610648965/281474976710656 * eps^29;
C1[16] = - 9694845/34359738368 * eps^16
        + 1710855/8589934592 * eps^18
        - 4372185/274877906944 * eps^20
        + 4272135/274877906944 * eps^22
        + 543781755/140737488355328 * eps^24
        + 271745805/70368744177664 * eps^26
        + 5567912565/2251799813685248 * eps^28
        + 4284219735/2251799813685248 * eps^30;
C1[17] = - 17678835/73014444032 * eps^17
        + 5892945/34359738368 * eps^19
        - 930465/68719476736 * eps^21
        + 59239605/4398046511104 * eps^23
        + 59859915/17592186044416 * eps^25
        + 930465/274877906944 * eps^27
        + 613284315/281474976710656 * eps^29;
C1[18] = - 21607465/103079215104 * eps^18
        + 10235115/68719476736 * eps^20
        - 51175575/4398046511104 * eps^22
        + 103488385/8796093022208 * eps^24
        + 53036505/17592186044416 * eps^26
        + 52551045/17592186044416 * eps^28
        + 278415054335/144115188075855872 * eps^30;
C1[19] = - 119409675/652835028992 * eps^19
        + 71645805/549755813888 * eps^21
        - 44352165/4398046511104 * eps^23
        + 182060985/17592186044416 * eps^25
        + 2953215/1099511627776 * eps^27
        + 47776802115/18014398509481984 * eps^29;
C1[20] = - 176726319/1099511627776 * eps^20
        + 126233085/1099511627776 * eps^22
        - 309844845/35184372088832 * eps^24
        + 161159235/17592186044416 * eps^26
        + 86652277095/36028797018963968 * eps^28
        + 426519840213/180143985094819840 * eps^30;
C1[21] = - 547010035/3848290697216 * eps^21
        + 447553665/4398046511104 * eps^23
        - 136211985/17592186044416 * eps^25
        + 9182417465/1125899906842624 * eps^27
        + 38976086565/18014398509481984 * eps^29;
C1[22] = - 6116566755/48378511622144 * eps^22
        + 797813055/8796093022208 * eps^24
        - 7712192865/1125899906842624 * eps^26
        + 16434948933/2251799813685248 * eps^28
        + 281701652697/144115188075855872 * eps^30;
C1[23] = - 11435320455/101155069755392 * eps^23
        + 11435320455/140737488355328 * eps^25
        - 6861192273/1125899906842624 * eps^27
        + 3694488147/562949953421312 * eps^29;
C1[24] = - 57176602275/562949953421312 * eps^24
        + 20583576819/281474976710656 * eps^26
        - 49083913953/9007199254740992 * eps^28
        + 160153129039/27021597764222976 * eps^30;
C1[25] = - 322476036831/3518437208883200 * eps^25
        + 74417546961/1125899906842624 * eps^27
        - 2756205443/562949953421312 * eps^29;
C1[26] = - 1215486600363/14636698788954112 * eps^26
        + 135054066707/2251799813685248 * eps^28
        - 636683457333/144115188075855872 * eps^30;
C1[27] = - 2295919134019/30399297484750848 * eps^27
        + 983965343151/18014398509481984 * eps^29;
C1[28] = - 2483341104143/36028797018963968 * eps^28
        + 1798281489207/36028797018963968 * eps^30;
C1[29] = - 32968493968795/522417556774977536 * eps^29;
C1[30] = - 125280277081421/2161727821137838080 * eps^30;

C1'[1] = + 1/2 * eps
         - 9/32 * eps^3
         + 205/1536 * eps^5
         - 4879/73728 * eps^7
         + 9039/327680 * eps^9
         - 1050467/88473600 * eps^11
         + 512031157/118908518400 * eps^13
         - 1086005273/591900180480 * eps^15
         + 4075676109451/7671026339020800 * eps^17
         - 794840669327713/2761569482047488000 * eps^19
         + 2239087029841367/77148607752437760000 * eps^21
         - 40730402540905726093/641567822069272412160000 * eps^23
         - 97668067278655185143/4927240873492012125388800 * eps^25
         - 741941887011669089199917/28784819522671853552271360000 * eps^27
         - 68324470839108426239947872773/3917038240645185831393086668800000 * eps^29;
C1'[2] = + 5/16 * eps^2
         - 37/96 * eps^4
         + 1335/4096 * eps^6
         - 86171/368640 * eps^8
         + 4119073/28311552 * eps^10
         - 18357853/220200960 * eps^12
         + 167645485631/3805072588800 * eps^14
         - 2133468723257/95887829237760 * eps^16
         + 59947666093201/5682241732608000 * eps^18
         - 29889474712770151/6075452860504473600 * eps^20
         + 3112904386445139443/1458108686521073664000 * eps^22
         - 4531132450329984761/4728107532256542720000 * eps^24
         + 1671560053825711640749861/4483789194877731034103808000 * eps^26
         - 1539092646053487110737563637/8743388930011575516502425600000 * eps^28
         + 3620358411657954539738131669/69636235389247748113654874112000 * eps^30;
C1'[3] = + 29/96 * eps^3
         - 75/128 * eps^5
         + 2901/4096 * eps^7
         - 443327/655360 * eps^9
         + 1152507/2097152 * eps^11
         - 1170339447/2936012800 * eps^13
         + 14896648073/56371445760 * eps^15
         - 1719099273321/10522669875200 * eps^17
         + 440255022166233/4629974745088000 * eps^19
         - 4689329894241941/88895515105689600 * eps^21
         + 4309464445273351209/154085559516528640000 * eps^23
         - 77740899024366984327/5423811694981808128000 * eps^25
         + 4025440507207669842667/569500227973089853440000 * eps^27
         - 10783702637849849812840017/3158827931157405053747200000 * eps^29;
C1'[4] = + 539/1536 * eps^4
         - 2391/2560 * eps^6
         + 1082857/737280 * eps^8
         - 2722891/1548288 * eps^10
         + 6190623251/3523215360 * eps^12
         - 2198240553463/1426902220800 * eps^14
         + 835898387989583/684913065984000 * eps^16
         - 62186045114429/69759664128000 * eps^18
         + 39435262997832698047/64804830512047718400 * eps^20
         - 14876456230497799912553/37910825849547915264000 * eps^22
         + 1136134446936925800945877/4717791661277073899520000 * eps^24
         - 45093458223482404762480843/318450937136202488217600000 * eps^26
         + 3448586228525796468187820868401/43044376270826217927396556800000 * eps^28
         - 9267292123878690223760617403717/211395714574502092487880867840000 * eps^30;
C1'[5] = + 3467/7680 * eps^5
         - 28223/18432 * eps^7
         + 1361343/458752 * eps^9
         - 211942939/49545216 * eps^11
         + 289319933243/57076088832 * eps^13
         - 2641923029237/507343011840 * eps^15
         + 164922300524827/34441342746624 * eps^17
         - 326226244879987219/81006038140059648 * eps^19
         + 905728657830831557/288021468942434304 * eps^21
         - 78322584746542259177147/33968099961194932076544 * eps^23
         + 13053248693785337495272007/8152343990686783698370560 * eps^25
         - 1878086576945897568602243/1771373509087498680139776 * eps^27
         + 39401408426156638969274880529/58540351728323656381259317248 * eps^29;
C1'[6] = + 38081/61440 * eps^6
         - 733437/286720 * eps^8
         + 10820079/1835008 * eps^10
         - 547525831/55050240 * eps^12
         + 45741465549/3355443200 * eps^14
         - 41464506827097/2583691264000 * eps^16
         + 33307900611667019/1984274890752000 * eps^18
         - 29549592050928009/1851989898035200 * eps^20
         + 1510642276897435153959/107859891661570048000 * eps^22
         - 3379725045215031439859/294163340895191040000 * eps^24
         + 3068085809843886425921127/345151653317024153600000 * eps^26
         - 120481724276440955567319861/18440959762938147635200000 * eps^28
         + 5351579260607165516870592929/1166336466888888019845120000 * eps^30;
C1'[7] = + 459485/516096 * eps^7
         - 709743/163840 * eps^9
         + 983638957/84934656 * eps^11
         - 570327360331/25480396800 * eps^13
         + 2524677004673/72477573120 * eps^15
         - 3979901788209089/86103356866560 * eps^17
         + 145501072048061969477/2686424734236672000 * eps^19
         - 767257565495432565461/13372425343755878400 * eps^21
         + 576429350583276368332877/10315870979468820480000 * eps^23
         - 15049813241233902040230469/297097084208702029824000 * eps^25
         + 1656087831553847819569877/38371513250126757888000 * eps^27
         - 222870544090985685701249717628901/6400184226857542607280537600000 * eps^29;
C1'[8] = + 109167851/82575360 * eps^8
         - 550835669/74317824 * eps^10
         + 29797006823/1321205760 * eps^12
         - 13775344174277/280284364800 * eps^14
         + 51602655250575029/602723498065920 * eps^16
         - 229269121915303969/1813751267328000 * eps^18
         + 83019178881141641377/506287738375372800 * eps^20
         - 132324024533588768532907/691082762882383872000 * eps^22
         + 396326201752354956063673999/1935504271293158522880000 * eps^24
         - 703889408095319694872984797279/3464746196041883071807488000 * eps^26
         + 673066976958864232412288090929279/3563738944500222588144844800000 * eps^28
         - 3842435239091994304467908471778509/23172222559128113984248479744000 * eps^30;
C1'[9] = + 83141299/41287680 * eps^9
         - 1172993649/91750400 * eps^11
         + 1409193884757/32296140800 * eps^13
         - 8205463797521/77510737920 * eps^15
         + 6267340235329209/30709016166400 * eps^17
         - 9985904736500570067/30094835843072000 * eps^19
         + 6818098564242858298663/14445521204674560000 * eps^21
         - 81179814711559538793297/134824864576962560000 * eps^23
         + 8228623619106009640781583/11735156212778821222400 * eps^25
         - 10637423815896802535794719059/14082187455334585466880000 * eps^27
         + 2713138463299280056775410984179/3567487488684761651609600000 * eps^29;
C1'[10] = + 9303339907/2972712960 * eps^10
         - 32258337779/1453326336 * eps^12
         + 105458791111591/1255673954304 * eps^14
         - 21991423000897853/97942568435712 * eps^16
         + 440758100714976799/928640648871936 * eps^18
         - 4436414286264685342183/5265392479103877120 * eps^20
         + 11983230751430888047165/9190503236254040064 * eps^22
         - 438407397616490706337835/243037752247606837248 * eps^24
         + 503750725100748248754169576435/221743756546680516595679232 * eps^26
         - 200204949675864221817037957885535/75836364738964736675722297344 * eps^28
         + 15426622123776978643737455613179549/5392808159215270163606918922240 * eps^30;
C1'[11] = + 230944143253/46714060800 * eps^11
         - 13820996202863/356725555200 * eps^13
         + 530891275077073/3297729576960 * eps^15
         - 5861919724284516433/12465417800908800 * eps^17
         + 25885301781901909490837/23933602177744896000 * eps^19
         - 110706057667150724184229/53185782617210880000 * eps^21
         + 2719521302806552306469953613/781192775081593405440000 * eps^23
         - 233567275961905041708130573/44996703844699780153344 * eps^25
         + 798884301221118236917664805229/113666887205034582343680000 * eps^27
         - 9934805882969858378831722690837171/1133916936886434459864268800000 * eps^29;
C1'[12] = + 306777964441/38755368960 * eps^12
         - 57044595387963/839699660800 * eps^14
         + 11568981229047951/37618544803840 * eps^16
         - 687397289384966383/705347715072000 * eps^18
         + 233327560280127272763/96303474697830400 * eps^20
         - 3739229605202668172763/744163213574144000 * eps^22
         + 65835782650063594518691/7289762092154880000 * eps^24
         - 14792936433071373028889379/1024668970784915456000 * eps^26
         + 74599042152248060866262559758871/3567487488684761651609600000 * eps^28
         - 16680060316657855648846944446971/599337898099039957470412800 * eps^30;
C1'[13] = + 2615671472444983/204047017574400 * eps^13
         - 1167820427927323/9766352977920 * eps^15
         + 24715664579918728243/42190644864614400 * eps^17
         - 5067175041833532570683/2531438691876864000 * eps^19
         + 93543614041472271515281/17487017757219225600 * eps^21
         - 11792083140833533278156043493/991513906834330091520000 * eps^23
         + 8268814159710166088320187726251/361704273213163617386496000 * eps^25
         - 24380431693719066689532645995167/625167879627690202890240000 * eps^27
         + 40946727771183021563590563999653687303/680582760477888662474430873600000 * eps^29;
C1'[14] = + 34216519493594561/1632376140595200 * eps^14
         - 1477329715340046517/6995897745408000 * eps^16
         + 9229913663063228233/8291434364928000 * eps^18
         - 18633370679636805385039/4566922048202342400 * eps^20
         + 613651924549596407462456317/52610941995290984448000 * eps^22
         - 30737516008559329681484121827/1110675442122809671680000 * eps^24
         + 271813271604582464710892651024459/4798117909970537781657600000 * eps^26
         - 20699812425639174189936631117519897/201520952218762586829619200000 * eps^28
         + 1211662551734777607545609062337329843/7206133351721085009678827520000 * eps^30;
C1'[15] = + 177298287500753/5129801564160 * eps^15
         - 5627790514610829/15047417921536 * eps^17
         + 17279798906736629091/8185795349315584 * eps^19
         - 115931060832532759571/14032792027398144 * eps^21
         + 2003356613292569725398363/79631417158142001152 * eps^23
         - 101051987173195622011224471/1592628343162840023040 * eps^25
         + 756303360522076489366917931/5488442290284248694784 * eps^27
         - 5815559636408944974046175630559/21975722930298131773915136 * eps^29;
C1'[16] = + 1259425185539653127243/21939135329599488000 * eps^16
         - 2293308899647899314723/3453382412992512000 * eps^18
         + 21460336637287899464532611/5370700328685954662400 * eps^20
         - 25456489696915892609916529129/1530649593675497078784000 * eps^22
         + 2553846684009183021840672953/47515526935735173120000 * eps^24
         - 29538537350054556934382434071434011/205719305389986807388569600000 * eps^26
         + 3770295466320560881269963263089000511/11433662446938214136964710400000 * eps^28
         - 519676261197496743489350631148600190213/777234965004088823221667758080000 * eps^30;
C1'[17] = + 1789450487559418666447/18648265030159564800 * eps^17
         - 233343808292218091539949/197452217966395392000 * eps^19
         + 20146628393835035886855197/2667798856079297740800 * eps^21
         - 239929099187527215432793286501/7203056911414103900160000 * eps^23
         + 62988069927933679012075753421807/553194770796603179532288000 * eps^25
         - 3378232317776013495553552510617097/10517530210207023413329920000 * eps^27
         + 7314657081705017862640836634319879174339/9405196215175528617136147660800000 * eps^29;
C1'[18] = + 212221079284639273481/1315574252568576000 * eps^18
         - 1260552943986821598063/598192737065369600 * eps^20
         + 3546697789798651658576181/248848178619193753600 * eps^22
         - 78517248057208956823851421/1182310350905671680000 * eps^24
         + 1067601202019151639052958889147/4459359360855952064512000 * eps^26
         - 40116098461444544658667493570308857/56410895914827793616076800000 * eps^28
         + 392210563613343460551402383435826349/216617840312938727485734912000 * eps^30;
C1'[19] = + 69532546869173713149501223/255108265612582846464000 * eps^19
         - 112316728120020126447652781/29837224048255303680000 * eps^21
         + 4848022300045341835150543297447/180455531043848076656640000 * eps^23
         - 125642956497967669586988251237879/952805203911517844747059200 * eps^25
         + 33298130071722823747096176158055463/66596830966654998455255040000 * eps^27
         - 6563632449843987460043036353052098320209/4207587780473262802403013427200000 * eps^29;
C1'[20] = + 5810177473683430838091097/12559176153234847825920 * eps^20
         - 4618600293785993240609142923/685731017966622691295232 * eps^22
         + 1356670146516048832626691899799/26819702036027909703991296 * eps^24
         - 2172503519024023685991761815076867/8327517482186665963089297408 * eps^26
         + 3793117143067735304052463936462682647/3654590529325348262658617376768 * eps^28
         - 48227737126007159325773215007655970673/14212296502931909910339067576320 * eps^30;
C1'[21] = + 80853671585727628548617/102547326354063360000 * eps^21
         - 33710670766735229663452761/2793193841644011520000 * eps^23
         + 7824467166805891507557010233/82231626697999699148800 * eps^25
         - 12690496274820158383049352282653/24669488009399909744640000 * eps^27
         + 56382836432185917384773311978295199/26314120543359903727616000000 * eps^29;
C1'[22] = + 924898009889615635728755915083/685731017966622691295232000 * eps^22
         - 34498885534979583771510062454227/1593112465983062818160640000 * eps^24
         + 579153806014612787074377437506223/3238703930845567705625395200 * eps^26
         - 1569950058036065954085485531335819511/1552386282642142415290368000000 * eps^28
         + 13441093380769154612428393473490856259941/3053881893191980641891039313920000 * eps^30;
C1'[23] = + 4016551943902862119978017069801911/1734899475455555408976936960000 * eps^23
         - 7042743315770579684284446742015447/181032988743188390501941248000 * eps^25
         + 600397969311873169056555916083822001/1787980135735193980266086400000 * eps^27
         - 223977408534083722217209433995298286356287/112964584975749555673211338752000000 * eps^29;
C1'[24] = + 33730424938117851020161782371647/8461634387224169042411520000 * eps^24
         - 2466848731962947446637554898208789/35256809946767371010048000000 * eps^26
         + 9241553981242966860439405699656735351/14666832937855226340179968000000 * eps^28
         - 34121931746328650162120952716097657509/8800099762713135804107980800000 * eps^30;
C1'[25] = + 251959060076566669691445659637541/36604472449172158079513395200 * eps^25
         - 10775075917257378388661547627353189/85536969693571680015929573376 * eps^27
         + 7072923673224417550895367212096744699801/5986219287034920454234815263145984 * eps^29;
C1'[26] = + 18043464502912016496703680586663352917/1514094087670302902379872256000000 * eps^26
         - 15705330809648579467084357186039173723679/69182452928935378770280316928000000 * eps^28
         + 762509129435444486126998095414252687404107/344374876801811663212062022041600000 * eps^30;
C1'[27] = + 819021838914972651233426418104059459/39600448932209111118485913600000 * eps^27
         - 4425211305648392775905209005851207973/10807140059472272040132608000000 * eps^29;
C1'[28] = + 137344334847260471742767128830849077140799/3817741892241658452955877081088000000 * eps^28
         - 3056545074816755404384556140143837530441/4134995887021777596105338388480000 * eps^30;
C1'[29] = + 2381352350093111938327626556685002210278872879/37975078602127776631552109325582336000000 * eps^29;
C1'[30] = + 20034557328168749612075941075238883149/182929433787470496587153418485760 * eps^30;

A2 = (1 + 1/4 * eps^2
        + 9/64 * eps^4
        + 25/256 * eps^6
        + 1225/16384 * eps^8
        + 3969/65536 * eps^10
        + 53361/1048576 * eps^12
        + 184041/4194304 * eps^14
        + 41409225/1073741824 * eps^16
        + 147744025/4294967296 * eps^18
        + 2133423721/68719476736 * eps^20
        + 7775536041/274877906944 * eps^22
        + 457028729521/17592186044416 * eps^24
        + 1690195005625/70368744177664 * eps^26
        + 25145962430625/1125899906842624 * eps^28
        + 93990019574025/4503599627370496 * eps^30) * (1 - eps);

C2[1] = + 1/2 * eps
        + 1/16 * eps^3
        + 1/32 * eps^5
        + 41/2048 * eps^7
        + 59/4096 * eps^9
        + 727/65536 * eps^11
        + 1171/131072 * eps^13
        + 498409/67108864 * eps^15
        + 848479/134217728 * eps^17
        + 11768921/2147483648 * eps^19
        + 20705249/4294967296 * eps^21
        + 2359256231/549755813888 * eps^23
        + 4242171053/1099511627776 * eps^25
        + 61534748221/17592186044416 * eps^27
        + 112374407161/35184372088832 * eps^29;
C2[2] = + 3/16 * eps^2
        + 1/32 * eps^4
        + 35/2048 * eps^6
        + 47/4096 * eps^8
        + 557/65536 * eps^10
        + 875/131072 * eps^12
        + 365987/67108864 * eps^14
        + 615099/134217728 * eps^16
        + 8448195/2147483648 * eps^18
        + 14747697/4294967296 * eps^20
        + 1669842701/549755813888 * eps^22
        + 2986894505/1099511627776 * eps^24
        + 43136495023/17592186044416 * eps^26
        + 78481301201/35184372088832 * eps^28
        + 294392827406755/144115188075855872 * eps^30;
C2[3] = + 5/48 * eps^3
        + 5/256 * eps^5
        + 23/2048 * eps^7
        + 191/24576 * eps^9
        + 385/65536 * eps^11
        + 39277/8388608 * eps^13
        + 778613/201326592 * eps^15
        + 879927/268435456 * eps^17
        + 6084639/2147483648 * eps^19
        + 512739193/206158430208 * eps^21
        + 1215236729/549755813888 * eps^23
        + 4364918719/2199023255552 * eps^25
        + 94882584065/52776558133248 * eps^27
        + 29549676515117/18014398509481984 * eps^29;
C2[4] = + 35/512 * eps^4
        + 7/512 * eps^6
        + 133/16384 * eps^8
        + 47/8192 * eps^10
        + 73859/16777216 * eps^12
        + 59533/16777216 * eps^14
        + 1587387/536870912 * eps^16
        + 169365/67108864 * eps^18
        + 301539693/137438953472 * eps^20
        + 265958173/137438953472 * eps^22
        + 7594835095/4398046511104 * eps^24
        + 3421780579/2199023255552 * eps^26
        + 50930607972739/36028797018963968 * eps^28
        + 46591933629593/36028797018963968 * eps^30;
C2[5] = + 63/1280 * eps^5
        + 21/2048 * eps^7
        + 51/8192 * eps^9
        + 2343/524288 * eps^11
        + 29099/8388608 * eps^13
        + 946609/335544320 * eps^15
        + 635521/268435456 * eps^17
        + 8729875/4294967296 * eps^19
        + 122017589/68719476736 * eps^21
        + 864489227/549755813888 * eps^23
        + 15483449661/10995116277760 * eps^25
        + 1433014740399/1125899906842624 * eps^27
        + 20884832418219/18014398509481984 * eps^29;
C2[6] = + 77/2048 * eps^6
        + 33/4096 * eps^8
        + 2607/524288 * eps^10
        + 11363/3145728 * eps^12
        + 189893/67108864 * eps^14
        + 311117/134217728 * eps^16
        + 25213345/12884901888 * eps^18
        + 14502017/8589934592 * eps^20
        + 814144243/549755813888 * eps^22
        + 4341484325/3298534883328 * eps^24
        + 1331147570487/1125899906842624 * eps^26
        + 2412694071441/2251799813685248 * eps^28
        + 422949801695839/432345564227567616 * eps^30;
C2[7] = + 429/14336 * eps^7
        + 429/65536 * eps^9
        + 2145/524288 * eps^11
        + 1573/524288 * eps^13
        + 158899/67108864 * eps^15
        + 1047631/536870912 * eps^17
        + 7110437/4294967296 * eps^19
        + 86245121/60129542144 * eps^21
        + 694168021/549755813888 * eps^23
        + 158428784829/140737488355328 * eps^25
        + 1141580229945/1125899906842624 * eps^27
        + 518508038199/562949953421312 * eps^29;
C2[8] = + 6435/262144 * eps^8
        + 715/131072 * eps^10
        + 14443/4194304 * eps^12
        + 10673/4194304 * eps^14
        + 4339205/2147483648 * eps^16
        + 898561/536870912 * eps^18
        + 24498667/17179869184 * eps^20
        + 21302303/17179869184 * eps^22
        + 616428279683/562949953421312 * eps^24
        + 275528165297/281474976710656 * eps^26
        + 7960491282361/9007199254740992 * eps^28
        + 7246735300607/9007199254740992 * eps^30;
C2[9] = + 12155/589824 * eps^9
        + 2431/524288 * eps^11
        + 1547/524288 * eps^13
        + 441779/201326592 * eps^15
        + 940321/536870912 * eps^17
        + 6258091/4294967296 * eps^19
        + 32109515/25769803776 * eps^21
        + 4780137299/4398046511104 * eps^23
        + 135454151123/140737488355328 * eps^25
        + 8739550412095/10133099161583616 * eps^27
        + 439310252633/562949953421312 * eps^29;
C2[10] = + 46189/2621440 * eps^10
        + 4199/1048576 * eps^12
        + 172159/67108864 * eps^14
        + 257431/134217728 * eps^16
        + 6604381/4294967296 * eps^18
        + 55148051/42949672960 * eps^20
        + 4844658589/4398046511104 * eps^22
        + 8475408793/8796093022208 * eps^24
        + 963016659745/1125899906842624 * eps^26
        + 1729685026007/2251799813685248 * eps^28
        + 100354915132471/144115188075855872 * eps^30;
C2[11] = + 88179/5767168 * eps^11
        + 29393/8388608 * eps^13
        + 151487/67108864 * eps^15
        + 455107/268435456 * eps^17
        + 5860189/4294967296 * eps^19
        + 628398115/549755813888 * eps^21
        + 4324974541/4398046511104 * eps^23
        + 15169948479/17592186044416 * eps^25
        + 863724574545/1125899906842624 * eps^27
        + 12434905703529/18014398509481984 * eps^29;
C2[12] = + 676039/50331648 * eps^12
        + 52003/16777216 * eps^14
        + 1077205/536870912 * eps^16
        + 304589/201326592 * eps^18
        + 1343185487/1099511627776 * eps^20
        + 1128482143/1099511627776 * eps^22
        + 93435460751/105553116266496 * eps^24
        + 13685462553/17592186044416 * eps^26
        + 24983462965221/36028797018963968 * eps^28
        + 67559103579581/108086391056891904 * eps^30;
C2[13] = + 1300075/109051904 * eps^13
        + 185725/67108864 * eps^15
        + 482885/268435456 * eps^17
        + 46765555/34359738368 * eps^19
        + 605955125/549755813888 * eps^21
        + 4083133535/4398046511104 * eps^23
        + 14117902665/17592186044416 * eps^25
        + 776981055/1099511627776 * eps^27
        + 11367459987135/18014398509481984 * eps^29;
C2[14] = + 5014575/469762048 * eps^14
        + 334305/134217728 * eps^16
        + 55828935/34359738368 * eps^18
        + 84736485/68719476736 * eps^20
        + 4403236035/4398046511104 * eps^22
        + 7434490215/8796093022208 * eps^24
        + 12878639895/17592186044416 * eps^26
        + 79525490115/123145302310912 * eps^28
        + 83239672976625/144115188075855872 * eps^30;
C2[15] = + 646323/67108864 * eps^15
        + 9694845/4294967296 * eps^17
        + 50755365/34359738368 * eps^19
        + 77241935/68719476736 * eps^21
        + 4023100545/4398046511104 * eps^23
        + 13613065131/17592186044416 * eps^25
        + 738265615/1099511627776 * eps^27
        + 166992644595/281474976710656 * eps^29;
C2[16] = + 300540195/34359738368 * eps^16
        + 17678835/8589934592 * eps^18
        + 371255535/274877906944 * eps^20
        + 283171515/274877906944 * eps^22
        + 118236358635/140737488355328 * eps^24
        + 50102128545/70368744177664 * eps^26
        + 1393471517565/2251799813685248 * eps^28
        + 1233068062875/2251799813685248 * eps^30;
C2[17] = + 583401555/73014444032 * eps^17
        + 64822395/34359738368 * eps^19
        + 85292625/68719476736 * eps^21
        + 4172515215/4398046511104 * eps^23
        + 13636584885/17592186044416 * eps^25
        + 2894056305/4398046511104 * eps^27
        + 161224515885/281474976710656 * eps^29;
C2[18] = + 756261275/103079215104 * eps^18
        + 119409675/68719476736 * eps^20
        + 5039088285/4398046511104 * eps^22
        + 7718413945/8796093022208 * eps^24
        + 12634163925/17592186044416 * eps^26
        + 10741625085/17592186044416 * eps^28
        + 76701028811195/144115188075855872 * eps^30;
C2[19] = + 4418157975/652835028992 * eps^19
        + 883631595/549755813888 * eps^21
        + 4670624145/4398046511104 * eps^23
        + 14333193015/17592186044416 * eps^25
        + 2937289215/4398046511104 * eps^27
        + 10243215614805/18014398509481984 * eps^29;
C2[20] = + 6892326441/1099511627776 * eps^20
        + 1641030105/1099511627776 * eps^22
        + 34760001315/35184372088832 * eps^24
        + 13355260815/17592186044416 * eps^26
        + 22452476602335/36028797018963968 * eps^28
        + 95701981543233/180143985094819840 * eps^30;
C2[21] = + 22427411435/3848290697216 * eps^21
        + 6116566755/4398046511104 * eps^23
        + 16222198785/17592186044416 * eps^25
        + 798965451635/1125899906842624 * eps^27
        + 10507463872035/18014398509481984 * eps^29;
C2[22] = + 263012370465/48378511622144 * eps^22
        + 11435320455/8796093022208 * eps^24
        + 972002238675/1125899906842624 * eps^26
        + 1498026979605/2251799813685248 * eps^28
        + 78899312939325/144115188075855872 * eps^30;
C2[23] = + 514589420475/101155069755392 * eps^23
        + 171529806825/140737488355328 * eps^25
        + 912538572309/1125899906842624 * eps^27
        + 352031942007/562949953421312 * eps^29;
C2[24] = + 2687300306925/562949953421312 * eps^24
        + 322476036831/281474976710656 * eps^26
        + 6871220169399/9007199254740992 * eps^28
        + 15922598844211/27021597764222976 * eps^30;
C2[25] = + 15801325804719/3518437208883200 * eps^25
        + 1215486600363/1125899906842624 * eps^27
        + 405162200121/562949953421312 * eps^29;
C2[26] = + 61989816618513/14636698788954112 * eps^26
        + 2295919134019/2251799813685248 * eps^28
        + 98068545867383/144115188075855872 * eps^30;
C2[27] = + 121683714103007/30399297484750848 * eps^27
        + 17383387729001/18014398509481984 * eps^29;
C2[28] = + 136583760727865/36028797018963968 * eps^28
        + 32968493968795/36028797018963968 * eps^30;
C2[29] = + 1879204156221315/522417556774977536 * eps^29;
C2[30] = + 7391536347803839/2161727821137838080 * eps^30;

A3 = 1 - (1/2 - 1/2*n) * eps
       - (1/4 + 1/8*n - 3/8*n^2) * eps^2
       - (1/16 + 3/16*n + 1/16*n^2 - 5/16*n^3) * eps^3
       - (3/64 + 1/32*n + 5/32*n^2 + 5/128*n^3 - 35/128*n^4) * eps^4
       - (3/128 + 5/128*n + 5/256*n^2 + 35/256*n^3 + 7/256*n^4 - 63/256*n^5) * eps^5
       - (5/256 + 15/1024*n + 35/1024*n^2 + 7/512*n^3 + 63/512*n^4 + 21/1024*n^5 - 231/1024*n^6) * eps^6
       - (25/2048 + 35/2048*n + 21/2048*n^2 + 63/2048*n^3 + 21/2048*n^4 + 231/2048*n^5 + 33/2048*n^6 - 429/2048*n^7) * eps^7
       - (175/16384 + 35/4096*n + 63/4096*n^2 + 63/8192*n^3 + 231/8192*n^4 + 33/4096*n^5 + 429/4096*n^6 + 429/32768*n^7 - 6435/32768*n^8) * eps^8
       - (245/32768 + 315/32768*n + 105/16384*n^2 + 231/16384*n^3 + 99/16384*n^4 + 429/16384*n^5 + 429/65536*n^6 + 6435/65536*n^7 + 715/65536*n^8 - 12155/65536*n^9) * eps^9
       - (441/65536 + 735/131072*n + 1155/131072*n^2 + 165/32768*n^3 + 429/32768*n^4 + 1287/262144*n^5 + 6435/262144*n^6 + 715/131072*n^7 + 12155/131072*n^8 + 2431/262144*n^9 - 46189/262144*n^10) * eps^10
       - (1323/262144 + 1617/262144*n + 1155/262144*n^2 + 2145/262144*n^3 + 2145/524288*n^4 + 6435/524288*n^5 + 2145/524288*n^6 + 12155/524288*n^7 + 2431/524288*n^8 + 46189/524288*n^9 + 4199/524288*n^10 - 88179/524288*n^11) * eps^11
       - (4851/1048576 + 2079/524288*n + 3003/524288*n^2 + 15015/4194304*n^3 + 32175/4194304*n^4 + 3575/1048576*n^5 + 12155/1048576*n^6 + 7293/2097152*n^7 + 46189/2097152*n^8 + 4199/1048576*n^9 + 88179/1048576*n^10 + 29393/4194304*n^11 - 676039/4194304*n^12) * eps^12
       - (7623/2097152 + 9009/2097152*n + 27027/8388608*n^2 + 45045/8388608*n^3 + 25025/8388608*n^4 + 60775/8388608*n^5 + 12155/4194304*n^6 + 46189/4194304*n^7 + 12597/4194304*n^8 + 88179/4194304*n^9 + 29393/8388608*n^10 + 676039/8388608*n^11 + 52003/8388608*n^12 - 1300075/8388608*n^13) * eps^13
       - (14157/4194304 + 99099/33554432*n + 135135/33554432*n^2 + 45045/16777216*n^3 + 85085/16777216*n^4 + 85085/33554432*n^5 + 230945/33554432*n^6 + 20995/8388608*n^7 + 88179/8388608*n^8 + 88179/33554432*n^9 + 676039/33554432*n^10 + 52003/16777216*n^11 + 1300075/16777216*n^12 + 185725/33554432*n^13 - 5014575/33554432*n^14) * eps^14
       - (184041/67108864 + 212355/67108864*n + 165165/67108864*n^2 + 255255/67108864*n^3 + 153153/67108864*n^4 + 323323/67108864*n^5 + 146965/67108864*n^6 + 440895/67108864*n^7 + 146965/67108864*n^8 + 676039/67108864*n^9 + 156009/67108864*n^10 + 1300075/67108864*n^11 + 185725/67108864*n^12 + 5014575/67108864*n^13 + 334305/67108864*n^14) * eps^15
       - (2760615/1073741824 + 306735/134217728*n + 401115/134217728*n^2 + 561561/268435456*n^3 + 969969/268435456*n^4 + 264537/134217728*n^5 + 617253/134217728*n^6 + 1028755/536870912*n^7 + 3380195/536870912*n^8 + 260015/134217728*n^9 + 1300075/134217728*n^10 + 557175/268435456*n^11 + 5014575/268435456*n^12 + 334305/134217728*n^13) * eps^16
       - (4601025/2147483648 + 5214495/2147483648*n + 1042899/536870912*n^2 + 1524237/536870912*n^3 + 969969/536870912*n^4 + 1851759/536870912*n^5 + 1851759/1073741824*n^6 + 4732273/1073741824*n^7 + 1820105/1073741824*n^8 + 6500375/1073741824*n^9 + 928625/536870912*n^10 + 5014575/536870912*n^11 + 1002915/536870912*n^12) * eps^17
       - (8690825/4294967296 + 15643485/8589934592*n + 19815081/8589934592*n^2 + 1801371/1073741824*n^3 + 2909907/1073741824*n^4 + 6789783/4294967296*n^5 + 14196819/4294967296*n^6 + 3276189/2147483648*n^7 + 9100525/2147483648*n^8 + 6500375/4294967296*n^9 + 25072875/4294967296*n^10 + 1671525/1073741824*n^11) * eps^18
       - (29548805/17179869184 + 33025135/17179869184*n + 27020565/17179869184*n^2 + 37828791/17179869184*n^3 + 12609597/8589934592*n^4 + 22309287/8589934592*n^5 + 12012693/8589934592*n^6 + 27301575/8589934592*n^7 + 11700675/8589934592*n^8 + 35102025/8589934592*n^9 + 11700675/8589934592*n^10) * eps^19
       - (112285459/68719476736 + 51038845/34359738368*n + 63047985/34359738368*n^2 + 189143955/137438953472*n^3 + 290020731/137438953472*n^4 + 22309287/17179869184*n^5 + 42902475/17179869184*n^6 + 42902475/34359738368*n^7 + 105306075/34359738368*n^8 + 21061215/17179869184*n^9) * eps^20
       - (193947611/137438953472 + 214363149/137438953472*n + 357271915/274877906944*n^2 + 483367885/274877906944*n^3 + 334639305/274877906944*n^4 + 557732175/274877906944*n^5 + 79676025/68719476736*n^6 + 165480975/68719476736*n^7 + 77224455/68719476736*n^8) * eps^21
       - (370263621/274877906944 + 1357633277/1099511627776*n + 1643450809/1099511627776*n^2 + 632096465/549755813888*n^3 + 929553625/549755813888*n^4 + 1195140375/1099511627776*n^5 + 2151252675/1099511627776*n^6 + 143416845/137438953472*n^7) * eps^22
       - (2591845347/2199023255552 + 2838687761/2199023255552*n + 2401966567/2199023255552*n^2 + 3160482325/2199023255552*n^3 + 2257487375/2199023255552*n^4 + 3585421125/2199023255552*n^5 + 2151252675/2199023255552*n^6) * eps^23
       - (19870814327/17592186044416 + 4585572537/4398046511104*n + 5459014925/4398046511104*n^2 + 8578452025/8796093022208*n^3 + 12190431825/8796093022208*n^4 + 4063477275/4398046511104*n^5) * eps^24
       - (35156056117/35184372088832 + 38213104475/35184372088832*n + 16377044775/17592186044416*n^2 + 21056200425/17592186044416*n^3 + 15441213645/17592186044416*n^4) * eps^25
       - (67607800225/70368744177664 + 125557343275/140737488355328*n + 147393402975/140737488355328*n^2 + 29478680595/35184372088832*n^3) * eps^26
       - (241456429375/281474976710656 + 260772943725/281474976710656*n + 226003217895/281474976710656*n^2) * eps^27
       - (931331941875/1125899906842624 + 434621572875/562949953421312*n) * eps^28
       - 1676397495375/2251799813685248 * eps^29;

C3[1] = + (1/4 - 1/4*n) * eps
        + (1/8 - 1/8*n^2) * eps^2
        + (3/64 + 3/64*n - 1/64*n^2 - 5/64*n^3) * eps^3
        + (5/128 + 1/64*n + 1/64*n^2 - 1/64*n^3 - 7/128*n^4) * eps^4
        + (3/128 + 11/512*n + 3/512*n^2 + 1/256*n^3 - 7/512*n^4 - 21/512*n^5) * eps^5
        + (21/1024 + 5/512*n + 13/1024*n^2 + 1/512*n^3 - 1/1024*n^4 - 3/256*n^5 - 33/1024*n^6) * eps^6
        + (243/16384 + 189/16384*n + 83/16384*n^2 + 127/16384*n^3 + 3/16384*n^4 - 51/16384*n^5 - 165/16384*n^6 - 429/16384*n^7) * eps^7
        + (435/32768 + 109/16384*n + 1/128*n^2 + 45/16384*n^3 + 39/8192*n^4 - 11/16384*n^5 - 33/8192*n^6 - 143/16384*n^7 - 715/32768*n^8) * eps^8
        + (345/32768 + 953/131072*n + 259/65536*n^2 + 365/65536*n^3 + 95/65536*n^4 + 47/16384*n^5 - 143/131072*n^6 - 143/32768*n^7 - 1001/131072*n^8 - 2431/131072*n^9) * eps^9
        + (2511/262144 + 317/65536*n + 1355/262144*n^2 + 165/65536*n^3 + 531/131072*n^4 + 89/131072*n^5 + 107/65536*n^6 - 169/131072*n^7 - 1157/262144*n^8 - 221/32768*n^9 - 4199/262144*n^10) * eps^10
        + (8401/1048576 + 5327/1048576*n + 807/262144*n^2 + 8243/2097152*n^3 + 3415/2097152*n^4 + 6235/2097152*n^5 + 429/2097152*n^6 + 845/1048576*n^7 - 2873/2097152*n^8 - 9061/2097152*n^9 - 12597/2097152*n^10 - 29393/2097152*n^11) * eps^11
        + (15477/2097152 + 969/262144*n + 15445/4194304*n^2 + 2237/1048576*n^3 + 6429/2097152*n^4 + 2183/2097152*n^5 + 9169/4194304*n^6 - 197/2097152*n^7 + 1019/4194304*n^8 - 2907/2097152*n^9 - 8721/2097152*n^10 - 11305/2097152*n^11 - 52003/4194304*n^12) * eps^12
        + (26789/4194304 + 63733/16777216*n + 40995/16777216*n^2 + 1517/524288*n^3 + 25475/16777216*n^4 + 40625/16777216*n^5 + 5365/8388608*n^6 + 839/524288*n^7 - 595/2097152*n^8 - 2431/16777216*n^9 - 22933/16777216*n^10 - 33269/8388608*n^11 - 81719/16777216*n^12 - 185725/16777216*n^13) * eps^13
        + (199327/33554432 + 49237/16777216*n + 93101/33554432*n^2 + 29853/16777216*n^3 + 78579/33554432*n^4 + 285/262144*n^5 + 64637/33554432*n^6 + 3015/8388608*n^7 + 38843/33554432*n^8 - 6783/16777216*n^9 - 13889/33554432*n^10 - 22287/16777216*n^11 - 126293/33554432*n^12 - 37145/8388608*n^13 - 334305/33554432*n^14) * eps^14
        + (5651931/1073741824 + 3197305/1073741824*n + 2129255/1073741824*n^2 + 2385073/1073741824*n^3 + 1438067/1073741824*n^4 + 2065081/1073741824*n^5 + 830627/1073741824*n^6 + 1651687/1073741824*n^7 + 172907/1073741824*n^8 + 879393/1073741824*n^9 - 515185/1073741824*n^10 - 645031/1073741824*n^11 - 1374365/1073741824*n^12 - 3825935/1073741824*n^13 - 4345965/1073741824*n^14) * eps^15
        + (10594535/2147483648 + 2577049/1073741824*n + 2340339/1073741824*n^2 + 1599809/1073741824*n^3 + 1974139/1073741824*n^4 + 1095805/1073741824*n^5 + 855347/536870912*n^6 + 580477/1073741824*n^7 + 330109/268435456*n^8 + 20577/1073741824*n^9 + 598443/1073741824*n^10 - 564167/1073741824*n^11 - 783541/1073741824*n^12 - 1317555/1073741824*n^13) * eps^16
        + (9550675/2147483648 + 20752127/8589934592*n + 7056899/4294967296*n^2 + 7580255/4294967296*n^3 + 4992507/4294967296*n^4 + 3321125/2147483648*n^5 + 3349163/4294967296*n^6 + 5700229/4294967296*n^7 + 1567945/4294967296*n^8 + 263547/268435456*n^9 - 355965/4294967296*n^10 + 1518119/4294967296*n^11 - 2366355/4294967296*n^12) * eps^17
        + (72058593/17179869184 + 8629549/4294967296*n + 30360645/17179869184*n^2 + 5413229/4294967296*n^3 + 12734831/8589934592*n^4 + 3957093/4294967296*n^5 + 11280727/8589934592*n^6 + 2549757/4294967296*n^7 + 9531415/8589934592*n^8 + 993989/4294967296*n^9 + 6705875/8589934592*n^10 - 671807/4294967296*n^11) * eps^18
        + (263253385/68719476736 + 138258975/68719476736*n + 23816915/17179869184*n^2 + 198093717/137438953472*n^3 + 69240987/68719476736*n^4 + 87088843/68719476736*n^5 + 50514007/68719476736*n^6 + 77115649/68719476736*n^7 + 30761115/68719476736*n^8 + 63886991/68719476736*n^9 + 8860067/68719476736*n^10) * eps^19
        + (499116509/137438953472 + 29445517/17179869184*n + 403691887/274877906944*n^2 + 37063307/34359738368*n^3 + 336216217/274877906944*n^4 + 56373745/68719476736*n^5 + 9400419/8589934592*n^6 + 40361177/68719476736*n^7 + 4136725/4294967296*n^8 + 22806365/68719476736*n^9) * eps^20
        + (921106197/274877906944 + 1880398291/1099511627776*n + 326574877/274877906944*n^2 + 661516723/549755813888*n^3 + 482354011/549755813888*n^4 + 1162954687/1099511627776*n^5 + 185209863/274877906944*n^6 + 261495221/274877906944*n^7 + 64353371/137438953472*n^8) * eps^21
        + (7015755337/2199023255552 + 408123935/274877906944*n + 2737209361/2199023255552*n^2 + 128335869/137438953472*n^3 + 2262026963/2199023255552*n^4 + 100083329/137438953472*n^5 + 2032983351/2199023255552*n^6 + 152722157/274877906944*n^7) * eps^22
        + (52217815849/17592186044416 + 25998927035/17592186044416*n + 18152051013/17592186044416*n^2 + 17993187773/17592186044416*n^3 + 13531950573/17592186044416*n^4 + 15783055573/17592186044416*n^5 + 1342789487/2199023255552*n^6) * eps^23
        + (99797592861/35184372088832 + 22918110427/17592186044416*n + 9429859753/8796093022208*n^2 + 14370219019/17592186044416*n^3 + 15464224607/17592186044416*n^4 + 5696035625/8796093022208*n^5) * eps^24
        + (93477766213/35184372088832 + 182178015931/140737488355328*n + 63784112813/70368744177664*n^2 + 15523581719/17592186044416*n^3 + 47802611279/70368744177664*n^4) * eps^25
        + (716876091533/281474976710656 + 81306684531/70368744177664*n + 263375014467/281474976710656*n^2 + 50762313771/70368744177664*n^3) * eps^26
        + (2701098070323/1125899906842624 + 1291014428313/1125899906842624*n + 905405918351/1125899906842624*n^2) * eps^27
        + (5192918413211/2251799813685248 + 1164465998161/1125899906842624*n) * eps^28
        + 4914956648311/2251799813685248 * eps^29;
C3[2] = + (1/16 - 3/32*n + 1/32*n^2) * eps^2
        + (3/64 - 1/32*n - 3/64*n^2 + 1/32*n^3) * eps^3
        + (3/128 + 1/128*n - 9/256*n^2 - 3/128*n^3 + 7/256*n^4) * eps^4
        + (5/256 + 1/256*n - 1/128*n^2 - 7/256*n^3 - 3/256*n^4 + 3/128*n^5) * eps^5
        + (27/2048 + 69/8192*n - 39/8192*n^2 - 47/4096*n^3 - 41/2048*n^4 - 45/8192*n^5 + 165/8192*n^6) * eps^6
        + (187/16384 + 39/8192*n + 31/16384*n^2 - 63/8192*n^3 - 185/16384*n^4 - 119/8192*n^5 - 33/16384*n^6 + 143/8192*n^7) * eps^7
        + (287/32768 + 47/8192*n + 31/65536*n^2 - 3/2048*n^3 - 537/65536*n^4 - 41/4096*n^5 - 693/65536*n^6 + 1001/65536*n^8) * eps^8
        + (255/32768 + 249/65536*n + 43/16384*n^2 - 119/65536*n^3 - 25/8192*n^4 - 507/65536*n^5 - 35/4096*n^6 - 507/65536*n^7 + 39/32768*n^8 + 221/16384*n^9) * eps^9
        + (1675/262144 + 2127/524288*n + 753/524288*n^2 + 357/524288*n^3 - 3109/1048576*n^4 - 3873/1048576*n^5 - 1821/262144*n^6 - 1885/262144*n^7 - 2977/524288*n^8 + 1989/1048576*n^9 + 12597/1048576*n^10) * eps^10
        + (6065/1048576 + 1551/524288*n + 75/32768*n^2 - 5/262144*n^3 - 1085/2097152*n^4 - 1815/524288*n^5 - 8057/2097152*n^6 - 1597/262144*n^7 - 12633/2097152*n^8 - 4369/1048576*n^9 + 4845/2097152*n^10 + 11305/1048576*n^11) * eps^11
        + (10377/2097152 + 1585/524288*n + 12521/8388608*n^2 + 73/65536*n^3 - 7799/8388608*n^4 - 645/524288*n^5 - 1883/524288*n^6 - 7843/2097152*n^7 - 2769/524288*n^8 - 21165/4194304*n^9 - 25517/8388608*n^10 + 10659/4194304*n^11 + 81719/8388608*n^12) * eps^12
        + (2381/524288 + 19679/8388608*n + 3951/2097152*n^2 + 4591/8388608*n^3 + 1267/4194304*n^4 - 6211/4194304*n^5 - 6839/4194304*n^6 - 3691/1048576*n^7 - 29513/8388608*n^8 - 38199/8388608*n^9 - 17765/4194304*n^10 - 18411/8388608*n^11 + 22287/8388608*n^12 + 37145/4194304*n^13) * eps^13
        + (267955/67108864 + 1262293/536870912*n + 723929/536870912*n^2 + 300995/268435456*n^3 - 28407/268435456*n^4 - 136037/536870912*n^5 - 962677/536870912*n^6 - 122923/67108864*n^7 - 897497/268435456*n^8 - 1743367/536870912*n^9 - 2103053/536870912*n^10 - 957049/268435456*n^11 - 52003/33554432*n^12 + 1448655/536870912*n^13 + 4345965/536870912*n^14) * eps^14
        + (3976491/1073741824 + 1022503/536870912*n + 1663043/1073741824*n^2 + 377461/536870912*n^3 + 604683/1073741824*n^4 - 298493/536870912*n^5 - 671633/1073741824*n^6 - 1045847/536870912*n^7 - 2047913/1073741824*n^8 - 1673607/536870912*n^9 - 3182937/1073741824*n^10 - 1808097/536870912*n^11 - 3232489/1073741824*n^12 - 565915/536870912*n^13 + 2890755/1073741824*n^14) * eps^15
        + (7129743/2147483648 + 1015025/536870912*n + 5052845/4294967296*n^2 + 1096857/1073741824*n^3 + 1006901/4294967296*n^4 + 10157/67108864*n^5 - 3691453/4294967296*n^6 - 232785/268435456*n^7 - 8591613/4294967296*n^8 - 2045245/1073741824*n^9 - 12341583/4294967296*n^10 - 1443525/536870912*n^11 - 12440079/4294967296*n^12 - 2737805/1073741824*n^13) * eps^16
        + (6667727/2147483648 + 6786587/4294967296*n + 2765703/2147483648*n^2 + 3065499/4294967296*n^3 + 1341327/2147483648*n^4 - 481047/4294967296*n^5 - 80463/536870912*n^6 - 4538443/4294967296*n^7 - 2183311/2147483648*n^8 - 8533921/4294967296*n^9 - 3983383/2147483648*n^10 - 11294905/4294967296*n^11 - 5218401/2147483648*n^12) * eps^17
        + (48519273/17179869184 + 53624999/34359738368*n + 35043145/34359738368*n^2 + 31055675/34359738368*n^3 + 25399201/68719476736*n^4 + 10932099/34359738368*n^5 - 25183979/68719476736*n^6 - 12612269/34359738368*n^7 - 80897803/68719476736*n^8 - 37844017/34359738368*n^9 - 132790935/68719476736*n^10 - 61071857/34359738368*n^11) * eps^18
        + (182709161/68719476736 + 45893303/34359738368*n + 37309115/34359738368*n^2 + 2893075/4294967296*n^3 + 21013705/34359738368*n^4 + 7175491/68719476736*n^5 + 2804597/34359738368*n^6 - 37828469/68719476736*n^7 - 17888297/34359738368*n^8 - 85404217/68719476736*n^9 - 39202063/34359738368*n^10) * eps^19
        + (336130837/137438953472 + 180823959/137438953472*n + 487608355/549755813888*n^2 + 218243165/274877906944*n^3 + 227499107/549755813888*n^4 + 104333133/274877906944*n^5 - 13837431/137438953472*n^6 - 27388031/274877906944*n^7 - 93516413/137438953472*n^8 - 172126779/274877906944*n^9) * eps^20
        + (636339537/274877906944 + 630601557/549755813888*n + 510119863/549755813888*n^2 + 339882125/549755813888*n^3 + 157181907/274877906944*n^4 + 57322697/274877906944*n^5 + 53319741/274877906944*n^6 - 35494201/137438953472*n^7 - 65167699/274877906944*n^8) * eps^21
        + (4724647749/2199023255552 + 9924101863/8796093022208*n + 6828890391/8796093022208*n^2 + 3070661829/4398046511104*n^3 + 229152657/549755813888*n^4 + 3452592737/8796093022208*n^5 + 390195853/8796093022208*n^6 + 403726013/8796093022208*n^7) * eps^22
        + (35940468233/17592186044416 + 8781999081/8796093022208*n + 14121810537/17592186044416*n^2 + 4938417863/8796093022208*n^3 + 9227803497/17592186044416*n^4 + 2245716697/8796093022208*n^5 + 2160045085/8796093022208*n^6) * eps^23
        + (67197451821/35184372088832 + 8631642763/8796093022208*n + 48175476253/70368744177664*n^2 + 5424112681/8796093022208*n^3 + 28247205103/70368744177664*n^4 + 421237869/1099511627776*n^5) * eps^24
        + (64142976365/35184372088832 + 61855152171/70368744177664*n + 385976459/549755813888*n^2 + 35768834103/70368744177664*n^3 + 16801928753/35184372088832*n^4) * eps^25
        + (482598495517/281474976710656 + 486224128685/562949953421312*n + 342398306855/562949953421312*n^2 + 2408805385/4398046511104*n^3) * eps^26
        + (1848743160243/1125899906842624 + 439979250473/562949953421312*n + 698099481901/1125899906842624*n^2) * eps^27
        + (3494999262339/2251799813685248 + 1729207092437/2251799813685248*n) * eps^28
        + 6713540223121/4503599627370496 * eps^29;
C3[3] = + (5/192 - 3/64*n + 5/192*n^2 - 1/192*n^3) * eps^3
        + (3/128 - 5/192*n - 1/64*n^2 + 5/192*n^3 - 1/128*n^4) * eps^4
        + (7/512 - 1/384*n - 77/3072*n^2 + 5/3072*n^3 + 65/3072*n^4 - 9/1024*n^5) * eps^5
        + (3/256 - 1/1024*n - 71/6144*n^2 - 47/3072*n^3 + 9/1024*n^4 + 25/1536*n^5 - 55/6144*n^6) * eps^6
        + (139/16384 + 143/49152*n - 383/49152*n^2 - 179/16384*n^3 - 121/16384*n^4 + 547/49152*n^5 + 605/49152*n^6 - 143/16384*n^7) * eps^7
        + (243/32768 + 95/49152*n - 41/16384*n^2 - 147/16384*n^3 - 389/49152*n^4 - 109/49152*n^5 + 557/49152*n^6 + 455/49152*n^7 - 273/32768*n^8) * eps^8
        + (581/98304 + 377/131072*n - 33/16384*n^2 - 907/196608*n^3 - 515/65536*n^4 - 1937/393216*n^5 + 89/98304*n^6 + 2093/196608*n^7 + 455/65536*n^8 - 1547/196608*n^9) * eps^9
        + (1383/262144 + 103/49152*n - 17/262144*n^2 - 127/32768*n^3 - 3853/786432*n^4 - 25/4096*n^5 - 2011/786432*n^6 + 265/98304*n^7 + 1895/196608*n^8 + 85/16384*n^9 - 969/131072*n^10) * eps^10
        + (4649/1048576 + 7447/3145728*n - 77/393216*n^2 - 3663/2097152*n^3 - 9285/2097152*n^4 - 27433/6291456*n^5 - 27545/6291456*n^6 - 2627/3145728*n^7 + 22993/6291456*n^8 + 17969/2097152*n^9 + 8075/2097152*n^10 - 14535/2097152*n^11) * eps^11
        + (8439/2097152 + 241/131072*n + 7829/12582912*n^2 - 1667/1048576*n^3 - 5295/2097152*n^4 - 26867/6291456*n^5 - 14817/4194304*n^6 - 18287/6291456*n^7 + 1505/4194304*n^8 + 25823/6291456*n^9 + 15827/2097152*n^10 + 17765/6291456*n^11 - 81719/12582912*n^12) * eps^12
        + (58663/16777216 + 48239/25165824*n + 81155/201326592*n^2 - 108067/201326592*n^3 - 467735/201326592*n^4 - 550477/201326592*n^5 - 380633/100663296*n^6 - 269125/100663296*n^7 - 174181/100663296*n^8 + 9707/8388608*n^9 + 854981/201326592*n^10 + 444125/67108864*n^11 + 408595/201326592*n^12 - 408595/67108864*n^13) * eps^13
        + (53929/16777216 + 313117/201326592*n + 317377/402653184*n^2 - 114511/201326592*n^3 - 62369/50331648*n^4 - 21877/8388608*n^5 - 1055003/402653184*n^6 - 106461/33554432*n^7 - 381119/201326592*n^8 - 55243/67108864*n^9 + 672619/402653184*n^10 + 846887/201326592*n^11 + 1166353/201326592*n^12 + 142025/100663296*n^13 - 766935/134217728*n^14) * eps^14
        + (9205697/3221225472 + 1685361/1073741824*n + 631247/1073741824*n^2 - 12349/1073741824*n^3 - 1279425/1073741824*n^4 - 1722535/1073741824*n^5 - 8411347/3221225472*n^6 - 7543081/3221225472*n^7 - 2745069/1073741824*n^8 - 1319223/1073741824*n^9 - 150233/1073741824*n^10 + 6386185/3221225472*n^11 + 4360823/1073741824*n^12 + 16332875/3221225472*n^13 + 994175/1073741824*n^14) * eps^15
        + (5698375/2147483648 + 1411153/1073741824*n + 633185/805306368*n^2 - 312125/3221225472*n^3 - 906475/1610612736*n^4 - 4985293/3221225472*n^5 - 1865903/1073741824*n^6 - 2632335/1073741824*n^7 - 2142387/1073741824*n^8 - 2132439/1073741824*n^9 - 137693/201326592*n^10 + 1176251/3221225472*n^11 + 3469849/1610612736*n^12 + 12431155/3221225472*n^13) * eps^16
        + (5151335/2147483648 + 11221815/8589934592*n + 4004635/6442450944*n^2 + 352181/1610612736*n^3 - 7504877/12884901888*n^4 - 23563667/25769803776*n^5 - 7348445/4294967296*n^6 - 924507/536870912*n^7 - 4740015/2147483648*n^8 - 14053273/8589934592*n^9 - 2388169/1610612736*n^10 - 1600145/6442450944*n^11 + 9427907/12884901888*n^12) * eps^17
        + (38568657/17179869184 + 2405303/2147483648*n + 12559943/17179869184*n^2 + 101021/805306368*n^3 - 3473571/17179869184*n^4 - 11685365/12884901888*n^5 - 57369983/51539607552*n^6 - 22445501/12884901888*n^7 - 27767351/17179869184*n^8 - 776185/402653184*n^9 - 22223933/17179869184*n^10 - 6776669/6442450944*n^11) * eps^18
        + (141238745/68719476736 + 227781229/206158430208*n + 15439981/25769803776*n^2 + 129846877/412316860416*n^3 - 17007629/68719476736*n^4 - 34417161/68719476736*n^5 - 227700493/206158430208*n^6 - 82496459/68719476736*n^7 - 347760895/206158430208*n^8 - 100402157/68719476736*n^9 - 338650721/206158430208*n^10) * eps^19
        + (266070741/137438953472 + 24865997/25769803776*n + 546610979/824633720832*n^2 + 23564155/103079215104*n^3 - 1988681/274877906944*n^4 - 35689789/68719476736*n^5 - 18022529/25769803776*n^6 - 82884377/68719476736*n^7 - 62369083/51539607552*n^8 - 108501709/68719476736*n^9) * eps^20
        + (1476084109/824633720832 + 1042422451/1099511627776*n + 1838348957/3298534883328*n^2 + 1148287217/3298534883328*n^3 - 65602265/1099511627776*n^4 - 25911799/103079215104*n^5 - 1166561623/1649267441664*n^6 - 450241025/549755813888*n^7 - 4082983123/3298534883328*n^8) * eps^21
        + (3727307793/2199023255552 + 2771727475/3298534883328*n + 1965618587/3298534883328*n^2 + 299691921/1099511627776*n^3 + 648655007/6597069766656*n^4 - 232283647/824633720832*n^5 - 1414792807/3298534883328*n^6 - 1364945647/1649267441664*n^7) * eps^22
        + (27791243081/17592186044416 + 43484270377/52776558133248*n + 8988365213/17592186044416*n^2 + 6177195751/17592186044416*n^3 + 821647265/17592186044416*n^4 - 5244741905/52776558133248*n^5 - 5898760729/13194139533312*n^6) * eps^23
        + (52866931869/35184372088832 + 13002628835/17592186044416*n + 28235801693/52776558133248*n^2 + 15115493921/52776558133248*n^3 + 1357399595/8796093022208*n^4 - 1176448685/8796093022208*n^5) * eps^24
        + (49596004877/35184372088832 + 101897209187/140737488355328*n + 16392942713/35184372088832*n^2 + 35874509113/105553116266496*n^3 + 11256301655/105553116266496*n^4) * eps^25
        + (378812456237/281474976710656 + 23082024431/35184372088832*n + 406385867693/844424930131968*n^2 + 30062357575/105553116266496*n^3) * eps^26
        + (4287844495145/3377699720527872 + 723291681375/1125899906842624*n + 477936436199/1125899906842624*n^2) * eps^27
        + (2738088177221/2251799813685248 + 1982787518731/3377699720527872*n) * eps^28
        + 41515375436483/36028797018963968 * eps^29;
C3[4] = + (7/512 - 7/256*n + 5/256*n^2 - 7/1024*n^3 + 1/1024*n^4) * eps^4
        + (7/512 - 5/256*n - 7/2048*n^2 + 9/512*n^3 - 21/2048*n^4 + 1/512*n^5) * eps^5
        + (9/1024 - 43/8192*n - 129/8192*n^2 + 39/4096*n^3 + 91/8192*n^4 - 91/8192*n^5 + 11/4096*n^6) * eps^6
        + (127/16384 - 23/8192*n - 165/16384*n^2 - 47/8192*n^3 + 213/16384*n^4 + 11/2048*n^5 - 175/16384*n^6 + 13/4096*n^7) * eps^7
        + (193/32768 + 3/8192*n - 505/65536*n^2 - 227/32768*n^3 + 75/65536*n^4 + 801/65536*n^5 + 165/131072*n^6 - 637/65536*n^7 + 455/131072*n^8) * eps^8
        + (171/32768 + 25/65536*n - 259/65536*n^2 - 471/65536*n^3 - 351/131072*n^4 + 605/131072*n^5 + 41/4096*n^6 - 189/131072*n^7 - 1127/131072*n^8 + 119/32768*n^9) * eps^9
        + (1121/262144 + 339/262144*n - 801/262144*n^2 - 2525/524288*n^3 - 2519/524288*n^4 + 73/131072*n^5 + 1539/262144*n^6 + 1989/262144*n^7 - 1633/524288*n^8 - 3927/524288*n^9 + 969/262144*n^10) * eps^10
        + (2017/524288 + 273/262144*n - 1467/1048576*n^2 - 277/65536*n^3 - 4123/1048576*n^4 - 153/65536*n^5 + 1331/524288*n^6 + 1549/262144*n^7 + 5677/1048576*n^8 - 1071/262144*n^9 - 6783/1048576*n^10 + 969/262144*n^11) * eps^11
        + (55215/16777216 + 11307/8388608*n - 2363/2097152*n^2 - 177843/67108864*n^3 - 268499/67108864*n^4 - 41907/16777216*n^5 - 6403/16777216*n^6 + 118801/33554432*n^7 + 179785/33554432*n^8 + 30345/8388608*n^9 - 154071/33554432*n^10 - 373065/67108864*n^11 + 245157/67108864*n^12) * eps^12
        + (50365/16777216 + 2327/2097152*n - 47759/134217728*n^2 - 76829/33554432*n^3 - 383837/134217728*n^4 - 105473/33554432*n^5 - 74037/67108864*n^6 + 16197/16777216*n^7 + 260819/67108864*n^8 + 153431/33554432*n^9 + 294443/134217728*n^10 - 80465/16777216*n^11 - 639331/134217728*n^12 + 120175/33554432*n^13) * eps^13
        + (2769/1048576 + 654529/536870912*n - 163129/536870912*n^2 - 372645/268435456*n^3 - 1430285/536870912*n^4 - 1335009/536870912*n^5 - 284489/134217728*n^6 + 987/33554432*n^7 + 482449/268435456*n^8 + 2057345/536870912*n^9 + 2007901/536870912*n^10 + 293645/268435456*n^11 - 2581359/536870912*n^12 - 2187185/536870912*n^13 + 937365/268435456*n^14) * eps^14
        + (2615571/1073741824 + 552353/536870912*n + 90895/1073741824*n^2 - 652503/536870912*n^3 - 1983405/1073741824*n^4 - 680875/268435456*n^5 - 2001037/1073741824*n^6 - 156103/134217728*n^7 + 920027/1073741824*n^8 + 1204095/536870912*n^9 + 3815723/1073741824*n^10 + 1584867/536870912*n^11 + 278231/1073741824*n^12 - 315445/67108864*n^13 - 3736005/1073741824*n^14) * eps^15
        + (4692619/2147483648 + 572057/536870912*n + 260179/4294967296*n^2 - 2984769/4294967296*n^3 - 3625809/2147483648*n^4 - 8162427/4294967296*n^5 - 18409849/8589934592*n^6 - 639067/536870912*n^7 - 3156661/8589934592*n^8 + 3027631/2147483648*n^9 + 162319/67108864*n^10 + 13593091/4294967296*n^11 + 9656343/4294967296*n^12 - 1568255/4294967296*n^13) * eps^16
        + (4367867/2147483648 + 3942989/4294967296*n + 2323595/8589934592*n^2 - 2679169/4294967296*n^3 - 2473899/2147483648*n^4 - 15712829/8589934592*n^5 - 14665951/8589934592*n^6 - 14129447/8589934592*n^7 - 2450171/4294967296*n^8 + 529403/2147483648*n^9 + 14965037/8589934592*n^10 + 5189391/2147483648*n^11 + 5874821/2147483648*n^12) * eps^17
        + (31803789/17179869184 + 31805471/34359738368*n + 7655783/34359738368*n^2 - 10716843/34359738368*n^3 - 18130187/17179869184*n^4 - 23156361/17179869184*n^5 - 60088211/34359738368*n^6 - 11928127/8589934592*n^7 - 9775259/8589934592*n^8 - 1657343/34359738368*n^9 + 23786693/34359738368*n^10 + 65561705/34359738368*n^11) * eps^18
        + (119278493/68719476736 + 27869745/34359738368*n + 2944971/8589934592*n^2 - 10021441/34359738368*n^3 - 48412679/68719476736*n^4 - 43782451/34359738368*n^5 - 46594423/34359738368*n^6 - 52867989/34359738368*n^7 - 70453029/68719476736*n^8 - 23159185/34359738368*n^9 + 12551255/34359738368*n^10) * eps^19
        + (109782837/68719476736 + 110884309/137438953472*n + 159981789/549755813888*n^2 - 106745493/1099511627776*n^3 - 717924527/1099511627776*n^4 - 15979315/17179869184*n^5 - 732221291/549755813888*n^6 - 21353761/17179869184*n^7 - 347832177/274877906944*n^8 - 732828227/1099511627776*n^9) * eps^20
        + (414212295/274877906944 + 394066451/549755813888*n + 797767751/2199023255552*n^2 - 13938969/137438953472*n^3 - 922185663/2199023255552*n^4 - 241117663/274877906944*n^5 - 70260475/68719476736*n^6 - 702480169/549755813888*n^7 - 2332298309/2199023255552*n^8) * eps^21
        + (3077054969/2199023255552 + 6225526419/8796093022208*n + 2760680993/8796093022208*n^2 + 107993597/4398046511104*n^3 - 3483012103/8796093022208*n^4 - 5569520181/8796093022208*n^5 - 4345994585/4398046511104*n^6 - 8944055483/8796093022208*n^7) * eps^22
        + (23336011385/17592186044416 + 5594946455/8796093022208*n + 6303559381/17592186044416*n^2 + 78999975/8796093022208*n^3 - 4164504717/17592186044416*n^4 - 330002595/549755813888*n^5 - 3315820133/4398046511104*n^6) * eps^23
        + (43652141925/35184372088832 + 5501899769/8796093022208*n + 22131275675/70368744177664*n^2 + 820267293/8796093022208*n^3 - 16179701905/70368744177664*n^4 - 1872775091/4398046511104*n^5) * eps^24
        + (41556934973/35184372088832 + 39939504101/70368744177664*n + 753834291/2199023255552*n^2 + 5148539461/70368744177664*n^3 - 4176807933/35184372088832*n^4) * eps^25
        + (312802619769/281474976710656 + 78374027619/140737488355328*n + 42845064993/140737488355328*n^2 + 18460662479/140737488355328*n^3) * eps^26
        + (298867963845/281474976710656 + 71700391575/140737488355328*n + 45431388475/140737488355328*n^2) * eps^27
        + (36174484487935/36028797018963968 + 8994085968251/18014398509481984*n) * eps^28
        + 34671257326469/36028797018963968 * eps^29;
C3[5] = + (21/2560 - 9/512*n + 15/1024*n^2 - 7/1024*n^3 + 9/5120*n^4 - 1/5120*n^5) * eps^5
        + (9/1024 - 15/1024*n + 3/2048*n^2 + 57/5120*n^3 - 5/512*n^4 + 9/2560*n^5 - 1/2048*n^6) * eps^6
        + (99/16384 - 91/16384*n - 781/81920*n^2 + 883/81920*n^3 + 319/81920*n^4 - 783/81920*n^5 + 387/81920*n^6 - 13/16384*n^7) * eps^7
        + (179/32768 - 55/16384*n - 79/10240*n^2 - 27/81920*n^3 + 461/40960*n^4 - 139/81920*n^5 - 65/8192*n^6 + 441/81920*n^7 - 35/32768*n^8) * eps^8
        + (141/32768 - 109/131072*n - 217/32768*n^2 - 219/65536*n^3 + 1559/327680*n^4 + 5431/655360*n^5 - 203/40960*n^6 - 1943/327680*n^7 + 369/65536*n^8 - 85/65536*n^9) * eps^9
        + (1013/262144 - 15/32768*n - 5399/1310720*n^2 - 199/40960*n^3 + 1267/1310720*n^4 + 1007/163840*n^5 + 6277/1310720*n^6 - 527/81920*n^7 - 659/163840*n^8 + 459/81920*n^9 - 969/655360*n^10) * eps^10
        + (6787/2097152 + 797/2097152*n - 34683/10485760*n^2 - 257/65536*n^3 - 7753/4194304*n^4 + 72641/20971520*n^5 + 115867/20971520*n^6 + 38817/20971520*n^7 - 142119/20971520*n^8 - 50133/20971520*n^9 + 113373/20971520*n^10 - 6783/4194304*n^11) * eps^11
        + (12315/4194304 + 799/2097152*n - 41519/20971520*n^2 - 19671/5242880*n^3 - 93317/41943040*n^4 + 12949/20971520*n^5 + 18211/4194304*n^6 + 86317/20971520*n^7 - 2971/10485760*n^8 - 135789/20971520*n^9 - 11229/10485760*n^10 + 107217/20971520*n^11 - 14421/8388608*n^12) * eps^12
        + (42753/16777216 + 11749/16777216*n - 534457/335544320*n^2 - 914519/335544320*n^3 - 953267/335544320*n^4 - 128591/335544320*n^5 + 354589/167772160*n^6 + 703457/167772160*n^7 + 433157/167772160*n^8 - 17697/10485760*n^9 - 1961579/335544320*n^10 - 2717/67108864*n^11 + 1600731/335544320*n^12 - 120175/67108864*n^13) * eps^13
        + (78439/33554432 + 41589/67108864*n - 606887/671088640*n^2 - 813811/335544320*n^3 - 795669/335544320*n^4 - 126481/83886080*n^5 + 693943/671088640*n^6 + 92775/33554432*n^7 + 1181311/335544320*n^8 + 409551/335544320*n^9 - 1692661/671088640*n^10 - 1705561/335544320*n^11 + 124729/167772160*n^12 + 148005/33554432*n^13 - 246675/134217728*n^14) * eps^14
        + (11153319/5368709120 + 806753/1073741824*n - 3945181/5368709120*n^2 - 9244317/5368709120*n^3 - 12780537/5368709120*n^4 - 8161927/5368709120*n^5 - 291353/1073741824*n^6 + 10250183/5368709120*n^7 + 15202259/5368709120*n^8 + 14255529/5368709120*n^9 + 710823/5368709120*n^10 - 3162357/1073741824*n^11 - 23067781/5368709120*n^12 + 1424137/1073741824*n^13 + 4351347/1073741824*n^14) * eps^15
        + (4132007/2147483648 + 710105/1073741824*n - 969349/2684354560*n^2 - 1619999/1073741824*n^3 - 5011741/2684354560*n^4 - 9930299/5368709120*n^5 - 1564801/2684354560*n^6 + 3561709/5368709120*n^7 + 1553999/671088640*n^8 + 13695849/5368709120*n^9 + 4792721/2684354560*n^10 - 3635919/5368709120*n^11 - 8283611/2684354560*n^12 - 3808363/1073741824*n^13) * eps^16
        + (3734859/2147483648 + 6155471/8589934592*n - 789297/2684354560*n^2 - 11355613/10737418240*n^3 - 37704683/21474836480*n^4 - 67981809/42949672960*n^5 - 4910633/4294967296*n^6 + 122353/536870912*n^7 + 13584809/10737418240*n^8 + 102204983/42949672960*n^9 + 22521571/10737418240*n^10 + 5393991/5368709120*n^11 - 26677631/21474836480*n^12) * eps^17
        + (27894537/17179869184 + 341135/536870912*n - 6919577/85899345920*n^2 - 9962193/10737418240*n^3 - 116140263/85899345920*n^4 - 35024383/21474836480*n^5 - 93895333/85899345920*n^6 - 9724319/21474836480*n^7 + 71547201/85899345920*n^8 + 16957261/10737418240*n^9 + 38167643/17179869184*n^10 + 4254817/2684354560*n^11) * eps^18
        + (102149077/68719476736 + 45149747/68719476736*n - 5268353/85899345920*n^2 - 438238873/687194767360*n^3 - 21374577/17179869184*n^4 - 229885771/171798691840*n^5 - 111314271/85899345920*n^6 - 190649511/343597383680*n^7 + 21780193/171798691840*n^8 + 42150359/34359738368*n^9 + 575291951/343597383680*n^10) * eps^19
        + (191992897/137438953472 + 10102641/17179869184*n + 91038377/1374389534720*n^2 - 48406631/85899345920*n^3 - 1306192047/1374389534720*n^4 - 111829633/85899345920*n^5 - 775578061/687194767360*n^6 - 75280887/85899345920*n^7 - 41514599/687194767360*n^8 + 38659177/68719476736*n^9) * eps^20
        + (355055163/274877906944 + 653193131/1099511627776*n + 347941049/5497558138880*n^2 - 2051760759/5497558138880*n^3 - 4780409067/5497558138880*n^4 - 2891926301/2748779069440*n^5 - 3246633917/2748779069440*n^6 - 2255299589/2748779069440*n^7 - 500938259/1099511627776*n^8) * eps^21
        + (2684106857/2199023255552 + 589926107/1099511627776*n + 391603487/2748779069440*n^2 - 1831096049/5497558138880*n^3 - 7250179399/10995116277760*n^4 - 687030501/687194767360*n^5 - 2742957537/2748779069440*n^6 - 2629744457/2748779069440*n^7) * eps^22
        + (20014266089/17592186044416 + 9415408371/17592186044416*n + 2280678869/17592186044416*n^2 - 18044662719/87960930222080*n^3 - 10627395203/17592186044416*n^4 - 70583370027/87960930222080*n^5 - 10917838539/10995116277760*n^6) * eps^23
        + (38001723933/35184372088832 + 8573148395/17592186044416*n + 7931117147/43980465111040*n^2 - 16302072297/87960930222080*n^3 - 39871150043/87960930222080*n^4 - 33222569643/43980465111040*n^5) * eps^24
        + (178265154501/175921860444160 + 67917412749/140737488355328*n + 7195977601/43980465111040*n^2 - 17107988587/175921860444160*n^3 - 73408496063/175921860444160*n^4) * eps^25
        + (271858418651/281474976710656 + 3893205391/8796093022208*n + 277112865109/1407374883553280*n^2 - 1966777807/21990232555520*n^3) * eps^26
        + (4103246283741/4503599627370496 + 1965390008631/4503599627370496*n + 4035517048233/22517998136852480*n^2) * eps^27
        + (7848710341433/9007199254740992 + 1814136297259/4503599627370496*n) * eps^28
        + 29752988542989/36028797018963968 * eps^29;
C3[6] = + (11/2048 - 99/8192*n + 275/24576*n^2 - 77/12288*n^3 + 9/4096*n^4 - 11/24576*n^5 + 1/24576*n^6) * eps^6
        + (99/16384 - 275/24576*n + 55/16384*n^2 + 167/24576*n^3 - 407/49152*n^4 + 35/8192*n^5 - 55/49152*n^6 + 1/8192*n^7) * eps^7
        + (143/32768 - 253/49152*n - 1105/196608*n^2 + 481/49152*n^3 - 73/196608*n^4 - 169/24576*n^5 + 1067/196608*n^6 - 11/6144*n^7 + 15/65536*n^8) * eps^8
        + (33/8192 - 221/65536*n - 23/4096*n^2 + 457/196608*n^3 + 267/32768*n^4 - 329/65536*n^5 - 69/16384*n^6 + 375/65536*n^7 - 77/32768*n^8 + 17/49152*n^9) * eps^9
        + (1711/524288 - 4333/3145728*n - 16885/3145728*n^2 - 1343/1572864*n^3 + 17381/3145728*n^4 + 8519/2097152*n^5 - 42985/6291456*n^6 - 4885/3145728*n^7 + 8549/1572864*n^8 - 5797/2097152*n^9 + 969/2097152*n^10) * eps^10
        + (6223/2097152 - 2827/3145728*n - 23731/6291456*n^2 - 8959/3145728*n^3 + 11937/4194304*n^4 + 32207/6291456*n^5 + 5071/12582912*n^6 - 42571/6291456*n^7 + 7489/12582912*n^8 + 10115/2097152*n^9 - 12749/4194304*n^10 + 1197/2097152*n^11) * eps^11
        + (31829/12582912 - 647/4194304*n - 13305/4194304*n^2 - 23369/8388608*n^3 + 981/4194304*n^4 + 53003/12582912*n^5 + 161989/50331648*n^6 - 25313/12582912*n^7 - 288887/50331648*n^8 + 8937/4194304*n^9 + 204725/50331648*n^10 - 80465/25165824*n^11 + 33649/50331648*n^12) * eps^12
        + (19409/8388608 - 143/4194304*n - 108221/50331648*n^2 - 37559/12582912*n^3 - 11319/16777216*n^4 + 110569/50331648*n^5 + 49103/12582912*n^6 + 19233/16777216*n^7 - 6811/2097152*n^8 - 73151/16777216*n^9 + 156973/50331648*n^10 + 165187/50331648*n^11 - 164197/50331648*n^12 + 6325/8388608*n^13) * eps^13
        + (136403/67108864 + 149829/536870912*n - 951655/536870912*n^2 - 1940579/805306368*n^3 - 1290821/805306368*n^4 + 1817813/1610612736*n^5 + 4654573/1610612736*n^6 + 374953/134217728*n^7 - 210217/402653184*n^8 - 1945219/536870912*n^9 - 1593647/536870912*n^10 + 2958659/805306368*n^11 + 2038421/805306368*n^12 - 5245955/1610612736*n^13 + 444015/536870912*n^14) * eps^14
        + (2013531/1073741824 + 153447/536870912*n - 3812959/3221225472*n^2 - 3623809/1610612736*n^3 - 1720969/1073741824*n^4 - 155419/1610612736*n^5 + 2321319/1073741824*n^6 + 1446653/536870912*n^7 + 4820965/3221225472*n^8 - 881605/536870912*n^9 - 11135251/3221225472*n^10 - 927839/536870912*n^11 + 12596617/3221225472*n^12 + 2976545/1610612736*n^13 - 3437005/1073741824*n^14) * eps^15
        + (3610319/2147483648 + 689891/1610612736*n - 4192091/4294967296*n^2 - 5626007/3221225472*n^3 - 23482225/12884901888*n^4 - 63477/134217728*n^5 + 13148195/12884901888*n^6 + 2657655/1073741824*n^7 + 8738873/4294967296*n^8 + 89999/268435456*n^9 - 9718455/4294967296*n^10 - 9643399/3221225472*n^11 - 9027109/12884901888*n^12 + 1580215/402653184*n^13) * eps^16
        + (3357815/2147483648 + 5140585/12884901888*n - 1357887/2147483648*n^2 - 20205383/12884901888*n^3 - 10165433/6442450944*n^4 - 12859795/12884901888*n^5 + 3376837/6442450944*n^6 + 20985541/12884901888*n^7 + 14739271/6442450944*n^8 + 5247007/4294967296*n^9 - 3621415/6442450944*n^10 - 32175059/12884901888*n^11 - 15465929/6442450944*n^12) * eps^17
        + (73325191/51539607552 + 16029851/34359738368*n - 17954851/34359738368*n^2 - 124000031/103079215104*n^3 - 107691583/68719476736*n^4 - 26099447/25769803776*n^5 - 10228585/68719476736*n^6 + 124145675/103079215104*n^7 + 371070857/206158430208*n^8 + 11745371/6442450944*n^9 + 91139599/206158430208*n^10 - 30320905/25769803776*n^11) * eps^18
        + (91563605/68719476736 + 44091817/103079215104*n - 10830499/34359738368*n^2 - 27517235/25769803776*n^3 - 268855985/206158430208*n^4 - 82123075/68719476736*n^5 - 69647705/206158430208*n^6 + 109205227/206158430208*n^7 + 319534237/206158430208*n^8 + 114455667/68719476736*n^9 + 64469791/51539607552*n^10) * eps^19
        + (168518401/137438953472 + 189582913/412316860416*n - 142520949/549755813888*n^2 - 671006539/824633720832*n^3 - 2036680639/1649267441664*n^4 - 888938183/824633720832*n^5 - 275851423/412316860416*n^6 + 73762303/274877906944*n^7 + 200547467/206158430208*n^8 + 445330347/274877906944*n^9) * eps^20
        + (317520693/274877906944 + 231509165/549755813888*n - 214107557/1649267441664*n^2 - 396525643/549755813888*n^3 - 278406799/274877906944*n^4 - 920067617/824633720832*n^5 - 564306103/824633720832*n^6 - 58960025/412316860416*n^7 + 595823299/824633720832*n^8) * eps^21
        + (2358489413/2199023255552 + 11489787637/26388279066624*n - 908814505/8796093022208*n^2 - 2396614237/4398046511104*n^3 - 12411634453/13194139533312*n^4 - 8522185111/8796093022208*n^5 - 21849837611/26388279066624*n^6 - 2193761283/8796093022208*n^7) * eps^22
        + (17864718441/17592186044416 + 10555835899/26388279066624*n - 1055263841/52776558133248*n^2 - 4259460285/8796093022208*n^3 - 40456260929/52776558133248*n^4 - 25125823283/26388279066624*n^5 - 20228133965/26388279066624*n^6) * eps^23
        + (100244499991/105553116266496 + 7127188931/17592186044416*n - 2047769071/211106232532992*n^2 - 19029851431/52776558133248*n^3 - 49723762631/70368744177664*n^4 - 21473509045/26388279066624*n^5) * eps^24
        + (7943510175/8796093022208 + 78919576567/211106232532992*n + 2396202703/52776558133248*n^2 - 67906408573/211106232532992*n^3 - 30263574227/52776558133248*n^4) * eps^25
        + (956603287889/1125899906842624 + 2527332335909/6755399441055744*n + 105375782699/2251799813685248*n^2 - 394588464167/1688849860263936*n^3) * eps^26
        + (3651975781065/4503599627370496 + 780981164949/2251799813685248*n + 378631414483/4503599627370496*n^2) * eps^27
        + (6906351178529/9007199254740992 + 9311073056275/27021597764222976*n) * eps^28
        + 13225333818489/18014398509481984 * eps^29;
C3[7] = + (429/114688 - 143/16384*n + 143/16384*n^2 - 91/16384*n^3 + 39/16384*n^4 - 11/16384*n^5 + 13/114688*n^6 - 1/114688*n^7) * eps^7
        + (143/32768 - 143/16384*n + 65/16384*n^2 + 65/16384*n^3 - 109/16384*n^4 + 507/114688*n^5 - 27/16384*n^6 + 39/114688*n^7 - 1/32768*n^8) * eps^8
        + (429/131072 - 299/65536*n - 13/4096*n^2 + 269/32768*n^3 - 601/229376*n^4 - 989/229376*n^5 + 9475/1835008*n^6 - 4667/1835008*n^7 + 1157/1835008*n^8 - 17/262144*n^9) * eps^9
        + (403/131072 - 13/4096*n - 521/131072*n^2 + 393/114688*n^3 + 1209/229376*n^4 - 11001/1835008*n^5 - 3979/3670016*n^6 + 8821/1835008*n^7 - 833/262144*n^8 + 429/458752*n^9 - 57/524288*n^10) * eps^10
        + (5343/2097152 - 3345/2097152*n - 8863/2097152*n^2 + 2511/3670016*n^3 + 146613/29360128*n^4 + 27159/29360128*n^5 - 185267/29360128*n^6 + 47549/29360128*n^7 + 112179/29360128*n^8 - 103371/29360128*n^9 + 35815/29360128*n^10 - 665/4194304*n^11) * eps^11
        + (9825/4194304 - 2337/2097152*n - 13661/4194304*n^2 - 1405/1048576*n^3 + 205965/58720256*n^4 + 98019/29360128*n^5 - 15733/7340032*n^6 - 145237/29360128*n^7 + 99087/29360128*n^8 + 76233/29360128*n^9 - 106087/29360128*n^10 + 6149/4194304*n^11 - 1771/8388608*n^12) * eps^12
        + (2125/1048576 - 3903/8388608*n - 96259/33554432*n^2 - 410489/234881024*n^3 + 341577/234881024*n^4 + 441667/117440512*n^5 + 102545/117440512*n^6 - 411905/117440512*n^7 - 44531/14680064*n^8 + 996015/234881024*n^9 + 324603/234881024*n^10 - 118019/33554432*n^11 + 55913/33554432*n^12 - 8855/33554432*n^13) * eps^13
        + (31337/16777216 - 9845/33554432*n - 141287/67108864*n^2 - 514903/234881024*n^3 + 213351/469762048*n^4 + 158209/58720256*n^5 + 299101/117440512*n^6 - 132045/117440512*n^7 - 1686973/469762048*n^8 - 284559/234881024*n^9 + 1041819/234881024*n^10 + 72061/234881024*n^11 - 773421/234881024*n^12 + 213785/117440512*n^13 - 148005/469762048*n^14) * eps^14
        + (1780203/1073741824 + 2521/1073741824*n - 1916449/1073741824*n^2 - 14648021/7516192768*n^3 - 606289/1073741824*n^4 + 2068453/1073741824*n^5 + 19266365/7516192768*n^6 + 1015577/1073741824*n^7 - 17180199/7516192768*n^8 - 22143117/7516192768*n^9 + 1831549/7516192768*n^10 + 4498521/1073741824*n^11 - 4339571/7516192768*n^12 - 22471345/7516192768*n^13 + 14517945/7516192768*n^14) * eps^15
        + (3302903/2147483648 + 61025/1073741824*n - 1392303/1073741824*n^2 - 14509913/7516192768*n^3 - 6298927/7516192768*n^4 + 6457051/7516192768*n^5 + 17971091/7516192768*n^6 + 12735795/7516192768*n^7 - 3219137/7516192768*n^8 - 20216205/7516192768*n^9 - 15046077/7516192768*n^10 + 9532867/7516192768*n^11 + 3961599/1073741824*n^12 - 9497345/7516192768*n^13) * eps^16
        + (2983837/2147483648 + 1733855/8589934592*n - 4685403/4294967296*n^2 - 48201865/30064771072*n^3 - 36259515/30064771072*n^4 + 5527869/15032385536*n^5 + 1536743/939524096*n^6 + 63232859/30064771072*n^7 + 73671/117440512*n^8 - 1449355/1073741824*n^9 - 76937885/30064771072*n^10 - 30946235/30064771072*n^11 + 3570999/1879048192*n^12) * eps^17
        + (22292529/17179869184 + 899355/4294967296*n - 13492583/17179869184*n^2 - 44700791/30064771072*n^3 - 70120189/60129542144*n^4 - 3471339/15032385536*n^5 + 72969301/60129542144*n^6 + 478067/268435456*n^7 + 85725937/60129542144*n^8 - 9546319/30064771072*n^9 - 109115611/60129542144*n^10 - 63656897/30064771072*n^11) * eps^18
        + (81611253/68719476736 + 19508379/68719476736*n - 2837849/4294967296*n^2 - 1163707393/962072674304*n^3 - 75492929/60129542144*n^4 - 25075777/60129542144*n^5 + 141589169/240518168576*n^6 + 109200085/68719476736*n^7 + 51248003/34359738368*n^8 + 19485265/30064771072*n^9 - 68932559/68719476736*n^10) * eps^19
        + (153351409/137438953472 + 1171063/4294967296*n - 128254133/274877906944*n^2 - 32936875/30064771072*n^3 - 2152615067/1924145348608*n^4 - 167428859/240518168576*n^5 + 297094515/962072674304*n^6 + 261663431/240518168576*n^7 + 1509210613/962072674304*n^8 + 472288869/481036337152*n^9) * eps^20
        + (1984807995/1924145348608 + 342786907/1099511627776*n - 215809073/549755813888*n^2 - 3403522219/3848290697216*n^3 - 2125818367/1924145348608*n^4 - 5503162739/7696581394432*n^5 - 36779903/481036337152*n^6 + 1607563715/1924145348608*n^7 + 4856829545/3848290697216*n^8) * eps^21
        + (2142375089/2199023255552 + 161430897/549755813888*n - 585488823/2199023255552*n^2 - 3056980555/3848290697216*n^3 - 14718114487/15393162788864*n^4 - 793901309/962072674304*n^5 - 3165663579/15393162788864*n^6 + 420223757/962072674304*n^7) * eps^22
        + (15972732585/17592186044416 + 5524675807/17592186044416*n - 3921720195/17592186044416*n^2 - 78636170271/123145302310912*n^3 - 112176079097/123145302310912*n^4 - 94959230613/123145302310912*n^5 - 12796244065/30786325577728*n^6) * eps^23
        + (30308424633/35184372088832 + 5175108963/17592186044416*n - 2441010467/17592186044416*n^2 - 70491037987/123145302310912*n^3 - 47936493201/61572651155456*n^4 - 49286431235/61572651155456*n^5) * eps^24
        + (227458182793/281474976710656 + 85653158665/281474976710656*n - 16050121299/140737488355328*n^2 - 451259285829/985162418487296*n^3 - 718664673347/985162418487296*n^4) * eps^25
        + (433302064951/562949953421312 + 40095993459/140737488355328*n - 31913675941/562949953421312*n^2 - 57834268753/140737488355328*n^3) * eps^26
        + (3269693185065/4503599627370496 + 1302630681669/4503599627370496*n - 195127280595/4503599627370496*n^2) * eps^27
        + (6249998138435/9007199254740992 + 1221397131411/4503599627370496*n) * eps^28
        + 5922672166091/9007199254740992 * eps^29;
C3[8] = + (715/262144 - 429/65536*n + 455/65536*n^2 - 637/131072*n^3 + 315/131072*n^4 - 55/65536*n^5 + 13/65536*n^6 - 15/524288*n^7 + 1/524288*n^8) * eps^8
        + (429/131072 - 455/65536*n + 1053/262144*n^2 + 35/16384*n^3 - 1361/262144*n^4 + 69/16384*n^5 - 2095/1048576*n^6 + 77/131072*n^7 - 105/1048576*n^8 + 1/131072*n^9) * eps^9
        + (663/262144 - 4173/1048576*n - 1717/1048576*n^2 + 3485/524288*n^3 - 3825/1048576*n^4 - 9469/4194304*n^5 + 18469/4194304*n^6 - 6137/2097152*n^7 + 4455/4194304*n^8 - 885/4194304*n^9 + 19/1048576*n^10) * eps^10
        + (5057/2097152 - 3043/1048576*n - 5771/2097152*n^2 + 3893/1048576*n^3 + 25381/8388608*n^4 - 24103/4194304*n^5 + 8933/8388608*n^6 + 14179/4194304*n^7 - 28533/8388608*n^8 + 399/262144*n^9 - 2925/8388608*n^10 + 35/1048576*n^11) * eps^11
        + (4269/2097152 - 3449/2097152*n - 27455/8388608*n^2 + 104101/67108864*n^3 + 268897/67108864*n^4 - 17303/16777216*n^5 - 162199/33554432*n^6 + 27987/8388608*n^7 + 61363/33554432*n^8 - 115233/33554432*n^9 + 127809/67108864*n^10 - 33495/67108864*n^11 + 1771/33554432*n^12) * eps^12
        + (991/524288 - 10081/8388608*n - 365791/134217728*n^2 - 9717/33554432*n^3 + 465795/134217728*n^4 + 27547/16777216*n^5 - 106205/33554432*n^6 - 89529/33554432*n^7 + 289573/67108864*n^8 + 17427/67108864*n^9 - 420741/134217728*n^10 + 146465/67108864*n^11 - 87285/134217728*n^12 + 1265/16777216*n^13) * eps^13
        + (55563/33554432 - 344251/536870912*n - 1348101/536870912*n^2 - 244277/268435456*n^3 + 1091783/536870912*n^4 + 1517573/536870912*n^5 - 219671/268435456*n^6 - 915171/268435456*n^7 - 65579/134217728*n^8 + 2300175/536870912*n^9 - 565193/536870912*n^10 - 705799/268435456*n^11 + 1263413/536870912*n^12 - 426075/536870912*n^13 + 13455/134217728*n^14) * eps^14
        + (1650255/1073741824 - 242867/536870912*n - 2099405/1073741824*n^2 - 798587/536870912*n^3 + 1248445/1073741824*n^4 + 85085/33554432*n^5 + 1183963/1073741824*n^6 - 612017/268435456*n^7 - 2724453/1073741824*n^8 + 612213/536870912*n^9 + 3906577/1073741824*n^10 - 1079195/536870912*n^11 - 2173807/1073741824*n^12 + 651625/268435456*n^13 - 991575/1073741824*n^14) * eps^15
        + (92379/67108864 - 96367/536870912*n - 7319885/4294967296*n^2 - 6313853/4294967296*n^3 + 429327/2147483648*n^4 + 9301893/4294967296*n^5 + 15031227/8589934592*n^6 - 2278773/4294967296*n^7 - 22903967/8589934592*n^8 - 2725917/2147483648*n^9 + 4500833/2147483648*n^10 + 11631693/4294967296*n^11 - 5617393/2147483648*n^12 - 12008165/8589934592*n^13) * eps^16
        + (2756519/2147483648 - 430227/4294967296*n - 11245169/8589934592*n^2 - 6724689/4294967296*n^3 - 53143/268435456*n^4 + 11801191/8589934592*n^5 + 4420815/2147483648*n^6 + 4422845/8589934592*n^7 - 13431985/8589934592*n^8 - 1236311/536870912*n^9 - 519961/8589934592*n^10 + 5300279/2147483648*n^11 + 29579711/17179869184*n^12) * eps^17
        + (20057037/17179869184 + 1437191/34359738368*n - 38619865/34359738368*n^2 - 47458715/34359738368*n^3 - 11051395/17179869184*n^4 + 31753819/34359738368*n^5 + 923369/536870912*n^6 + 22435517/17179869184*n^7 - 20287619/34359738368*n^8 - 16694191/8589934592*n^9 - 53676765/34359738368*n^10 + 60038145/68719476736*n^11) * eps^18
        + (75219653/68719476736 + 2460657/34359738368*n - 3690307/4294967296*n^2 - 45693585/34359738368*n^3 - 12731745/17179869184*n^4 + 3014801/8589934592*n^5 + 102479649/68719476736*n^6 + 95223/67108864*n^7 + 12997523/34359738368*n^8 - 45081435/34359738368*n^9 - 250602523/137438953472*n^10) * eps^19
        + (138411809/137438953472 + 20479031/137438953472*n - 404248825/549755813888*n^2 - 623123853/549755813888*n^3 - 249636485/274877906944*n^4 + 24599285/274877906944*n^5 + 278247109/274877906944*n^6 + 206754789/137438953472*n^7 + 433813329/549755813888*n^8 - 463032277/1099511627776*n^9) * eps^20
        + (260886645/274877906944 + 85615081/549755813888*n - 614045309/1099511627776*n^2 - 577943525/549755813888*n^3 - 959520737/1099511627776*n^4 - 65018321/274877906944*n^5 + 412167595/549755813888*n^6 + 341178333/274877906944*n^7 + 2517056589/2199023255552*n^8) * eps^21
        + (1937599123/2199023255552 + 875827069/4398046511104*n - 2101908333/4398046511104*n^2 - 1944837617/2199023255552*n^3 - 4013825043/4398046511104*n^4 - 1514642649/4398046511104*n^5 + 52220173/137438953472*n^6 + 9631735815/8796093022208*n^7) * eps^22
        + (7338112607/8796093022208 + 858111205/4398046511104*n - 3151357309/8796093022208*n^2 - 3552063895/4398046511104*n^3 - 7304761733/8796093022208*n^4 - 1117242591/2199023255552*n^5 + 3576385429/17592186044416*n^6) * eps^23
        + (439177896603/562949953421312 + 30926258881/140737488355328*n - 43123141703/140737488355328*n^2 - 190181338763/281474976710656*n^3 - 230252313827/281474976710656*n^4 - 74140886391/140737488355328*n^5) * eps^24
        + (208758190031/281474976710656 + 29681117575/140737488355328*n - 126131044829/562949953421312*n^2 - 21573269697/35184372088832*n^3 - 409510620075/562949953421312*n^4) * eps^25
        + (392781497985/562949953421312 + 506107726005/2251799813685248*n - 429816687963/2251799813685248*n^2 - 575742720763/1125899906842624*n^3) * eps^26
        + (2997989980695/4503599627370496 + 481944654003/2251799813685248*n - 599801259897/4503599627370496*n^2) * eps^27
        + (2834595204413/4503599627370496 + 997668129067/4503599627370496*n) * eps^28
        + 2712992943545/4503599627370496 * eps^29;
C3[9] = + (2431/1179648 - 663/131072*n + 1105/196608*n^2 - 833/196608*n^3 + 153/65536*n^4 - 187/196608*n^5 + 221/786432*n^6 - 15/262144*n^7 + 17/2359296*n^8 - 1/2359296*n^9) * eps^9
        + (663/262144 - 1105/196608*n + 1003/262144*n^2 + 187/196608*n^3 - 391/98304*n^4 + 1003/262144*n^5 - 3425/1572864*n^6 + 1921/2359296*n^7 - 13/65536*n^8 + 17/589824*n^9 - 1/524288*n^10) * eps^10
        + (4199/2097152 - 21743/6291456*n - 4199/6291456*n^2 + 33269/6291456*n^3 - 50065/12582912*n^4 - 9443/12582912*n^5 + 14573/4194304*n^6 - 112667/37748736*n^7 + 53599/37748736*n^8 - 15487/37748736*n^9 + 2567/37748736*n^10 - 21/4194304*n^11) * eps^11
        + (8109/4194304 - 5491/2097152*n - 3893/2097152*n^2 + 11305/3145728*n^3 + 11799/8388608*n^4 - 187397/37748736*n^5 + 2753/1179648*n^6 + 24241/12582912*n^7 - 118771/37748736*n^8 + 73177/37748736*n^9 - 693/1048576*n^10 + 4675/37748736*n^11 - 253/25165824*n^12) * eps^12
        + (6953/4194304 - 80971/50331648*n - 252263/100663296*n^2 + 199465/100663296*n^3 + 895717/301989888*n^4 - 52205/25165824*n^5 - 482759/150994944*n^6 + 591815/150994944*n^7 + 2911/37748736*n^8 - 277705/100663296*n^9 + 689963/301989888*n^10 - 276985/301989888*n^11 + 58259/301989888*n^12 - 575/33554432*n^13) * eps^13
        + (52105/33554432 - 122417/100663296*n - 450521/201326592*n^2 + 40603/100663296*n^3 + 1865333/603979776*n^4 + 23971/75497472*n^5 - 972811/301989888*n^6 - 36503/50331648*n^7 + 811127/201326592*n^8 - 149813/100663296*n^9 - 153359/75497472*n^10 + 81805/33554432*n^11 - 43547/37748736*n^12 + 40885/150994944*n^13 - 1755/67108864*n^14) * eps^14
        + (4429673/3221225472 - 788207/1073741824*n - 6941611/3221225472*n^2 - 897577/3221225472*n^3 + 2356975/1073741824*n^4 + 17574277/9663676416*n^5 - 17208913/9663676416*n^6 - 8196295/3221225472*n^7 + 3937649/3221225472*n^8 + 10299955/3221225472*n^9 - 2716857/1073741824*n^10 - 3753553/3221225472*n^11 + 23362279/9663676416*n^12 - 13084435/9663676416*n^13 + 379015/1073741824*n^14) * eps^15
        + (2758463/2147483648 - 1758869/3221225472*n - 5672105/3221225472*n^2 - 973687/1073741824*n^3 + 14858035/9663676416*n^4 + 19887425/9663676416*n^5 - 32501/536870912*n^6 - 24418015/9663676416*n^7 - 5340461/4831838208*n^8 + 2428553/1073741824*n^9 + 19060745/9663676416*n^10 - 29342159/9663676416*n^11 - 2979365/9663676416*n^12 + 21844849/9663676416*n^13) * eps^16
        + (2490257/2147483648 - 7674811/25769803776*n - 20315813/12884901888*n^2 - 4435023/4294967296*n^3 + 27370555/38654705664*n^4 + 26375911/12884901888*n^5 + 1831967/2147483648*n^6 - 54254453/38654705664*n^7 - 10497871/4831838208*n^8 + 3956369/12884901888*n^9 + 32001391/12884901888*n^10 + 28530035/38654705664*n^11 - 59974063/19327352832*n^12) * eps^17
        + (18666393/17179869184 - 889513/4294967296*n - 21696367/17179869184*n^2 - 15580247/12884901888*n^3 + 3662981/12884901888*n^4 + 14977259/9663676416*n^5 + 9479491/6442450944*n^6 - 2887897/6442450944*n^7 - 73237177/38654705664*n^8 - 16269899/12884901888*n^9 + 50631997/38654705664*n^10 + 83059381/38654705664*n^11) * eps^18
        + (68321333/68719476736 - 14723375/206158430208*n - 56990675/51539607552*n^2 - 155817437/137438953472*n^3 - 18588719/103079215104*n^4 + 41892585/34359738368*n^5 + 57054647/38654705664*n^6 + 283540243/618475290624*n^7 - 22561439/17179869184*n^8 - 174386747/103079215104*n^9 - 158151485/618475290624*n^10) * eps^19
        + (128591121/137438953472 - 1479029/51539607552*n - 726294569/824633720832*n^2 - 305943/268435456*n^3 - 295907705/824633720832*n^4 + 113271359/154618822656*n^5 + 1807217413/1236950581248*n^6 + 32409209/38654705664*n^7 - 581666617/1236950581248*n^8 - 111277655/68719476736*n^9) * eps^20
        + (713238475/824633720832 + 53664037/1099511627776*n - 1263187013/1649267441664*n^2 - 1670261267/1649267441664*n^3 - 474955129/824633720832*n^4 + 4600090009/9895604649984*n^5 + 1438755463/1236950581248*n^6 + 314620739/274877906944*n^7 + 247598477/4947802324992*n^8) * eps^21
        + (1797792591/2199023255552 + 110680117/1649267441664*n - 4012013791/6597069766656*n^2 - 1590584081/1649267441664*n^3 - 1351592063/2199023255552*n^4 + 41953639/309237645312*n^5 + 19375684513/19791209299968*n^6 + 85456501/77309411328*n^7) * eps^22
        + (26806607255/35184372088832 + 11900807335/105553116266496*n - 55739761391/105553116266496*n^2 - 88591049429/105553116266496*n^3 - 24583779341/35184372088832*n^4 - 1960568177/105553116266496*n^5 + 212797419253/316659348799488*n^6) * eps^23
        + (50883408771/70368744177664 + 4164850661/35184372088832*n - 14681082863/35184372088832*n^2 - 82400553121/105553116266496*n^3 - 70910402069/105553116266496*n^4 - 67176278281/316659348799488*n^5) * eps^24
        + (190930903235/281474976710656 + 15383945467/105553116266496*n - 38240500283/105553116266496*n^2 - 35530344527/52776558133248*n^3 - 437558257621/633318697598976*n^4) * eps^25
        + (45468475229/70368744177664 + 15280317955/105553116266496*n - 19959778025/70368744177664*n^2 - 32689473503/52776558133248*n^3) * eps^26
        + (24702973639945/40532396646334464 + 726357235713/4503599627370496*n - 3324932711075/13510798882111488*n^2) * eps^27
        + (5246222852159/9007199254740992 + 706735196961/4503599627370496*n) * eps^28
        + 310707493777/562949953421312 * eps^29;
C3[10] = + (4199/2621440 - 4199/1048576*n + 4845/1048576*n^2 - 969/262144*n^3 + 2907/1310720*n^4 - 10659/10485760*n^5 + 741/2097152*n^6 - 95/1048576*n^7 + 17/1048576*n^8 - 19/10485760*n^9 + 1/10485760*n^10) * eps^10
        + (4199/2097152 - 4845/1048576*n + 7429/2097152*n^2 + 969/5242880*n^3 - 12597/4194304*n^4 + 35397/10485760*n^5 - 9329/4194304*n^6 + 2087/2097152*n^7 - 6479/20971520*n^8 + 135/2097152*n^9 - 171/20971520*n^10 + 1/2097152*n^11) * eps^11
        + (6783/4194304 - 12597/4194304*n - 2261/41943040*n^2 + 174743/41943040*n^3 - 164901/41943040*n^4 + 1539/5242880*n^5 + 214809/83886080*n^6 - 29519/10485760*n^7 + 139141/83886080*n^8 - 1631/2621440*n^9 + 12559/83886080*n^10 - 893/41943040*n^11 + 23/16777216*n^12) * eps^12
        + (13243/8388608 - 19703/8388608*n - 101099/83886080*n^2 + 138073/41943040*n^3 + 24719/83886080*n^4 - 337423/83886080*n^5 + 12363/4194304*n^6 + 57103/83886080*n^7 - 27323/10485760*n^8 + 178529/83886080*n^9 - 81173/83886080*n^10 + 4485/16777216*n^11 - 3553/83886080*n^12 + 25/8388608*n^13) * eps^13
        + (92055/67108864 - 822035/536870912*n - 1020015/536870912*n^2 + 574655/268435456*n^3 + 2734037/1342177280*n^4 - 6716637/2684354560*n^5 - 4712349/2684354560*n^6 + 158653/41943040*n^7 - 320995/268435456*n^8 - 4870931/2684354560*n^9 + 6209363/2684354560*n^10 - 1727177/1342177280*n^11 + 272823/671088640*n^12 - 38285/536870912*n^13 + 2925/536870912*n^14) * eps^14
        + (1390515/1073741824 - 638609/536870912*n - 9739457/5368709120*n^2 + 2244193/2684354560*n^3 + 2762359/1073741824*n^4 - 1609109/2684354560*n^5 - 14885329/5368709120*n^6 + 1720321/2684354560*n^7 + 3362447/1073741824*n^8 - 6643351/2684354560*n^9 - 4107621/5368709120*n^10 + 5967063/2684354560*n^11 - 8268441/5368709120*n^12 + 1490177/2684354560*n^13 - 575757/5368709120*n^14) * eps^15
        + (2486055/2147483648 - 416271/536870912*n - 39210607/21474836480*n^2 + 939667/5368709120*n^3 + 9060325/4294967296*n^4 + 2491453/2684354560*n^5 - 46473241/21474836480*n^6 - 3953531/2684354560*n^7 + 44317207/21474836480*n^8 + 9488381/5368709120*n^9 - 64785587/21474836480*n^10 + 739973/2684354560*n^11 + 41224629/21474836480*n^12 - 9171349/5368709120*n^13) * eps^16
        + (2335727/2147483648 - 2563477/4294967296*n - 16701111/10737418240*n^2 - 9668041/21474836480*n^3 + 17992927/10737418240*n^4 + 31720101/21474836480*n^5 - 2271699/2684354560*n^6 - 47531759/21474836480*n^7 + 1536949/10737418240*n^8 + 10243175/4294967296*n^9 + 3586031/10737418240*n^10 - 63134341/21474836480*n^11 + 12279279/10737418240*n^12) * eps^17
        + (16987677/17179869184 - 12817701/34359738368*n - 245571871/171798691840*n^2 - 113240313/171798691840*n^3 + 346569259/343597383680*n^4 + 74555269/42949672960*n^5 + 27207641/343597383680*n^6 - 297892471/171798691840*n^7 - 90518711/68719476736*n^8 + 56969301/42949672960*n^9 + 132544051/68719476736*n^10 - 17233729/21474836480*n^11) * eps^18
        + (63952469/68719476736 - 9581357/34359738368*n - 203499591/171798691840*n^2 - 76181293/85899345920*n^3 + 212001921/343597383680*n^4 + 103062223/68719476736*n^5 + 287585989/343597383680*n^6 - 73169205/68719476736*n^7 - 114638241/68719476736*n^8 - 59443911/343597383680*n^9 + 159059379/85899345920*n^10) * eps^19
        + (588367381/687194767360 - 20787795/137438953472*n - 2904705599/2748779069440*n^2 - 1224194119/1374389534720*n^3 + 476022861/2748779069440*n^4 + 1802954677/1374389534720*n^5 + 739674421/687194767360*n^6 - 326887271/1374389534720*n^7 - 530422339/343597383680*n^8 - 279426503/274877906944*n^9) * eps^20
        + (222258195/274877906944 - 55829477/549755813888*n - 477453485/549755813888*n^2 - 2590977593/2748779069440*n^3 - 58684921/1374389534720*n^4 + 1291134563/1374389534720*n^5 + 1706006381/1374389534720*n^6 + 33790047/137438953472*n^7 - 1348338613/1374389534720*n^8) * eps^21
        + (3301594169/4398046511104 - 453528367/17592186044416*n - 67434894591/87960930222080*n^2 - 38367823899/43980465111040*n^3 - 2503383779/8796093022208*n^4 + 62281465759/87960930222080*n^5 + 98226145519/87960930222080*n^6 + 5981539941/8796093022208*n^7) * eps^22
        + (25036620431/35184372088832 - 3706957/17592186044416*n - 110515260937/175921860444160*n^2 - 75242715363/87960930222080*n^3 - 13113832313/35184372088832*n^4 + 35799902519/87960930222080*n^5 + 181849615997/175921860444160*n^6) * eps^23
        + (46828608507/70368744177664 + 1623985719/35184372088832*n - 77781379687/140737488355328*n^2 - 135023615257/175921860444160*n^3 - 343735176087/703687441776640*n^4 + 21076200917/87960930222080*n^5) * eps^24
        + (22273557181/35184372088832 + 8209167567/140737488355328*n - 79486039261/175921860444160*n^2 - 512388782813/703687441776640*n^3 - 35491170583/70368744177664*n^4) * eps^25
        + (670564680061/1125899906842624 + 196582254575/2251799813685248*n - 4472224828261/11258999068426240*n^2 - 3626987174247/5629499534213120*n^3) * eps^26
        + (2559941004369/4503599627370496 + 206983074593/2251799813685248*n - 7284964906539/22517998136852480*n^2) * eps^27
        + (4841011900185/9007199254740992 + 992966911831/9007199254740992*n) * eps^28
        + 9267877312991/18014398509481984 * eps^29;
C3[11] = + (29393/23068672 - 6783/2097152*n + 8075/2097152*n^2 - 6783/2097152*n^3 + 8721/4194304*n^4 - 4389/4194304*n^5 + 1729/4194304*n^6 - 525/4194304*n^7 + 119/4194304*n^8 - 19/4194304*n^9 + 21/46137344*n^10 - 1/46137344*n^11) * eps^11
        + (6783/4194304 - 8075/2097152*n + 6783/2097152*n^2 - 323/1048576*n^3 - 18753/8388608*n^4 + 12255/4194304*n^5 - 9135/4194304*n^6 + 4711/4194304*n^7 - 219/524288*n^8 + 5131/46137344*n^9 - 85/4194304*n^10 + 105/46137344*n^11 - 1/8388608*n^12) * eps^12
        + (22287/16777216 - 5491/2097152*n + 22287/67108864*n^2 + 218937/67108864*n^3 - 247779/67108864*n^4 + 65849/67108864*n^5 + 58673/33554432*n^6 - 84249/33554432*n^7 + 655201/369098752*n^8 - 300367/369098752*n^9 + 187059/738197504*n^10 - 38619/738197504*n^11 + 4809/738197504*n^12 - 25/67108864*n^13) * eps^13
        + (5491/4194304 - 141151/67108864*n - 98363/134217728*n^2 + 196213/67108864*n^3 - 29417/67108864*n^4 - 52095/16777216*n^5 + 419083/134217728*n^6 - 103155/369098752*n^7 - 718191/369098752*n^8 + 1557273/738197504*n^9 - 1788277/1476395008*n^10 + 325161/738197504*n^11 - 6875/67108864*n^12 + 5187/369098752*n^13 - 117/134217728*n^14) * eps^14
        + (1235475/1073741824 - 1541223/1073741824*n - 1529937/1073741824*n^2 + 2296199/1073741824*n^3 + 1365211/1073741824*n^4 - 2738587/1073741824*n^5 - 7375295/11811160064*n^6 + 38530187/11811160064*n^7 - 23317551/11811160064*n^8 - 10011949/11811160064*n^9 + 24284837/11811160064*n^10 - 18010915/11811160064*n^11 + 7660305/11811160064*n^12 - 1998361/11811160064*n^13 + 300321/11811160064*n^14) * eps^15
        + (2349103/2147483648 - 1224911/1073741824*n - 781795/536870912*n^2 + 1166537/1073741824*n^3 + 1094423/536870912*n^4 - 13807153/11811160064*n^5 - 25077685/11811160064*n^6 + 17157263/11811160064*n^7 + 24268865/11811160064*n^8 - 33106325/11811160064*n^9 + 2076575/5905580032*n^10 + 19838275/11811160064*n^11 - 10084007/5905580032*n^12 + 10078335/11811160064*n^13) * eps^16
        + (2117379/2147483648 - 6739785/8589934592*n - 1646453/1073741824*n^2 + 261625/536870912*n^3 + 8131213/4294967296*n^4 + 20997261/94489280512*n^5 - 101979543/47244640256*n^6 - 530353/1073741824*n^7 + 828023/369098752*n^8 + 43716997/94489280512*n^9 - 65673747/23622320128*n^10 + 31841459/23622320128*n^11 + 52076665/47244640256*n^12) * eps^17
        + (15999297/17179869184 - 665231/1073741824*n - 23300153/17179869184*n^2 - 221463/2147483648*n^3 + 28505205/17179869184*n^4 + 3924281/4294967296*n^5 - 243226535/188978561024*n^6 - 77376389/47244640256*n^7 + 188744355/188978561024*n^8 + 45186567/23622320128*n^9 - 160724471/188978561024*n^10 - 25713125/11811160064*n^11) * eps^18
        + (58546741/68719476736 - 28776169/68719476736*n - 10980371/8589934592*n^2 - 48605103/137438953472*n^3 + 39670397/34359738368*n^4 + 31828611/23622320128*n^5 - 187541869/377957122048*n^6 - 115448809/68719476736*n^7 - 42158467/94489280512*n^8 + 82411933/47244640256*n^9 + 753396595/755914244096*n^10) * eps^19
        + (110659725/137438953472 - 2797611/8589934592*n - 299770405/274877906944*n^2 - 10459603/17179869184*n^3 + 226651699/274877906944*n^4 + 497934925/377957122048*n^5 + 409147909/1511828488192*n^6 - 510313799/377957122048*n^7 - 1751353333/1511828488192*n^8 + 493141905/755914244096*n^9) * eps^20
        + (818467293/1099511627776 - 56886273/274877906944*n - 2178023121/2199023255552*n^2 - 1468259459/2199023255552*n^3 + 936005777/2199023255552*n^4 + 30592744379/24189255811072*n^5 + 483964345/755914244096*n^6 - 2151235101/3023656976384*n^7 - 17107054983/12094627905536*n^8) * eps^21
        + (96937173/137438953472 - 338878191/2199023255552*n - 3672830975/4398046511104*n^2 - 1657202547/2199023255552*n^3 + 445677205/2199023255552*n^4 + 12225739435/12094627905536*n^5 + 45022865775/48378511622144*n^6 - 743433509/3023656976384*n^7) * eps^22
        + (23130670543/35184372088832 - 2857753463/35184372088832*n - 26305948157/35184372088832*n^2 - 25618373853/35184372088832*n^3 - 1549180705/35184372088832*n^4 + 324075281367/387028092977152*n^5 + 367058948627/387028092977152*n^6) * eps^23
        + (43968565791/70368744177664 - 1805535203/35184372088832*n - 2760991455/4398046511104*n^2 - 25963357003/35184372088832*n^3 - 177189123/1099511627776*n^4 + 225673037041/387028092977152*n^5) * eps^24
        + (41252640009/70368744177664 - 1485684057/281474976710656*n - 39333792359/70368744177664*n^2 - 95968855991/140737488355328*n^3 - 41727255371/140737488355328*n^4) * eps^25
        + (314637345025/562949953421312 + 791327487/70368744177664*n - 263720191503/562949953421312*n^2 - 5813138145/8796093022208*n^3) * eps^26
        + (2374498758045/4503599627370496 + 184441277827/4503599627370496*n - 1875159093121/4503599627370496*n^2) * eps^27
        + (4540838699861/9007199254740992 + 223044732129/4503599627370496*n) * eps^28
        + 17213216597955/36028797018963968 * eps^29;
C3[12] = + (52003/50331648 - 22287/8388608*n + 81719/25165824*n^2 - 572033/201326592*n^3 + 129789/67108864*n^4 - 52877/50331648*n^5 + 23023/50331648*n^6 - 5313/33554432*n^7 + 4301/100663296*n^8 - 437/50331648*n^9 + 21/16777216*n^10 - 23/201326592*n^11 + 1/201326592*n^12) * eps^12
        + (22287/16777216 - 81719/25165824*n + 393737/134217728*n^2 - 62491/100663296*n^3 - 658559/402653184*n^4 + 83743/33554432*n^5 - 417197/201326592*n^6 + 60467/50331648*n^7 - 34569/67108864*n^8 + 8287/50331648*n^9 - 15479/402653184*n^10 + 209/33554432*n^11 - 253/402653184*n^12 + 1/33554432*n^13) * eps^13
        + (37145/33554432 - 3692213/1610612736*n + 919885/1610612736*n^2 + 2047345/805306368*n^3 - 1807685/536870912*n^4 + 2268145/1610612736*n^5 + 107525/100663296*n^6 - 287615/134217728*n^7 + 1439165/805306368*n^8 - 1554985/1610612736*n^9 + 196337/536870912*n^10 - 78625/805306368*n^11 + 28451/1610612736*n^12 - 3151/1610612736*n^13 + 27/268435456*n^14) * eps^14
        + (1181211/1073741824 - 1011655/536870912*n - 1258123/3221225472*n^2 + 1368385/536870912*n^3 - 966345/1073741824*n^4 - 1845635/805306368*n^5 + 3249555/1073741824*n^6 - 32195/33554432*n^7 - 4125455/3221225472*n^8 + 1038315/536870912*n^9 - 1464041/1073741824*n^10 + 330167/536870912*n^11 - 602911/3221225472*n^12 + 5049/134217728*n^13 - 14651/3221225472*n^14) * eps^15
        + (2097163/2147483648 - 716243/536870912*n - 13577935/12884901888*n^2 + 26345695/12884901888*n^3 + 539465/805306368*n^4 - 30721445/12884901888*n^5 + 1671665/8589934592*n^6 + 16667215/6442450944*n^7 - 60325345/25769803776*n^8 - 7435/2147483648*n^9 + 3478199/2147483648*n^10 - 20654597/12884901888*n^11 + 11205989/12884901888*n^12 - 1294237/4294967296*n^13) * eps^16
        + (2006267/2147483648 - 4643355/4294967296*n - 29853701/25769803776*n^2 + 15623785/12884901888*n^3 + 19883891/12884901888*n^4 - 37991705/25769803776*n^5 - 12448665/8589934592*n^6 + 47094413/25769803776*n^7 + 6739069/6442450944*n^8 - 2864351/1073741824*n^9 + 30201445/25769803776*n^10 + 1058057/1073741824*n^11 - 10580051/6442450944*n^12) * eps^17
        + (43720079/51539607552 - 26598603/34359738368*n - 43949251/34359738368*n^2 + 71325415/103079215104*n^3 + 6957895/4294967296*n^4 - 2536467/8589934592*n^5 - 198525719/103079215104*n^6 + 13878817/51539607552*n^7 + 34508611/17179869184*n^8 - 52928069/103079215104*n^9 - 220720771/103079215104*n^10 + 66852739/34359738368*n^11) * eps^18
        + (55326431/68719476736 - 64299007/103079215104*n - 120784247/103079215104*n^2 + 15781747/103079215104*n^3 + 106472291/68719476736*n^4 + 14611239/34359738368*n^5 - 150547861/103079215104*n^6 - 103209593/103079215104*n^7 + 99804641/68719476736*n^8 + 123227375/103079215104*n^9 - 12788579/8589934592*n^10) * eps^19
        + (814404171/1099511627776 - 732481345/1649267441664*n - 466819643/412316860416*n^2 - 734752241/6597069766656*n^3 + 2621301201/2199023255552*n^4 + 785792285/824633720832*n^5 - 1433859853/1649267441664*n^6 - 770153889/549755813888*n^7 + 432049963/1649267441664*n^8 + 5608251079/3298534883328*n^9) * eps^20
        + (772604523/1099511627776 - 48760475/137438953472*n - 13077992689/13194139533312*n^2 - 1241891819/3298534883328*n^3 + 4110854519/4398046511104*n^4 + 3534181601/3298534883328*n^5 - 586500377/3298534883328*n^6 - 2275702691/1649267441664*n^7 - 3789336937/6597069766656*n^8) * eps^21
        + (358745439/549755813888 - 12934264661/52776558133248*n - 48333688039/52776558133248*n^2 - 4146286613/8796093022208*n^3 + 31281974437/52776558133248*n^4 + 59718172567/52776558133248*n^5 + 2095950701/8796093022208*n^6 - 25516746833/26388279066624*n^7) * eps^22
        + (21821485195/35184372088832 - 10108238849/52776558133248*n - 27769272537/35184372088832*n^2 - 10217136851/17592186044416*n^3 + 13447296309/35184372088832*n^4 + 2169033311/2199023255552*n^5 + 21069180867/35184372088832*n^6) * eps^23
        + (122479921063/211106232532992 - 2150084801/17592186044416*n - 302356197395/422212465065984*n^2 - 62203620647/105553116266496*n^3 + 20409605765/140737488355328*n^4 + 370492702933/422212465065984*n^5) * eps^24
        + (38901506935/70368744177664 - 12663469807/140737488355328*n - 43169763871/70368744177664*n^2 - 262080088265/422212465065984*n^3 + 4124183297/281474976710656*n^4) * eps^25
        + (292863078097/562949953421312 - 1583046845/35184372088832*n - 29152993591/52776558133248*n^2 - 1996652856445/3377699720527872*n^3) * eps^26
        + (69950118165/140737488355328 - 1807466357/70368744177664*n - 1063027613707/2251799813685248*n^2) * eps^27
        + (16935196336601/36028797018963968 + 223223833507/54043195528445952*n) * eps^28
        + 16221720992423/36028797018963968 * eps^29;
C3[13] = + (185725/218103808 - 37145/16777216*n + 185725/67108864*n^2 - 168245/67108864*n^3 + 120175/67108864*n^4 - 69575/67108864*n^5 + 16445/33554432*n^6 - 6325/33554432*n^7 + 1955/33554432*n^8 - 475/33554432*n^9 + 175/67108864*n^10 - 23/67108864*n^11 + 25/872415232*n^12 - 1/872415232*n^13) * eps^13
        + (37145/33554432 - 185725/67108864*n + 356155/134217728*n^2 - 54625/67108864*n^3 - 39215/33554432*n^4 + 8855/4194304*n^5 - 259325/134217728*n^6 + 41515/33554432*n^7 - 625/1048576*n^8 + 14765/67108864*n^9 - 8297/134217728*n^10 + 11225/872415232*n^11 - 63/33554432*n^12 + 75/436207616*n^13 - 1/134217728*n^14) * eps^14
        + (1002915/1073741824 - 2165335/1073741824*n + 766935/1073741824*n^2 + 2116575/1073741824*n^3 - 3237825/1073741824*n^4 + 1772265/1073741824*n^5 + 558555/1073741824*n^6 - 1889505/1073741824*n^7 + 1846575/1073741824*n^8 - 1148355/1073741824*n^9 + 6621687/13958643712*n^10 - 2147433/13958643712*n^11 + 502623/13958643712*n^12 - 80975/13958643712*n^13 + 8075/13958643712*n^14) * eps^15
        + (2008015/2147483648 - 1815735/1073741824*n - 76705/536870912*n^2 + 2357385/1073741824*n^3 - 19665/16777216*n^4 - 1726035/1073741824*n^5 + 1491465/536870912*n^6 - 1503195/1073741824*n^7 - 363375/536870912*n^8 + 23156505/13958643712*n^9 - 9914347/6979321856*n^10 + 10709897/13958643712*n^11 - 501361/1744830464*n^12 + 1052013/13958643712*n^13) * eps^16
        + (1798255/2147483648 - 10601045/8589934592*n - 1641165/2147483648*n^2 + 4086755/2147483648*n^3 + 913905/4294967296*n^4 - 18130905/8589934592*n^5 + 3204135/4294967296*n^6 + 1017741/536870912*n^7 - 33577953/13958643712*n^8 + 73063651/111669149696*n^9 + 1928075/1744830464*n^10 - 10703707/6979321856*n^11 + 57707979/55834574848*n^12) * eps^17
        + (13840365/17179869184 - 2184195/2147483648*n - 15684505/17179869184*n^2 + 1348605/1073741824*n^3 + 19080865/17179869184*n^4 - 6839475/4294967296*n^5 - 14431629/17179869184*n^6 + 105895953/55834574848*n^7 + 48950133/223338299392*n^8 - 7886043/3489660928*n^9 + 372503147/223338299392*n^10 + 8024167/27917287424*n^11) * eps^18
        + (101195745/137438953472 - 103316805/137438953472*n - 145814825/137438953472*n^2 + 56137605/68719476736*n^3 + 45844365/34359738368*n^4 - 11127843/17179869184*n^5 - 176827545/111669149696*n^6 + 177367791/223338299392*n^7 + 43666839/27917287424*n^8 - 502109665/446676598784*n^9 - 608048583/446676598784*n^10) * eps^19
        + (192942285/274877906944 - 84667255/137438953472*n - 276352515/274877906944*n^2 + 46276975/137438953472*n^3 + 190922955/137438953472*n^4 + 544527/17179869184*n^5 - 80867391/55834574848*n^6 - 46739031/111669149696*n^7 + 1413025611/893353197568*n^8 + 208444667/446676598784*n^9) * eps^20
        + (713651475/1099511627776 - 500804215/1099511627776*n - 2189663055/2199023255552*n^2 + 166841355/2199023255552*n^3 + 2545633095/2199023255552*n^4 + 1301305233/2199023255552*n^5 - 73499007/68719476736*n^6 - 3649124073/3573412790272*n^7 + 10673011569/14293651161088*n^8) * eps^21
        + (1358850675/2199023255552 - 816309985/2199023255552*n - 3925550751/4398046511104*n^2 - 411093181/2199023255552*n^3 + 1069809697/1099511627776*n^4 + 887786559/1099511627776*n^5 - 28489507799/57174604644352*n^6 - 4430888365/3573412790272*n^7) * eps^22
        + (20273133015/35184372088832 - 9511268919/35184372088832*n - 29503243001/35184372088832*n^2 - 10679084579/35184372088832*n^3 + 24333880611/35184372088832*n^4 + 33531947513/35184372088832*n^5 - 43359239675/457396837154816*n^6) * eps^23
        + (38647569279/70368744177664 - 7657024935/35184372088832*n - 25922041023/35184372088832*n^2 - 15045539631/35184372088832*n^3 + 17766942325/35184372088832*n^4 + 31659609403/35184372088832*n^5) * eps^24
        + (36274342699/70368744177664 - 42850331919/281474976710656*n - 11911257957/17592186044416*n^2 - 64900868793/140737488355328*n^3 + 40343787423/140737488355328*n^4) * eps^25
        + (277172296351/562949953421312 - 2094012549/17592186044416*n - 332189237881/562949953421312*n^2 - 35829993671/70368744177664*n^3) * eps^26
        + (1046221099377/2251799813685248 - 170172833119/2251799813685248*n - 604554123131/1125899906842624*n^2) * eps^27
        + (2003125009747/4503599627370496 - 61476552589/1125899906842624*n) * eps^28
        + 15190705138949/36028797018963968 * eps^29;
C3[14] = + (334305/469762048 - 1002915/536870912*n + 1278225/536870912*n^2 - 596505/268435456*n^3 + 444015/268435456*n^4 - 542685/536870912*n^5 + 1924065/3758096384*n^6 - 201825/939524096*n^7 + 9945/134217728*n^8 - 11115/536870912*n^9 + 2457/536870912*n^10 - 207/268435456*n^11 + 25/268435456*n^12 - 27/3758096384*n^13 + 1/3758096384*n^14) * eps^14
        + (1002915/1073741824 - 1278225/536870912*n + 2576115/1073741824*n^2 - 497835/536870912*n^3 - 865605/1073741824*n^4 + 6660225/3758096384*n^5 - 1906125/1073741824*n^6 + 4658355/3758096384*n^7 - 707265/1073741824*n^8 + 146835/536870912*n^9 - 95481/1073741824*n^10 + 11985/536870912*n^11 - 31527/7516192768*n^12 + 299/536870912*n^13 - 351/7516192768*n^14) * eps^15
        + (1710855/2147483648 - 478515/268435456*n + 3411705/4294967296*n^2 + 1630815/1073741824*n^3 - 80250105/30064771072*n^4 + 6633315/3758096384*n^5 + 2765295/30064771072*n^6 - 10456095/7516192768*n^7 + 48041487/30064771072*n^8 - 604737/536870912*n^9 + 2449717/4294967296*n^10 - 1624435/7516192768*n^11 + 1847371/30064771072*n^12 - 48169/3758096384*n^13) * eps^16
        + (1723965/2147483648 - 6533265/4294967296*n + 76935/2147483648*n^2 + 56398185/30064771072*n^3 - 19759875/15032385536*n^4 - 31583175/30064771072*n^5 + 36921495/15032385536*n^6 - 49642983/30064771072*n^7 - 355569/2147483648*n^8 + 40109813/30064771072*n^9 - 20948701/15032385536*n^10 + 26526277/30064771072*n^11 - 5886663/15032385536*n^12) * eps^17
        + (24894855/34359738368 - 78264285/68719476736*n - 36988485/68719476736*n^2 + 418581945/240518168576*n^3 - 60094815/481036337152*n^4 - 107991795/60129542144*n^5 + 522459795/481036337152*n^6 + 303630087/240518168576*n^7 - 1091940219/481036337152*n^8 + 33522753/30064771072*n^9 + 40499933/68719476736*n^10 - 324917351/240518168576*n^11) * eps^18
        + (96292605/137438953472 - 65462715/68719476736*n - 97786455/137438953472*n^2 + 85607565/68719476736*n^3 + 359327175/481036337152*n^4 - 762768759/481036337152*n^5 - 159920877/481036337152*n^6 + 852547365/481036337152*n^7 - 189618327/481036337152*n^8 - 831922211/481036337152*n^9 + 903295221/481036337152*n^10) * eps^19
        + (177052965/274877906944 - 198593385/274877906944*n - 120299805/137438953472*n^2 + 850632495/962072674304*n^3 + 255130545/240518168576*n^4 - 1668127191/1924145348608*n^5 - 2324152365/1924145348608*n^6 + 2128566621/1924145348608*n^7 + 2025323859/1924145348608*n^8 - 2724276899/1924145348608*n^9) * eps^20
        + (338946975/549755813888 - 82552875/137438953472*n - 471549795/549755813888*n^2 + 446058513/962072674304*n^3 + 4645483323/3848290697216*n^4 - 514236729/1924145348608*n^5 - 2539636863/1924145348608*n^6 + 110256645/1924145348608*n^7 + 2860511727/1924145348608*n^8) * eps^21
        + (2519012745/4398046511104 - 8042808615/17592186044416*n - 15323258283/17592186044416*n^2 + 13365078339/61572651155456*n^3 + 2371903421/2199023255552*n^4 + 34764704609/123145302310912*n^5 - 139920418129/123145302310912*n^6 - 38482766489/61572651155456*n^7) * eps^22
        + (19248770055/35184372088832 - 6660671445/17592186044416*n - 28084233477/35184372088832*n^2 - 4351178653/123145302310912*n^3 + 236611923917/246290604621824*n^4 + 68150566051/123145302310912*n^5 - 172847147773/246290604621824*n^6) * eps^23
        + (36031799979/70368744177664 - 5033314047/17592186044416*n - 107266336785/140737488355328*n^2 - 20083658499/123145302310912*n^3 + 727351416229/985162418487296*n^4 + 46669684549/61572651155456*n^5) * eps^24
        + (34437446319/70368744177664 - 33102303575/140737488355328*n - 187327049/274877906944*n^2 - 290583351929/985162418487296*n^3 + 10224940189/17592186044416*n^4) * eps^25
        + (259380435671/562949953421312 - 195750751369/1125899906842624*n - 713851834615/1125899906842624*n^2 - 2727777187263/7881299347898368*n^3) * eps^26
        + (993200127657/2251799813685248 - 158323530281/1125899906842624*n - 631656315671/1125899906842624*n^2) * eps^27
        + (13155294584639/31525197391593472 - 13930847115/140737488355328*n) * eps^28
        + 112658685443/281474976710656 * eps^29;
C3[15] = + (646323/1073741824 - 1710855/1073741824*n + 2217775/1073741824*n^2 - 2124395/1073741824*n^3 + 1638819/1073741824*n^4 - 1049191/1073741824*n^5 + 563615/1073741824*n^6 - 254475/1073741824*n^7 + 96135/1073741824*n^8 - 150423/5368709120*n^9 + 38367/5368709120*n^10 - 4669/3221225472*n^11 + 725/3221225472*n^12 - 27/1073741824*n^13 + 29/16106127360*n^14) * eps^15
        + (1710855/2147483648 - 2217775/1073741824*n + 2331165/1073741824*n^2 - 1059863/1073741824*n^3 - 563615/1073741824*n^4 + 1586793/1073741824*n^5 - 1732315/1073741824*n^6 + 1306305/1073741824*n^7 - 3776409/5368709120*n^8 + 346173/1073741824*n^9 - 1902313/16106127360*n^10 + 36917/1073741824*n^11 - 25153/3221225472*n^12 + 21547/16106127360*n^13) * eps^16
        + (5892945/8589934592 - 6800065/4294967296*n + 3577121/4294967296*n^2 + 4983157/4294967296*n^3 - 10069699/4294967296*n^4 + 7701733/4294967296*n^5 - 502541/2147483648*n^6 - 1414127/1342177280*n^7 + 968223/671088640*n^8 - 6128483/5368709120*n^9 + 41761247/64424509440*n^10 - 18009853/64424509440*n^11 + 5979931/64424509440*n^12) * eps^17
        + (5972985/8589934592 - 5892945/4294967296*n + 22011/134217728*n^2 + 6844087/4294967296*n^3 - 5882157/4294967296*n^4 - 326337/536870912*n^5 + 18126537/8589934592*n^6 - 18908667/10737418240*n^7 + 2622383/10737418240*n^8 + 21415079/21474836480*n^9 - 55870711/42949672960*n^10 + 4095751/4294967296*n^11) * eps^18
        + (86853405/137438953472 - 144315455/137438953472*n - 49728185/137438953472*n^2 + 108068645/68719476736*n^3 - 12628253/34359738368*n^4 - 25408437/17179869184*n^5 + 43573631/34359738368*n^6 + 24761157/34359738368*n^7 - 17319235/8589934592*n^8 + 240067131/171798691840*n^9 + 31601183/257698037760*n^10) * eps^19
        + (168754335/274877906944 - 122304455/137438953472*n - 150252509/274877906944*n^2 + 165190351/137438953472*n^3 + 308731767/687194767360*n^4 - 257790947/171798691840*n^5 + 4546243/68719476736*n^6 + 264538841/171798691840*n^7 - 69252419/85899345920*n^8 - 101279697/85899345920*n^9) * eps^20
        + (9748205/17179869184 - 2961915/4294967296*n - 789535179/1099511627776*n^2 + 2502565179/2748779069440*n^3 + 892979397/1099511627776*n^4 - 4058500961/4123168604160*n^5 - 348426329/412316860416*n^6 + 858120331/687194767360*n^7 + 2315189833/4123168604160*n^8) * eps^21
        + (299705865/549755813888 - 638342925/1099511627776*n - 4003125229/5497558138880*n^2 + 3007831367/5497558138880*n^3 + 16848959603/16492674416640*n^4 - 1323821551/2748779069440*n^5 - 9300135223/8246337208320*n^6 + 169736315/412316860416*n^7) * eps^22
        + (17894468415/35184372088832 - 15913542447/35184372088832*n - 133457144181/175921860444160*n^2 + 56414449099/175921860444160*n^3 + 514339794913/527765581332480*n^4 + 15799330939/527765581332480*n^5 - 116951809217/105553116266496*n^6) * eps^23
        + (34289203599/70368744177664 - 13355533647/35184372088832*n - 37471080293/52776558133248*n^2 + 8836479539/105553116266496*n^3 + 80449237869/87960930222080*n^4 + 171417192913/527765581332480*n^5) * eps^24
        + (32203691103/70368744177664 - 249040377061/844424930131968*n - 484768709513/703687441776640*n^2 - 100719650663/2111062325329920*n^3 + 525315006811/703687441776640*n^4) * eps^25
        + (246854172911/562949953421312 - 104020069985/422212465065984*n - 5286374681359/8444249301319680*n^2 - 384367611317/2111062325329920*n^3) * eps^26
        + (932306372777/2251799813685248 - 425703913753/2251799813685248*n - 3317960448433/5629499534213120*n^2) * eps^27
        + (1788762256877/4503599627370496 - 528241493161/3377699720527872*n) * eps^28
        + 3392857970671/9007199254740992 * eps^29;
C3[16] = + (17678835/34359738368 - 5892945/4294967296*n + 7753875/4294967296*n^2 - 15197595/8589934592*n^3 + 12096045/8589934592*n^4 - 4032015/4294967296*n^5 + 2278965/4294967296*n^6 - 4382625/17179869184*n^7 + 1788111/17179869184*n^8 - 153729/4294967296*n^9 + 44051/4294967296*n^10 - 20677/8589934592*n^11 + 3875/8589934592*n^12 - 279/4294967296*n^13) * eps^16
        + (5892945/8589934592 - 7753875/4294967296*n + 33806895/17179869184*n^2 - 2171085/2147483648*n^3 - 5272635/17179869184*n^4 + 2629575/2147483648*n^5 - 49961925/34359738368*n^6 + 315549/268435456*n^7 - 25144131/34359738368*n^8 + 97991/268435456*n^9 - 2539675/17179869184*n^10 + 104315/2147483648*n^11 - 220193/17179869184*n^12) * eps^17
        + (10235115/17179869184 - 97078515/68719476736*n + 57998985/68719476736*n^2 + 30085035/34359738368*n^3 - 140769915/68719476736*n^4 + 242500755/137438953472*n^5 - 65388765/137438953472*n^6 - 51866007/68719476736*n^7 + 174649629/137438953472*n^8 - 154238733/137438953472*n^9 + 48486449/68719476736*n^10 - 11678227/34359738368*n^11) * eps^18
        + (83431695/137438953472 - 85292625/68719476736*n + 35047515/137438953472*n^2 + 92601495/68719476736*n^3 - 375786495/274877906944*n^4 - 36110133/137438953472*n^5 + 486541497/274877906944*n^6 - 243255915/137438953472*n^7 + 153035871/274877906944*n^8 + 46310869/68719476736*n^9 - 319425953/274877906944*n^10) * eps^19
        + (38149065/68719476736 - 133056495/137438953472*n - 123158505/549755813888*n^2 + 3098731635/2199023255552*n^3 - 1178980065/2199023255552*n^4 - 324619011/274877906944*n^5 + 183751105/137438953472*n^6 + 76834833/274877906944*n^7 - 937074355/549755813888*n^8 + 1685222465/1099511627776*n^9) * eps^20
        + (4652325/8589934592 - 456372855/549755813888*n - 1811480505/4398046511104*n^2 + 1251405303/1099511627776*n^3 + 925958313/4398046511104*n^4 - 1506611625/1099511627776*n^5 + 99867213/274877906944*n^6 + 172997329/137438953472*n^7 - 2305540773/2199023255552*n^8) * eps^21
        + (1106107125/2199023255552 - 11527530885/17592186044416*n - 10297013847/17592186044416*n^2 + 7988241603/8796093022208*n^3 + 10444117217/17592186044416*n^4 - 18068838281/17592186044416*n^5 - 4569806627/8796093022208*n^6 + 11141677047/8796093022208*n^7) * eps^22
        + (17062152465/35184372088832 - 9812616465/17592186044416*n - 21645687783/35184372088832*n^2 + 10515729759/17592186044416*n^3 + 29676530299/35184372088832*n^4 - 2748637785/4398046511104*n^5 - 31988983111/35184372088832*n^6) * eps^23
        + (63917467893/140737488355328 - 15585334599/35184372088832*n - 92640075585/140737488355328*n^2 + 55477610943/140737488355328*n^3 + 60444721971/70368744177664*n^4 - 23535121849/140737488355328*n^5) * eps^24
        + (15353322477/35184372088832 - 52919675455/140737488355328*n - 176994259657/281474976710656*n^2 + 24691209499/140737488355328*n^3 + 119255343701/140737488355328*n^4) * eps^25
        + (231447333341/562949953421312 - 336197745329/1125899906842624*n - 697975437421/1125899906842624*n^2 + 51290363939/1125899906842624*n^3) * eps^26
        + (889178086077/2251799813685248 - 284507373851/1125899906842624*n - 644017953049/1125899906842624*n^2) * eps^27
        + (1683573628847/4503599627370496 - 897506094655/4503599627370496*n) * eps^28
        + 3236675038231/9007199254740992 * eps^29;
C3[17] = + (64822395/146028888064 - 10235115/8589934592*n + 3411705/2147483648*n^2 - 3411705/2147483648*n^3 + 2791395/2147483648*n^4 - 1928355/2147483648*n^5 + 2278965/4294967296*n^6 - 1157013/4294967296*n^7 + 504339/4294967296*n^8 - 187891/4294967296*n^9 + 29667/2147483648*n^10 - 7843/2147483648*n^11 + 1705/2147483648*n^12) * eps^17
        + (10235115/17179869184 - 3411705/2147483648*n + 30705345/17179869184*n^2 - 2171085/2147483648*n^3 - 148335/1073741824*n^4 + 4328685/4294967296*n^5 - 11184459/8589934592*n^6 + 4819539/4294967296*n^7 - 801009/1073741824*n^8 + 860343/2147483648*n^9 - 1518473/8589934592*n^10 + 138105/2147483648*n^11) * eps^18
        + (71645805/137438953472 - 173996955/137438953472*n + 115067505/137438953472*n^2 + 89230245/137438953472*n^3 - 122538195/68719476736*n^4 + 116788191/68719476736*n^5 - 44648835/68719476736*n^6 - 34126939/68719476736*n^7 + 75175279/68719476736*n^8 - 73970743/68719476736*n^9 + 51014623/68719476736*n^10) * eps^19
        + (146703315/274877906944 - 154767345/137438953472*n + 43785795/137438953472*n^2 + 156007965/137438953472*n^3 - 364998495/274877906944*n^4 + 115971/68719476736*n^5 + 24948149/17179869184*n^6 - 117523573/68719476736*n^7 + 53786953/68719476736*n^8 + 26103457/68719476736*n^9) * eps^20
        + (134917425/274877906944 - 982018155/1099511627776*n - 128013105/1099511627776*n^2 + 172486635/137438953472*n^3 - 712641795/1099511627776*n^4 - 1003151847/1099511627776*n^5 + 365003889/274877906944*n^6 - 17906623/274877906944*n^7 - 94572227/68719476736*n^8) * eps^21
        + (1057102635/2199023255552 - 850997895/1099511627776*n - 663815307/2199023255552*n^2 + 1169497413/1099511627776*n^3 + 49560971/2199023255552*n^4 - 669423269/549755813888*n^5 + 1259901225/2199023255552*n^6 + 266092003/274877906944*n^7) * eps^22
        + (15777490455/35184372088832 - 21840324879/35184372088832*n - 16655962689/35184372088832*n^2 + 31191967407/35184372088832*n^3 + 14292320879/35184372088832*n^4 - 35796602007/35184372088832*n^5 - 8516465049/35184372088832*n^6) * eps^23
        + (30518839359/70368744177664 - 18775799295/35184372088832*n - 9098510199/17592186044416*n^2 + 21950540481/35184372088832*n^3 + 93296577/137438953472*n^4 - 25028086871/35184372088832*n^5) * eps^24
        + (28684124199/70368744177664 - 121237396839/281474976710656*n - 80108249325/140737488355328*n^2 + 62476546353/140737488355328*n^3 + 104269770907/140737488355328*n^4) * eps^25
        + (221067686111/562949953421312 - 51971219667/140737488355328*n - 312369078125/562949953421312*n^2 + 34424571581/140737488355328*n^3) * eps^26
        + (835594467657/2251799813685248 - 672205282129/2251799813685248*n - 9778893735/17592186044416*n^2) * eps^27
        + (1608685463477/4503599627370496 - 1123143299/4398046511104*n) * eps^28
        + 3053457067201/9007199254740992 * eps^29;
C3[18] = + (39803225/103079215104 - 71645805/68719476736*n + 96664975/68719476736*n^2 - 12302815/8589934592*n^3 + 10316025/8589934592*n^4 - 29419775/34359738368*n^5 + 18079789/34359738368*n^6 - 4814145/17179869184*n^7 + 20005447/154618822656*n^8 - 15970735/309237645312*n^9 + 608685/34359738368*n^10 - 133331/25769803776*n^11) * eps^18
        + (71645805/137438953472 - 96664975/68719476736*n + 223621755/137438953472*n^2 - 68391425/68719476736*n^3 - 534905/68719476736*n^4 + 28288833/34359738368*n^5 - 79700845/68719476736*n^6 + 328110727/309237645312*n^7 - 51427295/68719476736*n^8 + 132652751/309237645312*n^9 - 42045641/206158430208*n^10) * eps^19
        + (126233085/274877906944 - 313153165/274877906944*n + 450214705/549755813888*n^2 + 128894125/274877906944*n^3 - 851033855/549755813888*n^4 + 27708079/17179869184*n^5 - 635023933/824633720832*n^6 - 10743949/38654705664*n^7 + 2277775685/2473901162496*n^8 - 39095495/38654705664*n^9) * eps^20
        + (259599735/549755813888 - 563308905/549755813888*n + 6216585/17179869184*n^2 + 523725935/549755813888*n^3 - 696028275/549755813888*n^4 + 248241769/1236950581248*n^5 + 360205027/309237645312*n^6 - 1324703563/824633720832*n^7 + 578515831/618475290624*n^8) * eps^21
        + (1919738085/4398046511104 - 14510296015/17592186044416*n - 571757707/17592186044416*n^2 + 9787185553/8796093022208*n^3 - 14198943547/19791209299968*n^4 - 35731280915/52776558133248*n^5 + 200707555277/158329674399744*n^6 - 1602798301/4947802324992*n^7) * eps^22
        + (15095149455/35184372088832 - 12695123317/17592186044416*n - 7461993973/35184372088832*n^2 + 17320543045/17592186044416*n^3 - 38933502733/316659348799488*n^4 - 167508491351/158329674399744*n^5 + 225029316355/316659348799488*n^6) * eps^23
        + (28276211939/70368744177664 - 10324749795/17592186044416*n - 160063685731/422212465065984*n^2 + 44977263973/52776558133248*n^3 + 34943975527/140737488355328*n^4 - 76982106281/79164837199872*n^5) * eps^24
        + (27428616759/70368744177664 - 214928208341/422212465065984*n - 1901680771/4398046511104*n^2 + 266821592123/422212465065984*n^3 + 168025657159/316659348799488*n^4) * eps^25
        + (206917174391/562949953421312 - 1407328813243/3377699720527872*n - 1656940587997/3377699720527872*n^2 + 1604700872215/3377699720527872*n^3) * eps^26
        + (799328663817/2251799813685248 - 405743161697/1125899906842624*n - 17171897611/35184372088832*n^2) * eps^27
        + (1514801868617/4503599627370496 - 1997506016729/6755399441055744*n) * eps^28
        + 1461210130553/4503599627370496 * eps^29;
C3[19] = + (883631595/2611340115968 - 126233085/137438953472*n + 172136025/137438953472*n^2 - 178123365/137438953472*n^3 + 76338585/68719476736*n^4 - 55981629/68719476736*n^5 + 35624673/68719476736*n^6 - 19791485/68719476736*n^7 + 9613007/68719476736*n^8 - 4075291/68719476736*n^9 + 1501423/68719476736*n^10) * eps^19
        + (126233085/274877906944 - 172136025/137438953472*n + 204068505/137438953472*n^2 - 133218315/137438953472*n^3 + 25446195/274877906944*n^4 + 45803151/68719476736*n^5 - 70683875/68719476736*n^6 + 68421991/68719476736*n^7 - 12732847/17179869184*n^8 + 30944913/68719476736*n^9) * eps^20
        + (447553665/1099511627776 - 282901815/274877906944*n + 1744810665/2199023255552*n^2 + 714788607/2199023255552*n^3 - 2949064317/2199023255552*n^4 + 3330058719/2199023255552*n^5 - 466513575/549755813888*n^6 - 52627801/549755813888*n^7 + 415894171/549755813888*n^8) * eps^21
        + (231011535/549755813888 - 2056152345/2199023255552*n + 1715472699/4398046511104*n^2 + 1751396739/2199023255552*n^3 - 2620093247/2199023255552*n^4 + 381959029/1099511627776*n^5 + 4006284039/4398046511104*n^6 - 811840865/549755813888*n^7) * eps^22
        + (13730467455/35184372088832 - 26834758935/35184372088832*n + 1154658519/35184372088832*n^2 + 34587765501/35184372088832*n^3 - 26560472237/35184372088832*n^4 - 16713828219/35184372088832*n^5 + 41375557803/35184372088832*n^6) * eps^23
        + (27079840719/70368744177664 - 23683023159/35184372088832*n - 4885170495/35184372088832*n^2 + 31837181505/35184372088832*n^3 - 8213174937/35184372088832*n^4 - 31695410011/35184372088832*n^5) * eps^24
        + (25457271579/70368744177664 - 156005632095/281474976710656*n - 10545202575/35184372088832*n^2 + 114004448877/140737488355328*n^3 + 16505168273/140737488355328*n^4) * eps^25
        + (198096366191/562949953421312 - 17051245797/35184372088832*n - 202196269517/562949953421312*n^2 + 44120523793/70368744177664*n^3) * eps^26
        + (749484543777/2251799813685248 - 904154339527/2251799813685248*n - 237166138569/562949953421312*n^2) * eps^27
        + (1451001339947/4503599627370496 - 197052059395/562949953421312*n) * eps^28
        + 11027253546199/36028797018963968 * eps^29;
C3[20] = + (328206021/1099511627776 - 447553665/549755813888*n + 616197075/549755813888*n^2 - 2588027715/2199023255552*n^3 + 11313378297/10995116277760*n^4 - 1063650951/1374389534720*n^5 + 139671337/274877906944*n^6 - 161159235/549755813888*n^7 + 81876301/549755813888*n^8 - 91508807/1374389534720*n^9) * eps^20
        + (447553665/1099511627776 - 616197075/549755813888*n + 5973868485/4398046511104*n^2 - 5151407547/5497558138880*n^3 + 745124463/4398046511104*n^4 + 2933098077/5497558138880*n^5 - 999187257/1099511627776*n^6 + 255261409/274877906944*n^7 - 3993414699/5497558138880*n^8) * eps^21
        + (797813055/2199023255552 - 16416787335/17592186044416*n + 67175859231/87960930222080*n^2 + 9242357391/43980465111040*n^3 - 102015059749/87960930222080*n^4 + 124091978953/87960930222080*n^5 - 39356567111/43980465111040*n^6 + 592399119/10995116277760*n^7) * eps^22
        + (13225535115/35184372088832 - 15052072971/17592186044416*n + 71611679859/175921860444160*n^2 + 58313997297/87960930222080*n^3 - 195393281759/175921860444160*n^4 + 4977760923/10995116277760*n^5 + 24290150905/35184372088832*n^6) * eps^23
        + (24669936369/70368744177664 - 12424628601/17592186044416*n + 11746262979/140737488355328*n^2 + 30472467141/35184372088832*n^3 - 541082739303/703687441776640*n^4 - 214208596351/703687441776640*n^5) * eps^24
        + (24401503959/70368744177664 - 88423598371/140737488355328*n - 27848548649/351843720888320*n^2 + 582032816309/703687441776640*n^3 - 443970412913/1407374883553280*n^4) * eps^25
        + (184144866101/562949953421312 - 73617505285/140737488355328*n - 163863036307/703687441776640*n^2 + 4297898591023/5629499534213120*n^3) * eps^26
        + (89787248319/281474976710656 - 64845907663/140737488355328*n - 3332997588781/11258999068426240*n^2) * eps^27
        + (10901346434011/36028797018963968 - 6951464328397/18014398509481984*n) * eps^28
        + 10575447871909/36028797018963968 * eps^29;
C3[21] = + (2038855585/7696581394432 - 797813055/1099511627776*n + 2216147375/2199023255552*n^2 - 2357980807/2199023255552*n^3 + 2098862037/2199023255552*n^4 - 4845520999/6597069766656*n^5 + 5726524817/11544872091648*n^6 - 1139229075/3848290697216*n^7 + 258225257/1649267441664*n^8) * eps^21
        + (797813055/2199023255552 - 2216147375/2199023255552*n + 5478316311/4398046511104*n^2 - 1981576699/2199023255552*n^3 + 751444433/3298534883328*n^4 + 3238984625/7696581394432*n^5 - 10556856095/13194139533312*n^6 + 9949267255/11544872091648*n^7) * eps^22
        + (11435320455/35184372088832 - 29873666615/35184372088832*n + 25744131691/35184372088832*n^2 + 4163629499/35184372088832*n^3 - 739894554773/738871813865472*n^4 + 965405949493/738871813865472*n^5 - 677248006993/738871813865472*n^6) * eps^23
        + (23774829039/70368744177664 - 27620697099/35184372088832*n + 10971634235/26388279066624*n^2 + 405631341473/738871813865472*n^3 - 126601433727/123145302310912*n^4 + 129456725059/246290604621824*n^5) * eps^24
        + (22261029909/70368744177664 - 553102652395/844424930131968*n + 8620472343/70368744177664*n^2 + 2249783201615/2955487255461888*n^3 - 2263819350305/2955487255461888*n^4) * eps^25
        + (176646720641/562949953421312 - 123911959597/211106232532992*n - 51597036833/1688849860263936*n^2 + 39733441489/52776558133248*n^3) * eps^26
        + (1337288787659/4503599627370496 - 2222831651699/4503599627370496*n - 795233577023/4503599627370496*n^2) * eps^27
        + (2614429242859/9007199254740992 - 5913700976995/13510798882111488*n) * eps^28
        + 9945743757025/36028797018963968 * eps^29;
C3[22] = + (11435320455/48378511622144 - 11435320455/17592186044416*n + 16009448637/17592186044416*n^2 - 8620472343/8796093022208*n^3 + 7799474977/8796093022208*n^4 - 12256317821/17592186044416*n^5 + 8491054039/17592186044416*n^6 - 653158003/2199023255552*n^7) * eps^22
        + (11435320455/35184372088832 - 16009448637/17592186044416*n + 40287513603/35184372088832*n^2 - 15188451271/17592186044416*n^3 + 9558755047/35184372088832*n^4 + 5724737791/17592186044416*n^5 - 24704740937/35184372088832*n^6) * eps^23
        + (20583576819/70368744177664 - 27268841085/35184372088832*n + 98343755913/140737488355328*n^2 + 1583352063/35184372088832*n^3 - 121489410719/140737488355328*n^4 + 21194269441/17592186044416*n^5) * eps^24
        + (10731608427/35184372088832 - 101627745377/140737488355328*n + 14719309919/35184372088832*n^2 + 63574719679/140737488355328*n^3 - 66603916857/70368744177664*n^4) * eps^25
        + (322710607507/1125899906842624 - 1370068675847/2251799813685248*n + 343057591489/2251799813685248*n^2 + 751691842047/1125899906842624*n^3) * eps^26
        + (1283746667079/4503599627370496 - 1236043889089/2251799813685248*n + 40279424959/4503599627370496*n^2) * eps^27
        + (2436782869279/9007199254740992 - 4195124656575/9007199254740992*n) * eps^28
        + 4774615334345/18014398509481984 * eps^29;
C3[23] = + (171529806825/809240558043136 - 20583576819/35184372088832*n + 29028121155/35184372088832*n^2 - 31608398591/35184372088832*n^3 + 29028121155/35184372088832*n^4 - 23244740695/35184372088832*n^5 + 16482634311/35184372088832*n^6) * eps^23
        + (20583576819/70368744177664 - 29028121155/35184372088832*n + 37120809477/35184372088832*n^2 - 29028121155/35184372088832*n^3 + 10699253851/35184372088832*n^4 + 8608339377/35184372088832*n^5) * eps^24
        + (74417546961/281474976710656 - 99868465307/140737488355328*n + 46855492531/70368744177664*n^2 - 475207835/35184372088832*n^3 - 26136430925/35184372088832*n^4) * eps^25
        + (77818821763/281474976710656 - 46855492531/70368744177664*n + 117206473721/281474976710656*n^2 + 25946347791/70368744177664*n^3) * eps^26
        + (1173967590711/4503599627370496 - 2549380838081/4503599627370496*n + 787609465729/4503599627370496*n^2) * eps^27
        + (2340726177457/9007199254740992 - 2314357198017/4503599627370496*n) * eps^28
        + 556913250205/2251799813685248 * eps^29;
C3[24] = + (107492012277/562949953421312 - 74417546961/140737488355328*n + 316963625945/422212465065984*n^2 - 697319977079/844424930131968*n^3 + 216409648059/281474976710656*n^4 - 264500680961/422212465065984*n^5) * eps^24
        + (74417546961/281474976710656 - 316963625945/422212465065984*n + 548484883157/562949953421312*n^2 - 41533164779/52776558133248*n^3 + 553046878373/1688849860263936*n^4) * eps^25
        + (135054066707/562949953421312 - 4401660092471/6755399441055744*n + 4279816803577/6755399441055744*n^2 - 202913745545/3377699720527872*n^3) * eps^26
        + (1132800437073/4503599627370496 - 1385801088427/2251799813685248*n + 1851694849861/4503599627370496*n^2) * eps^27
        + (1071403584791/4503599627370496 - 7127072067763/13510798882111488*n) * eps^28
        + 1045457237/4398046511104 * eps^29;
C3[25] = + (1215486600363/7036874417766400 - 135054066707/281474976710656*n + 96467190505/140737488355328*n^2 - 107111846009/140737488355328*n^3 + 504955845471/703687441776640*n^4) * eps^25
        + (135054066707/562949953421312 - 96467190505/140737488355328*n + 507617009347/562949953421312*n^2 - 527575738417/703687441776640*n^3) * eps^26
        + (983965343151/4503599627370496 - 2701746625109/4503599627370496*n + 13560625821127/22517998136852480*n^2) * eps^27
        + (2068389622621/9007199254740992 - 2567357849371/4503599627370496*n) * eps^28
        + 1961943067581/9007199254740992 * eps^29;
C3[26] = + (2295919134019/14636698788954112 - 983965343151/2251799813685248*n + 1413743309125/2251799813685248*n^2 - 395848126555/562949953421312*n^3) * eps^26
        + (983965343151/4503599627370496 - 1413743309125/2251799813685248*n + 3766212175509/4503599627370496*n^2) * eps^27
        + (1798281489207/9007199254740992 - 4987686394593/9007199254740992*n) * eps^28
        + 3788832068455/18014398509481984 * eps^29;
C3[27] = + (17383387729001/121597189939003392 - 1798281489207/4503599627370496*n + 7792553119897/13510798882111488*n^2) * eps^27
        + (1798281489207/9007199254740992 - 7792553119897/13510798882111488*n) * eps^28
        + 6593698793759/36028797018963968 * eps^29;
C3[28] = + (4709784852685/36028797018963968 - 6593698793759/18014398509481984*n) * eps^28
        + 6593698793759/36028797018963968 * eps^29;
C3[29] = + 125280277081421/1044835113549955072 * eps^29;

C4[0] = + (2/3 - 1/15*ep2 + 4/105*ep2^2 - 8/315*ep2^3 + 64/3465*ep2^4 - 128/9009*ep2^5 + 512/45045*ep2^6 - 1024/109395*ep2^7 + 16384/2078505*ep2^8 - 32768/4849845*ep2^9 + 131072/22309287*ep2^10 - 262144/50702925*ep2^11 + 2097152/456326325*ep2^12 - 4194304/1017958725*ep2^13 + 16777216/4508102925*ep2^14 - 33554432/9917826435*ep2^15 + 1073741824/347123925225*ep2^16 - 2147483648/755505013725*ep2^17 + 8589934592/3273855059475*ep2^18 - 17179869184/7064634602025*ep2^19 + 137438953472/60755857577415*ep2^20 - 274877906944/130191123380175*ep2^21 + 1099511627776/556271163533475*ep2^22 - 2199023255552/1185099435353925*ep2^23 + 35184372088832/20146690401016725*ep2^24 - 70368744177664/42710983650155457*ep2^25 + 281474976710656/180700315442965395*ep2^26 - 562949953421312/381478443712926945*ep2^27 + 4503599627370496/3215318311294669965*ep2^28 - 9007199254740992/6763255758240512685*ep2^29)
        - (1/20 - 1/35*ep2 + 2/105*ep2^2 - 16/1155*ep2^3 + 32/3003*ep2^4 - 128/15015*ep2^5 + 256/36465*ep2^6 - 4096/692835*ep2^7 + 8192/1616615*ep2^8 - 32768/7436429*ep2^9 + 65536/16900975*ep2^10 - 524288/152108775*ep2^11 + 1048576/339319575*ep2^12 - 4194304/1502700975*ep2^13 + 8388608/3305942145*ep2^14 - 268435456/115707975075*ep2^15 + 536870912/251835004575*ep2^16 - 2147483648/1091285019825*ep2^17 + 4294967296/2354878200675*ep2^18 - 34359738368/20251952525805*ep2^19 + 68719476736/43397041126725*ep2^20 - 274877906944/185423721177825*ep2^21 + 549755813888/395033145117975*ep2^22 - 8796093022208/6715563467005575*ep2^23 + 17592186044416/14236994550051819*ep2^24 - 70368744177664/60233438480988465*ep2^25 + 140737488355328/127159481237642315*ep2^26 - 1125899906842624/1071772770431556655*ep2^27 + 2251799813685248/2254418586080170895*ep2^28) * k2
        + (1/42 - 1/63*ep2 + 8/693*ep2^2 - 80/9009*ep2^3 + 64/9009*ep2^4 - 128/21879*ep2^5 + 2048/415701*ep2^6 - 4096/969969*ep2^7 + 81920/22309287*ep2^8 - 32768/10140585*ep2^9 + 262144/91265265*ep2^10 - 524288/203591745*ep2^11 + 2097152/901620585*ep2^12 - 4194304/1983565287*ep2^13 + 134217728/69424785045*ep2^14 - 268435456/151101002745*ep2^15 + 1073741824/654771011895*ep2^16 - 2147483648/1412926920405*ep2^17 + 17179869184/12151171515483*ep2^18 - 34359738368/26038224676035*ep2^19 + 137438953472/111254232706695*ep2^20 - 274877906944/237019887070785*ep2^21 + 4398046511104/4029338080203345*ep2^22 - 43980465111040/42710983650155457*ep2^23 + 35184372088832/36140063088593079*ep2^24 - 70368744177664/76295688742585389*ep2^25 + 562949953421312/643063662258933993*ep2^26 - 1125899906842624/1352651151648102537*ep2^27) * k2^2
        - (1/72 - 1/99*ep2 + 10/1287*ep2^2 - 8/1287*ep2^3 + 112/21879*ep2^4 - 1792/415701*ep2^5 + 512/138567*ep2^6 - 10240/3187041*ep2^7 + 4096/1448655*ep2^8 - 32768/13037895*ep2^9 + 65536/29084535*ep2^10 - 1835008/901620585*ep2^11 + 3670016/1983565287*ep2^12 - 16777216/9917826435*ep2^13 + 33554432/21585857535*ep2^14 - 134217728/93538715985*ep2^15 + 268435456/201846702915*ep2^16 - 2147483648/1735881645069*ep2^17 + 30064771072/26038224676035*ep2^18 - 120259084288/111254232706695*ep2^19 + 34359738368/33859983867255*ep2^20 - 549755813888/575619725743335*ep2^21 + 5497558138880/6101569092879351*ep2^22 - 4398046511104/5162866155513297*ep2^23 + 8796093022208/10899384106083627*ep2^24 - 70368744177664/91866237465561999*ep2^25 + 140737488355328/193235878806871791*ep2^26) * k2^3
        + (1/110 - 1/143*ep2 + 4/715*ep2^2 - 56/12155*ep2^3 + 896/230945*ep2^4 - 768/230945*ep2^5 + 3072/1062347*ep2^6 - 6144/2414425*ep2^7 + 16384/7243275*ep2^8 - 32768/16158075*ep2^9 + 917504/500900325*ep2^10 - 1835008/1101980715*ep2^11 + 8388608/5509903575*ep2^12 - 16777216/11992143075*ep2^13 + 67108864/51965953325*ep2^14 - 134217728/112137057175*ep2^15 + 1073741824/964378691705*ep2^16 - 15032385536/14465680375575*ep2^17 + 60129542144/61807907059275*ep2^18 - 17179869184/18811102148475*ep2^19 + 274877906944/319788736524075*ep2^20 - 549755813888/677952121431039*ep2^21 + 2199023255552/2868258975285165*ep2^22 - 13194139533312/18165640176806045*ep2^23 + 105553116266496/153110395775936665*ep2^24 - 211106232532992/322059798011452985*ep2^25) * k2^4
        - (1/156 - 1/195*ep2 + 14/3315*ep2^2 - 224/62985*ep2^3 + 64/20995*ep2^4 - 256/96577*ep2^5 + 5632/2414425*ep2^6 - 45056/21729825*ep2^7 + 90112/48474225*ep2^8 - 2523136/1502700975*ep2^9 + 458752/300540195*ep2^10 - 2097152/1502700975*ep2^11 + 4194304/3270584475*ep2^12 - 16777216/14172532725*ep2^13 + 33554432/30582833775*ep2^14 - 268435456/263012370465*ep2^15 + 3758096384/3945185556975*ep2^16 - 165356240896/185423721177825*ep2^17 + 47244640256/56433306445425*ep2^18 - 755914244096/959366209572225*ep2^19 + 1511828488192/2033856364293117*ep2^20 - 549755813888/782252447805045*ep2^21 + 1099511627776/1651421834255095*ep2^22 - 8796093022208/13919126888721515*ep2^23 + 17592186044416/29278163455586635*ep2^24) * k2^5
        + (1/210 - 1/255*ep2 + 16/4845*ep2^2 - 32/11305*ep2^3 + 128/52003*ep2^4 - 2816/1300075*ep2^5 + 22528/11700675*ep2^6 - 585728/339319575*ep2^7 + 2342912/1502700975*ep2^8 - 425984/300540195*ep2^9 + 13631488/10518906825*ep2^10 - 27262976/22894091325*ep2^11 + 8388608/7631363775*ep2^12 - 16777216/16467679725*ep2^13 + 134217728/141622045635*ep2^14 - 268435456/303475812075*ep2^15 + 11811160064/14263363167525*ep2^16 - 23622320128/30387165009075*ep2^17 + 377957122048/516581805154275*ep2^18 - 755914244096/1095153426927063*ep2^19 + 3573412790272/5475767134635315*ep2^20 - 7146825580544/11559952839785665*ep2^21 + 57174604644352/97433888221050605*ep2^22 - 114349209288704/204947144189106445*ep2^23) * k2^6
        - (1/272 - 1/323*ep2 + 6/2261*ep2^2 - 120/52003*ep2^3 + 528/260015*ep2^4 - 1408/780045*ep2^5 + 36608/22621305*ep2^6 - 146432/100180065*ep2^7 + 26624/20036013*ep2^8 - 851968/701260455*ep2^9 + 1703936/1526272755*ep2^10 - 524288/508757585*ep2^11 + 1048576/1097845315*ep2^12 - 8388608/9441469709*ep2^13 + 16777216/20231720805*ep2^14 - 738197504/950890877835*ep2^15 + 1476395008/2025811000605*ep2^16 - 23622320128/34438787010285*ep2^17 + 236223201280/365051142309021*ep2^18 - 223338299392/365051142309021*ep2^19 + 1340029796352/2311990567957133*ep2^20 - 10720238370816/19486777644210121*ep2^21 + 21440476741632/40989428837821289*ep2^22) * k2^7
        + (1/342 - 1/399*ep2 + 20/9177*ep2^2 - 88/45885*ep2^3 + 704/412965*ep2^4 - 18304/11975985*ep2^5 + 73216/53036505*ep2^6 - 13312/10607301*ep2^7 + 425984/371255535*ep2^8 - 14483456/13736454795*ep2^9 + 4456448/4578818265*ep2^10 - 8912896/9880607835*ep2^11 + 71303168/84973227381*ep2^12 - 142606336/182085487245*ep2^13 + 6274678784/8558017900515*ep2^14 - 12549357568/18232299005445*ep2^15 + 11811160064/18232299005445*ep2^16 - 118111600640/193262369457717*ep2^17 + 111669149696/193262369457717*ep2^18 - 223338299392/407998335521847*ep2^19 + 1786706395136/3438843113684139*ep2^20 - 3573412790272/7233428618439051*ep2^21) * k2^8
        - (1/420 - 1/483*ep2 + 22/12075*ep2^2 - 176/108675*ep2^3 + 4576/3151575*ep2^4 - 18304/13956975*ep2^5 + 3328/2791395*ep2^6 - 106496/97698825*ep2^7 + 3620864/3614856525*ep2^8 - 1114112/1204952175*ep2^9 + 42336256/49403039175*ep2^10 - 338690048/424866136905*ep2^11 + 677380096/910427436225*ep2^12 - 29804724224/42790089502575*ep2^13 + 59609448448/91161495027225*ep2^14 - 56103010304/91161495027225*ep2^15 + 112206020608/193262369457717*ep2^16 - 530428461056/966311847288585*ep2^17 + 55834574848/107367983032065*ep2^18 - 446676598784/904958714127405*ep2^19 + 893353197568/1903533846957645*ep2^20) * k2^9
        + (1/506 - 1/575*ep2 + 8/5175*ep2^2 - 208/150075*ep2^3 + 5824/4652325*ep2^4 - 11648/10235115*ep2^5 + 53248/51175575*ep2^6 - 1810432/1893496275*ep2^7 + 557056/631165425*ep2^8 - 21168128/25877782425*ep2^9 + 169345024/222548928855*ep2^10 - 2370830336/3338233932825*ep2^11 + 9483321344/14263363167525*ep2^12 - 2709520384/4341023572725*ep2^13 + 2550136832/4341023572725*ep2^14 - 5100273664/9202969974177*ep2^15 + 265214230528/506163348579735*ep2^16 - 27917287424/56240372064415*ep2^17 + 223338299392/474025993114355*ep2^18 - 446676598784/997089157930195*ep2^19) * k2^10
        - (1/600 - 1/675*ep2 + 26/19575*ep2^2 - 728/606825*ep2^3 + 1456/1335015*ep2^4 - 6656/6675075*ep2^5 + 226304/246977775*ep2^6 - 69632/82325925*ep2^7 + 2646016/3375362925*ep2^8 - 21168128/29028121155*ep2^9 + 296353792/435421817325*ep2^10 - 1185415168/1860438674025*ep2^11 + 7789871104/13023070718175*ep2^12 - 7331643392/13023070718175*ep2^13 + 14663286784/27608909922531*ep2^14 - 762490912768/1518490045739205*ep2^15 + 80262201344/168721116193245*ep2^16 - 642097610752/1422077979343065*ep2^17 + 1284195221504/2991267473790585*ep2^18) * k2^11
        + (1/702 - 1/783*ep2 + 28/24273*ep2^2 - 280/267003*ep2^3 + 256/267003*ep2^4 - 8704/9879111*ep2^5 + 34816/42809481*ep2^6 - 1323008/1755188721*ep2^7 + 52920320/75473115003*ep2^8 - 148176896/226419345009*ep2^9 + 592707584/967428110493*ep2^10 - 3894935552/6771996773451*ep2^11 + 3665821696/6771996773451*ep2^12 - 183291084800/358915828992903*ep2^13 + 146632867840/303698009147841*ep2^14 - 15435038720/33744223238649*ep2^15 + 123480309760/284415595868613*ep2^16 - 246960619520/598253494758117*ep2^17) * k2^12
        - (1/812 - 1/899*ep2 + 10/9889*ep2^2 - 64/69223*ep2^3 + 2176/2561251*ep2^4 - 26112/33296263*ep2^5 + 992256/1365146783*ep2^6 - 39690240/58701311669*ep2^7 + 5292032/8385901667*ep2^8 - 21168128/35830670759*ep2^9 + 973733888/1755702867191*ep2^10 - 916455424/1755702867191*ep2^11 + 45822771200/93052251961123*ep2^12 - 36658216960/78736520890181*ep2^13 + 34728837120/78736520890181*ep2^14 - 277830696960/663636390360097*ep2^15 + 555661393920/1395924821102273*ep2^16) * k2^13
        + (1/930 - 1/1023*ep2 + 32/35805*ep2^2 - 1088/1324785*ep2^3 + 4352/5740735*ep2^4 - 165376/235370135*ep2^5 + 1323008/2024183161*ep2^6 - 2646016/4337535345*ep2^7 + 10584064/18533105565*ep2^8 - 486866944/908122172685*ep2^9 + 458227712/908122172685*ep2^10 - 4582277120/9626095030461*ep2^11 + 3665821696/8145157333467*ep2^12 - 1157627904/2715052444489*ep2^13 + 9261023232/22884013460693*ep2^14 - 537139347456/1395924821102273*ep2^15) * k2^14
        - (1/1056 - 1/1155*ep2 + 34/42735*ep2^2 - 136/185185*ep2^3 + 5168/7592585*ep2^4 - 41344/65296231*ep2^5 + 82688/139920495*ep2^6 - 330752/597842115*ep2^7 + 15214592/29294263635*ep2^8 - 14319616/29294263635*ep2^9 + 143196160/310519194531*ep2^10 - 114556928/262747010757*ep2^11 + 36175872/87582336919*ep2^12 - 289406976/738193982603*ep2^13 + 16785604608/45029832938783*ep2^14) * k2^15
        + (1/1190 - 1/1295*ep2 + 12/16835*ep2^2 - 456/690235*ep2^3 + 3648/5936021*ep2^4 - 2432/4240015*ep2^5 + 107008/199280705*ep2^6 - 4922368/9764754545*ep2^7 + 78757888/166000827265*ep2^8 - 787578880/1759608769009*ep2^9 + 57278464/135354520693*ep2^10 - 54263808/135354520693*ep2^11 + 434110464/1140845245841*ep2^12 - 25178406912/69591559996301*ep2^13) * k2^16
        - (1/1332 - 1/1443*ep2 + 38/59163*ep2^2 - 1520/2544009*ep2^3 + 4256/7632027*ep2^4 - 187264/358705269*ep2^5 + 1230592/2510936883*ep2^6 - 19689472/42685927011*ep2^7 + 984473600/2262354131583*ep2^8 - 71598080/174027240891*ep2^9 + 7536640/19336360099*ep2^10 - 60293120/162977892263*ep2^11 + 3497000960/9941651428043*ep2^12) * k2^17
        + (1/1482 - 1/1599*ep2 + 40/68757*ep2^2 - 112/206271*ep2^3 + 4928/9694737*ep2^4 - 32384/67863159*ep2^5 + 518144/1153673703*ep2^6 - 25907200/61144706259*ep2^7 + 1884160/4703438943*ep2^8 - 3768320/9929482213*ep2^9 + 30146560/83691350081*ep2^10 - 1748500480/5105172354941*ep2^11) * k2^18
        - (1/1640 - 1/1763*ep2 + 14/26445*ep2^2 - 616/1242915*ep2^3 + 4048/8700405*ep2^4 - 64768/147906885*ep2^5 + 647680/1567812981*ep2^6 - 612352/1567812981*ep2^7 + 3674112/9929482213*ep2^8 - 29392896/83691350081*ep2^9 + 1704787968/5105172354941*ep2^10) * k2^19
        + (1/1806 - 1/1935*ep2 + 44/90945*ep2^2 - 2024/4456305*ep2^3 + 32384/75757185*ep2^4 - 323840/803026161*ep2^5 + 306176/803026161*ep2^6 - 612352/1695277451*ep2^7 + 4898816/14288767087*ep2^8 - 284131328/871614792307*ep2^9) * k2^20
        - (1/1980 - 1/2115*ep2 + 46/103635*ep2^2 - 736/1761795*ep2^3 + 7360/18675027*ep2^4 - 76544/205425297*ep2^5 + 153088/433675627*ep2^6 - 1224704/3655265999*ep2^7 + 71032832/222971225939*ep2^8) * k2^21
        + (1/2162 - 1/2303*ep2 + 16/39151*ep2^2 - 800/2075003*ep2^3 + 8320/22825033*ep2^4 - 149760/433675627*ep2^5 + 1198080/3655265999*ep2^6 - 69488640/222971225939*ep2^7) * k2^22
        - (1/2352 - 1/2499*ep2 + 50/132447*ep2^2 - 520/1456917*ep2^3 + 3120/9227141*ep2^4 - 24960/77771617*ep2^5 + 1447680/4744068637*ep2^6) * k2^23
        + (1/2550 - 1/2703*ep2 + 52/148665*ep2^2 - 312/941545*ep2^3 + 17472/55551155*ep2^4 - 1013376/3388620455*ep2^5) * k2^24
        - (1/2756 - 1/2915*ep2 + 18/55385*ep2^2 - 1008/3267715*ep2^3 + 58464/199330615*ep2^4) * k2^25
        + (1/2970 - 1/3135*ep2 + 56/184965*ep2^2 - 3248/11282865*ep2^3) * k2^26
        - (1/3192 - 1/3363*ep2 + 58/205143*ep2^2) * k2^27
        + (1/3422 - 1/3599*ep2) * k2^28
        - 1/3660 * k2^29;
C4[1] = + (1/180 - 1/315*ep2 + 2/945*ep2^2 - 16/10395*ep2^3 + 32/27027*ep2^4 - 128/135135*ep2^5 + 256/328185*ep2^6 - 4096/6235515*ep2^7 + 8192/14549535*ep2^8 - 32768/66927861*ep2^9 + 65536/152108775*ep2^10 - 524288/1368978975*ep2^11 + 1048576/3053876175*ep2^12 - 4194304/13524308775*ep2^13 + 8388608/29753479305*ep2^14 - 268435456/1041371775675*ep2^15 + 536870912/2266515041175*ep2^16 - 2147483648/9821565178425*ep2^17 + 4294967296/21193903806075*ep2^18 - 34359738368/182267572732245*ep2^19 + 68719476736/390573370140525*ep2^20 - 274877906944/1668813490600425*ep2^21 + 549755813888/3555298306061775*ep2^22 - 8796093022208/60440071203050175*ep2^23 + 17592186044416/128132950950466371*ep2^24 - 70368744177664/542100946328896185*ep2^25 + 140737488355328/1144435331138780835*ep2^26 - 1125899906842624/9645954933884009895*ep2^27 + 2251799813685248/20289767274721538055*ep2^28) * k2
        - (1/252 - 1/378*ep2 + 4/2079*ep2^2 - 40/27027*ep2^3 + 32/27027*ep2^4 - 64/65637*ep2^5 + 1024/1247103*ep2^6 - 2048/2909907*ep2^7 + 40960/66927861*ep2^8 - 16384/30421755*ep2^9 + 131072/273795795*ep2^10 - 262144/610775235*ep2^11 + 1048576/2704861755*ep2^12 - 2097152/5950695861*ep2^13 + 67108864/208274355135*ep2^14 - 134217728/453303008235*ep2^15 + 536870912/1964313035685*ep2^16 - 1073741824/4238780761215*ep2^17 + 8589934592/36453514546449*ep2^18 - 17179869184/78114674028105*ep2^19 + 68719476736/333762698120085*ep2^20 - 137438953472/711059661212355*ep2^21 + 2199023255552/12088014240610035*ep2^22 - 21990232555520/128132950950466371*ep2^23 + 17592186044416/108420189265779237*ep2^24 - 35184372088832/228887066227756167*ep2^25 + 281474976710656/1929190986776801979*ep2^26 - 562949953421312/4057953454944307611*ep2^27) * k2^2
        + (1/360 - 1/495*ep2 + 2/1287*ep2^2 - 8/6435*ep2^3 + 112/109395*ep2^4 - 1792/2078505*ep2^5 + 512/692835*ep2^6 - 2048/3187041*ep2^7 + 4096/7243275*ep2^8 - 32768/65189475*ep2^9 + 65536/145422675*ep2^10 - 1835008/4508102925*ep2^11 + 3670016/9917826435*ep2^12 - 16777216/49589132175*ep2^13 + 33554432/107929287675*ep2^14 - 134217728/467693579925*ep2^15 + 268435456/1009233514575*ep2^16 - 2147483648/8679408225345*ep2^17 + 30064771072/130191123380175*ep2^18 - 120259084288/556271163533475*ep2^19 + 34359738368/169299919336275*ep2^20 - 549755813888/2878098628716675*ep2^21 + 1099511627776/6101569092879351*ep2^22 - 4398046511104/25814330777566485*ep2^23 + 8796093022208/54496920530418135*ep2^24 - 70368744177664/459331187327809995*ep2^25 + 140737488355328/966179394034358955*ep2^26) * k2^3
        - (1/495 - 2/1287*ep2 + 8/6435*ep2^2 - 112/109395*ep2^3 + 1792/2078505*ep2^4 - 512/692835*ep2^5 + 2048/3187041*ep2^6 - 4096/7243275*ep2^7 + 32768/65189475*ep2^8 - 65536/145422675*ep2^9 + 1835008/4508102925*ep2^10 - 3670016/9917826435*ep2^11 + 16777216/49589132175*ep2^12 - 33554432/107929287675*ep2^13 + 134217728/467693579925*ep2^14 - 268435456/1009233514575*ep2^15 + 2147483648/8679408225345*ep2^16 - 30064771072/130191123380175*ep2^17 + 120259084288/556271163533475*ep2^18 - 34359738368/169299919336275*ep2^19 + 549755813888/2878098628716675*ep2^20 - 1099511627776/6101569092879351*ep2^21 + 4398046511104/25814330777566485*ep2^22 - 8796093022208/54496920530418135*ep2^23 + 70368744177664/459331187327809995*ep2^24 - 140737488355328/966179394034358955*ep2^25) * k2^4
        + (5/3276 - 1/819*ep2 + 2/1989*ep2^2 - 32/37791*ep2^3 + 64/88179*ep2^4 - 1280/2028117*ep2^5 + 5632/10140585*ep2^6 - 45056/91265265*ep2^7 + 90112/203591745*ep2^8 - 360448/901620585*ep2^9 + 65536/180324117*ep2^10 - 2097152/6311344095*ep2^11 + 4194304/13736454795*ep2^12 - 16777216/59524637445*ep2^13 + 33554432/128447901855*ep2^14 - 268435456/1104651955953*ep2^15 + 536870912/2367111334185*ep2^16 - 23622320128/111254232706695*ep2^17 + 47244640256/237019887070785*ep2^18 - 755914244096/4029338080203345*ep2^19 + 7559142440960/42710983650155457*ep2^20 - 549755813888/3285460280781189*ep2^21 + 1099511627776/6935971703871399*ep2^22 - 8796093022208/58460332932630363*ep2^23 + 17592186044416/122968286513463867*ep2^24) * k2^5
        - (1/840 - 1/1020*ep2 + 4/4845*ep2^2 - 8/11305*ep2^3 + 32/52003*ep2^4 - 704/1300075*ep2^5 + 5632/11700675*ep2^6 - 146432/339319575*ep2^7 + 585728/1502700975*ep2^8 - 106496/300540195*ep2^9 + 3407872/10518906825*ep2^10 - 6815744/22894091325*ep2^11 + 2097152/7631363775*ep2^12 - 4194304/16467679725*ep2^13 + 33554432/141622045635*ep2^14 - 67108864/303475812075*ep2^15 + 2952790016/14263363167525*ep2^16 - 5905580032/30387165009075*ep2^17 + 94489280512/516581805154275*ep2^18 - 188978561024/1095153426927063*ep2^19 + 893353197568/5475767134635315*ep2^20 - 1786706395136/11559952839785665*ep2^21 + 14293651161088/97433888221050605*ep2^22 - 28587302322176/204947144189106445*ep2^23) * k2^6
        + (7/7344 - 7/8721*ep2 + 2/2907*ep2^2 - 40/66861*ep2^3 + 176/334305*ep2^4 - 1408/3008745*ep2^5 + 36608/87253605*ep2^6 - 1025024/2704861755*ep2^7 + 186368/540972351*ep2^8 - 851968/2704861755*ep2^9 + 1703936/5887052055*ep2^10 - 524288/1962350685*ep2^11 + 1048576/4234546215*ep2^12 - 8388608/36417097449*ep2^13 + 117440512/546256461735*ep2^14 - 5167382528/25674053701545*ep2^15 + 1476395008/7813842430905*ep2^16 - 23622320128/132835321325385*ep2^17 + 236223201280/1408054406049081*ep2^18 - 223338299392/1408054406049081*ep2^19 + 446676598784/2972559301659171*ep2^20 - 3573412790272/25054428399698727*ep2^21 + 7146825580544/52700694220055943*ep2^22) * k2^7
        - (2/2565 - 4/5985*ep2 + 16/27531*ep2^2 - 352/688275*ep2^3 + 2816/6194475*ep2^4 - 73216/179639775*ep2^5 + 292864/795547575*ep2^6 - 53248/159109515*ep2^7 + 1703936/5568833025*ep2^8 - 57933824/206046821925*ep2^9 + 17825792/68682273975*ep2^10 - 35651584/148209117525*ep2^11 + 285212672/1274598410715*ep2^12 - 570425344/2731282308675*ep2^13 + 25098715136/128370268507725*ep2^14 - 50197430272/273484485081675*ep2^15 + 47244640256/273484485081675*ep2^16 - 94489280512/579787108373151*ep2^17 + 446676598784/2898935541865755*ep2^18 - 893353197568/6119975032827705*ep2^19 + 7146825580544/51582646705262085*ep2^20 - 14293651161088/108501429276585765*ep2^21) * k2^8
        + (1/1540 - 1/1771*ep2 + 2/4025*ep2^2 - 16/36225*ep2^3 + 416/1050525*ep2^4 - 1664/4652325*ep2^5 + 3328/10235115*ep2^6 - 106496/358229025*ep2^7 + 3620864/13254473925*ep2^8 - 1114112/4418157975*ep2^9 + 42336256/181144476975*ep2^10 - 338690048/1557842501985*ep2^11 + 677380096/3338233932825*ep2^12 - 2709520384/14263363167525*ep2^13 + 5419040768/30387165009075*ep2^14 - 5100273664/30387165009075*ep2^15 + 10200547328/64420789819239*ep2^16 - 530428461056/3543143440058145*ep2^17 + 55834574848/393682604450905*ep2^18 - 446676598784/3318181951800485*ep2^19 + 893353197568/6979624105511365*ep2^20) * k2^9
        - (5/9108 - 1/2070*ep2 + 4/9315*ep2^2 - 104/270135*ep2^3 + 2912/8374185*ep2^4 - 5824/18423207*ep2^5 + 26624/92116035*ep2^6 - 905216/3408293295*ep2^7 + 278528/1136097765*ep2^8 - 10584064/46580008365*ep2^9 + 84672512/400588071939*ep2^10 - 1185415168/6008821079085*ep2^11 + 4741660672/25674053701545*ep2^12 - 1354760192/7813842430905*ep2^13 + 1275068416/7813842430905*ep2^14 - 12750684160/82826729767593*ep2^15 + 132607115264/911094027443523*ep2^16 - 13958643712/101232669715947*ep2^17 + 111669149696/853246787605839*ep2^18 - 223338299392/1794760484274351*ep2^19) * k2^10
        + (11/23400 - 11/26325*ep2 + 22/58725*ep2^2 - 616/1820475*ep2^3 + 112/364095*ep2^4 - 512/1820475*ep2^5 + 17408/67357575*ep2^6 - 69632/291882825*ep2^7 + 2646016/11967195825*ep2^8 - 21168128/102917884095*ep2^9 + 296353792/1543768261425*ep2^10 - 13039566848/72557108286975*ep2^11 + 85688582144/507899758008825*ep2^12 - 80648077312/507899758008825*ep2^13 + 161296154624/1076747486978709*ep2^14 - 58653147136/414133648837965*ep2^15 + 6174015488/46014849870885*ep2^16 - 49392123904/387839448911745*ep2^17 + 98784247808/815800220124705*ep2^18) * k2^11
        - (1/2457 - 2/5481*ep2 + 8/24273*ep2^2 - 80/267003*ep2^3 + 512/1869021*ep2^4 - 17408/69153777*ep2^5 + 69632/299666367*ep2^6 - 2646016/12286321047*ep2^7 + 105840640/528311805021*ep2^8 - 42336256/226419345009*ep2^9 + 169345024/967428110493*ep2^10 - 7789871104/47403977414157*ep2^11 + 7331643392/47403977414157*ep2^12 - 366582169600/2512410802950321*ep2^13 + 293265735680/2125886064034887*ep2^14 - 30870077440/236209562670543*ep2^15 + 246960619520/1990909171080291*ep2^16 - 493921239040/4187774463306819*ep2^17) * k2^12
        + (13/36540 - 13/40455*ep2 + 26/89001*ep2^2 - 832/3115035*ep2^3 + 28288/115256295*ep2^4 - 8704/38418765*ep2^5 + 330752/1575169365*ep2^6 - 2646016/13546456539*ep2^7 + 5292032/29028121155*ep2^8 - 21168128/124029244935*ep2^9 + 973733888/6077433001815*ep2^10 - 916455424/6077433001815*ep2^11 + 9164554240/64420789819239*ep2^12 - 95311364096/708628688011629*ep2^13 + 10032775168/78736520890181*ep2^14 - 80262201344/663636390360097*ep2^15 + 160524402688/1395924821102273*ep2^16) * k2^13
        - (7/22320 - 7/24552*ep2 + 4/15345*ep2^2 - 136/567765*ep2^3 + 544/2460315*ep2^4 - 20672/100872915*ep2^5 + 165376/867507069*ep2^6 - 2315264/13012606035*ep2^7 + 9261056/55599316695*ep2^8 - 60858368/389195216865*ep2^9 + 57278464/389195216865*ep2^10 - 572784640/4125469298769*ep2^11 + 458227712/3490781714343*ep2^12 - 48234496/387864634927*ep2^13 + 385875968/3269144780099*ep2^14 - 22380806144/199417831586039*ep2^15) * k2^14
        + (5/17952 - 1/3927*ep2 + 2/8547*ep2^2 - 8/37037*ep2^3 + 304/1518517*ep2^4 - 12160/65296231*ep2^5 + 4864/27984099*ep2^6 - 19456/119568423*ep2^7 + 894976/5858852727*ep2^8 - 14319616/99600496359*ep2^9 + 715980800/5278826307027*ep2^10 - 572784640/4466699182869*ep2^11 + 180879360/1488899727623*ep2^12 - 1447034880/12549297704251*ep2^13 + 83928023040/765507159959311*ep2^14) * k2^15
        - (4/16065 - 8/34965*ep2 + 32/151515*ep2^2 - 1216/6212115*ep2^3 + 9728/53424189*ep2^4 - 19456/114480405*ep2^5 + 856064/5380579035*ep2^6 - 39378944/263648372715*ep2^7 + 630063104/4482022336155*ep2^8 - 6300631040/47509436763243*ep2^9 + 458227712/3654572058711*ep2^10 - 48234496/406063562079*ep2^11 + 385875968/3422535737523*ep2^12 - 22380806144/208774679988903*ep2^13) * k2^16
        + (17/75924 - 17/82251*ep2 + 34/177489*ep2^2 - 1360/7632027*ep2^3 + 3808/22896081*ep2^4 - 167552/1076115807*ep2^5 + 1101056/7532810649*ep2^6 - 1036288/7532810649*ep2^7 + 51814400/399238964397*ep2^8 - 3768320/30710689569*ep2^9 + 7536640/64833677979*ep2^10 - 60293120/546455285823*ep2^11 + 3497000960/33333772435203*ep2^12) * k2^17
        - (1/4940 - 1/5330*ep2 + 4/22919*ep2^2 - 56/343785*ep2^3 + 2464/16157895*ep2^4 - 16192/113105265*ep2^5 + 259072/1922789505*ep2^6 - 2590720/20381568753*ep2^7 + 188416/1567812981*ep2^8 - 1130496/9929482213*ep2^9 + 9043968/83691350081*ep2^10 - 524550144/5105172354941*ep2^11) * k2^18
        + (19/103320 - 19/111069*ep2 + 38/238005*ep2^2 - 1672/11186235*ep2^3 + 76912/548125515*ep2^4 - 1230592/9318133755*ep2^5 + 12305920/98772217803*ep2^6 - 11634688/98772217803*ep2^7 + 1224704/10974690867*ep2^8 - 9797632/92500965879*ep2^9 + 568262656/5642558918619*ep2^10) * k2^19
        - (5/29799 - 2/12771*ep2 + 8/54567*ep2^2 - 368/2673783*ep2^3 + 5888/45454311*ep2^4 - 294400/2409078483*ep2^5 + 3061760/26499863313*ep2^6 - 6123520/55944155883*ep2^7 + 48988160/471529313871*ep2^8 - 2841313280/28763288146131*ep2^9) * k2^20
        + (7/45540 - 7/48645*ep2 + 2/14805*ep2^2 - 32/251685*ep2^3 + 320/2667861*ep2^4 - 3328/29346471*ep2^5 + 6656/61953661*ep2^6 - 53248/522180857*ep2^7 + 3088384/31853032277*ep2^8) * k2^21
        - (11/77832 - 11/82908*ep2 + 44/352359*ep2^2 - 2200/18675027*ep2^3 + 2080/18675027*ep2^4 - 4160/39425057*ep2^5 + 33280/332296909*ep2^6 - 1930240/20270111449*ep2^7) * k2^22
        + (23/176400 - 23/187425*ep2 + 46/397341*ep2^2 - 2392/21853755*ep2^3 + 4784/46135705*ep2^4 - 38272/388858085*ep2^5 + 2219776/23720343185*ep2^6) * k2^23
        - (2/16575 - 4/35139*ep2 + 16/148665*ep2^2 - 96/941545*ep2^3 + 5376/55551155*ep2^4 - 311808/3388620455*ep2^5) * k2^24
        + (25/223236 - 5/47223*ep2 + 10/99693*ep2^2 - 560/5881887*ep2^3 + 32480/358795107*ep2^4) * k2^25
        - (13/124740 - 13/131670*ep2 + 52/554895*ep2^2 - 3016/33848595*ep2^3) * k2^26
        + (3/30856 - 3/32509*ep2 + 6/68381*ep2^2) * k2^27
        - (7/76995 - 14/161955*ep2) * k2^28
        + 29/340380 * k2^29;
C4[2] = + (1/2100 - 1/3150*ep2 + 4/17325*ep2^2 - 8/45045*ep2^3 + 32/225225*ep2^4 - 64/546975*ep2^5 + 1024/10392525*ep2^6 - 2048/24249225*ep2^7 + 8192/111546435*ep2^8 - 16384/253514625*ep2^9 + 131072/2281631625*ep2^10 - 262144/5089793625*ep2^11 + 1048576/22540514625*ep2^12 - 2097152/49589132175*ep2^13 + 67108864/1735619626125*ep2^14 - 134217728/3777525068625*ep2^15 + 536870912/16369275297375*ep2^16 - 1073741824/35323173010125*ep2^17 + 8589934592/303779287887075*ep2^18 - 17179869184/650955616900875*ep2^19 + 68719476736/2781355817667375*ep2^20 - 137438953472/5925497176769625*ep2^21 + 2199023255552/100733452005083625*ep2^22 - 4398046511104/213554918250777285*ep2^23 + 17592186044416/903501577214826975*ep2^24 - 35184372088832/1907392218564634725*ep2^25 + 281474976710656/16076591556473349825*ep2^26 - 562949953421312/33816278791202563425*ep2^27) * k2^2
        - (1/1800 - 1/2475*ep2 + 2/6435*ep2^2 - 8/32175*ep2^3 + 112/546975*ep2^4 - 1792/10392525*ep2^5 + 512/3464175*ep2^6 - 2048/15935205*ep2^7 + 4096/36216375*ep2^8 - 32768/325947375*ep2^9 + 65536/727113375*ep2^10 - 1835008/22540514625*ep2^11 + 3670016/49589132175*ep2^12 - 16777216/247945660875*ep2^13 + 33554432/539646438375*ep2^14 - 134217728/2338467899625*ep2^15 + 268435456/5046167572875*ep2^16 - 2147483648/43397041126725*ep2^17 + 30064771072/650955616900875*ep2^18 - 120259084288/2781355817667375*ep2^19 + 34359738368/846499596681375*ep2^20 - 549755813888/14390493143583375*ep2^21 + 1099511627776/30507845464396755*ep2^22 - 4398046511104/129071653887832425*ep2^23 + 8796093022208/272484602652090675*ep2^24 - 70368744177664/2296655936639049975*ep2^25 + 140737488355328/4830896970171794775*ep2^26) * k2^3
        + (1/1925 - 2/5005*ep2 + 8/25025*ep2^2 - 16/60775*ep2^3 + 256/1154725*ep2^4 - 1536/8083075*ep2^5 + 6144/37182145*ep2^6 - 12288/84504875*ep2^7 + 32768/253514625*ep2^8 - 65536/565532625*ep2^9 + 262144/2504501625*ep2^10 - 524288/5509903575*ep2^11 + 16777216/192846625125*ep2^12 - 33554432/419725007625*ep2^13 + 134217728/1818808366375*ep2^14 - 268435456/3924797001125*ep2^15 + 2147483648/33753254209675*ep2^16 - 4294967296/72328401877875*ep2^17 + 17179869184/309039535296375*ep2^18 - 34359738368/658388575196625*ep2^19 + 549755813888/11192605778342625*ep2^20 - 1099511627776/23728324250086365*ep2^21 + 4398046511104/100389064134980775*ep2^22 - 26388279066624/635797406188211575*ep2^23 + 211106232532992/5358863852157783275*ep2^24 - 422212465065984/11272092930400854475*ep2^25) * k2^4
        - (1/2184 - 1/2730*ep2 + 1/3315*ep2^2 - 16/62985*ep2^3 + 32/146965*ep2^4 - 128/676039*ep2^5 + 2816/16900975*ep2^6 - 22528/152108775*ep2^7 + 45056/339319575*ep2^8 - 180224/1502700975*ep2^9 + 32768/300540195*ep2^10 - 1048576/10518906825*ep2^11 + 2097152/22894091325*ep2^12 - 8388608/99207729075*ep2^13 + 16777216/214079836425*ep2^14 - 134217728/1841086593255*ep2^15 + 268435456/3945185556975*ep2^16 - 11811160064/185423721177825*ep2^17 + 23622320128/395033145117975*ep2^18 - 377957122048/6715563467005575*ep2^19 + 755914244096/14236994550051819*ep2^20 - 274877906944/5475767134635315*ep2^21 + 549755813888/11559952839785665*ep2^22 - 4398046511104/97433888221050605*ep2^23 + 8796093022208/204947144189106445*ep2^24) * k2^5
        + (1/2520 - 1/3060*ep2 + 4/14535*ep2^2 - 8/33915*ep2^3 + 32/156009*ep2^4 - 704/3900225*ep2^5 + 5632/35102025*ep2^6 - 146432/1017958725*ep2^7 + 585728/4508102925*ep2^8 - 106496/901620585*ep2^9 + 3407872/31556720475*ep2^10 - 6815744/68682273975*ep2^11 + 2097152/22894091325*ep2^12 - 4194304/49403039175*ep2^13 + 33554432/424866136905*ep2^14 - 67108864/910427436225*ep2^15 + 2952790016/42790089502575*ep2^16 - 5905580032/91161495027225*ep2^17 + 94489280512/1549745415462825*ep2^18 - 188978561024/3285460280781189*ep2^19 + 893353197568/16427301403905945*ep2^20 - 1786706395136/34679858519356995*ep2^21 + 14293651161088/292301664663151815*ep2^22 - 28587302322176/614841432567319335*ep2^23) * k2^6
        - (7/20400 - 7/24225*ep2 + 2/8075*ep2^2 - 8/37145*ep2^3 + 176/928625*ep2^4 - 1408/8357625*ep2^5 + 36608/242371125*ep2^6 - 1025024/7513504875*ep2^7 + 186368/1502700975*ep2^8 - 851968/7513504875*ep2^9 + 1703936/16352922375*ep2^10 - 524288/5450974125*ep2^11 + 1048576/11762628375*ep2^12 - 8388608/101158604025*ep2^13 + 117440512/1517379060375*ep2^14 - 5167382528/71316815837625*ep2^15 + 1476395008/21705117863625*ep2^16 - 23622320128/368987003681625*ep2^17 + 47244640256/782252447805045*ep2^18 - 223338299392/3911262239025225*ep2^19 + 446676598784/8257109171275475*ep2^20 - 3573412790272/69595634443607575*ep2^21 + 7146825580544/146390817277933175*ep2^22) * k2^7
        + (14/47025 - 4/15675*ep2 + 16/72105*ep2^2 - 32/163875*ep2^3 + 256/1474875*ep2^4 - 6656/42771375*ep2^5 + 186368/1325912625*ep2^6 - 372736/2917007775*ep2^7 + 1703936/14585038875*ep2^8 - 57933824/539646438375*ep2^9 + 17825792/179882146125*ep2^10 - 35651584/388166736375*ep2^11 + 285212672/3338233932825*ep2^12 - 3992977408/50073508992375*ep2^13 + 15971909632/213950447512875*ep2^14 - 4563402752/65115353590875*ep2^15 + 4294967296/65115353590875*ep2^16 - 8589934592/138044549612655*ep2^17 + 446676598784/7592450228696025*ep2^18 - 893353197568/16028506038358275*ep2^19 + 7146825580544/135097408037591175*ep2^20 - 14293651161088/284170410010105575*ep2^21) * k2^8
        - (1/3850 - 2/8855*ep2 + 4/20125*ep2^2 - 32/181125*ep2^3 + 832/5252625*ep2^4 - 3328/23261625*ep2^5 + 6656/51175575*ep2^6 - 212992/1791145125*ep2^7 + 7241728/66272369625*ep2^8 - 2228224/22090789875*ep2^9 + 84672512/905722384875*ep2^10 - 677380096/7789212509925*ep2^11 + 1354760192/16691169664125*ep2^12 - 5419040768/71316815837625*ep2^13 + 10838081536/151935825045375*ep2^14 - 10200547328/151935825045375*ep2^15 + 20401094656/322103949096195*ep2^16 - 1060856922112/17715717200290725*ep2^17 + 111669149696/1968413022254525*ep2^18 - 893353197568/16590909759002425*ep2^19 + 1786706395136/34898120527556825*ep2^20) * k2^9
        + (3/13156 - 3/14950*ep2 + 4/22425*ep2^2 - 8/50025*ep2^3 + 224/1550775*ep2^4 - 448/3411705*ep2^5 + 2048/17058525*ep2^6 - 69632/631165425*ep2^7 + 278528/2735050175*ep2^8 - 10584064/112137057175*ep2^9 + 84672512/964378691705*ep2^10 - 1185415168/14465680375575*ep2^11 + 4741660672/61807907059275*ep2^12 - 1354760192/18811102148475*ep2^13 + 1275068416/18811102148475*ep2^14 - 2550136832/39879536554767*ep2^15 + 10200547328/168721116193245*ep2^16 - 3221225472/56240372064415*ep2^17 + 25769803776/474025993114355*ep2^18 - 51539607552/997089157930195*ep2^19) * k2^10
        - (11/54600 - 11/61425*ep2 + 22/137025*ep2^2 - 88/606825*ep2^3 + 16/121365*ep2^4 - 512/4247775*ep2^5 + 17408/157167675*ep2^6 - 69632/681059925*ep2^7 + 2646016/27923456925*ep2^8 - 21168128/240141729555*ep2^9 + 42336256/514589420475*ep2^10 - 1862795264/24185702762325*ep2^11 + 85688582144/1185099435353925*ep2^12 - 80648077312/1185099435353925*ep2^13 + 161296154624/2512410802950321*ep2^14 - 58653147136/966311847288585*ep2^15 + 6174015488/107367983032065*ep2^16 - 49392123904/904958714127405*ep2^17 + 98784247808/1903533846957645*ep2^18) * k2^11
        + (11/61425 - 22/137025*ep2 + 88/606825*ep2^2 - 16/121365*ep2^3 + 512/4247775*ep2^4 - 17408/157167675*ep2^5 + 69632/681059925*ep2^6 - 2646016/27923456925*ep2^7 + 21168128/240141729555*ep2^8 - 42336256/514589420475*ep2^9 + 1862795264/24185702762325*ep2^10 - 85688582144/1185099435353925*ep2^11 + 80648077312/1185099435353925*ep2^12 - 161296154624/2512410802950321*ep2^13 + 58653147136/966311847288585*ep2^14 - 6174015488/107367983032065*ep2^15 + 49392123904/904958714127405*ep2^16 - 98784247808/1903533846957645*ep2^17) * k2^12
        - (13/81200 - 13/89900*ep2 + 13/98890*ep2^2 - 208/1730575*ep2^3 + 7072/64031275*ep2^4 - 6528/64031275*ep2^5 + 248064/2625282275*ep2^6 - 1984512/22577427565*ep2^7 + 1323008/16126733975*ep2^8 - 5292032/68905136075*ep2^9 + 243433472/3376351667675*ep2^10 - 229113856/3376351667675*ep2^11 + 458227712/7157865535471*ep2^12 - 23827841024/393682604450905*ep2^13 + 22573744128/393682604450905*ep2^14 - 180589953024/3318181951800485*ep2^15 + 361179906048/6979624105511365*ep2^16) * k2^13
        + (91/632400 - 91/695640*ep2 + 52/434775*ep2^2 - 104/946275*ep2^3 + 32/315425*ep2^4 - 1216/12932425*ep2^5 + 9728/111218855*ep2^6 - 136192/1668282825*ep2^7 + 544768/7128117525*ep2^8 - 3579904/49896822675*ep2^9 + 57278464/848245985475*ep2^10 - 114556928/1798281489207*ep2^11 + 5956960256/98905481906385*ep2^12 - 1881145344/32968493968795*ep2^13 + 15049162752/277877306308415*ep2^14 - 872851439616/16950515684813315*ep2^15) * k2^14
        - (7/53856 - 1/8415*ep2 + 2/18315*ep2^2 - 8/79365*ep2^3 + 304/3253965*ep2^4 - 2432/27984099*ep2^5 + 34048/419761485*ep2^6 - 136192/1793526345*ep2^7 + 894976/12554684415*ep2^8 - 14319616/213429635055*ep2^9 + 143196160/2262354131583*ep2^10 - 114556928/1914299649801*ep2^11 + 12058624/212699961089*ep2^12 - 96468992/1792756814893*ep2^13 + 5595201536/109358165708473*ep2^14) * k2^15
        + (4/33915 - 8/73815*ep2 + 32/319865*ep2^2 - 64/690235*ep2^3 + 512/5936021*ep2^4 - 1024/12720045*ep2^5 + 45056/597842115*ep2^6 - 2072576/29294263635*ep2^7 + 33161216/498002481795*ep2^8 - 331612160/5278826307027*ep2^9 + 24117248/406063562079*ep2^10 - 144703488/2571735893167*ep2^11 + 1157627904/21676059670979*ep2^12 - 67142418432/1322239639929719*ep2^13) * k2^16
        - (17/158175 - 68/685425*ep2 + 136/1479075*ep2^2 - 1088/12720045*ep2^3 + 15232/190800675*ep2^4 - 670208/8967631725*ep2^5 + 4404224/62773422075*ep2^6 - 4145152/62773422075*ep2^7 + 8290304/133079654799*ep2^8 - 3014656/51184482615*ep2^9 + 6029312/108056129965*ep2^10 - 48234496/910758809705*ep2^11 + 2797600768/55556287392005*ep2^12) * k2^17
        + (17/172900 - 17/186550*ep2 + 68/802165*ep2^2 - 136/1718925*ep2^3 + 5984/80789475*ep2^4 - 275264/3958684275*ep2^5 + 259072/3958684275*ep2^6 - 518144/8392410663*ep2^7 + 188416/3227850255*ep2^8 - 1130496/20443051615*ep2^9 + 9043968/172305720755*ep2^10 - 524550144/10510648966055*ep2^11) * k2^18
        - (57/631400 - 57/678755*ep2 + 38/484825*ep2^2 - 152/2071525*ep2^3 + 6992/101504725*ep2^4 - 111872/1725580325*ep2^5 + 223744/3658230289*ep2^6 - 11634688/201202665895*ep2^7 + 11022336/201202665895*ep2^8 - 88178688/1695851041115*ep2^9 + 5114363904/103446913508015*ep2^10) * k2^19
        + (19/228459 - 38/489555*ep2 + 152/2091735*ep2^2 - 304/4456305*ep2^3 + 4864/75757185*ep2^4 - 48640/803026161*ep2^5 + 505856/8833287771*ep2^6 - 53248/981476419*ep2^7 + 425984/8272444103*ep2^8 - 24707072/504619090283*ep2^9) * k2^20
        - (7/91080 - 7/97290*ep2 + 1/14805*ep2^2 - 16/251685*ep2^3 + 160/2667861*ep2^4 - 1664/29346471*ep2^5 + 3328/61953661*ep2^6 - 26624/522180857*ep2^7 + 1544192/31853032277*ep2^8) * k2^21
        + (77/1081000 - 11/164500*ep2 + 44/699125*ep2^2 - 88/1482145*ep2^3 + 416/7410725*ep2^4 - 7488/140803775*ep2^5 + 59904/1186774675*ep2^6 - 3474432/72393255175*ep2^7) * k2^22
        - (253/3822000 - 253/4060875*ep2 + 506/8609055*ep2^2 - 184/3311175*ep2^3 + 1104/20970775*ep2^4 - 8832/176753675*ep2^5 + 512256/10781974175*ep2^6) * k2^23
        + (46/745875 - 92/1581255*ep2 + 368/6689925*ep2^2 - 736/14123175*ep2^3 + 41216/833267325*ep2^4 - 2390528/50829306825*ep2^5) * k2^24
        - (5/86814 - 2/36729*ep2 + 4/77539*ep2^2 - 32/653543*ep2^3 + 1856/39866123*ep2^4) * k2^25
        + (13/241164 - 13/254562*ep2 + 52/1072797*ep2^2 - 104/2256573*ep2^3) * k2^26
        - (39/771400 - 39/812725*ep2 + 78/1709525*ep2^2) * k2^27
        + (63/1326025 - 126/2789225*ep2) * k2^28
        - 203/4538400 * k2^29;
C4[3] = + (1/17640 - 1/24255*ep2 + 2/63063*ep2^2 - 8/315315*ep2^3 + 16/765765*ep2^4 - 256/14549535*ep2^5 + 512/33948915*ep2^6 - 2048/156165009*ep2^7 + 4096/354920475*ep2^8 - 32768/3194284275*ep2^9 + 65536/7125711075*ep2^10 - 262144/31556720475*ep2^11 + 524288/69424785045*ep2^12 - 16777216/2429867476575*ep2^13 + 33554432/5288535096075*ep2^14 - 134217728/22916985416325*ep2^15 + 268435456/49452442214175*ep2^16 - 2147483648/425291003041905*ep2^17 + 4294967296/911337863661225*ep2^18 - 17179869184/3893898144734325*ep2^19 + 34359738368/8295696047477475*ep2^20 - 549755813888/141026832807117075*ep2^21 + 1099511627776/298976885551088199*ep2^22 - 4398046511104/1264902208100757765*ep2^23 + 8796093022208/2670349105990488615*ep2^24 - 70368744177664/22507228179062689755*ep2^25 + 140737488355328/47342790307683588795*ep2^26) * k2^3
        - (1/10780 - 1/14014*ep2 + 2/35035*ep2^2 - 4/85085*ep2^3 + 64/1616615*ep2^4 - 384/11316305*ep2^5 + 1536/52055003*ep2^6 - 3072/118306825*ep2^7 + 8192/354920475*ep2^8 - 16384/791745675*ep2^9 + 65536/3506302275*ep2^10 - 131072/7713865005*ep2^11 + 4194304/269985275175*ep2^12 - 8388608/587615010675*ep2^13 + 33554432/2546331712925*ep2^14 - 67108864/5494715801575*ep2^15 + 536870912/47254555893545*ep2^16 - 1073741824/101259762629025*ep2^17 + 4294967296/432655349414925*ep2^18 - 8589934592/921744005275275*ep2^19 + 137438953472/15669648089679675*ep2^20 - 274877906944/33219653950120911*ep2^21 + 1099511627776/140544689788973085*ep2^22 - 6597069766656/890116368663496205*ep2^23 + 52776558133248/7502409393020896585*ep2^24 - 105553116266496/15780930102561196265*ep2^25) * k2^4
        + (5/45864 - 1/11466*ep2 + 1/13923*ep2^2 - 16/264537*ep2^3 + 32/617253*ep2^4 - 640/14196819*ep2^5 + 2816/70984095*ep2^6 - 22528/638856855*ep2^7 + 45056/1425142215*ep2^8 - 180224/6311344095*ep2^9 + 32768/1262268819*ep2^10 - 1048576/44179408665*ep2^11 + 2097152/96155183565*ep2^12 - 8388608/416672462115*ep2^13 + 16777216/899135312985*ep2^14 - 134217728/7732563691671*ep2^15 + 268435456/16569779339295*ep2^16 - 11811160064/778779628946865*ep2^17 + 23622320128/1659139209495495*ep2^18 - 377957122048/28205366561423415*ep2^19 + 3779571220480/298976885551088199*ep2^20 - 274877906944/22998221965468323*ep2^21 + 549755813888/48551801927099793*ep2^22 - 4398046511104/409222330528412541*ep2^23 + 8796093022208/860778005594247069*ep2^24) * k2^5
        - (1/8820 - 1/10710*ep2 + 8/101745*ep2^2 - 16/237405*ep2^3 + 64/1092063*ep2^4 - 1408/27301575*ep2^5 + 11264/245714175*ep2^6 - 292864/7125711075*ep2^7 + 1171456/31556720475*ep2^8 - 212992/6311344095*ep2^9 + 6815744/220897043325*ep2^10 - 13631488/480775917825*ep2^11 + 4194304/160258639275*ep2^12 - 8388608/345821274225*ep2^13 + 67108864/2974062958335*ep2^14 - 134217728/6372992053575*ep2^15 + 5905580032/299530626518025*ep2^16 - 11811160064/638130465190575*ep2^17 + 188978561024/10848217908239775*ep2^18 - 377957122048/22998221965468323*ep2^19 + 1786706395136/114991109827341615*ep2^20 - 3573412790272/242759009635498965*ep2^21 + 28587302322176/2046111652642062705*ep2^22 - 57174604644352/4303890027971235345*ep2^23) * k2^6
        + (1/8976 - 1/10659*ep2 + 2/24871*ep2^2 - 40/572033*ep2^3 + 16/260015*ep2^4 - 128/2340135*ep2^5 + 3328/67863915*ep2^6 - 13312/300540195*ep2^7 + 26624/661188429*ep2^8 - 851968/23141595015*ep2^9 + 1703936/50367000915*ep2^10 - 524288/16789000305*ep2^11 + 1048576/36228895395*ep2^12 - 8388608/311568500397*ep2^13 + 16777216/667646786565*ep2^14 - 67108864/2852672633505*ep2^15 + 134217728/6077433001815*ep2^16 - 2147483648/103316361030855*ep2^17 + 21474836480/1095153426927063*ep2^18 - 223338299392/12046687696197693*ep2^19 + 446676598784/25431896247528463*ep2^20 - 3573412790272/214354554086311331*ep2^21 + 7146825580544/450883717216034179*ep2^22) * k2^7
        - (1/9405 - 2/21945*ep2 + 8/100947*ep2^2 - 16/229425*ep2^3 + 128/2064825*ep2^4 - 3328/59879925*ep2^5 + 13312/265182525*ep2^6 - 26624/583401555*ep2^7 + 851968/20419054425*ep2^8 - 28966912/755505013725*ep2^9 + 8912896/251835004575*ep2^10 - 17825792/543433430925*ep2^11 + 142606336/4673527505955*ep2^12 - 285212672/10014701798475*ep2^13 + 1140850688/42790089502575*ep2^14 - 2281701376/91161495027225*ep2^15 + 2147483648/91161495027225*ep2^16 - 4294967296/193262369457717*ep2^17 + 223338299392/10629430320174435*ep2^18 - 446676598784/22439908453701585*ep2^19 + 3573412790272/189136371252627645*ep2^20 - 7146825580544/397838574014147805*ep2^21) * k2^8
        + (1/10010 - 2/23023*ep2 + 4/52325*ep2^2 - 32/470925*ep2^3 + 64/1050525*ep2^4 - 256/4652325*ep2^5 + 512/10235115*ep2^6 - 16384/358229025*ep2^7 + 557056/13254473925*ep2^8 - 2228224/57436053675*ep2^9 + 84672512/2354878200675*ep2^10 - 677380096/20251952525805*ep2^11 + 1354760192/43397041126725*ep2^12 - 5419040768/185423721177825*ep2^13 + 10838081536/395033145117975*ep2^14 - 10200547328/395033145117975*ep2^15 + 20401094656/837470267650107*ep2^16 - 81604378624/3543143440058145*ep2^17 + 8589934592/393682604450905*ep2^18 - 68719476736/3318181951800485*ep2^19 + 137438953472/6979624105511365*ep2^20) * k2^9
        - (15/161161 - 6/73255*ep2 + 16/219765*ep2^2 - 32/490245*ep2^3 + 128/2171085*ep2^4 - 256/4776387*ep2^5 + 8192/167173545*ep2^6 - 278528/6185421165*ep2^7 + 1114112/26803491715*ep2^8 - 42336256/1098943160315*ep2^9 + 338690048/9450911178709*ep2^10 - 677380096/20251952525805*ep2^11 + 2709520384/86531069882985*ep2^12 - 5419040768/184348801055055*ep2^13 + 5100273664/184348801055055*ep2^14 - 51002736640/1954097291183583*ep2^15 + 40802189312/1653466938693801*ep2^16 - 12884901888/551155646231267*ep2^17 + 103079215104/4645454732520679*ep2^18 - 206158430208/9771473747715911*ep2^19) * k2^10
        + (11/127400 - 11/143325*ep2 + 22/319725*ep2^2 - 88/1415925*ep2^3 + 16/283185*ep2^4 - 512/9911475*ep2^5 + 17408/366724575*ep2^6 - 69632/1589139825*ep2^7 + 2646016/65154732825*ep2^8 - 21168128/560330702295*ep2^9 + 42336256/1200708647775*ep2^10 - 1862795264/56433306445425*ep2^11 + 85688582144/2765232015825825*ep2^12 - 80648077312/2765232015825825*ep2^13 + 161296154624/5862291873550749*ep2^14 - 58653147136/2254727643673365*ep2^15 + 6174015488/250525293741485*ep2^16 - 49392123904/2111570332963945*ep2^17 + 98784247808/4441578976234505*ep2^18) * k2^11
        - (11/137592 - 11/153468*ep2 + 11/169911*ep2^2 - 10/169911*ep2^3 + 64/1189377*ep2^4 - 2176/44006949*ep2^5 + 8704/190696779*ep2^6 - 330752/7818567939*ep2^7 + 13230080/336198421377*ep2^8 - 5292032/144085037733*ep2^9 + 232849408/6771996773451*ep2^10 - 10711072768/331827841899099*ep2^11 + 10081009664/331827841899099*ep2^12 - 504050483200/17586875620652247*ep2^13 + 36658216960/1352836586204019*ep2^14 - 3858759680/150315176244891*ep2^15 + 30870077440/1266942199778367*ep2^16 - 61740154880/2664947385740703*ep2^17) * k2^12
        + (143/1932560 - 143/2139620*ep2 + 13/213962*ep2^2 - 208/3744335*ep2^3 + 416/8149435*ep2^4 - 384/8149435*ep2^5 + 14592/334126835*ep2^6 - 116736/2873490781*ep2^7 + 77824/2052493415*ep2^8 - 3424256/96467190505*ep2^9 + 157515776/4726892334745*ep2^10 - 2520252416/80357169690665*ep2^11 + 25202524160/851785998721049*ep2^12 - 23827841024/851785998721049*ep2^13 + 22573744128/851785998721049*ep2^14 - 180589953024/7179339132077413*ep2^15 + 361179906048/15101368519197317*ep2^16) * k2^13
        - (13/189720 - 13/208692*ep2 + 104/1826055*ep2^2 - 208/3974355*ep2^3 + 64/1324785*ep2^4 - 2432/54316185*ep2^5 + 19456/467119191*ep2^6 - 38912/1000969695*ep2^7 + 155648/4276870515*ep2^8 - 7159808/209566655235*ep2^9 + 114556928/3562633138995*ep2^10 - 1145569280/37763911273347*ep2^11 + 11913920512/415403024006817*ep2^12 - 1254096896/46155891556313*ep2^13 + 10032775168/389028228831781*ep2^14 - 581900959744/23730721958738641*ep2^15) * k2^14
        + (65/1023264 - 13/223839*ep2 + 26/487179*ep2^2 - 8/162393*ep2^3 + 16/350427*ep2^4 - 640/15068361*ep2^5 + 256/6457869*ep2^6 - 1024/27592713*ep2^7 + 47104/1352042937*ep2^8 - 753664/22984729929*ep2^9 + 37683200/1218190686237*ep2^10 - 391905280/13400097548607*ep2^11 + 783810560/28289094824837*ep2^12 - 6270484480/238436656380769*ep2^13 + 363688099840/14544636039226909*ep2^14) * k2^15
        - (2/33915 - 4/73815*ep2 + 16/319865*ep2^2 - 32/690235*ep2^3 + 256/5936021*ep2^4 - 512/12720045*ep2^5 + 22528/597842115*ep2^6 - 1036288/29294263635*ep2^7 + 16580608/498002481795*ep2^8 - 165806080/5278826307027*ep2^9 + 12058624/406063562079*ep2^10 - 72351744/2571735893167*ep2^11 + 578813952/21676059670979*ep2^12 - 33571209216/1322239639929719*ep2^13) * k2^16
        + (17/310023 - 68/1343433*ep2 + 136/2898987*ep2^2 - 5440/124656441*ep2^3 + 2176/53424189*ep2^4 - 95744/2510936883*ep2^5 + 4404224/123035907267*ep2^6 - 4145152/123035907267*ep2^7 + 207257600/6520903085151*ep2^8 - 15073280/501607929627*ep2^9 + 30146560/1058950073657*ep2^10 - 241172480/8925436335109*ep2^11 + 13988003840/544451616441649*ep2^12) * k2^17
        - (34/665665 - 68/1436435*ep2 + 544/12353341*ep2^2 - 1088/26471445*ep2^3 + 4352/113105265*ep2^4 - 200192/5542157985*ep2^5 + 188416/5542157985*ep2^6 - 1884160/58746874641*ep2^7 + 1507328/49708893927*ep2^8 - 9043968/314822994871*ep2^9 + 72351744/2653508099627*ep2^10 - 4196401152/161863994077247*ep2^11) * k2^18
        + (969/20331080 - 969/21855911*ep2 + 646/15611365*ep2^2 - 2584/66703105*ep2^3 + 5168/142106615*ep2^4 - 4864/142106615*ep2^5 + 48640/1506330119*ep2^6 - 505856/16569631309*ep2^7 + 479232/16569631309*ep2^8 - 3833856/139658321033*ep2^9 + 222363648/8519157583013*ep2^10) * k2^19
        - (95/2132284 - 19/456918*ep2 + 38/976143*ep2^2 - 76/2079609*ep2^3 + 1216/35353353*ep2^4 - 60800/1873727709*ep2^5 + 632320/20611004799*ep2^6 - 199680/6870334933*ep2^7 + 1597440/57907108721*ep2^8 - 92651520/3532333631981*ep2^9) * k2^20
        + (19/455400 - 19/486450*ep2 + 19/518175*ep2^2 - 304/8808975*ep2^3 + 608/18675027*ep2^4 - 31616/1027126485*ep2^5 + 3328/114125165*ep2^6 - 26624/961912105*ep2^7 + 1544192/58676638405*ep2^8) * k2^21
        - (11/281060 - 11/299390*ep2 + 88/2544815*ep2^2 - 880/26975039*ep2^3 + 64/2075003*ep2^4 - 1152/39425057*ep2^5 + 9216/332296909*ep2^6 - 534528/20270111449*ep2^7) * k2^22
        + (253/6879600 - 253/7309575*ep2 + 506/15496299*ep2^2 - 184/5960115*ep2^3 + 368/12582465*ep2^4 - 2944/106052205*ep2^5 + 170752/6469184505*ep2^6) * k2^23
        - (253/7309575 - 506/15496299*ep2 + 184/5960115*ep2^2 - 368/12582465*ep2^3 + 2944/106052205*ep2^4 - 170752/6469184505*ep2^5) * k2^24
        + (575/17623242 - 230/7455987*ep2 + 460/15740417*ep2^2 - 3680/132669229*ep2^3 + 7360/279062861*ep2^4) * k2^25
        - (13/422037 - 26/890967*ep2 + 208/7509579*ep2^2 - 416/15796011*ep2^3) * k2^26
        + (195/6695752 - 195/7054453*ep2 + 390/14838677*ep2^2) * k2^27
        - (117/4243280 - 117/4462760*ep2) * k2^28
        + 87/3328160 * k2^29;
C4[4] = + (1/124740 - 1/162162*ep2 + 2/405405*ep2^2 - 4/984555*ep2^3 + 64/18706545*ep2^4 - 128/43648605*ep2^5 + 512/200783583*ep2^6 - 1024/456326325*ep2^7 + 8192/4106936925*ep2^8 - 16384/9161628525*ep2^9 + 65536/40572926325*ep2^10 - 131072/89260437915*ep2^11 + 4194304/3124115327025*ep2^12 - 8388608/6799545123525*ep2^13 + 33554432/29464695535275*ep2^14 - 67108864/63581711418225*ep2^15 + 536870912/546802718196735*ep2^16 - 1073741824/1171720110421575*ep2^17 + 4294967296/5006440471801275*ep2^18 - 8589934592/10665894918185325*ep2^19 + 137438953472/181320213609150525*ep2^20 - 274877906944/384398852851399113*ep2^21 + 1099511627776/1626302838986688555*ep2^22 - 2199023255552/3433305993416342505*ep2^23 + 17592186044416/28937864801652029685*ep2^24 - 35184372088832/60869301824164614165*ep2^25) * k2^4
        - (1/58968 - 1/73710*ep2 + 1/89505*ep2^2 - 16/1700595*ep2^3 + 32/3968055*ep2^4 - 128/18253053*ep2^5 + 2816/456326325*ep2^6 - 22528/4106936925*ep2^7 + 45056/9161628525*ep2^8 - 180224/40572926325*ep2^9 + 32768/8114585265*ep2^10 - 1048576/284010484275*ep2^11 + 2097152/618140465775*ep2^12 - 8388608/2678608685025*ep2^13 + 16777216/5780155583475*ep2^14 - 134217728/49709338017885*ep2^15 + 268435456/106520010038325*ep2^16 - 11811160064/5006440471801275*ep2^17 + 23622320128/10665894918185325*ep2^18 - 377957122048/181320213609150525*ep2^19 + 755914244096/384398852851399113*ep2^20 - 274877906944/147845712635153505*ep2^21 + 549755813888/312118726674212955*ep2^22 - 4398046511104/2630714981968366335*ep2^23 + 8796093022208/5533572893105874015*ep2^24) * k2^5
        + (1/41580 - 1/50490*ep2 + 8/479655*ep2^2 - 16/1119195*ep2^3 + 64/5148297*ep2^4 - 128/11700675*ep2^5 + 1024/105306075*ep2^6 - 26624/3053876175*ep2^7 + 106496/13524308775*ep2^8 - 212992/29753479305*ep2^9 + 6815744/1041371775675*ep2^10 - 13631488/2266515041175*ep2^11 + 4194304/755505013725*ep2^12 - 8388608/1630300292775*ep2^13 + 67108864/14020582517865*ep2^14 - 134217728/30044105395425*ep2^15 + 536870912/128370268507725*ep2^16 - 1073741824/273484485081675*ep2^17 + 17179869184/4649236246388475*ep2^18 - 34359738368/9856380842343567*ep2^19 + 1786706395136/542100946328896185*ep2^20 - 3573412790272/1144435331138780835*ep2^21 + 28587302322176/9645954933884009895*ep2^22 - 57174604644352/20289767274721538055*ep2^23) * k2^6
        - (7/242352 - 7/287793*ep2 + 2/95931*ep2^2 - 40/2206413*ep2^3 + 16/1002915*ep2^4 - 128/9026235*ep2^5 + 3328/261760815*ep2^6 - 93184/8114585265*ep2^7 + 186368/17852087583*ep2^8 - 851968/89260437915*ep2^9 + 1703936/194272717815*ep2^10 - 524288/64757572605*ep2^11 + 1048576/139740025095*ep2^12 - 8388608/1201764215817*ep2^13 + 117440512/18026463237255*ep2^14 - 469762048/77022161104635*ep2^15 + 134217728/23441527292715*ep2^16 - 2147483648/398505963976155*ep2^17 + 21474836480/4224163218147243*ep2^18 - 223338299392/46465795399619673*ep2^19 + 446676598784/98094456954752643*ep2^20 - 3573412790272/826796137190057991*ep2^21 + 7146825580544/1739122909261846119*ep2^22) * k2^7
        + (7/220077 - 2/73359*ep2 + 40/1687257*ep2^2 - 16/766935*ep2^3 + 128/6902415*ep2^4 - 256/15397695*ep2^5 + 7168/477328545*ep2^6 - 14336/1050122799*ep2^7 + 65536/5250613995*ep2^8 - 2228224/194272717815*ep2^9 + 8912896/841848443865*ep2^10 - 17825792/1816620326235*ep2^11 + 142606336/15622934805621*ep2^12 - 1996488704/234344022084315*ep2^13 + 7985954816/1001288094360255*ep2^14 - 2281701376/304739854805295*ep2^15 + 2147483648/304739854805295*ep2^16 - 21474836480/3230242460936127*ep2^17 + 17179869184/2733282082330569*ep2^18 - 34359738368/5770262173808979*ep2^19 + 274877906944/48635066893532823*ep2^20 - 549755813888/102301347603638007*ep2^21) * k2^8
        - (1/30030 - 2/69069*ep2 + 4/156975*ep2^2 - 32/1412775*ep2^3 + 64/3151575*ep2^4 - 256/13956975*ep2^5 + 512/30705345*ep2^6 - 16384/1074687075*ep2^7 + 557056/39763421775*ep2^8 - 2228224/172308161025*ep2^9 + 84672512/7064634602025*ep2^10 - 677380096/60755857577415*ep2^11 + 1354760192/130191123380175*ep2^12 - 5419040768/556271163533475*ep2^13 + 10838081536/1185099435353925*ep2^14 - 10200547328/1185099435353925*ep2^15 + 20401094656/2512410802950321*ep2^16 - 81604378624/10629430320174435*ep2^17 + 8589934592/1181047813352715*ep2^18 - 68719476736/9954545855401455*ep2^19 + 137438953472/20938872316534095*ep2^20) * k2^9
        + (1/29601 - 2/67275*ep2 + 16/605475*ep2^2 - 32/1350675*ep2^3 + 896/41870925*ep2^4 - 1792/92116035*ep2^5 + 8192/460580175*ep2^6 - 278528/17041466475*ep2^7 + 1114112/73846354725*ep2^8 - 42336256/3027700543725*ep2^9 + 338690048/26038224676035*ep2^10 - 4741660672/390573370140525*ep2^11 + 18966642688/1668813490600425*ep2^12 - 5419040768/507899758008825*ep2^13 + 5100273664/507899758008825*ep2^14 - 10200547328/1076747486978709*ep2^15 + 40802189312/4555470137217615*ep2^16 - 4294967296/506163348579735*ep2^17 + 34359738368/4266233938029195*ep2^18 - 68719476736/8973802421371755*ep2^19) * k2^10
        - (11/327600 - 11/368550*ep2 + 11/411075*ep2^2 - 44/1820475*ep2^3 + 8/364095*ep2^4 - 256/12743325*ep2^5 + 8704/471503025*ep2^6 - 34816/2043179775*ep2^7 + 1323008/83770370775*ep2^8 - 10584064/720425188665*ep2^9 + 21168128/1543768261425*ep2^10 - 931397632/72557108286975*ep2^11 + 42844291072/3555298306061775*ep2^12 - 40324038656/3555298306061775*ep2^13 + 80648077312/7537232408850963*ep2^14 - 29326573568/2898935541865755*ep2^15 + 3087007744/322103949096195*ep2^16 - 24696061952/2714876142382215*ep2^17 + 49392123904/5710601540872935*ep2^18) * k2^11
        + (11/334152 - 11/372708*ep2 + 11/412641*ep2^2 - 10/412641*ep2^3 + 64/2888487*ep2^4 - 128/6286707*ep2^5 + 512/27242397*ep2^6 - 19456/1116938277*ep2^7 + 778240/48028345911*ep2^8 - 311296/20583576819*ep2^9 + 13697024/967428110493*ep2^10 - 630063104/47403977414157*ep2^11 + 10081009664/805867616040669*ep2^12 - 504050483200/42710983650155457*ep2^13 + 36658216960/3285460280781189*ep2^14 - 3858759680/365051142309021*ep2^15 + 30870077440/3076859628033177*ep2^16 - 61740154880/6472015079655993*ep2^17) * k2^12
        - (143/4472496 - 143/4951692*ep2 + 65/2475846*ep2^2 - 208/8665461*ep2^3 + 416/18860121*ep2^4 - 128/6286707*ep2^5 + 4864/257754987*ep2^6 - 194560/11083464441*ep2^7 + 77824/4750056189*ep2^8 - 3424256/223252640883*ep2^9 + 157515776/10939379403267*ep2^10 - 2520252416/185969449855539*ep2^11 + 126012620800/9856380842343567*ep2^12 - 119139205120/9856380842343567*ep2^13 + 12540968960/1095153426927063*ep2^14 - 100327751680/9230578884099531*ep2^15 + 200655503360/19416045238967979*ep2^16) * k2^13
        + (1001/32442120 - 91/3244212*ep2 + 104/4055265*ep2^2 - 208/8826165*ep2^3 + 64/2942055*ep2^4 - 128/6348645*ep2^5 + 1024/54598347*ep2^6 - 14336/818975205*ep2^7 + 630784/38491834635*ep2^8 - 4145152/269442842445*ep2^9 + 66322432/4580528321565*ep2^10 - 663224320/48553600208589*ep2^11 + 627048448/48553600208589*ep2^12 - 1254096896/102502044884799*ep2^13 + 10032775168/863945806886163*ep2^14 - 581900959744/52700694220055943*ep2^15) * k2^14
        - (91/3069792 - 13/479655*ep2 + 26/1043955*ep2^2 - 8/347985*ep2^3 + 16/750915*ep2^4 - 128/6457869*ep2^5 + 1792/96868035*ep2^6 - 7168/413890695*ep2^7 + 47104/2897234865*ep2^8 - 753664/49252992705*ep2^9 + 7536640/522081722673*ep2^10 - 78381056/5742898949403*ep2^11 + 156762112/12123897782073*ep2^12 - 1254096896/102187138448901*ep2^13 + 72737619968/6233415445382961*ep2^14) * k2^15
        + (26/915705 - 52/1993005*ep2 + 16/664335*ep2^2 - 32/1433565*ep2^3 + 256/12328659*ep2^4 - 512/26418555*ep2^5 + 22528/1241672085*ep2^6 - 1036288/60841932165*ep2^7 + 16580608/1034312846805*ep2^8 - 165806080/10963716176133*ep2^9 + 156762112/10963716176133*ep2^10 - 313524224/23145623038503*ep2^11 + 2508193792/195084537038811*ep2^12 - 145475239936/11900156759367471*ep2^13) * k2^16
        - (17/626373 - 68/2714283*ep2 + 136/5857137*ep2^2 - 5440/251856891*ep2^3 + 15232/755570673*ep2^4 - 60928/3228347421*ep2^5 + 400384/22598431947*ep2^6 - 376832/22598431947*ep2^7 + 18841600/1197716893191*ep2^8 - 15073280/1013452755777*ep2^9 + 30146560/2139511373307*ep2^10 - 241172480/18033024432159*ep2^11 + 13988003840/1100014490361699*ep2^12) * k2^17
        + (34/1312311 - 68/2831829*ep2 + 2720/121768647*ep2^2 - 1088/52186563*ep2^3 + 4352/222978951*ep2^4 - 8704/475042113*ep2^5 + 8192/475042113*ep2^6 - 409600/25177231989*ep2^7 + 327680/21303811683*ep2^8 - 655360/44974713553*ep2^9 + 5242880/379072585661*ep2^10 - 304087040/23123427725321*ep2^11) * k2^18
        - (323/13069980 - 646/28100457*ep2 + 1292/60215265*ep2^2 - 5168/257283405*ep2^3 + 10336/548125515*ep2^4 - 9728/548125515*ep2^5 + 97280/5810130459*ep2^6 - 1011712/63911435049*ep2^7 + 106496/7101270561*ep2^8 - 851968/59853566157*ep2^9 + 49414144/3651067535577*ep2^10) * k2^19
        + (323/13707540 - 323/14686650*ep2 + 646/31376025*ep2^2 - 1292/66844575*ep2^3 + 1216/66844575*ep2^4 - 2432/141710499*ep2^5 + 126464/7794077445*ep2^6 - 13312/866008605*ep2^7 + 106496/7299215385*ep2^8 - 6176768/445252138485*ep2^9) * k2^20
        - (133/5920200 - 133/6323850*ep2 + 19/962325*ep2^2 - 304/16359525*ep2^3 + 608/34682193*ep2^4 - 2432/146732355*ep2^5 + 256/16303595*ep2^6 - 2048/137416015*ep2^7 + 118784/8382376915*ep2^8) * k2^21
        + (1463/68297580 - 209/10393110*ep2 + 1672/88341435*ep2^2 - 16720/936419211*ep2^3 + 1216/72032247*ep2^4 - 128/8003583*ep2^5 + 1024/67458771*ep2^6 - 59392/4114985031*ep2^7) * k2^22
        - (253/12383280 - 253/13157235*ep2 + 2530/139466691*ep2^2 - 184/10728207*ep2^3 + 368/22648437*ep2^4 - 2944/190893969*ep2^5 + 170752/11644532109*ep2^6) * k2^23
        + (253/12978225 - 506/27513837*ep2 + 184/10582245*ep2^2 - 368/22340295*ep2^3 + 20608/1318077405*ep2^4 - 41216/2772507645*ep2^5) * k2^24
        - (1265/67975362 - 46/2614437*ep2 + 92/5519367*ep2^2 - 736/46520379*ep2^3 + 1472/97853211*ep2^4) * k2^25
        + (299/16821189 - 598/35511399*ep2 + 4784/299310363*ep2^2 - 9568/629583867*ep2^3) * k2^26
        - (65/3826144 - 65/4031116*ep2 + 65/4239622*ep2^2) * k2^27
        + (455/28005648 - 455/29454216*ep2) * k2^28
        - 2639/169736160 * k2^29;
C4[5] = + (1/792792 - 1/990990*ep2 + 1/1203345*ep2^2 - 16/22863555*ep2^3 + 32/53348295*ep2^4 - 128/245402157*ep2^5 + 256/557732175*ep2^6 - 2048/5019589575*ep2^7 + 4096/11197545975*ep2^8 - 16384/49589132175*ep2^9 + 32768/109096090785*ep2^10 - 1048576/3818363177475*ep2^11 + 2097152/8310555150975*ep2^12 - 8388608/36012405654225*ep2^13 + 16777216/77710980622275*ep2^14 - 134217728/668314433351565*ep2^15 + 268435456/1432102357181925*ep2^16 - 1073741824/6118982798868225*ep2^17 + 2147483648/13036093788893175*ep2^18 - 34359738368/221613594411183975*ep2^19 + 68719476736/469820820151710027*ep2^20 - 274877906944/1987703469872619345*ep2^21 + 549755813888/4196262880842196395*ep2^22 - 4398046511104/35368501424241369615*ep2^23 + 8796093022208/74395813340645639535*ep2^24) * k2^5
        - (1/304920 - 1/370260*ep2 + 4/1758735*ep2^2 - 8/4103715*ep2^3 + 32/18877089*ep2^4 - 64/42902475*ep2^5 + 512/386122275*ep2^6 - 13312/11197545975*ep2^7 + 53248/49589132175*ep2^8 - 106496/109096090785*ep2^9 + 3407872/3818363177475*ep2^10 - 6815744/8310555150975*ep2^11 + 2097152/2770185050325*ep2^12 - 4194304/5977767740175*ep2^13 + 33554432/51408802565505*ep2^14 - 67108864/110161719783225*ep2^15 + 268435456/470690984528325*ep2^16 - 536870912/1002776445299475*ep2^17 + 8589934592/17047199570091075*ep2^18 - 17179869184/36140063088593079*ep2^19 + 893353197568/1987703469872619345*ep2^20 - 1786706395136/4196262880842196395*ep2^21 + 14293651161088/35368501424241369615*ep2^22 - 28587302322176/74395813340645639535*ep2^23) * k2^6
        + (7/1283568 - 7/1524237*ep2 + 2/508079*ep2^2 - 40/11685817*ep2^3 + 16/5311735*ep2^4 - 128/47805615*ep2^5 + 256/106643295*ep2^6 - 7168/3305942145*ep2^7 + 14336/7273072719*ep2^8 - 65536/36365363595*ep2^9 + 131072/79148144295*ep2^10 - 524288/342975291945*ep2^11 + 1048576/740104577355*ep2^12 - 8388608/6364899365253*ep2^13 + 117440512/95473490478795*ep2^14 - 469762048/407932186591215*ep2^15 + 134217728/124153274179935*ep2^16 - 2147483648/2110605661058895*ep2^17 + 21474836480/22372420007224287*ep2^18 - 17179869184/18930509236882089*ep2^19 + 34359738368/39964408388973299*ep2^20 - 274877906944/336842870707060663*ep2^21 + 549755813888/708531555625196567*ep2^22) * k2^7
        - (2/268983 - 4/627627*ep2 + 80/14435421*ep2^2 - 32/6561555*ep2^3 + 256/59053995*ep2^4 - 512/131735835*ep2^5 + 2048/583401555*ep2^6 - 4096/1283483421*ep2^7 + 131072/44921919735*ep2^8 - 4456448/1662111030195*ep2^9 + 17825792/7202481130845*ep2^10 - 35651584/15542196124455*ep2^11 + 285212672/133662886670313*ep2^12 - 570425344/286420471436385*ep2^13 + 2281701376/1223796559773645*ep2^14 - 4563402752/2607218757778635*ep2^15 + 4294967296/2607218757778635*ep2^16 - 42949672960/27636518832453531*ep2^17 + 34359738368/23384746704383757*ep2^18 - 68719476736/49367798598143487*ep2^19 + 549755813888/416100016755780819*ep2^20 - 1099511627776/875244862831125171*ep2^21) * k2^8
        + (1/110110 - 2/253253*ep2 + 4/575575*ep2^2 - 32/5180175*ep2^3 + 64/11555775*ep2^4 - 256/51175575*ep2^5 + 512/112586265*ep2^6 - 16384/3940519275*ep2^7 + 557056/145799213175*ep2^8 - 2228224/631796590425*ep2^9 + 84672512/25903660207425*ep2^10 - 677380096/222771477783855*ep2^11 + 1354760192/477367452393975*ep2^12 - 5419040768/2039660932956075*ep2^13 + 10838081536/4345364596297725*ep2^14 - 10200547328/4345364596297725*ep2^15 + 20401094656/9212172944151177*ep2^16 - 81604378624/38974577840639595*ep2^17 + 8589934592/4330508648959955*ep2^18 - 68719476736/36500001469805335*ep2^19 + 137438953472/76775865160625015*ep2^20) * k2^9
        - (3/289432 - 3/328900*ep2 + 2/246675*ep2^2 - 4/550275*ep2^3 + 112/17058525*ep2^4 - 224/37528755*ep2^5 + 1024/187643775*ep2^6 - 34816/6942819675*ep2^7 + 139264/30085551925*ep2^8 - 5292032/1233507628925*ep2^9 + 42336256/10608165608755*ep2^10 - 592707584/159122484131325*ep2^11 + 2370830336/679886977652025*ep2^12 - 677380096/206922123633225*ep2^13 + 637534208/206922123633225*ep2^14 - 1275068416/438674902102437*ep2^15 + 5100273664/1855932278125695*ep2^16 - 1610612736/618644092708565*ep2^17 + 12884901888/5214285924257905*ep2^18 - 25769803776/10967980737232145*ep2^19) * k2^10
        + (1/88400 - 1/99450*ep2 + 1/110925*ep2^2 - 28/3438675*ep2^3 + 56/7565085*ep2^4 - 256/37825425*ep2^5 + 512/82325925*ep2^6 - 2048/356745675*ep2^7 + 77824/14626572675*ep2^8 - 622592/125788525005*ep2^9 + 8716288/1886827875075*ep2^10 - 34865152/8061900920775*ep2^11 + 229113856/56433306445425*ep2^12 - 3665821696/959366209572225*ep2^13 + 7331643392/2033856364293117*ep2^14 - 29326573568/8604776925855495*ep2^15 + 3087007744/956086325095055*ep2^16 - 24696061952/8058441882944035*ep2^17 + 49392123904/16950515684813315*ep2^18) * k2^11
        - (1/83538 - 1/93177*ep2 + 4/412641*ep2^2 - 40/4539051*ep2^3 + 256/31773357*ep2^4 - 512/69153777*ep2^5 + 2048/299666367*ep2^6 - 77824/12286321047*ep2^7 + 3112960/528311805021*ep2^8 - 1245184/226419345009*ep2^9 + 4980736/967428110493*ep2^10 - 229113856/47403977414157*ep2^11 + 3665821696/805867616040669*ep2^12 - 183291084800/42710983650155457*ep2^13 + 146632867840/36140063088593079*ep2^14 - 15435038720/4015562565399231*ep2^15 + 123480309760/33845455908364947*ep2^16 - 246960619520/71192165876215923*ep2^17) * k2^12
        + (13/1049104 - 13/1161508*ep2 + 65/6388294*ep2^2 - 208/22359029*ep2^3 + 416/48663769*ep2^4 - 384/48663769*ep2^5 + 768/105011291*ep2^6 - 30720/4515485513*ep2^7 + 4096/645069359*ep2^8 - 16384/2756205443*ep2^9 + 753664/135054066707*ep2^10 - 12058624/2295919134019*ep2^11 + 602931200/121683714103007*ep2^12 - 6270484480/1338520855133077*ep2^13 + 112868720640/25431896247528463*ep2^14 - 902949765120/214354554086311331*ep2^15 + 1805899530240/450883717216034179*ep2^16) * k2^13
        - (91/7209360 - 91/7930296*ep2 + 52/4956435*ep2^2 - 104/10787535*ep2^3 + 32/3595845*ep2^4 - 64/7759455*ep2^5 + 512/66731313*ep2^6 - 7168/1000969695*ep2^7 + 28672/4276870515*ep2^8 - 188416/29938093605*ep2^9 + 3014656/508947591285*ep2^10 - 30146560/5394844467621*ep2^11 + 313524224/59343289143831*ep2^12 - 627048448/125280277081421*ep2^13 + 5016387584/1055933763971977*ep2^14 - 290950479872/64411959602290597*ep2^15) * k2^14
        + (13/1023264 - 13/1119195*ep2 + 26/2435895*ep2^2 - 8/811965*ep2^3 + 16/1752135*ep2^4 - 128/15068361*ep2^5 + 256/32289345*ep2^6 - 1024/137963565*ep2^7 + 47104/6760214685*ep2^8 - 753664/114923649645*ep2^9 + 7536640/1218190686237*ep2^10 - 78381056/13400097548607*ep2^11 + 156762112/28289094824837*ep2^12 - 1254096896/238436656380769*ep2^13 + 72737619968/14544636039226909*ep2^14) * k2^15
        - (52/4103715 - 104/8931615*ep2 + 32/2977205*ep2^2 - 64/6424495*ep2^3 + 512/55250657*ep2^4 - 1024/118394265*ep2^5 + 4096/505866405*ep2^6 - 188416/24787453845*ep2^7 + 3014656/421386715365*ep2^8 - 30146560/4466699182869*ep2^9 + 313524224/49133691011559*ep2^10 - 1881145344/311180043073207*ep2^11 + 15049162752/2622803220188459*ep2^12 - 872851439616/159990996431495999*ep2^13) * k2^16
        + (221/17608041 - 68/5869347*ep2 + 136/12665433*ep2^2 - 5440/544613619*ep2^3 + 15232/1633840857*ep2^4 - 60928/6980956389*ep2^5 + 17408/2124638901*ep2^6 - 16384/2124638901*ep2^7 + 819200/112605861753*ep2^8 - 8519680/1238664479283*ep2^9 + 17039360/2614958345153*ep2^10 - 136314880/22040363194861*ep2^11 + 7906263040/1344462154886521*ep2^12) * k2^17
        - (17/1374802 - 17/1483339*ep2 + 680/63783577*ep2^2 - 1904/191350731*ep2^3 + 7616/817589487*ep2^4 - 2176/248831583*ep2^5 + 2048/248831583*ep2^6 - 102400/13188073899*ep2^7 + 81920/11159139453*ep2^8 - 491520/70674549869*ep2^9 + 3932160/595685491753*ep2^10 - 228065280/36336814996933*ep2^11) * k2^18
        + (969/79872100 - 1938/171725015*ep2 + 1292/122660725*ep2^2 - 5168/524095825*ep2^3 + 10336/1116551975*ep2^4 - 9728/1116551975*ep2^5 + 19456/2367090187*ep2^6 - 1011712/130189960285*ep2^7 + 958464/130189960285*ep2^8 - 7667712/1097315379545*ep2^9 + 444727296/66936238152245*ep2^10) * k2^19
        - (646/54449395 - 1292/116677275*ep2 + 5168/498530175*ep2^2 - 10336/1062086025*ep2^3 + 9728/1062086025*ep2^4 - 19456/2251622373*ep2^5 + 77824/9526094655*ep2^6 - 24576/3175364885*ep2^7 + 196608/26763789745*ep2^8 - 11403264/1632591174445*ep2^9) * k2^20
        + (2261/195366600 - 2261/208687050*ep2 + 323/31756725*ep2^2 - 304/31756725*ep2^3 + 608/67324257*ep2^4 - 2432/284833395*ep2^5 + 256/31648155*ep2^6 - 2048/266748735*ep2^7 + 118784/16271672835*ep2^8) * k2^21
        - (19/1686360 - 19/1796340*ep2 + 76/7634445*ep2^2 - 760/80925117*ep2^3 + 608/68475099*ep2^4 - 192/22825033*ep2^5 + 1536/192382421*ep2^6 - 89088/11735327681*ep2^7) * k2^22
        + (437/39901680 - 437/42395535*ep2 + 4370/449392671*ep2^2 - 3496/380255337*ep2^3 + 368/42250593*ep2^4 - 2944/356112141*ep2^5 + 5888/749063469*ep2^6) * k2^23
        - (46/4326075 - 92/9171279*ep2 + 368/38801565*ep2^2 - 736/81914415*ep2^3 + 41216/4832950485*ep2^4 - 82432/10165861365*ep2^5) * k2^24
        + (115/11149398 - 46/4717053*ep2 + 92/9958223*ep2^2 - 5152/587535157*ep2^3 + 10304/1235849813*ep2^4) * k2^25
        - (299/29904336 - 299/31565688*ep2 + 299/33256707*ep2^2 - 598/69953763*ep2^3) * k2^26
        + (4485/462963424 - 4485/487765036*ep2 + 4485/512994262*ep2^2) * k2^27
        - (4095/436421348 - 4095/458994866*ep2) * k2^28
        + 1131/124473184 * k2^29;
C4[6] = + (1/4684680 - 1/5688540*ep2 + 4/27020565*ep2^2 - 8/63047985*ep2^3 + 32/290020731*ep2^4 - 64/659138025*ep2^5 + 512/5932242225*ep2^6 - 1024/13233463425*ep2^7 + 4096/58605338025*ep2^8 - 8192/128931743655*ep2^9 + 262144/4512611027925*ep2^10 - 524288/9821565178425*ep2^11 + 2097152/42560115773175*ep2^12 - 4194304/91840249826325*ep2^13 + 33554432/789826148506395*ep2^14 - 67108864/1692484603942275*ep2^15 + 268435456/7231525125935175*ep2^16 - 536870912/15406292659601025*ep2^17 + 8589934592/261906975213217425*ep2^18 - 17179869184/555242787452020941*ep2^19 + 68719476736/2349104100758550135*ep2^20 - 137438953472/4959219768268050285*ep2^21 + 1099511627776/41799138046830709545*ep2^22 - 2199023255552/87922324857126664905*ep2^23) * k2^6
        - (1/1516944 - 1/1801371*ep2 + 2/4203199*ep2^2 - 40/96673577*ep2^3 + 16/43942535*ep2^4 - 128/395482815*ep2^5 + 256/882230895*ep2^6 - 1024/3907022535*ep2^7 + 2048/8595449577*ep2^8 - 65536/300840735195*ep2^9 + 131072/654771011895*ep2^10 - 524288/2837341051545*ep2^11 + 1048576/6122683321755*ep2^12 - 8388608/52655076567093*ep2^13 + 16777216/112832306929485*ep2^14 - 67108864/482101675062345*ep2^15 + 134217728/1027086177306735*ep2^16 - 2147483648/17460465014214495*ep2^17 + 21474836480/185080929150673647*ep2^18 - 17179869184/156606940050570009*ep2^19 + 34359738368/330614651217870019*ep2^20 - 274877906944/2786609203122047303*ep2^21 + 549755813888/5861488323808444327*ep2^22) * k2^7
        + (2/1589445 - 4/3708705*ep2 + 16/17060043*ep2^2 - 32/38772825*ep2^3 + 256/348955425*ep2^4 - 512/778439025*ep2^5 + 2048/3447372825*ep2^6 - 4096/7584220215*ep2^7 + 131072/265447707525*ep2^8 - 4456448/9821565178425*ep2^9 + 17825792/42560115773175*ep2^10 - 35651584/91840249826325*ep2^11 + 285212672/789826148506395*ep2^12 - 570425344/1692484603942275*ep2^13 + 2281701376/7231525125935175*ep2^14 - 4563402752/15406292659601025*ep2^15 + 4294967296/15406292659601025*ep2^16 - 8589934592/32661340438354173*ep2^17 + 34359738368/138182594162267655*ep2^18 - 68719476736/291718809898120605*ep2^19 + 549755813888/2458772826284159385*ep2^20 - 1099511627776/5171901462183921465*ep2^21) * k2^8
        - (1/520520 - 1/598598*ep2 + 1/680225*ep2^2 - 8/6122025*ep2^3 + 16/13656825*ep2^4 - 64/60480225*ep2^5 + 128/133056495*ep2^6 - 4096/4656977325*ep2^7 + 139264/172308161025*ep2^8 - 557056/746668697775*ep2^9 + 21168128/30613416608775*ep2^10 - 169345024/263275382835465*ep2^11 + 338690048/564161534647425*ep2^12 - 1354760192/2410508375311725*ep2^13 + 2709520384/5135430886533675*ep2^14 - 2550136832/5135430886533675*ep2^15 + 5100273664/10887113479451391*ep2^16 - 20401094656/46060864720755885*ep2^17 + 2147483648/5117873857861765*ep2^18 - 17179869184/43136365373406305*ep2^19 + 34359738368/90735113371647745*ep2^20) * k2^9
        + (15/5814952 - 3/1321580*ep2 + 2/991185*ep2^2 - 4/2211105*ep2^3 + 112/68544255*ep2^4 - 224/150797361*ep2^5 + 1024/753986805*ep2^6 - 2048/1641030105*ep2^7 + 8192/7111130455*ep2^8 - 311296/291556348655*ep2^9 + 2490368/2507384598433*ep2^10 - 34865152/37610768976495*ep2^11 + 139460608/160700558354115*ep2^12 - 39845888/48908865586035*ep2^13 + 637534208/831450714962595*ep2^14 - 6375342080/8813377578603507*ep2^15 + 5100273664/7457473335741429*ep2^16 - 1610612736/2485824445247143*ep2^17 + 12884901888/20951948895654491*ep2^18 - 25769803776/44071340780514619*ep2^19) * k2^10
        - (11/3447600 - 11/3878550*ep2 + 11/4326075*ep2^2 - 308/134108325*ep2^3 + 56/26821665*ep2^4 - 256/134108325*ep2^5 + 512/291882825*ep2^6 - 2048/1264825575*ep2^7 + 77824/51857848575*ep2^8 - 622592/445977497745*ep2^9 + 8716288/6689662466175*ep2^10 - 383516672/314414135910225*ep2^11 + 2520252416/2200898951371575*ep2^12 - 40324038656/37415282173316775*ep2^13 + 80648077312/79320398207431563*ep2^14 - 29326573568/30507845464396755*ep2^15 + 3087007744/3389760607155195*ep2^16 - 24696061952/28570839403165215*ep2^17 + 49392123904/60097282882519935*ep2^18) * k2^11
        + (11/2947698 - 11/3287817*ep2 + 308/101922327*ep2^2 - 280/101922327*ep2^3 + 256/101922327*ep2^4 - 512/221830947*ep2^5 + 2048/961267437*ep2^6 - 4096/2074313943*ep2^7 + 163840/89195499549*ep2^8 - 458752/267586498647*ep2^9 + 20185088/12576565436409*ep2^10 - 132644864/88035958054863*ep2^11 + 2122317824/1496611286932671*ep2^12 - 106115891200/79320398207431563*ep2^13 + 7717519360/6101569092879351*ep2^14 - 15435038720/12881090307189741*ep2^15 + 123480309760/108569189732027817*ep2^16 - 246960619520/228369674953575753*ep2^17) * k2^12
        - (11/2622760 - 11/2903770*ep2 + 1/290377*ep2^2 - 32/10163195*ep2^3 + 64/22119895*ep2^4 - 768/287558635*ep2^5 + 1536/620521265*ep2^6 - 12288/5336482879*ep2^7 + 8192/3811773485*ep2^8 - 360448/179153353795*ep2^9 + 16580608/8778514335955*ep2^10 - 265289728/149234743711235*ep2^11 + 2652897280/1581888283339091*ep2^12 - 192937984/121683714103007*ep2^13 + 3472883712/2311990567957133*ep2^14 - 27783069696/19486777644210121*ep2^15 + 55566139392/40989428837821289*ep2^16) * k2^13
        + (11/2403120 - 1/240312*ep2 + 4/1051365*ep2^2 - 8/2288265*ep2^3 + 32/9915815*ep2^4 - 64/21397285*ep2^5 + 512/184016651*ep2^6 - 1024/394321395*ep2^7 + 45056/18533105565*ep2^8 - 2072576/908122172685*ep2^9 + 33161216/15438076935645*ep2^10 - 331612160/163643615517837*ep2^11 + 24117248/12587970424449*ep2^12 - 144703488/79723812688177*ep2^13 + 1157627904/671957849800349*ep2^14 - 67142418432/40989428837821289*ep2^15) * k2^14
        - (5/1023264 - 1/223839*ep2 + 2/487179*ep2^2 - 8/2111109*ep2^3 + 16/4555551*ep2^4 - 640/195888693*ep2^5 + 256/83952297*ep2^6 - 1024/358705269*ep2^7 + 47104/17576558181*ep2^8 - 753664/298801489077*ep2^9 + 37683200/15836478921081*ep2^10 - 30146560/13400097548607*ep2^11 + 60293120/28289094824837*ep2^12 - 482344960/238436656380769*ep2^13 + 27976007680/14544636039226909*ep2^14) * k2^15
        + (4/780045 - 8/1697745*ep2 + 32/7356895*ep2^2 - 64/15875405*ep2^3 + 512/136528483*ep2^4 - 1024/292561035*ep2^5 + 45056/13750368645*ep2^6 - 90112/29294263635*ep2^7 + 1441792/498002481795*ep2^8 - 14417920/5278826307027*ep2^9 + 1048576/406063562079*ep2^10 - 6291456/2571735893167*ep2^11 + 50331648/21676059670979*ep2^12 - 2919235584/1322239639929719*ep2^13) * k2^16
        - (17/3201462 - 34/6936501*ep2 + 68/14968239*ep2^2 - 2720/643634277*ep2^3 + 7616/1930902831*ep2^4 - 30464/8250221187*ep2^5 + 8704/2510936883*ep2^6 - 8192/2510936883*ep2^7 + 409600/133079654799*ep2^8 - 327680/112605861753*ep2^9 + 655360/237723485923*ep2^10 - 5242880/2003669381351*ep2^11 + 304087040/122223832262411*ep2^12) * k2^17
        + (17/3124550 - 17/3371225*ep2 + 136/28992535*ep2^2 - 1904/434888025*ep2^3 + 7616/1858157925*ep2^4 - 2176/565526325*ep2^5 + 2048/565526325*ep2^6 - 4096/1198915809*ep2^7 + 16384/5072336115*ep2^8 - 98304/32124795395*ep2^9 + 786432/270766132615*ep2^10 - 45613056/16516734089515*ep2^11) * k2^18
        - (969/175303700 - 1938/376902955*ep2 + 9044/1884514775*ep2^2 - 36176/8052017675*ep2^3 + 10336/2450614075*ep2^4 - 9728/2450614075*ep2^5 + 19456/5195301839*ep2^6 - 77824/21980123165*ep2^7 + 73728/21980123165*ep2^8 - 589824/185261038105*ep2^9 + 34209792/11300923324405*ep2^10) * k2^19
        + (646/115828713 - 1292/248204385*ep2 + 5168/1060509645*ep2^2 - 10336/2259346635*ep2^3 + 9728/2259346635*ep2^4 - 97280/23949074331*ep2^5 + 77824/20264601357*ep2^6 - 8192/2251622373*ep2^7 + 65536/18977960001*ep2^8 - 3801088/1157655560061*ep2^9) * k2^20
        - (323/57721950 - 646/123315075*ep2 + 1292/262714725*ep2^2 - 1216/262714725*ep2^3 + 2432/556955217*ep2^4 - 9728/2356348995*ep2^5 + 1024/261816555*ep2^6 - 8192/2206739535*ep2^7 + 475136/134611111635*ep2^8) * k2^21
        + (3553/635757720 - 3553/677220180*ep2 + 836/169305045*ep2^2 - 8360/1794633477*ep2^3 + 608/138048729*ep2^4 - 192/46016243*ep2^5 + 1536/387851191*ep2^6 - 3072/815824919*ep2^7) * k2^22
        - (4807/864536400 - 4807/918569925*ep2 + 9614/1947368241*ep2^2 - 3496/748987785*ep2^3 + 368/83220865*ep2^4 - 2944/701433005*ep2^5 + 5888/1475428045*ep2^6) * k2^23
        + (9614/1743408225 - 19228/3696025437*ep2 + 6992/1421548245*ep2^2 - 736/157949805*ep2^3 + 41216/9319038495*ep2^4 - 82432/19602115455*ep2^5) * k2^24
        - (6325/1159537392 - 115/22298796*ep2 + 115/23537618*ep2^2 - 3220/694359731*ep2^3 + 6440/1460549779*ep2^4) * k2^25
        + (23/4272048 - 23/4509384*ep2 + 161/33256707*ep2^2 - 322/69953763*ep2^3) * k2^26
        - (345/65044448 - 345/68528972*ep2 + 345/72073574*ep2^2) * k2^27
        + (207/39674668 - 207/41726806*ep2) * k2^28
        - 29/5657872 * k2^29;
C4[7] = + (1/26254800 - 1/31177575*ep2 + 2/72747675*ep2^2 - 8/334639305*ep2^3 + 16/760543875*ep2^4 - 128/6844894875*ep2^5 + 256/15269380875*ep2^6 - 1024/67621543875*ep2^7 + 2048/148767396525*ep2^8 - 65536/5206858878375*ep2^9 + 131072/11332575205875*ep2^10 - 524288/49107825892125*ep2^11 + 1048576/105969519030375*ep2^12 - 8388608/911337863661225*ep2^13 + 16777216/1952866850702625*ep2^14 - 67108864/8344067453002125*ep2^15 + 134217728/17776491530308875*ep2^16 - 2147483648/302200356015250875*ep2^17 + 4294967296/640664754752331855*ep2^18 - 17179869184/2710504731644480925*ep2^19 + 34359738368/5722176655693904175*ep2^20 - 274877906944/48229774669420049475*ep2^21 + 549755813888/101448836373607690275*ep2^22) * k2^7
        - (1/7335900 - 1/8558550*ep2 + 2/19684665*ep2^2 - 4/44737875*ep2^3 + 32/402640875*ep2^4 - 64/898198875*ep2^5 + 256/3977737875*ep2^6 - 512/8751023325*ep2^7 + 16384/306285816375*ep2^8 - 557056/11332575205875*ep2^9 + 2228224/49107825892125*ep2^10 - 4456448/105969519030375*ep2^11 + 35651584/911337863661225*ep2^12 - 71303168/1952866850702625*ep2^13 + 285212672/8344067453002125*ep2^14 - 570425344/17776491530308875*ep2^15 + 536870912/17776491530308875*ep2^16 - 1073741824/37686162044254815*ep2^17 + 4294967296/159441454802616525*ep2^18 - 8589934592/336598626805523775*ep2^19 + 68719476736/2837045568789414675*ep2^20 - 137438953472/5967578610212217075*ep2^21) * k2^8
        + (1/3403400 - 1/3913910*ep2 + 1/4447625*ep2^2 - 8/40028625*ep2^3 + 16/89294625*ep2^4 - 64/395447625*ep2^5 + 128/869984775*ep2^6 - 4096/30449467125*ep2^7 + 8192/66272369625*ep2^8 - 32768/287180268375*ep2^9 + 1245184/11774391003375*ep2^10 - 9961472/101259762629025*ep2^11 + 19922944/216985205633625*ep2^12 - 79691776/927118605889125*ep2^13 + 159383552/1975165725589875*ep2^14 - 2550136832/33577817335027875*ep2^15 + 5100273664/71184972750259095*ep2^16 - 20401094656/301167192404942325*ep2^17 + 2147483648/33463021378326925*ep2^18 - 17179869184/282045465903041225*ep2^19 + 34359738368/593268048968466025*ep2^20) * k2^9
        - (1/2012868 - 1/2287350*ep2 + 4/10293075*ep2^2 - 8/22961475*ep2^3 + 224/711805725*ep2^4 - 448/1565972595*ep2^5 + 2048/7829862975*ep2^6 - 4096/17041466475*ep2^7 + 16384/73846354725*ep2^8 - 622592/3027700543725*ep2^9 + 4980736/26038224676035*ep2^10 - 69730304/390573370140525*ep2^11 + 278921216/1668813490600425*ep2^12 - 79691776/507899758008825*ep2^13 + 1275068416/8634295886150025*ep2^14 - 2550136832/18304707278638053*ep2^15 + 10200547328/77442992332699455*ep2^16 - 1073741824/8604776925855495*ep2^17 + 8589934592/72525976946496315*ep2^18 - 17179869184/152554641163319835*ep2^19) * k2^10
        + (11/15116400 - 11/17005950*ep2 + 11/18968175*ep2^2 - 308/588013425*ep2^3 + 56/117602685*ep2^4 - 256/588013425*ep2^5 + 512/1279793925*ep2^6 - 2048/5545773675*ep2^7 + 4096/11967195825*ep2^8 - 32768/102917884095*ep2^9 + 458752/1543768261425*ep2^10 - 20185088/72557108286975*ep2^11 + 132644864/507899758008825*ep2^12 - 2122317824/8634295886150025*ep2^13 + 4244635648/18304707278638053*ep2^14 - 1543503872/7040272030245405*ep2^15 + 3087007744/14862796508295855*ep2^16 - 24696061952/125272141998493635*ep2^17 + 49392123904/263503471100279715*ep2^18) * k2^11
        - (11/11337300 - 11/12645450*ep2 + 154/196004475*ep2^2 - 28/39200895*ep2^3 + 128/196004475*ep2^4 - 256/426597975*ep2^5 + 1024/1848591225*ep2^6 - 2048/3989065275*ep2^7 + 16384/34305961365*ep2^8 - 229376/514589420475*ep2^9 + 10092544/24185702762325*ep2^10 - 66322432/169299919336275*ep2^11 + 1061158912/2878098628716675*ep2^12 - 2122317824/6101569092879351*ep2^13 + 771751936/2346757343415135*ep2^14 - 1543503872/4954265502765285*ep2^15 + 12348030976/41757380666164545*ep2^16 - 24696061952/87834490366759905*ep2^17) * k2^12
        + (143/118024200 - 143/130669650*ep2 + 13/13066965*ep2^2 - 416/457343775*ep2^3 + 832/995395275*ep2^4 - 256/331798425*ep2^5 + 512/715986075*ep2^6 - 4096/6157480245*ep2^7 + 8192/13194600525*ep2^8 - 360448/620146224675*ep2^9 + 16580608/30387165009075*ep2^10 - 265289728/516581805154275*ep2^11 + 530579456/1095153426927063*ep2^12 - 2508193792/5475767134635315*ep2^13 + 5016387584/11559952839785665*ep2^14 - 40131100672/97433888221050605*ep2^15 + 80262201344/204947144189106445*ep2^16) * k2^13
        - (13/9011700 - 13/9912870*ep2 + 208/173475225*ep2^2 - 416/377563725*ep2^3 + 128/125854575*ep2^4 - 256/271580925*ep2^5 + 2048/2335595955*ep2^6 - 4096/5004848475*ep2^7 + 16384/21384352575*ep2^8 - 753664/1047833276175*ep2^9 + 12058624/17813165694975*ep2^10 - 24117248/37763911273347*ep2^11 + 1254096896/2077015120034085*ep2^12 - 2508193792/4384809697849735*ep2^13 + 20065550336/36957681739019195*ep2^14 - 1163801919488/2254418586080170895*ep2^15) * k2^14
        + (13/7845024 - 13/8580495*ep2 + 26/18675195*ep2^2 - 8/6225065*ep2^3 + 16/13433035*ep2^4 - 128/115524101*ep2^5 + 256/247551645*ep2^6 - 1024/1057720665*ep2^7 + 2048/2253404895*ep2^8 - 32768/38307883215*ep2^9 + 327680/406063562079*ep2^10 - 3407872/4466699182869*ep2^11 + 20447232/28289094824837*ep2^12 - 163577856/238436656380769*ep2^13 + 9487515648/14544636039226909*ep2^14) * k2^15
        - (13/7020405 - 26/15279705*ep2 + 8/5093235*ep2^2 - 16/10990665*ep2^3 + 128/94519719*ep2^4 - 256/202542255*ep2^5 + 11264/9519485985*ep2^6 - 22528/20280644055*ep2^7 + 360448/344770948935*ep2^8 - 3604480/3654572058711*ep2^9 + 3407872/3654572058711*ep2^10 - 6815744/7715207679501*ep2^11 + 54525952/65028179012937*ep2^12 - 3162505216/3966718919789157*ep2^13) * k2^16
        + (221/109140750 - 34/18190125*ep2 + 68/39252375*ep2^2 - 544/337570425*ep2^3 + 7616/5063556375*ep2^4 - 335104/237987149625*ep2^5 + 95744/72430871625*ep2^6 - 90112/72430871625*ep2^7 + 180224/153553447845*ep2^8 - 851968/767767239225*ep2^9 + 1703936/1620841949475*ep2^10 - 13631488/13661382145575*ep2^11 + 790626304/833344310880075*ep2^12) * k2^17
        - (17/7811375 - 34/16856125*ep2 + 272/144962675*ep2^2 - 3808/2174440125*ep2^3 + 15232/9290789625*ep2^4 - 4352/2827631625*ep2^5 + 4096/2827631625*ep2^6 - 8192/5994579045*ep2^7 + 32768/25361680575*ep2^8 - 196608/160623976975*ep2^9 + 1572864/1353830663075*ep2^10 - 91226112/82583670447575*ep2^11) * k2^18
        + (323/140035500 - 646/301076325*ep2 + 9044/4516144875*ep2^2 - 36176/19296255375*ep2^3 + 10336/5872773375*ep2^4 - 9728/5872773375*ep2^5 + 19456/12450279555*ep2^6 - 1011712/684765375525*ep2^7 + 106496/76085041725*ep2^8 - 851968/641288208825*ep2^9 + 49414144/39118580738325*ep2^10) * k2^19
        - (323/133648515 - 646/286389675*ep2 + 2584/1223664975*ep2^2 - 5168/2606938425*ep2^3 + 4864/2606938425*ep2^4 - 9728/5526709461*ep2^5 + 38912/23382232335*ep2^6 - 4096/2598025815*ep2^7 + 32768/21897646155*ep2^8 - 1900544/1335756415455*ep2^9) * k2^20
        + (323/128764350 - 646/275087475*ep2 + 1292/586055925*ep2^2 - 1216/586055925*ep2^3 + 2432/1242438561*ep2^4 - 9728/5256470835*ep2^5 + 1024/584052315*ep2^6 - 8192/4922726655*ep2^7 + 16384/10354700895*ep2^8) * k2^21
        - (3553/1375437375 - 7106/2930279625*ep2 + 6688/2930279625*ep2^2 - 13376/6212192805*ep2^3 + 4864/2389304925*ep2^4 - 512/265478325*ep2^5 + 4096/2237603025*ep2^6 - 8192/4706682225*ep2^7) * k2^22
        + (81719/30923802000 - 4807/1932737625*ep2 + 9614/4097403765*ep2^2 - 3496/1575924525*ep2^3 + 368/175102725*ep2^4 - 2944/1475865825*ep2^5 + 5888/3104407425*ep2^6) * k2^23
        - (4807/1788111000 - 4807/1895397660*ep2 + 437/182249775*ep2^2 - 46/20249975*ep2^3 + 2576/1194748525*ep2^4 - 5152/2513091725*ep2^5) * k2^24
        + (2185/802756656 - 437/169813908*ep2 + 23/9434106*ep2^2 - 644/278306127*ep2^3 + 1288/585402543*ep2^4) * k2^25
        - (299/108937224 - 299/114989292*ep2 + 4186/1696092057*ep2^2 - 8372/3567641913*ep2^3) * k2^26
        + (897/325222240 - 897/342644860*ep2 + 897/360367870*ep2^2) * k2^27
        - (299/108203640 - 299/113800380*ep2) * k2^28
        + 8671/3140118960 * k2^29;
C4[8] = + (1/141338340 - 1/164894730*ep2 + 2/379257879*ep2^2 - 4/861949725*ep2^3 + 32/7757547525*ep2^4 - 64/17305298325*ep2^5 + 256/76637749725*ep2^6 - 512/168603049395*ep2^7 + 16384/5901106728825*ep2^8 - 32768/12843585233325*ep2^9 + 131072/55655536011075*ep2^10 - 262144/120098788234425*ep2^11 + 2097152/1032849578816055*ep2^12 - 4194304/2213249097462975*ep2^13 + 16777216/9456609780069075*ep2^14 - 33554432/20146690401016725*ep2^15 + 536870912/342493736817284325*ep2^16 - 1073741824/726086722052642769*ep2^17 + 4294967296/3071905362530411715*ep2^18 - 8589934592/6485133543119758065*ep2^19 + 68719476736/54660411292009389405*ep2^20 - 137438953472/114975347890088715645*ep2^21) * k2^8
        - (1/34714680 - 1/39921882*ep2 + 1/45365775*ep2^2 - 8/408291975*ep2^3 + 16/910805175*ep2^4 - 64/4033565775*ep2^5 + 128/8873844705*ep2^6 - 4096/310584564675*ep2^7 + 8192/675978170175*ep2^8 - 32768/2929238737425*ep2^9 + 1245184/120098788234425*ep2^10 - 9961472/1032849578816055*ep2^11 + 19922944/2213249097462975*ep2^12 - 79691776/9456609780069075*ep2^13 + 159383552/20146690401016725*ep2^14 - 2550136832/342493736817284325*ep2^15 + 5100273664/726086722052642769*ep2^16 - 20401094656/3071905362530411715*ep2^17 + 2147483648/341322818058934635*ep2^18 - 17179869184/2876863752211020495*ep2^19 + 34359738368/6051334099478353455*ep2^20) * k2^9
        + (5/72239596 - 1/16418090*ep2 + 4/73881405*ep2^2 - 8/164812365*ep2^3 + 224/5109183315*ep2^4 - 448/11240203293*ep2^5 + 2048/56201016465*ep2^6 - 4096/122319859365*ep2^7 + 16384/530052723915*ep2^8 - 32768/1143797983185*ep2^9 + 262144/9836662655391*ep2^10 - 3670016/147549939830865*ep2^11 + 14680064/630440652004605*ep2^12 - 4194304/191873241914445*ep2^13 + 67108864/3261845112545565*ep2^14 - 671088640/34575558192982989*ep2^15 + 536870912/29256241547908683*ep2^16 - 1073741824/61763176601140553*ep2^17 + 8589934592/520575345638184661*ep2^18 - 17179869184/1095003313238940149*ep2^19) * k2^10
        - (11/85659600 - 11/96367050*ep2 + 11/107486325*ep2^2 - 308/3332076075*ep2^3 + 56/666415215*ep2^4 - 256/3332076075*ep2^5 + 512/7252165575*ep2^6 - 2048/31426050825*ep2^7 + 4096/67814109675*ep2^8 - 32768/583201343205*ep2^9 + 458752/8748020148075*ep2^10 - 20185088/411156946959525*ep2^11 + 132644864/2878098628716675*ep2^12 - 2122317824/48927676688183475*ep2^13 + 4244635648/103726674578948967*ep2^14 - 1543503872/39894874838057295*ep2^15 + 3087007744/84222513547009845*ep2^16 - 24696061952/709875471324797265*ep2^17 + 49392123904/1493186336234918385*ep2^18) * k2^11
        + (11/53965548 - 11/60192342*ep2 + 22/133283043*ep2^2 - 20/133283043*ep2^3 + 128/932981301*ep2^4 - 256/2030606361*ep2^5 + 1024/8799294231*ep2^6 - 2048/18987950709*ep2^7 + 81920/816481880487*ep2^8 - 32768/349920805923*ep2^9 + 1441792/16446277878381*ep2^10 - 66322432/805867616040669*ep2^11 + 1061158912/13699749472691373*ep2^12 - 53057945600/726086722052642769*ep2^13 + 3858759680/55852824773280213*ep2^14 - 7717519360/117911518965813783*ep2^15 + 61740154880/993825659854716171*ep2^16 - 123480309760/2090460870728885739*ep2^17) * k2^12
        - (13/44586920 - 13/49364090*ep2 + 13/54300499*ep2^2 - 416/1900517465*ep2^3 + 832/4136420365*ep2^4 - 768/4136420365*ep2^5 + 1536/8925959735*ep2^6 - 12288/76763253721*ep2^7 + 8192/54830895515*ep2^8 - 32768/234277462655*ep2^9 + 1507328/11479595670095*ep2^10 - 24117248/195153126391615*ep2^11 + 241172480/2068623139751119*ep2^12 - 2508193792/22754854537262309*ep2^13 + 45147488256/432342236207983871*ep2^14 - 361179906048/3644027419467292627*ep2^15 + 722359812096/7665023192672581043*ep2^16) * k2^13
        + (91/234904980 - 91/258395478*ep2 + 208/645988695*ep2^2 - 416/1405975395*ep2^3 + 128/468658465*ep2^4 - 256/1011315635*ep2^5 + 2048/8697314461*ep2^6 - 28672/130459716915*ep2^7 + 114688/557418790455*ep2^8 - 32768/169649197095*ep2^9 + 524288/2884036350615*ep2^10 - 5242880/30570785316519*ep2^11 + 54525952/336278638481709*ep2^12 - 327155712/2129764710384157*ep2^13 + 2617245696/17950873987523609*ep2^14 - 151800250368/1095003313238940149*ep2^15) * k2^14
        - (65/133365408 - 13/29173683*ep2 + 26/63495663*ep2^2 - 8/21165221*ep2^3 + 16/45672319*ep2^4 - 640/1963909717*ep2^5 + 256/841675593*ep2^6 - 1024/3596250261*ep2^7 + 2048/7661576643*ep2^8 - 32768/130246802931*ep2^9 + 1638400/6903080555343*ep2^10 - 17039360/75933886108773*ep2^11 + 102236160/480914612022229*ep2^12 - 817889280/4053423158473073*ep2^13 + 47437578240/247258812666857453*ep2^14) * k2^15
        + (13/22101275 - 26/48102775*ep2 + 24/48102775*ep2^2 - 48/103800725*ep2^3 + 384/892686235*ep2^4 - 256/637633025*ep2^5 + 11264/29968752175*ep2^6 - 22528/63846472025*ep2^7 + 360448/1085390024425*ep2^8 - 720896/2301026851781*ep2^9 + 3407872/11505134258905*ep2^10 - 61341696/218597550919195*ep2^11 + 490733568/1842465072033215*ep2^12 - 28462546944/112390369394026115*ep2^13) * k2^16
        - (1/1455210 - 2/3152955*ep2 + 4/6803745*ep2^2 - 32/58512207*ep2^3 + 448/877683105*ep2^4 - 19712/41251105935*ep2^5 + 5632/12554684415*ep2^6 - 90112/213429635055*ep2^7 + 901120/2262354131583*ep2^8 - 65536/174027240891*ep2^9 + 131072/367390841881*ep2^10 - 1048576/3096579952997*ep2^11 + 60817408/188891377132817*ep2^12) * k2^17
        + (1/1278225 - 2/2758275*ep2 + 16/23721165*ep2^2 - 224/355817475*ep2^3 + 9856/16723421325*ep2^4 - 2816/5089736925*ep2^5 + 45056/86525527725*ep2^6 - 90112/183434118777*ep2^7 + 32768/70551584145*ep2^8 - 65536/148942233195*ep2^9 + 524288/1255370251215*ep2^10 - 30408704/76577585324115*ep2^11) * k2^18
        - (19/21783300 - 38/46834095*ep2 + 76/100358775*ep2^2 - 304/428805675*ep2^3 + 608/913542525*ep2^4 - 9728/15530222925*ep2^5 + 19456/32924072601*ep2^6 - 1011712/1810823993055*ep2^7 + 106496/201202665895*ep2^8 - 851968/1695851041115*ep2^9 + 49414144/103446913508015*ep2^10) * k2^19
        + (19/19875933 - 38/42591285*ep2 + 152/181980945*ep2^2 - 304/387698535*ep2^3 + 4864/6590875095*ep2^4 - 48640/69863276007*ep2^5 + 505856/768496036077*ep2^6 - 53248/85388448453*ep2^7 + 425984/719702636961*ep2^8 - 851968/1513857270849*ep2^9) * k2^20
        - (133/128764350 - 266/275087475*ep2 + 76/83722275*ep2^2 - 1216/1423278675*ep2^3 + 2432/3017350791*ep2^4 - 9728/12765714885*ep2^5 + 1024/1418412765*ep2^6 - 8192/11955193305*ep2^7 + 16384/25147130745*ep2^8) * k2^21
        + (209/189504705 - 418/403727415*ep2 + 6688/6863366055*ep2^2 - 66880/72751680183*ep2^3 + 4864/5596283091*ep2^4 - 1536/1865427697*ep2^5 + 12288/15722890589*ep2^6 - 24576/33072287101*ep2^7) * k2^22
        - (4807/4123173600 - 4807/4380871950*ep2 + 4807/4643724267*ep2^2 - 1748/1786047795*ep2^3 + 184/198449755*ep2^4 - 1472/1672647935*ep2^5 + 2944/3518328415*ep2^6) * k2^23
        + (437/357622200 - 437/379079532*ep2 + 437/400949505*ep2^2 - 46/44549945*ep2^3 + 2576/2628446755*ep2^4 - 5152/5528801795*ep2^5) * k2^24
        - (10925/8592469392 - 2185/1817637756*ep2 + 345/302939626*ep2^2 - 9660/8936718967*ep2^3 + 19320/18797926103*ep2^4) * k2^25
        + (5681/4321176552 - 299/240065364*ep2 + 598/505852017*ep2^2 - 1196/1064033553*ep2^3) * k2^26
        - (1495/1105755616 - 1495/1164992524*ep2 + 1495/1225250758*ep2^2) * k2^27
        + (6279/4537339304 - 6279/4772029268*ep2) * k2^28
        - 8671/6147020752 * k2^29;
C4[9] = + (1/737176440 - 1/847752906*ep2 + 1/963355575*ep2^2 - 8/8670200175*ep2^3 + 16/19341215775*ep2^4 - 64/85653955575*ep2^5 + 128/188438702265*ep2^6 - 4096/6595354579275*ep2^7 + 8192/14354595260775*ep2^8 - 32768/62203246130025*ep2^9 + 65536/134228057438475*ep2^10 - 524288/1154361293970885*ep2^11 + 1048576/2473631344223325*ep2^12 - 4194304/10569152107136025*ep2^13 + 8388608/22516889271724575*ep2^14 - 134217728/382787117619317775*ep2^15 + 268435456/811508689352953683*ep2^16 - 1073741824/3433305993416342505*ep2^17 + 2147483648/7248090430545611955*ep2^18 - 17179869184/61091047914598729335*ep2^19 + 34359738368/128501859406569741015*ep2^20) * k2^9
        - (1/161476744 - 1/183496300*ep2 + 2/412866675*ep2^2 - 4/921010275*ep2^3 + 112/28551318525*ep2^4 - 224/62812900755*ep2^5 + 1024/314064503775*ep2^6 - 2048/683552155275*ep2^7 + 8192/2962059339525*ep2^8 - 16384/6391812258975*ep2^9 + 131072/54969585427185*ep2^10 - 1835008/824543781407775*ep2^11 + 7340032/3523050702378675*ep2^12 - 2097152/1072232822463075*ep2^13 + 33554432/18227957981872275*ep2^14 - 67108864/38643270921569223*ep2^15 + 268435456/163490761591254405*ep2^16 - 536870912/345147163359314855*ep2^17 + 4294967296/2909097519742796635*ep2^18 - 8589934592/6119136162217606715*ep2^19) * k2^10
        + (11/670160400 - 11/753930450*ep2 + 11/840922425*ep2^2 - 44/3724085025*ep2^3 + 8/744817005*ep2^4 - 256/26068595175*ep2^5 + 512/56737530675*ep2^6 - 2048/245862632925*ep2^7 + 4096/530545681575*ep2^8 - 32768/4562692861545*ep2^9 + 65536/9777198989025*ep2^10 - 2883584/459528352484175*ep2^11 + 132644864/22516889271724575*ep2^12 - 2122317824/382787117619317775*ep2^13 + 4244635648/811508689352953683*ep2^14 - 1543503872/312118726674212955*ep2^15 + 3087007744/658917311867782905*ep2^16 - 24696061952/5553731628599884485*ep2^17 + 49392123904/11681987218779067365*ep2^18) * k2^11
        - (1/30157218 - 1/33636897*ep2 + 4/148963401*ep2^2 - 40/1638597411*ep2^3 + 256/11470181877*ep2^4 - 512/24964513497*ep2^5 + 2048/108179558487*ep2^6 - 4096/233440099893*ep2^7 + 163840/10037924295399*ep2^8 - 65536/4301967555171*ep2^9 + 262144/18381134099367*ep2^10 - 12058624/900675570868983*ep2^11 + 192937984/15311484704772711*ep2^12 - 9646899200/811508689352953683*ep2^13 + 7717519360/686661198683268501*ep2^14 - 15435038720/1449618086109122391*ep2^15 + 123480309760/12218209582919745867*ep2^16 - 246960619520/25700371881313948203*ep2^17) * k2^12
        + (13/229229224 - 13/253789498*ep2 + 65/1395842239*ep2^2 - 416/9770895673*ep2^3 + 832/21266067053*ep2^4 - 768/21266067053*ep2^5 + 1536/45889934167*ep2^6 - 61440/1973267169181*ep2^7 + 8192/281895309883*ep2^8 - 32768/1204461778591*ep2^9 + 65536/2566027267433*ep2^10 - 1048576/43622463546361*ep2^11 + 52428800/2311990567957133*ep2^12 - 545259520/25431896247528463*ep2^13 + 9814671360/483206028703040797*ep2^14 - 78517370880/4072736527639915289*ep2^15 + 157034741760/8566790627104649401*ep2^16) * k2^13
        - (91/1050163440 - 91/1155179784*ep2 + 52/721987365*ep2^2 - 104/1571384265*ep2^3 + 32/523794755*ep2^4 - 64/1130293945*ep2^5 + 512/9720527927*ep2^6 - 7168/145807918905*ep2^7 + 28672/622997471685*ep2^8 - 8192/189607926165*ep2^9 + 131072/3223334744805*ep2^10 - 1310720/34167348294933*ep2^11 + 13631488/375840831244263*ep2^12 - 81788928/2380325264546999*ep2^13 + 654311424/20062741515467563*ep2^14 - 37950062592/1223827232443521343*ep2^15) * k2^14
        + (91/745277280 - 13/116449575*ep2 + 26/253449075*ep2^2 - 8/84483025*ep2^3 + 16/182305475*ep2^4 - 128/1567827085*ep2^5 + 1792/23517406275*ep2^6 - 7168/100483463175*ep2^7 + 2048/30581923575*ep2^8 - 32768/519892700775*ep2^9 + 65536/1102172525643*ep2^10 - 3407872/60619488910365*ep2^11 + 20447232/383923429765645*ep2^12 - 163577856/3235926050881865*ep2^13 + 9487515648/197391489103793765*ep2^14) * k2^15
        - (4/24701425 - 8/53761925*ep2 + 96/698905025*ep2^2 - 192/1508163475*ep2^3 + 1536/12970205885*ep2^4 - 1024/9264432775*ep2^5 + 45056/435428340425*ep2^6 - 90112/927651681775*ep2^7 + 1441792/15770078590175*ep2^8 - 2883584/33432566611171*ep2^9 + 1048576/12858679465835*ep2^10 - 18874368/244314909850865*ep2^11 + 150994944/2059225668743005*ep2^12 - 8757706752/125612765793323305*ep2^13) * k2^16
        + (17/82946970 - 34/179718435*ep2 + 68/387813465*ep2^2 - 544/3335195799*ep2^3 + 7616/50027936985*ep2^4 - 335104/2351313038295*ep2^5 + 95744/715617011655*ep2^6 - 90112/715617011655*ep2^7 + 901120/7585540323543*ep2^8 - 65536/583503101811*ep2^9 + 131072/1231839881601*ep2^10 - 1048576/10382650430637*ep2^11 + 60817408/633341676268857*ep2^12) * k2^17
        - (17/68001570 - 17/73370115*ep2 + 136/630982989*ep2^2 - 272/1352106405*ep2^3 + 11968/63549001035*ep2^4 - 23936/135387002205*ep2^5 + 22528/135387002205*ep2^6 - 225280/1435102223373*ep2^7 + 16384/110392478721*ep2^8 - 32768/233050788411*ep2^9 + 262144/1964285216607*ep2^10 - 15204352/119821398213027*ep2^11) * k2^18
        + (17/57428700 - 34/123471705*ep2 + 68/264582225*ep2^2 - 2992/12435364575*ep2^3 + 5984/26492733225*ep2^4 - 5632/26492733225*ep2^5 + 11264/56164594437*ep2^6 - 53248/280822972185*ep2^7 + 106496/592848496835*ep2^8 - 851968/4996865901895*ep2^9 + 1703936/10510648966055*ep2^10) * k2^19
        - (34/99379665 - 68/212956425*ep2 + 272/909904725*ep2^2 - 544/1938492675*ep2^3 + 512/1938492675*ep2^4 - 1024/4109604471*ep2^5 + 53248/226028245905*ep2^6 - 106496/477170741355*ep2^7 + 851968/4021867677135*ep2^8 - 1703936/8459790631215*ep2^9) * k2^20
        + (119/307053450 - 238/655977825*ep2 + 68/199645425*ep2^2 - 64/199645425*ep2^3 + 128/423248301*ep2^4 - 6656/23278656555*ep2^5 + 13312/49143830505*ep2^6 - 106496/414212285685*ep2^7 + 212992/871274118165*ep2^8) * k2^21
        - (1309/3032075280 - 187/461402760*ep2 + 22/57675345*ep2^2 - 220/611358657*ep2^3 + 16/47027589*ep2^4 - 96/297841397*ep2^5 + 768/2510377489*ep2^6 - 1536/5280449201*ep2^7) * k2^22
        + (391/824634720 - 23/51539670*ep2 + 115/273160251*ep2^2 - 92/231135597*ep2^3 + 184/487952927*ep2^4 - 1472/4112746099*ep2^5 + 2944/8650948691*ep2^6) * k2^23
        - (23/44702775 - 46/94769883*ep2 + 184/400949505*ep2^2 - 368/846448955*ep2^3 + 20608/49940488345*ep2^4 - 41216/105047234105*ep2^5) * k2^24
        + (115/208122096 - 23/44025828*ep2 + 69/139415122*ep2^2 - 276/587535157*ep2^3 + 552/1235849813*ep2^4) * k2^25
        - (299/508373712 - 299/536616696*ep2 + 299/565364019*ep2^2 - 598/1189213971*ep2^3) * k2^26
        + (1495/2406644576 - 1495/2535571964*ep2 + 1495/2666722238*ep2^2) * k2^27
        - (31395/48175867316 - 31395/50667722522*ep2) * k2^28
        + 4669/6870199664 * k2^29;
C4[10] = + (1/3747960216 - 1/4259045700*ep2 + 2/9582852825*ep2^2 - 4/21377133225*ep2^3 + 16/94670161425*ep2^4 - 32/208274355135*ep2^5 + 1024/7289602429725*ep2^6 - 2048/15865605288225*ep2^7 + 8192/68750956248975*ep2^8 - 16384/148357326642525*ep2^9 + 131072/1275873009125715*ep2^10 - 262144/2734013590983675*ep2^11 + 1048576/11681694434202975*ep2^12 - 2097152/24887088142432425*ep2^13 + 33554432/423080498421351225*ep2^14 - 67108864/896930656653264597*ep2^15 + 268435456/3794706624302273295*ep2^16 - 536870912/8011047317971465845*ep2^17 + 4294967296/67521684537188069265*ep2^18 - 8589934592/142028370923050766385*ep2^19) * k2^10
        - (1/740703600 - 1/833291550*ep2 + 1/929440575*ep2^2 - 4/4116093975*ep2^3 + 8/9055406745*ep2^4 - 256/316939236075*ep2^5 + 512/689808925575*ep2^6 - 2048/2989172010825*ep2^7 + 4096/6450318549675*ep2^8 - 32768/55472739527205*ep2^9 + 65536/118870156129725*ep2^10 - 262144/507899758008825*ep2^11 + 12058624/24887088142432425*ep2^12 - 192937984/423080498421351225*ep2^13 + 385875968/896930656653264597*ep2^14 - 1543503872/3794706624302273295*ep2^15 + 3087007744/8011047317971465845*ep2^16 - 24696061952/67521684537188069265*ep2^17 + 49392123904/142028370923050766385*ep2^18) * k2^11
        + (1/255542742 - 1/285028443*ep2 + 4/1262268819*ep2^2 - 40/13884957009*ep2^3 + 256/97194699063*ep2^4 - 512/211541403843*ep2^5 + 2048/916679416653*ep2^6 - 4096/1978097688567*ep2^7 + 163840/85058200608381*ep2^8 - 65536/36453514546449*ep2^9 + 262144/155755925789373*ep2^10 - 524288/331827841899099*ep2^11 + 8388608/5641073312284683*ep2^12 - 419430400/298976885551088199*ep2^13 + 335544320/252980441620151553*ep2^14 - 671088640/534069821198097723*ep2^15 + 5368709120/4501445635812537951*ep2^16 - 10737418240/9468558061536717759*ep2^17) * k2^12
        - (13/1520151696 - 13/1683025092*ep2 + 65/9256638006*ep2^2 - 208/32398233021*ep2^3 + 416/70513801281*ep2^4 - 128/23504600427*ep2^5 + 256/50720453553*ep2^6 - 10240/2180979502779*ep2^7 + 4096/934705501191*ep2^8 - 16384/3993741686907*ep2^9 + 32768/8508406202541*ep2^10 - 524288/144642905443197*ep2^11 + 26214400/7666073988489441*ep2^12 - 272629760/84326813873383851*ep2^13 + 545259520/178023273732699241*ep2^14 - 4362076160/1500481878604179317*ep2^15 + 8724152320/3156186020512239253*ep2^16) * k2^13
        + (13/829076400 - 13/911984040*ep2 + 52/3989930175*ep2^2 - 104/8683965675*ep2^3 + 32/2894655225*ep2^4 - 64/6246361275*ep2^5 + 512/53718706965*ep2^6 - 1024/115111514925*ep2^7 + 4096/491840109225*ep2^8 - 8192/1047833276175*ep2^9 + 131072/17813165694975*ep2^10 - 262144/37763911273347*ep2^11 + 13631488/2077015120034085*ep2^12 - 27262976/4384809697849735*ep2^13 + 218103808/36957681739019195*ep2^14 - 12650020864/2254418586080170895*ep2^15) * k2^14
        - (1/39225120 - 1/42902475*ep2 + 2/93375975*ep2^2 - 8/404629225*ep2^3 + 16/873147275*ep2^4 - 128/7509066565*ep2^5 + 256/16090856925*ep2^6 - 1024/68751843225*ep2^7 + 2048/146471318175*ep2^8 - 32768/2490012408975*ep2^9 + 65536/5278826307027*ep2^10 - 262144/22333495914345*ep2^11 + 1572864/141445474124185*ep2^12 - 12582912/1192183281903845*ep2^13 + 729808896/72723180196134545*ep2^14) * k2^15
        + (4/105306075 - 8/229195575*ep2 + 32/993180825*ep2^2 - 64/2143179675*ep2^3 + 512/18431345205*ep2^4 - 1024/39495739725*ep2^5 + 45056/1856299767075*ep2^6 - 90112/3954725590725*ep2^7 + 1441792/67230335042325*ep2^8 - 2883584/142528310289729*ep2^9 + 1048576/54818580880665*ep2^10 - 2097152/115728115192515*ep2^11 + 16777216/975422685194055*ep2^12 - 973078528/59500783796837355*ep2^13) * k2^16
        - (17/320873805 - 68/1390453155*ep2 + 136/3000451545*ep2^2 - 1088/25803883287*ep2^3 + 2176/55294035615*ep2^4 - 95744/2598819673905*ep2^5 + 191488/5536615827015*ep2^6 - 180224/5536615827015*ep2^7 + 1802240/58688127766359*ep2^8 - 131072/4514471366643*ep2^9 + 262144/9530550662913*ep2^10 - 2097152/80328927015981*ep2^11 + 121634816/4900064547974841*ep2^12) * k2^17
        + (17/242181030 - 17/261300585*ep2 + 136/2247185031*ep2^2 - 272/4815396495*ep2^3 + 11968/226323635265*ep2^4 - 23936/482167744695*ep2^5 + 22528/482167744695*ep2^6 - 225280/5110978093767*ep2^7 + 16384/393152161059*ep2^8 - 32768/829987895569*ep2^9 + 262144/6995612262653*ep2^10 - 524288/14714908552477*ep2^11) * k2^18
        - (323/3618008100 - 646/7778717415*ep2 + 1292/16668680175*ep2^2 - 56848/783427968225*ep2^3 + 113696/1669042193175*ep2^4 - 107008/1669042193175*ep2^5 + 214016/3538369449531*ep2^6 - 1011712/17691847247655*ep2^7 + 106496/1965760805295*ep2^8 - 851968/16568555358915*ep2^9 + 1703936/34851099203235*ep2^10) * k2^19
        + (646/5881469265 - 1292/12603148425*ep2 + 56848/592347975975*ep2^2 - 113696/1261958731425*ep2^3 + 107008/1261958731425*ep2^4 - 214016/2675352510621*ep2^5 + 1011712/13376762553105*ep2^6 - 106496/1486306950345*ep2^7 + 851968/12527444295765*ep2^8 - 1703936/26350831104885*ep2^9) * k2^20
        - (323/2456427600 - 323/2623911300*ep2 + 323/2795035950*ep2^2 - 152/1397517975*ep2^3 + 304/2962738107*ep2^4 - 15808/162950595885*ep2^5 + 1664/18105621765*ep2^6 - 13312/152604526305*ep2^7 + 26624/320995727745*ep2^8) * k2^21
        + (323/2099129040 - 323/2236028760*ep2 + 38/279503595*ep2^2 - 380/2962738107*ep2^3 + 3952/32590119177*ep2^4 - 416/3621124353*ep2^5 + 3328/30520905261*ep2^6 - 6656/64199145549*ep2^7) * k2^22
        - (437/2473904160 - 437/2628523170*ep2 + 2185/13931172801*ep2^2 - 1748/11787915447*ep2^3 + 184/1309768383*ep2^4 - 1472/11039476371*ep2^5 + 2944/23220967539*ep2^6) * k2^23
        + (437/2190435975 - 874/4643724267*ep2 + 3496/19646525745*ep2^2 - 368/2182947305*ep2^3 + 2944/18399127285*ep2^4 - 5888/38701612565*ep2^5) * k2^24
        - (2185/9833769036 - 437/2080220373*ep2 + 46/231135597*ep2^2 - 368/1948142889*ep2^3 + 736/4097817801*ep2^4) * k2^25
        + (5681/23235669072 - 299/1290870504*ep2 + 299/1360024281*ep2^2 - 598/2860740729*ep2^3) * k2^26
        - (4485/16846512032 - 4485/17749003748*ep2 + 4485/18667055666*ep2^2) * k2^27
        + (115/400353468 - 115/421061406*ep2) * k2^28
        - 667/2169536736 * k2^29;
C4[11] = + (1/18658676400 - 1/20991010950*ep2 + 1/23413050675*ep2^2 - 4/103686367275*ep2^3 + 8/228110008005*ep2^4 - 256/7983850280175*ep2^5 + 512/17376615315675*ep2^6 - 2048/75298666367925*ep2^7 + 4096/162486595846575*ep2^8 - 32768/1397384724280545*ep2^9 + 65536/2994395837744025*ep2^10 - 262144/12794236761269925*ep2^11 + 524288/27257287013140275*ep2^12 - 8388608/463373879223384675*ep2^13 + 16777216/982352623953575511*ep2^14 - 67108864/4156107255188204085*ep2^15 + 134217728/8774004205397319735*ep2^16 - 1073741824/73952321159777409195*ep2^17 + 2147483648/155554882439531791755*ep2^18) * k2^11
        - (1/3358561752 - 1/3746088108*ep2 + 1/4147454691*ep2^2 - 10/45622001601*ep2^3 + 64/319354011207*ep2^4 - 128/695064612627*ep2^5 + 512/3011946654717*ep2^6 - 1024/6499463833863*ep2^7 + 40960/279476944856109*ep2^8 - 16384/119775833509761*ep2^9 + 65536/511769470450797*ep2^10 - 131072/1090291480525611*ep2^11 + 2097152/18534955168935387*ep2^12 - 104857600/982352623953575511*ep2^13 + 83886080/831221451037640817*ep2^14 - 167772160/1754800841079463947*ep2^15 + 1342177280/14790464231955481839*ep2^16 - 2684354560/31110976487906358351*ep2^17) * k2^12
        + (13/13874400400 - 13/15360943300*ep2 + 13/16897037630*ep2^2 - 208/295698158525*ep2^3 + 416/643578345025*ep2^4 - 384/643578345025*ep2^5 + 768/1388774323475*ep2^6 - 6144/11943459181885*ep2^7 + 4096/8531042272775*ep2^8 - 16384/36450816983675*ep2^9 + 32768/77656088356525*ep2^10 - 524288/1320153502060925*ep2^11 + 1048576/2798725424369161*ep2^12 - 54525952/153929898340303855*ep2^13 + 981467136/2924668068465773245*ep2^14 - 7851737088/24650773719925803065*ep2^15 + 15703474176/51851627479843930585*ep2^16) * k2^13
        - (7/3178126200 - 7/3495938820*ep2 + 8/4369923525*ep2^2 - 16/9511010025*ep2^3 + 64/41214376775*ep2^4 - 128/88936286725*ep2^5 + 1024/764852065835*ep2^6 - 14336/11472780987525*ep2^7 + 57344/49020064219425*ep2^8 - 16384/14919149979825*ep2^9 + 262144/253625549657025*ep2^10 - 524288/537686165272893*ep2^11 + 2097152/2274826083846855*ep2^12 - 12582912/14407231864363415*ep2^13 + 100663296/121432382856777355*ep2^14 - 5838471168/7407375354263418655*ep2^15) * k2^14
        + (7/1623919968 - 1/253737495*ep2 + 2/552252195*ep2^2 - 8/2393092845*ep2^3 + 16/5164042455*ep2^4 - 128/44410765113*ep2^5 + 1792/666161476695*ep2^6 - 7168/2846326309515*ep2^7 + 2048/866273224635*ep2^8 - 32768/14726644818795*ep2^9 + 327680/156102435079227*ep2^10 - 262144/132086675836269*ep2^11 + 524288/278849648987679*ep2^12 - 4194304/2350304184324723*ep2^13 + 243269632/143368555243808103*ep2^14) * k2^15
        - (2/269115525 - 4/585722025*ep2 + 16/2538128775*ep2^2 - 32/5477014725*ep2^3 + 256/47102326635*ep2^4 - 512/100933557075*ep2^5 + 22528/4743877182525*ep2^6 - 45056/10106520954075*ep2^7 + 720896/171810856219275*ep2^8 - 1441792/364239015184863*ep2^9 + 524288/140091928917255*ep2^10 - 1048576/295749627714205*ep2^11 + 8388608/2492746862162585*ep2^12 - 486539264/152057558591917685*ep2^13) * k2^16
        + (17/1455937605 - 68/6309062955*ep2 + 136/13614293745*ep2^2 - 1088/117082926207*ep2^3 + 15232/1756243893105*ep2^4 - 670208/82543462975935*ep2^5 + 191488/25121923514415*ep2^6 - 180224/25121923514415*ep2^7 + 1802240/266292389252799*ep2^8 - 131072/20484029942523*ep2^9 + 262144/43244063211993*ep2^10 - 2097152/364485675643941*ep2^11 + 4194304/766676766009669*ep2^12) * k2^17
        - (34/1989344175 - 68/4292795325*ep2 + 544/36918039795*ep2^2 - 1088/79110085275*ep2^3 + 47872/3718174007925*ep2^4 - 95744/7921327234275*ep2^5 + 90112/7921327234275*ep2^6 - 180224/16793213736663*ep2^7 + 65536/6458928360255*ep2^8 - 131072/13635515427205*ep2^9 + 1048576/114927915743585*ep2^10 - 2097152/241744926219265*ep2^11) * k2^18
        + (323/13648887700 - 646/29345108555*ep2 + 1292/62882375475*ep2^2 - 56848/2955471647325*ep2^3 + 113696/6296439596475*ep2^4 - 107008/6296439596475*ep2^5 + 214016/13348451944527*ep2^6 - 1011712/66742259722635*ep2^7 + 319488/22247419907545*ep2^8 - 2555904/187513967792165*ep2^9 + 5111808/394425932252485*ep2^10) * k2^19
        - (323/10306574712 - 323/11042758620*ep2 + 3553/129752413785*ep2^2 - 7106/276429055455*ep2^3 + 6688/276429055455*ep2^4 - 66880/2930147987823*ep2^5 + 63232/2930147987823*ep2^6 - 6656/325571998647*ep2^7 + 53248/2744106845739*ep2^8 - 106496/5772086813451*ep2^9) * k2^20
        + (2261/56497834800 - 2261/60349959900*ep2 + 323/9183689550*ep2^2 - 152/4591844775*ep2^3 + 304/9734710923*ep2^4 - 15808/535409100765*ep2^5 + 1664/59489900085*ep2^6 - 13312/501414872145*ep2^7 + 26624/1054700248305*ep2^8) * k2^21
        - (133/2682220440 - 19/408163980*ep2 + 76/1734696915*ep2^2 - 760/18387787299*ep2^3 + 7904/202265660289*ep2^4 - 2496/67421886763*ep2^5 + 19968/568270188431*ep2^6 - 39936/1195326948079*ep2^7) * k2^22
        + (19/317167200 - 19/336990150*ep2 + 19/357209559*ep2^2 - 988/19646525745*ep2^3 + 104/2182947305*ep2^4 - 832/18399127285*ep2^5 + 1664/38701612565*ep2^6) * k2^23
        - (19/268216650 - 19/284309649*ep2 + 76/1202848515*ep2^2 - 8/133649835*ep2^3 + 448/7885340265*ep2^4 - 896/16586405385*ep2^5) * k2^24
        + (475/5775388164 - 95/1221716727*ep2 + 10/135746303*ep2^2 - 80/1144147411*ep2^3 + 160/2406654899*ep2^4) * k2^25
        - (13/138307554 - 13/145991307*ep2 + 104/1230498159*ep2^2 - 208/2588289231*ep2^3) * k2^26
        + (15/141567328 - 15/149151292*ep2 + 15/156866014*ep2^2) * k2^27
        - (63/533804624 - 63/561415208*ep2) * k2^28
        + 203/1560543968 * k2^29;
C4[12] = + (1/91265265000 - 1/101795872500*ep2 + 1/112702573125*ep2^2 - 2/247945660875*ep2^3 + 64/8678098130625*ep2^4 - 128/18887625343125*ep2^5 + 512/81846376486875*ep2^6 - 1024/176615865050625*ep2^7 + 8192/1518896439435375*ep2^8 - 16384/3254778084504375*ep2^9 + 65536/13906779088336875*ep2^10 - 131072/29627485883848125*ep2^11 + 2097152/503667260025418125*ep2^12 - 4194304/1067774591253886425*ep2^13 + 16777216/4517507886074134875*ep2^14 - 33554432/9536961092823173625*ep2^15 + 268435456/80382957782366749125*ep2^16 - 536870912/169081393956012817125*ep2^17) * k2^12
        - (1/15080870000 - 1/16696677500*ep2 + 1/18366345250*ep2^2 - 16/321411041875*ep2^3 + 32/699541679375*ep2^4 - 384/9094041831875*ep2^5 + 768/19623985005625*ep2^6 - 6144/168766271048375*ep2^7 + 4096/120547336463125*ep2^8 - 16384/515065892160625*ep2^9 + 32768/1097314291994375*ep2^10 - 524288/18654342963904375*ep2^11 + 1048576/39547207083477275*ep2^12 - 4194304/167315106891634625*ep2^13 + 75497472/3178987030941057875*ep2^14 - 603979776/26794319260788916375*ep2^15 + 1207959552/56360464652004272375*ep2^16) * k2^13
        + (7/31090365000 - 7/34199401500*ep2 + 8/42749251875*ep2^2 - 16/93042489375*ep2^3 + 64/403184120625*ep2^4 - 128/870028891875*ep2^5 + 1024/7482248470125*ep2^6 - 14336/112233727051875*ep2^7 + 57344/479544106494375*ep2^8 - 16384/145948206324375*ep2^9 + 262144/2481119507514375*ep2^10 - 524288/5259973355930475*ep2^11 + 2097152/22253733428936625*ep2^12 - 4194304/46980103905532875*ep2^13 + 33554432/395975161489491375*ep2^14 - 1946157056/24154484850858973875*ep2^15) * k2^14
        - (1/1765130400 - 1/1930611375*ep2 + 2/4201918875*ep2^2 - 8/18208315125*ep2^3 + 16/39291627375*ep2^4 - 128/337907995425*ep2^5 + 256/724088561625*ep2^6 - 1024/3093832945125*ep2^7 + 2048/6591209317875*ep2^8 - 32768/112050558403875*ep2^9 + 65536/237547183816215*ep2^10 - 262144/1005007316145525*ep2^11 + 524288/2121682111862775*ep2^12 - 4194304/17882749228557675*ep2^13 + 243269632/1090847702942018175*ep2^14) * k2^15
        + (2/1696597875 - 4/3692595375*ep2 + 16/16001246625*ep2^2 - 32/34529005875*ep2^3 + 256/296949450525*ep2^4 - 512/636320251125*ep2^5 + 22528/29907051802875*ep2^6 - 45056/63715023406125*ep2^7 + 720896/1083155397904125*ep2^8 - 1441792/2296289443556745*ep2^9 + 524288/883188247521825*ep2^10 - 1048576/1864508522546075*ep2^11 + 8388608/15715143261459775*ep2^12 - 16777216/33055990998242975*ep2^13) * k2^16
        - (17/7912704375 - 68/34288385625*ep2 + 136/73990726875*ep2^2 - 1088/636320251125*ep2^3 + 15232/9544803766875*ep2^4 - 670208/448605777043125*ep2^5 + 191488/136532193013125*ep2^6 - 180224/136532193013125*ep2^7 + 360448/289448249187825*ep2^8 - 131072/111326249687625*ep2^9 + 262144/235022082673875*ep2^10 - 2097152/1980900411108375*ep2^11 + 4194304/4166721554400375*ep2^12) * k2^17
        + (34/9576035625 - 68/20664076875*ep2 + 544/177711061125*ep2^2 - 7616/2665665916875*ep2^3 + 335104/125286298093125*ep2^4 - 95744/38130612463125*ep2^5 + 90112/38130612463125*ep2^6 - 180224/80836898421825*ep2^7 + 65536/31091114777625*ep2^8 - 131072/65636797863875*ep2^9 + 1048576/553224439138375*ep2^10 - 2097152/1163678992670375*ep2^11) * k2^18
        - (323/59342990000 - 323/63793714250*ep2 + 323/68350408125*ep2^2 - 14212/3212469181875*ep2^3 + 28424/6843956083125*ep2^4 - 26752/6843956083125*ep2^5 + 53504/14509186896225*ep2^6 - 252928/72545934481125*ep2^7 + 79872/24181978160375*ep2^8 - 638976/203819530208875*ep2^9 + 1277952/428723839404875*ep2^10) * k2^19
        + (323/41076928200 - 323/44010994500*ep2 + 323/47011744125*ep2^2 - 646/100155454875*ep2^3 + 608/100155454875*ep2^4 - 1216/212329564335*ep2^5 + 63232/11678126038425*ep2^6 - 6656/1297569559825*ep2^7 + 53248/10936657718525*ep2^8 - 106496/23004693821725*ep2^9) * k2^20
        - (133/12282138000 - 133/13119556500*ep2 + 19/1996454250*ep2^2 - 152/16969861125*ep2^3 + 304/35976105585*ep2^4 - 15808/1978685807175*ep2^5 + 1664/219853978575*ep2^6 - 13312/1853054962275*ep2^7 + 26624/3897805265475*ep2^8) * k2^21
        + (209/14577285000 - 209/15527977500*ep2 + 836/65993904375*ep2^2 - 1672/139907077275*ep2^3 + 7904/699535386375*ep2^4 - 2496/233178462125*ep2^5 + 19968/1965361323625*ep2^6 - 39936/4134035887625*ep2^7) * k2^22
        - (437/23787540000 - 437/25274261250*ep2 + 437/26790716925*ep2^2 - 22724/1473489430875*ep2^3 + 2392/163721047875*ep2^4 - 19136/1379934546375*ep2^5 + 38272/2902620942375*ep2^6) * k2^23
        + (437/19084646250 - 437/20229725025*ep2 + 22724/1112634876375*ep2^2 - 2392/123626097375*ep2^3 + 133952/7293939745125*ep2^4 - 267904/15342424981125*ep2^5) * k2^24
        - (23/825055452 - 23/872654805*ep2 + 46/1842271255*ep2^2 - 2576/108694004045*ep2^3 + 5152/228632215405*ep2^4) * k2^25
        + (23/691537770 - 23/729956535*ep2 + 184/6152490795*ep2^2 - 368/12941446155*ep2^3) * k2^26
        - (69/1769591600 - 69/1864391150*ep2 + 69/1960825175*ep2^2) * k2^27
        + (1449/32185278800 - 1449/33850034600*ep2) * k2^28
        - 2001/39013599200 * k2^29;
C4[13] = + (1/439758169200 - 1/486875115900*ep2 + 1/535562627490*ep2^2 - 16/9372345981075*ep2^3 + 32/20398635370575*ep2^4 - 128/88394086605825*ep2^5 + 256/190745134254675*ep2^6 - 2048/1640408154590205*ep2^7 + 4096/3515160331264725*ep2^8 - 16384/15019321415403825*ep2^9 + 32768/31997684754555975*ep2^10 - 524288/543960640827451575*ep2^11 + 1048576/1153196558554197339*ep2^12 - 4194304/4878908516960065665*ep2^13 + 8388608/10299917980249027515*ep2^14 - 67108864/86813594404956089055*ep2^15 + 134217728/182607905472493842495*ep2^16) * k2^13
        - (1/67155188400 - 1/73870707240*ep2 + 4/323184344175*ep2^2 - 8/703401219675*ep2^3 + 32/3048071951925*ep2^4 - 64/6577418422575*ep2^5 + 512/56565798434145*ep2^6 - 1024/121212425216025*ep2^7 + 4096/517907635013925*ep2^8 - 8192/1103368439812275*ep2^9 + 131072/18757263476808675*ep2^10 - 262144/39765398570834391*ep2^11 + 1048576/168238224722760885*ep2^12 - 2097152/355169585525828535*ep2^13 + 16777216/2993572220860554795*ep2^14 - 973078528/182607905472493842495*ep2^15) * k2^14
        + (1/18427961376 - 1/20155582755*ep2 + 2/43868033055*ep2^2 - 8/190094809905*ep2^3 + 16/410204589795*ep2^4 - 128/3527759472237*ep2^5 + 256/7559484583365*ep2^6 - 1024/32299615947105*ep2^7 + 2048/68812225278615*ep2^8 - 32768/1169807829736455*ep2^9 + 327680/12399962995206423*ep2^10 - 262144/10492276380559281*ep2^11 + 524288/22150361247847371*ep2^12 - 4194304/186695901946142127*ep2^13 + 8388608/392705173059126543*ep2^14) * k2^15
        - (4/27484885575 - 8/59820045075*ep2 + 32/259220195325*ep2^2 - 64/559369895175*ep2^3 + 512/4810581098505*ep2^4 - 1024/10308388068225*ep2^5 + 45056/484494239206575*ep2^6 - 90112/1032183379179225*ep2^7 + 1441792/17547117446046825*ep2^8 - 2883584/37199888985619269*ep2^9 + 1048576/14307649609853565*ep2^10 - 2097152/30205038065246415*ep2^11 + 16777216/254585320835648355*ep2^12 - 33554432/535507054171536195*ep2^13) * k2^16
        + (17/52983468495 - 68/229595030145*ep2 + 136/495441907155*ep2^2 - 1088/4260800401533*ep2^3 + 15232/63912006022995*ep2^4 - 670208/3003864283080765*ep2^5 + 191488/914219564415885*ep2^6 - 180224/914219564415885*ep2^7 + 1802240/9690727382808381*ep2^8 - 131072/745440567908337*ep2^9 + 262144/1573707865584267*ep2^10 - 2097152/13264109152781679*ep2^11 + 4194304/27900367528264911*ep2^12) * k2^17
        - (17/27578982600 - 17/29756270700*ep2 + 34/63975982005*ep2^2 - 476/959639730075*ep2^3 + 20944/45103067313525*ep2^4 - 5984/13727020486725*ep2^5 + 5632/13727020486725*ep2^6 - 11264/29101283431857*ep2^7 + 4096/11192801319945*ep2^8 - 8192/23629247230995*ep2^9 + 65536/199160798089815*ep2^10 - 131072/418924437361335*ep2^11) * k2^18
        + (323/302140594800 - 323/324801139410*ep2 + 2261/2436008545575*ep2^2 - 9044/10408400149275*ep2^3 + 2584/3167773958475*ep2^4 - 2432/3167773958475*ep2^5 + 4864/6715680791967*ep2^6 - 252928/369362443558185*ep2^7 + 26624/41040271506465*ep2^8 - 212992/345910859840205*ep2^9 + 425984/727605601732845*ep2^10) * k2^19
        - (19/11090770614 - 19/11882968515*ep2 + 76/50772683655*ep2^2 - 152/108167891265*ep2^3 + 2432/1838854151505*ep2^4 - 24320/19491854005953*ep2^5 + 252928/214410394065483*ep2^6 - 26624/23823377118387*ep2^7 + 212992/200797035712119*ep2^8 - 425984/422366178566871*ep2^9) * k2^20
        + (19/7369282800 - 19/7871733900*ep2 + 19/8385107850*ep2^2 - 152/71273416725*ep2^3 + 304/151099643457*ep2^4 - 15808/8310480390135*ep2^5 + 1664/923386710015*ep2^6 - 13312/7782830841555*ep2^7 + 26624/16370782114995*ep2^8) * k2^21
        - (209/56676484080 - 209/60372776520*ep2 + 418/128292150105*ep2^2 - 4180/1359896791113*ep2^3 + 3952/1359896791113*ep2^4 - 416/151099643457*ep2^5 + 3328/1273554137709*ep2^6 - 6656/2678855255181*ep2^7) * k2^22
        + (4807/950550098400 - 4807/1009959479550*ep2 + 4807/1070557048323*ep2^2 - 22724/5352785241615*ep2^3 + 2392/594753915735*ep2^4 - 19136/5012925861195*ep2^5 + 38272/10544430259755*ep2^6) * k2^23
        - (23/3435236325 - 46/7282701009*ep2 + 2392/400548555495*ep2^2 - 4784/845602506045*ep2^3 + 267904/49890547856655*ep2^4 - 535808/104942186870895*ep2^5) * k2^24
        + (575/66829491612 - 115/14137007841*ep2 + 230/29844794331*ep2^2 - 12880/1760842865529*ep2^3 + 25760/3703841889561*ep2^4) * k2^25
        - (23/2133887976 - 23/2252437308*ep2 + 322/33223450293*ep2^2 - 644/69883809237*ep2^3) * k2^26
        + (115/8706390672 - 115/9172804458*ep2 + 115/9647259861*ep2^2) * k2^27
        - (23/1448337546 - 23/1523251557*ep2) * k2^28
        + 667/35525324448 * k2^29;
C4[14] = + (1/2091759757200 - 1/2300935732920*ep2 + 4/10066593831525*ep2^2 - 8/21909645398025*ep2^3 + 32/94941796724775*ep2^4 - 64/204874403458725*ep2^5 + 512/1761919869745035*ep2^6 - 1024/3775542578025075*ep2^7 + 4096/16131863742470775*ep2^8 - 8192/34367883625263825*ep2^9 + 131072/584254021629485025*ep2^10 - 262144/1238618525854508253*ep2^11 + 1048576/5240309147845996455*ep2^12 - 2097152/11062874867674881405*ep2^13 + 16777216/93244231027545428985*ep2^14 - 33554432/196134416988974867865*ep2^15) * k2^14
        - (1/296894933280 - 1/324728833275*ep2 + 2/706762754775*ep2^2 - 8/3062638604025*ep2^3 + 16/6608851724475*ep2^4 - 128/56836124830485*ep2^5 + 256/121791696065325*ep2^6 - 1024/520382701370025*ep2^7 + 2048/1108641407266575*ep2^8 - 32768/18846903923531775*ep2^9 + 65536/39955436317887363*ep2^10 - 262144/169042230575677305*ep2^11 + 524288/356866931215318755*ep2^12 - 4194304/3007878420243400935*ep2^13 + 8388608/6326916677063705415*ep2^14) * k2^15
        + (4/305048297925 - 8/663928648425*ep2 + 32/2877024143175*ep2^2 - 64/6208315256325*ep2^3 + 512/53391511204395*ep2^4 - 1024/114410381152275*ep2^5 + 45056/5377287914156925*ep2^6 - 90112/11455961208421275*ep2^7 + 1441792/194751340543161675*ep2^8 - 2883584/412872841951502751*ep2^9 + 1048576/158797246904424135*ep2^10 - 2097152/335238632353784285*ep2^11 + 16777216/2825582758410467545*ep2^12 - 33554432/5943467181484086905*ep2^13) * k2^16
        - (17/455265358920 - 17/493204138830*ep2 + 17/532141307685*ep2^2 - 136/4576415246091*ep2^3 + 1904/68646228691365*ep2^4 - 83776/3226372748494155*ep2^5 + 23936/981939532150395*ep2^6 - 22528/981939532150395*ep2^7 + 225280/10408559040794187*ep2^8 - 16384/800658387753399*ep2^9 + 32768/1690278818590509*ep2^10 - 262144/14246635756691433*ep2^11 + 524288/29967061419247497*ep2^12) * k2^17
        + (17/195504343320 - 17/210938896740*ep2 + 34/453518627991*ep2^2 - 476/6802779419865*ep2^3 + 1904/29066421157605*ep2^4 - 544/8846302091445*ep2^5 + 512/8846302091445*ep2^6 - 5120/93770802169317*ep2^7 + 4096/79344524912499*ep2^8 - 8192/167505108148609*ep2^9 + 65536/1411828768681133*ep2^10 - 131072/2969708789294797*ep2^11) * k2^18
        - (19/108173793200 - 19/116286827690*ep2 + 133/872151207675*ep2^2 - 532/3726464250975*ep2^3 + 152/1134141293775*ep2^4 - 2432/19280401994175*ep2^5 + 4864/40874452227651*ep2^6 - 252928/2248094872520805*ep2^7 + 79872/749364957506935*ep2^8 - 638976/6316076070415595*ep2^9 + 1277952/13285539320529355*ep2^10) * k2^19
        + (19/59561545890 - 19/63815942025*ep2 + 76/272668115925*ep2^2 - 152/580901638275*ep2^3 + 2432/9875327850675*ep2^4 - 4864/20935695043431*ep2^5 + 252928/1151463227388705*ep2^6 - 26624/127940358598745*ep2^7 + 212992/1078354451046565*ep2^8 - 425984/2268262810822085*ep2^9) * k2^20
        - (19/35618200200 - 19/38046713850*ep2 + 19/40528021275*ep2^2 - 304/688976361675*ep2^3 + 608/1460629886751*ep2^4 - 31616/80334643771305*ep2^5 + 3328/8926071530145*ep2^6 - 26624/75234031468365*ep2^7 + 53248/158250893778285*ep2^8) * k2^21
        + (209/250262828880 - 209/266584317720*ep2 + 418/566491675155*ep2^2 - 4180/6004811756643*ep2^3 + 3952/6004811756643*ep2^4 - 1248/2001603918881*ep2^5 + 9984/16870661601997*ep2^6 - 19968/35486564059373*ep2^7) * k2^22
        - (253/204192243360 - 253/216954258570*ep2 + 1265/1149857570421*ep2^2 - 1196/1149857570421*ep2^3 + 2392/2427477093111*ep2^4 - 19136/20460164070507*ep2^5 + 38272/43036896837963*ep2^6) * k2^23
        + (253/143898232725 - 506/305064253377*ep2 + 184/117332405145*ep2^2 - 368/247701744195*ep2^3 + 20608/14614402907505*ep2^4 - 41216/30740640598545*ep2^5) * k2^24
        - (115/47853216216 - 23/10122795738*ep2 + 23/10685173279*ep2^2 - 1288/630425223461*ep2^3 + 2576/1326066849349*ep2^4) * k2^25
        + (299/93970103832 - 299/99190665156*ep2 + 4186/1463062311051*ep2^2 - 8372/3077475895659*ep2^3) * k2^26
        - (345/84161776496 - 345/88670443094*ep2 + 345/93256845323*ep2^2) * k2^27
        + (1035/200675213318 - 1035/211054965731*ep2) * k2^28
        - 69/10854960248 * k2^29;
C4[15] = + (1/9838483823520 - 1/10760841681975*ep2 + 2/23420655425475*ep2^2 - 8/101489506843725*ep2^3 + 16/219003672662775*ep2^4 - 128/1883431584899865*ep2^5 + 256/4035924824785425*ep2^6 - 1024/17244406069537725*ep2^7 + 2048/36738082495971675*ep2^8 - 32768/624547402431518475*ep2^9 + 65536/1324040493154819167*ep2^10 - 262144/5601709778731927245*ep2^11 + 524288/11825831755100735295*ep2^12 - 4194304/99674867650134768915*ep2^13 + 8388608/209660928505455893235*ep2^14) * k2^15
        - (1/1304344446300 - 1/1419433662150*ep2 + 2/3075439601325*ep2^2 - 4/6636474929175*ep2^3 + 32/57073684390905*ep2^4 - 64/122300752266225*ep2^5 + 2816/5748135356512575*ep2^6 - 5632/12246027498657225*ep2^7 + 90112/208182467477172825*ep2^8 - 180224/441346831051606389*ep2^9 + 65536/169748781173694765*ep2^10 - 131072/358358538033355615*ep2^11 + 1048576/3020450534852568755*ep2^12 - 2097152/6353361469862299795*ep2^13) * k2^16
        + (17/5353292668680 - 17/5799400391070*ep2 + 17/6257247790365*ep2^2 - 136/53812330997139*ep2^3 + 1904/807184964957085*ep2^4 - 7616/3448881213907545*ep2^5 + 2176/1049659499884905*ep2^6 - 2048/1049659499884905*ep2^7 + 20480/11126390698779993*ep2^8 - 16384/9414638283583071*ep2^9 + 32768/19875347487564261*ep2^10 - 262144/167520785966613057*ep2^11 + 524288/352371308412530913*ep2^12) * k2^17
        - (1/104493700740 - 1/112743203430*ep2 + 4/484795774749*ep2^2 - 56/7271936621235*ep2^3 + 224/31071001927095*ep2^4 - 64/9456391890855*ep2^5 + 1024/160758662144535*ep2^6 - 10240/1704041818732071*ep2^7 + 8192/1441881538927137*ep2^8 - 16384/3043972137735067*ep2^9 + 131072/25656336589481279*ep2^10 - 262144/53966776964081311*ep2^11) * k2^18
        + (19/809438383600 - 19/870146262370*ep2 + 19/932299566825*ep2^2 - 76/3983461785525*ep2^3 + 152/8486505543075*ep2^4 - 2432/144270594232275*ep2^5 + 4864/305853659772423*ep2^6 - 252928/16821951287483265*ep2^7 + 79872/5607317095827755*ep2^8 - 638976/47261672664833935*ep2^9 + 1277952/99412483881202415*ep2^10) * k2^19
        - (19/382015432260 - 19/409302248850*ep2 + 38/874418440725*ep2^2 - 76/1862891460675*ep2^3 + 1216/31669154831475*ep2^4 - 2432/67138608242727*ep2^5 + 126464/3692623453349985*ep2^6 - 13312/410291494816665*ep2^7 + 106496/3458171170597605*ep2^8 - 212992/7274084186429445*ep2^9) * k2^20
        + (133/1408761228600 - 133/1504813130550*ep2 + 19/228993302475*ep2^2 - 304/3892886142075*ep2^3 + 608/8252918621199*ep2^4 - 31616/453910524165945*ep2^5 + 3328/50434502685105*ep2^6 - 26624/425090808345885*ep2^7 + 53248/894156527899965*ep2^8) * k2^21
        - (11/66880583580 - 11/71242360770*ep2 + 88/605560066545*ep2^2 - 880/6418936705377*ep2^3 + 832/6418936705377*ep2^4 - 4992/40653265800721*ep2^5 + 39936/342648954606077*ep2^6 - 79872/720744352792093*ep2^7) * k2^22
        + (253/945856023840 - 253/1004972025330*ep2 + 1265/5326351734249*ep2^2 - 92/409719364173*ep2^3 + 184/864963102143*ep2^4 - 1472/7290403289491*ep2^5 + 2944/15334986229619*ep2^6) * k2^23
        - (253/615288995100 - 253/652206334806*ep2 + 46/125424295155*ep2^2 - 92/264784623105*ep2^3 + 5152/15622292763195*ep2^4 - 10304/32860684777755*ep2^5) * k2^24
        + (1265/2097290958984 - 23/40332518442*ep2 + 23/42573213911*ep2^2 - 1288/2511819620749*ep2^3 + 2576/5283482650541*ep2^4) * k2^25
        - (299/351577802268 - 299/371109902394*ep2 + 1196/1563963160089*ep2^2 - 2392/3289715612601*ep2^3) * k2^26
        + (4485/3868539588592 - 4485/4075782780838*ep2 + 4485/4286599131571*ep2^2) * k2^27
        - (7245/4719327430444 - 7245/4963430573398*ep2) * k2^28
        + 667/336503767688 * k2^29;
C4[16] = + (1/45820358129700 - 1/49863330905850*ep2 + 2/108037216962675*ep2^2 - 4/233132941866825*ep2^3 + 32/2004943300054695*ep2^4 - 64/4296307071545775*ep2^5 + 256/18356948396604675*ep2^6 - 512/39108281366679525*ep2^7 + 8192/664840783233551925*ep2^8 - 16384/1409462460455130081*ep2^9 + 65536/5963110409617858035*ep2^10 - 131072/12588788642526589185*ep2^11 + 1048576/106105504272724108845*ep2^12 - 2097152/223187440021936918605*ep2^13) * k2^16
        - (1/5698666389240 - 1/6173555255010*ep2 + 1/6660941196195*ep2^2 - 8/57284094287277*ep2^3 + 112/859261414309155*ep2^4 - 448/3671389679320935*ep2^5 + 128/1117379467619415*ep2^6 - 2048/18995450949530055*ep2^7 + 20480/201351780065018583*ep2^8 - 16384/170374583131938801*ep2^9 + 32768/359679675500759691*ep2^10 - 262144/3031585836363545967*ep2^11 + 524288/6376784000626769103*ep2^12) * k2^17
        + (1/1297744347900 - 1/1400197849050*ep2 + 4/6020850750915*ep2^2 - 8/12901823037675*ep2^3 + 32/55125971160975*ep2^4 - 64/117442286386425*ep2^5 + 1024/1996518868569225*ep2^6 - 2048/4232620001366757*ep2^7 + 8192/17907238467320895*ep2^8 - 16384/37804170097677445*ep2^9 + 131072/318635147966138465*ep2^10 - 262144/670232552618429185*ep2^11) * k2^18
        - (19/7754941933200 - 19/8336562578190*ep2 + 19/8932031333775*ep2^2 - 76/38164133880675*ep2^3 + 152/81306198267525*ep2^4 - 2432/1382205370547925*ep2^5 + 4864/2930275385561601*ep2^6 - 252928/161165146205888055*ep2^7 + 26624/17907238467320895*ep2^8 - 212992/150932438510276115*ep2^9 + 425984/317478577556098035*ep2^10) * k2^19
        + (19/3009295759932 - 19/3224245457070*ep2 + 38/6888160749195*ep2^2 - 76/14674777248285*ep2^3 + 1216/249471213220845*ep2^4 - 12160/2644394860140957*ep2^5 + 126464/29088343461550527*ep2^6 - 13312/3232038162394503*ep2^7 + 106496/27241464511610811*ep2^8 - 212992/57301011558905499*ep2^9) * k2^20
        - (7/499883016600 - 7/533965949550*ep2 + 1/81255687975*ep2^2 - 16/1381346695575*ep2^3 + 32/2928454994619*ep2^4 - 1664/161065024704045*ep2^5 + 3328/340026163264095*ep2^6 - 26624/2865934804654515*ep2^7 + 53248/6028345623583635*ep2^8) * k2^21
        + (7/252420267060 - 1/38411779770*ep2 + 8/326500128045*ep2^2 - 80/3460901357277*ep2^3 + 64/2928454994619*ep2^4 - 128/6182293877529*ep2^5 + 1024/52107905539173*ep2^6 - 2048/109606284065157*ep2^7) * k2^22
        - (23/457672269600 - 23/486276786450*ep2 + 23/515453393637*ep2^2 - 92/2180764357695*ep2^3 + 184/4603835866245*ep2^4 - 1472/38803759444065*ep2^5 + 2944/81621700899585*ep2^6) * k2^23
        + (23/271256438700 - 23/287531825022*ep2 + 46/608240399085*ep2^2 - 92/1284063064735*ep2^3 + 5152/75759720819365*ep2^4 - 10304/159356654137285*ep2^5) * k2^24
        - (575/4262236465032 - 115/901626944526*ep2 + 115/951717330333*ep2^2 - 920/8021617498521*ep2^3 + 1840/16873057496889*ep2^4) * k2^25
        + (299/1463017306212 - 299/1544296045446*ep2 + 1196/6508104762951*ep2^2 - 2392/13689461742759*ep2^3) * k2^26
        - (4485/15099783555472 - 4485/15908700531658*ep2 + 4485/16731564352261*ep2^2) * k2^27
        + (2093/5023800167892 - 2093/5283651900714*ep2) * k2^28
        - 203/358213688184 * k2^29;
C4[17] = + (1/211541403843000 - 1/229169854163250*ep2 + 1/247262211070875*ep2^2 - 8/2126455015209525*ep2^3 + 16/4556689318306125*ep2^4 - 64/19469490723671625*ep2^5 + 128/41478480237387375*ep2^6 - 2048/705134164035585375*ep2^7 + 4096/1494884427755440995*ep2^8 - 16384/6324511040503788825*ep2^9 + 32768/13351745529952443075*ep2^10 - 262144/112536140895313448775*ep2^11 + 524288/236713951538417943975*ep2^12) * k2^17
        - (1/24775119369000 - 1/26731049845500*ep2 + 2/57471757167825*ep2^2 - 4/123153765359625*ep2^3 + 16/526202451991125*ep2^4 - 32/1121040006415875*ep2^5 + 512/19057680109069875*ep2^6 - 1024/40402281831228135*ep2^7 + 4096/170932730824426725*ep2^8 - 8192/360857987296011975*ep2^9 + 65536/3041517321494958075*ep2^10 - 131072/6397674365903187675*ep2^11) * k2^18
        + (19/101440907106000 - 19/109048975138950*ep2 + 19/116838187648875*ep2^2 - 76/499217710863375*ep2^3 + 152/1063550775317625*ep2^4 - 2432/18080363180399625*ep2^5 + 4864/38330369942447205*ep2^6 - 252928/2108170346834596275*ep2^7 + 26624/234241149648288475*ep2^8 - 212992/1974318261321288575*ep2^9 + 425984/4152876342779262175*ep2^10) * k2^19
        - (1/1595838660570 - 1/1709827136325*ep2 + 4/7305625037025*ep2^2 - 8/15564157687575*ep2^3 + 128/264590680688775*ep2^4 - 256/560932243060203*ep2^5 + 13312/30851273368311165*ep2^6 - 26624/65130465999768015*ep2^7 + 212992/548956784855187555*ep2^8 - 425984/1154702202626428995*ep2^9) * k2^20
        + (1/590770837800 - 1/631050667650*ep2 + 1/672206145975*ep2^2 - 16/11427504481575*ep2^3 + 32/24226309500939*ep2^4 - 128/102495924811665*ep2^5 + 256/216380285713515*ep2^6 - 2048/1823776693871055*ep2^7 + 4096/3836219942280495*ep2^8) * k2^21
        - (11/2804669634000 - 11/2987582871000*ep2 + 22/6348613600875*ep2^2 - 44/13459060833855*ep2^3 + 16/5176561859175*ep2^4 - 96/32784891774775*ep2^5 + 768/276329802101675*ep2^6 - 1536/581245445800075*ep2^7) * k2^22
        + (253/31274271756000 - 253/33228913740750*ep2 + 253/35222648565195*ep2^2 - 92/13547172525075*ep2^3 + 184/28599586441825*ep2^4 - 1472/241053657152525*ep2^5 + 2944/507043899527725*ep2^6) * k2^23
        - (253/16614456870375 - 506/35222648565195*ep2 + 184/13547172525075*ep2^2 - 368/28599586441825*ep2^3 + 2944/241053657152525*ep2^4 - 5888/507043899527725*ep2^5) * k2^24
        + (1265/47516043554616 - 23/913770068358*ep2 + 69/2893605216467*ep2^2 - 552/24388958253079*ep2^3 + 1104/51300912187511*ep2^4) * k2^25
        - (299/6827414095656 - 299/7206714878748*ep2 + 598/15185577780219*ep2^2 - 1196/31942077399771*ep2^3) * k2^26
        + (299/4367705987120 - 299/4601690236430*ep2 + 299/4839708696935*ep2^2) * k2^27
        - (39/380590921810 - 39/400276659145*ep2) * k2^28
        + 377/2550915658280 * k2^29;
C4[18] = + (1/969061097604600 - 1/1045565921099700*ep2 + 2/2247966730364355*ep2^2 - 4/4817071565066475*ep2^3 + 16/20582033050738575*ep2^4 - 32/43848679108095225*ep2^5 + 512/745427544837618825*ep2^6 - 1024/1580306395055751909*ep2^7 + 4096/6685911671389719615*ep2^8 - 8192/14114702417378296965*ep2^9 + 65536/118966777517902788705*ep2^10 - 131072/250240463054898969345*ep2^11) * k2^18
        - (1/107237530369200 - 1/115280345146890*ep2 + 1/123514655514525*ep2^2 - 4/527744437198425*ep2^3 + 8/1124325105335775*ep2^4 - 128/19113526790708175*ep2^5 + 256/40520676796301331*ep2^6 - 13312/2228637223796573205*ep2^7 + 26624/4704900805792765655*ep2^8 - 212992/39655592505967596235*ep2^9 + 425984/83413487684966323115*ep2^10) * k2^19
        + (1/21931382735262 - 1/23497910073495*ep2 + 4/100400161223115*ep2^2 - 8/213895995649245*ep2^3 + 128/3636231926037165*ep2^4 - 1280/38544058415993949*ep2^5 + 1024/32614203275071803*ep2^6 - 2048/68852206914040473*ep2^7 + 16384/580325743989769701*ep2^8 - 32768/1220685185633653509*ep2^9) * k2^20
        - (7/43717041997200 - 7/46697749406100*ep2 + 1/7106179257450*ep2^2 - 8/60402523688325*ep2^3 + 16/128053350219249*ep2^4 - 64/541764174004515*ep2^5 + 128/1143724367342865*ep2^6 - 1024/9639962524747005*ep2^7 + 2048/20277162552054045*ep2^8) * k2^21
        + (77/170187353391120 - 11/25898075516040*ep2 + 22/55033410471585*ep2^2 - 220/583354150998801*ep2^3 + 16/44873396230677*ep2^4 - 96/284198176127621*ep2^5 + 768/2395384627361377*ep2^6 - 1536/5038567664449793*ep2^7) * k2^22
        - (253/231429610994400 - 253/245893961681550*ep2 + 253/260647599382443*ep2^2 - 92/100249076685555*ep2^3 + 184/211636939669505*ep2^4 - 1472/1783797062928685*ep2^5 + 2944/3752124856505165*ep2^6) * k2^23
        + (253/107892248492925 - 506/228731566805001*ep2 + 184/87973679540385*ep2^2 - 368/185722212363035*ep2^3 + 20608/10957610529419065*ep2^4 - 41216/23048766975674585*ep2^5) * k2^24
        - (575/125578115108628 - 115/26564601272979*ep2 + 690/168242474728867*ep2^2 - 5520/1418043715571879*ep2^3 + 11040/2982781608616711*ep2^4) * k2^25
        + (299/36087760219896 - 299/38092635787668*ep2 + 598/80266625409729*ep2^2 - 1196/168836694827361*ep2^3) * k2^26
        - (65/4617289186384 - 65/4864643964226*ep2 + 65/5116263479617*ep2^2) * k2^27
        + (273/12033592964138 - 273/12656020186421*ep2) * k2^28
        - 2639/75507103485088 * k2^29;
C4[19] = + (1/4408331991663600 - 1/4738956891038370*ep2 + 1/5077453811826825*ep2^2 - 4/21694575377805525*ep2^3 + 8/46218877978803075*ep2^4 - 128/785720925639652275*ep2^5 + 256/1665728362356062823*ep2^6 - 1024/7047312302275650405*ep2^7 + 2048/14877659304804150855*ep2^8 - 16384/125397414140492128635*ep2^9 + 32768/263766974571379994715*ep2^10) * k2^19
        - (1/462337257662280 - 1/495361347495300*ep2 + 1/529135984824525*ep2^2 - 2/1127289706800075*ep2^3 + 32/19163925015601275*ep2^4 - 64/40627521033074703*ep2^5 + 256/171885665909162205*ep2^6 - 512/362869739141564655*ep2^7 + 4096/3058473515621759235*ep2^8 - 8192/6433340843204390115*ep2^9) * k2^20
        + (7/629761713094800 - 7/672700011714900*ep2 + 1/102367393087050*ep2^2 - 8/870122841239925*ep2^3 + 16/1844660423428641*ep2^4 - 64/7804332560659635*ep2^5 + 128/16475813183614785*ep2^6 - 1024/138867568261896045*ep2^7 + 2048/292100747033643405*ep2^8) * k2^21
        - (11/269080004685960 - 11/286628700643740*ep2 + 44/1218171977735895*ep2^2 - 440/12912622964000487*ep2^3 + 32/993278689538499*ep2^4 - 64/2096921677914609*ep2^5 + 512/17674054142423133*ep2^6 - 1024/37176458713372797*ep2^7) * k2^22
        + (253/2097878149392480 - 253/2228995533729510*ep2 + 1265/11813676328766403*ep2^2 - 92/908744332982031*ep2^3 + 184/1918460258517621*ep2^4 - 1472/16169879321791377*ep2^5 + 2944/34012504780319793*ep2^6) * k2^23
        - (23/75816174616650 - 23/80365145093649*ep2 + 92/340006383088515*ep2^2 - 184/717791253186865*ep2^3 + 10304/42349683938025035*ep2^4 - 20608/89080369662742315*ep2^5) * k2^24
        + (115/170185013139492 - 23/36000675856431*ep2 + 46/76001426808021*ep2^2 - 2576/4484084181673239*ep2^3 + 5152/9432039140760951*ep2^4) * k2^25
        - (1/731508653106 - 1/772148022723*ep2 + 8/6508104762951*ep2^2 - 16/13689461742759*ep2^3) * k2^26
        + (15/5865205182704 - 15/6179412603206*ep2 + 15/6499037393027*ep2^2) * k2^27
        - (35/7805573814576 - 35/8209310391192*ep2) * k2^28
        + 29/3895943914464 * k2^29;
C4[20] = + (1/19927921285392120 - 1/21351344234348700*ep2 + 1/22807117704872475*ep2^2 - 2/48589076849510925*ep2^3 + 32/826014306441685725*ep2^4 - 64/1751150329656373737*ep2^5 + 256/7408712933161581195*ep2^6 - 512/15640616192230004745*ep2^7 + 4096/131828050763081468565*ep2^8 - 8192/277293486087861020085*ep2^9) * k2^20
        - (1/1986171556683600 - 1/2121592344639300*ep2 + 1/2259957062767950*ep2^2 - 8/19209635033527575*ep2^3 + 16/40724426271078459*ep2^4 - 64/172295649608408865*ep2^5 + 128/363735260284418715*ep2^6 - 1024/3065768622397243455*ep2^7 + 2048/6448685722973512095*ep2^8) * k2^21
        + (11/4054598703088440 - 11/4319029053289860*ep2 + 44/18355873476481905*ep2^2 - 440/194572258850708193*ep2^3 + 32/14967096834669861*ep2^4 - 192/94791613286242453*ep2^5 + 1536/798957883412614961*ep2^6 - 3072/1680566582350672849*ep2^7) * k2^22
        - (23/2205461644233120 - 23/2343302996997690*ep2 + 115/12419505884087757*ep2^2 - 92/10508812671151179*ep2^3 + 184/22185271194652489*ep2^4 - 1472/186990142926356693*ep2^5 + 2944/393324093741646837*ep2^6) * k2^23
        + (23/717337652142150 - 23/760377911270679*ep2 + 92/3216983470760565*ep2^2 - 184/6791409549383415*ep2^3 + 10304/400693163413621485*ep2^4 - 20608/842837343732100365*ep2^5) * k2^24
        - (5/59637483236916 - 1/12615621453963*ep2 + 2/26632978625033*ep2^2 - 112/1571345738876947*ep2^3 + 224/3305244485223923*ep2^4) * k2^25
        + (13/67124627358822 - 13/70853773323201*ep2 + 728/4180372626068859*ep2^2 - 1456/8793197592765531*ep2^3) * k2^26
        - (195/480946824981728 - 195/506711833462892*ep2 + 195/532921066228214*ep2^2) * k2^27
        + (585/746733228261104 - 585/785357360757368*ep2) * k2^28
        - 377/266222834155040 * k2^29;
C4[21] = + (1/89571492885560400 - 1/95678640127757700*ep2 + 1/101918551440437550*ep2^2 - 8/866307687243719175*ep2^3 + 16/1836572296956684651*ep2^4 - 64/7770113564047511985*ep2^5 + 128/16403573079655858635*ep2^6 - 1024/138258687385670808495*ep2^7 + 2048/290819997604342045455*ep2^8) * k2^21
        - (1/8504768011356240 - 1/9059426794705560*ep2 + 2/19251281938749315*ep2^2 - 20/204063588550742739*ep2^3 + 16/172669190312166933*ep2^4 - 96/1093571538643723909*ep2^5 + 768/9217245825711387233*ep2^6 - 1536/19387999840289469697*ep2^7) * k2^22
        + (23/34695677086106400 - 23/36864156903988050*ep2 + 23/39076006318227333*ep2^2 - 92/165321565192500255*ep2^3 + 184/349012193184167205*ep2^4 - 1472/2941674199695123585*ep2^5 + 2944/6187659523496639265*ep2^6) * k2^23
        - (1/376164866367225 - 2/797469516698517*ep2 + 8/3373909493724495*ep2^2 - 16/7122697820085045*ep2^3 + 896/420239171385017655*ep2^4 - 1792/883951360499519895*ep2^5) * k2^24
        + (25/2939691551751396 - 5/621857828255103*ep2 + 10/1312810970760773*ep2^2 - 560/77455847274885607*ep2^3 + 1120/162924368405793863*ep2^4) * k2^25
        - (13/563191995400848 - 13/594480439589784*ep2 + 91/4384293241974657*ep2^2 - 182/9222134060705313*ep2^3) * k2^26
        + (195/3530853519987808 - 195/3720006387130012*ep2 + 195/3912420510602254*ep2^2) * k2^27
        - (117/978949049244740 - 117/1029584344895330*ep2) * k2^28
        + 1131/4746558335788640 * k2^29;
C4[22] = + (1/400515237744102000 - 1/426635796727413000*ep2 + 2/906601068045752625*ep2^2 - 4/1921994264256995565*ep2^3 + 16/8131514194933442775*ep2^4 - 32/17166529967081712525*ep2^5 + 256/144689324008260148425*ep2^6 - 512/304346509120823070825*ep2^7) * k2^22
        - (1/36309429508716000 - 1/38578768853010750*ep2 + 1/40893494984191395*ep2^2 - 4/173010940317732825*ep2^3 + 8/365245318448547075*ep2^4 - 64/3078496255494896775*ep2^5 + 128/6475457640868575975*ep2^6) * k2^23
        + (1/6167354204392875 - 2/13074790913312895*ep2 + 8/55316423094785325*ep2^2 - 16/116779115422324575*ep2^3 + 896/6889967809917149925*ep2^4 - 1792/14492690910515384325*ep2^5) * k2^24
        - (5/7383411339282576 - 1/1561875475617468*ep2 + 1/1648646335373994*ep2^2 - 28/48635066893532823*ep2^3 + 56/102301347603638007*ep2^4) * k2^25
        + (13/5775992324924976 - 13/6096880787420808*ep2 + 13/6423499401032637*ep2^2 - 26/13511498740103133*ep2^3) * k2^26
        - (13/2052821813946400 - 13/2162794411122100*ep2 + 13/2274663087559450*ep2^2) * k2^27
        + (13/829342217798700 - 13/872239229064150*ep2) * k2^28
        - 29/827888081823600 * k2^29;
C4[23] = + (1/1782389550772303200 - 1/1893788897695572150*ep2 + 1/2007416231557306479*ep2^2 - 4/8492914825819373565*ep2^3 + 8/17929486854507566415*ep2^4 - 64/151119960630849488355*ep2^5 + 128/317873020637304096195*ep2^6) * k2^23
        - (1/154595012056781400 - 1/163870712780188284*ep2 + 1/173324792363660685*ep2^2 - 2/365907894989950335*ep2^3 + 112/21588565804407069765*ep2^4 - 224/45410431519614870885*ep2^5) * k2^24
        + (25/629777641272880464 - 5/133222193346186252*ep2 + 5/140623426309863266*ep2^2 - 20/592627296591566621*ep2^3 + 40/1246560865244329789*ep2^4) * k2^25
        - (13/75408788686520520 - 13/79598165835771660*ep2 + 26/167724706582518855*ep2^2 - 52/352800244880470695*ep2^3) * k2^26
        + (39/65608185173726944 - 39/69122909379462316*ep2 + 39/72698232278400022*ep2^2) * k2^27
        - (9/5197211231538520 - 9/5466032502135340*ep2) * k2^28
        + 87/19640659160215120 * k2^29;
C4[24] = + (1/7897502637198556200 - 1/8371352795430469572*ep2 + 1/8854315456705304355*ep2^2 - 2/18692443741933420305*ep2^3 + 16/157550597253438828285*ep2^4 - 32/331399532153785121565*ep2^5) * k2^24
        - (1/656576689837683888 - 1/694456114251396420*ep2 + 1/733037009487585110*ep2^2 - 4/3089227397126251535*ep2^3 + 8/6498030042231080815*ep2^4) * k2^25
        + (13/1336500446295140280 - 13/1410750471089314740*ep2 + 26/2972652778366770345*ep2^2 - 52/6252821361392172105*ep2^3) * k2^26
        - (3/68400022840694048 - 3/72064309778588372*ep2 + 3/75791774077480874*ep2^2) * k2^27
        + (9/57434713056619304 - 9/60405474076789268*ep2) * k2^28
        - 29/61429295671311120 * k2^29;
C4[25] = + (1/34852162658526852912 - 1/36862864350364940580*ep2 + 1/38910801258718548390*ep2^2 - 4/163981233876028168215*ep2^3 + 8/344926043670266146935*ep2^4) * k2^25
        - (1/2782102969838863440 - 1/2936664245941022520*ep2 + 1/3093985544830720155*ep2^2 - 2/6508038559816342395*ep2^3) * k2^26
        + (3/1257722868968680352 - 3/1325100879806288228*ep2 + 3/1393640580485923826*ep2^2) * k2^27
        - (1/89668480588395444 - 1/94306505446415898*ep2) * k2^28
        + 29/703302752481745680 * k2^29;
C4[26] = + (1/153233867495634654960 - 1/161746860134281024680*ep2 + 1/170411870498617508145*ep2^2 - 2/358452555186747172305*ep2^3) * k2^26
        - (1/11763408009765892704 - 1/12393590581717636956*ep2 + 1/13034638370427169902*ep2^2) * k2^27
        + (1/1708389679184135420 - 1/1796754662590211390*ep2) * k2^28
        - 29/10232365536106966560 * k2^29;
C4[27] = + (1/671402060934751423200 - 1/707370028484827392300*ep2 + 1/743958133406456395350*ep2^2) * k2^27
        - (1/49640001998935255600 - 1/52207588309225010200*ep2) * k2^28
        + 29/201751358211920378400 * k2^29;
C4[28] = + (1/2932370299900739008080 - 1/3084044625757673784360*ep2) * k2^28
        - 1/209087771237808392160 * k2^29;
C4[29] = + 1/12769026871558087949280 * k2^29;
    
geographiclib-1.21/doc/html/functions_eval.html0000644000175000017500000003230311745620414021477 0ustar frankiefrankie GeographicLib: Class Members - Enumerator
 

- a -

- d -

- e -

- f -

- g -

- i -

- l -

- m -

- n -

- r -

- s -

- u -

geographiclib-1.21/doc/html/pages.html0000644000175000017500000000521411745620415017561 0ustar frankiefrankie GeographicLib: Related Pages
Related Pages
geographiclib-1.21/doc/html/CircularEngine_8hpp_source.html0000644000175000017500000005770311745620414023704 0ustar frankiefrankie GeographicLib: CircularEngine.hpp Source File
CircularEngine.hpp
Go to the documentation of this file.
00001 /**
00002  * \file CircularEngine.hpp
00003  * \brief Header for GeographicLib::CircularEngine class
00004  *
00005  * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under
00006  * the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_CIRCULARENGINE_HPP)
00011 #define GEOGRAPHICLIB_CIRCULARENGINE_HPP \
00012   "$Id: d0528f468369dbc1b7af11e02278ad7a361d398b $"
00013 
00014 #include <vector>
00015 #include <GeographicLib/Constants.hpp>
00016 #include <GeographicLib/SphericalEngine.hpp>
00017 
00018 #if defined(_MSC_VER)
00019 // Squelch warnings about dll vs vector
00020 #pragma warning (push)
00021 #pragma warning (disable: 4251)
00022 #endif
00023 
00024 namespace GeographicLib {
00025 
00026   /**
00027    * \brief Spherical Harmonic sums for a circle.
00028    *
00029    * The class is a companion to SphericalEngine.  If the results of a
00030    * spherical harmonic sum are needed for several points on a circle of
00031    * constant latitude \e lat and height \e h, then SphericalEngine::Circle can
00032    * compute the inner sum, which is independent of longitude \e lon, and
00033    * produce a CircularEngine object.  CircularEngine::operator()() can
00034    * then be used to perform the outer sum for particular vales of \e lon.
00035    * This can lead to substantial improvements in computational speed for high
00036    * degree sum (approximately by a factor of \e N / 2 where \e N is the
00037    * maximum degree).
00038    *
00039    * CircularEngine is tightly linked to the internals of SphericalEngine.  For
00040    * that reason, the constructor for this class is private.  Use
00041    * SphericalHarmonic::Circle, SphericalHarmonic1::Circle, and
00042    * SphericalHarmonic2::Circle to create instances of this class.
00043    *
00044    * CircularEngine stores the coefficients needed to allow the summation over
00045    * order to be performed in 2 or 6 vectors of length \e M + 1 (depending on
00046    * whether gradients are to be calculated).  For this reason the constructor
00047    * may throw a bad_alloc exception.
00048    *
00049    * Example of use:
00050    * \include example-CircularEngine.cpp
00051    **********************************************************************/
00052 
00053   class GEOGRAPHIC_EXPORT CircularEngine {
00054   private:
00055     typedef Math::real real;
00056     enum normalization {
00057       FULL = SphericalEngine::FULL,
00058       SCHMIDT = SphericalEngine::SCHMIDT,
00059     };
00060     int _M;
00061     bool _gradp;
00062     unsigned _norm;
00063     real _a, _r, _u, _t;
00064     std::vector<real> _wc, _ws, _wrc, _wrs, _wtc, _wts;
00065     real _q, _uq, _uq2;
00066 
00067     Math::real Value(bool gradp, real cl, real sl,
00068                      real& gradx, real& grady, real& gradz) const throw();
00069 
00070     static inline void cossin(real x, real& cosx, real& sinx) {
00071       x = x >= 180 ? x - 360 : (x < -180 ? x + 360 : x);
00072       real xi = x * Math::degree<real>();
00073       cosx = std::abs(x) ==   90 ? 0 : cos(xi);
00074       sinx =          x  == -180 ? 0 : sin(xi);
00075     }
00076 
00077     friend class SphericalEngine;
00078     friend class GravityCircle;  // Access to cossin
00079     friend class MagneticCircle; // Access to cossin
00080     CircularEngine(int M, bool gradp, unsigned norm,
00081                    real a, real r, real u, real t)
00082       : _M(M)
00083       , _gradp(gradp)
00084       , _norm(norm)
00085       , _a(a)
00086       , _r(r)
00087       , _u(u)
00088       , _t(t)
00089       , _wc(std::vector<real>(_M + 1, 0))
00090       , _ws(std::vector<real>(_M + 1, 0))
00091       , _wrc(std::vector<real>(_gradp ? _M + 1 : 0, 0))
00092       , _wrs(std::vector<real>(_gradp ? _M + 1 : 0, 0))
00093       , _wtc(std::vector<real>(_gradp ? _M + 1 : 0, 0))
00094       , _wts(std::vector<real>(_gradp ? _M + 1 : 0, 0))
00095       {
00096         _q = _a / _r;
00097         _uq = _u * _q;
00098         _uq2 = Math::sq(_uq);
00099       }
00100 
00101     void SetCoeff(int m, real wc, real ws)
00102     { _wc[m] = wc; _ws[m] = ws; }
00103 
00104     void SetCoeff(int m, real wc, real ws,
00105                   real wrc, real wrs, real wtc, real wts) {
00106       _wc[m] = wc; _ws[m] = ws;
00107       if (_gradp) {
00108         _wrc[m] = wrc; _wrs[m] = wrs;
00109         _wtc[m] = wtc; _wts[m] = wts;
00110       }
00111     }
00112 
00113   public:
00114 
00115     /**
00116      * A default constructor.  CircularEngine::operator()() on the resulting
00117      * object returns zero.  The resulting object can be assigned to the result
00118      * of SphericalHarmonic::Circle.
00119      **********************************************************************/
00120     CircularEngine()
00121       : _M(-1)
00122       , _gradp(true)
00123       , _u(0)
00124       , _t(1)
00125       {}
00126 
00127     /**
00128      * Evaluate the sum for a particular longitude given in terms of its
00129      * cosine and sine.
00130      *
00131      * @param[in] coslon the cosine of the longitude.
00132      * @param[in] sinlon the sine of the longitude.
00133      * @return \e V the value of the sum.
00134      *
00135      * The arguments must satisfy <i>coslon</i><sup>2</sup> +
00136      * <i>sinlon</i><sup>2</sup> = 1.
00137      **********************************************************************/
00138     Math::real operator()(real coslon, real sinlon) const throw() {
00139       real dummy;
00140       return Value(false, coslon, sinlon, dummy, dummy, dummy);
00141     }
00142 
00143     /**
00144      * Evaluate the sum for a particular longitude.
00145      *
00146      * @param[in] lon the longitude (degrees).
00147      * @return \e V the value of the sum.
00148      **********************************************************************/
00149     Math::real operator()(real lon) const throw() {
00150       real coslon, sinlon;
00151       cossin(lon, coslon, sinlon);
00152       return (*this)(coslon, sinlon);
00153     }
00154 
00155     /**
00156      * Evaluate the sum and its gradient for a particular longitude given in
00157      * terms of its cosine and sine.
00158      *
00159      * @param[in] coslon the cosine of the longitude.
00160      * @param[in] sinlon the sine of the longitude.
00161      * @param[out] gradx \e x component of the gradient.
00162      * @param[out] grady \e y component of the gradient.
00163      * @param[out] gradz \e z component of the gradient.
00164      * @return \e V the value of the sum.
00165      *
00166      * The gradients will only be computed if the CircularEngine object was
00167      * created with this capability (e.g., via \e gradp = true in
00168      * SphericalHarmonic::Circle).  If not, \e gradx, etc., will not be
00169      * touched.  The arguments must satisfy <i>coslon</i><sup>2</sup> +
00170      * <i>sinlon</i><sup>2</sup> = 1.
00171      **********************************************************************/
00172     Math::real operator()(real coslon, real sinlon,
00173                           real& gradx, real& grady, real& gradz) const throw() {
00174       return Value(true, coslon, sinlon, gradx, grady, gradz);
00175     }
00176 
00177     /**
00178      * Evaluate the sum and its gradient for a particular longitude.
00179      *
00180      * @param[in] lon the longitude (degrees).
00181      * @param[out] gradx \e x component of the gradient.
00182      * @param[out] grady \e y component of the gradient.
00183      * @param[out] gradz \e z component of the gradient.
00184      * @return \e V the value of the sum.
00185      *
00186      * The gradients will only be computed if the CircularEngine object was
00187      * created with this capability (e.g., via \e gradp = true in
00188      * SphericalHarmonic::Circle).  If not, \e gradx, etc., will not be
00189      * touched.
00190      **********************************************************************/
00191     Math::real operator()(real lon,
00192                           real& gradx, real& grady, real& gradz) const throw() {
00193       real coslon, sinlon;
00194       cossin(lon, coslon, sinlon);
00195       return (*this)(coslon, sinlon, gradx, grady, gradz);
00196     }
00197   };
00198 
00199 } // namespace GeographicLib
00200 
00201 #if defined(_MSC_VER)
00202 #pragma warning (pop)
00203 #endif
00204 
00205 #endif  // GEOGRAPHICLIB_CIRCULARENGINE_HPP
geographiclib-1.21/doc/html/CartConvert_8cpp.html0000644000175000017500000001340711745620415021651 0ustar frankiefrankie GeographicLib: CartConvert.cpp File Reference
CartConvert.cpp File Reference

Command line utility for geodetic to cartesian coordinate conversions. More...

#include <iostream>
#include <sstream>
#include <string>
#include <fstream>
#include <GeographicLib/Geocentric.hpp>
#include <GeographicLib/LocalCartesian.hpp>
#include <GeographicLib/DMS.hpp>
#include <GeographicLib/Utility.hpp>
#include "CartConvert.usage"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Detailed Description

Command line utility for geodetic to cartesian coordinate conversions.

Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Compile and link with g++ -g -O3 -I../include -I../man -o CartConvert \ CartConvert.cpp \ ../src/DMS.cpp \ ../src/Geocentric.cpp \ ../src/LocalCartesian.cpp

See the man page for usage information.

Definition in file CartConvert.cpp.


Function Documentation

geographiclib-1.21/doc/html/classGeographicLib_1_1Gnomonic.html0000644000175000017500000007214511745620414024347 0ustar frankiefrankie GeographicLib: GeographicLib::Gnomonic Class Reference
GeographicLib::Gnomonic Class Reference

Gnomonic Projection. More...

#include <GeographicLib/Gnomonic.hpp>

List of all members.

Public Member Functions

 Gnomonic (const Geodesic &earth=Geodesic::WGS84) throw ()
void Forward (real lat0, real lon0, real lat, real lon, real &x, real &y, real &azi, real &rk) const throw ()
void Reverse (real lat0, real lon0, real x, real y, real &lat, real &lon, real &azi, real &rk) const throw ()
void Forward (real lat0, real lon0, real lat, real lon, real &x, real &y) const throw ()
void Reverse (real lat0, real lon0, real x, real y, real &lat, real &lon) const throw ()
Inspector functions
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()

Detailed Description

Gnomonic Projection.

Gnomonic projection centered at an arbitrary position C on the ellipsoid. This projection is derived in Section 13 of

See also Section 8 of

The projection of P is defined as follows: compute the geodesic line from C to P; compute the reduced length m12, geodesic scale M12, and rho = m12/M12; finally x = rho sin azi1; y = rho cos azi1, where azi1 is the azimuth of the geodesic at C. The Gnomonic::Forward and Gnomonic::Reverse methods also return the azimuth azi of the geodesic at P and reciprocal scale rk in the azimuthal direction. The scale in the radial direction if 1/rk2.

For a sphere, rho is reduces to a tan(s12/a), where s12 is the length of the geodesic from C to P, and the gnomonic projection has the property that all geodesics appear as straight lines. For an ellipsoid, this property holds only for geodesics interesting the centers. However geodesic segments close to the center are approximately straight.

Consider a geodesic segment of length l. Let T be the point on the geodesic (extended if necessary) closest to C the center of the projection and t be the distance CT. To lowest order, the maximum deviation (as a true distance) of the corresponding gnomonic line segment (i.e., with the same end points) from the geodesic is

(K(T) - K(C)) l2 t / 32.

where K is the Gaussian curvature.

This result applies for any surface. For an ellipsoid of revolution, consider all geodesics whose end points are within a distance r of C. For a given r, the deviation is maximum when the latitude of C is 45o, when endpoints are a distance r away, and when their azimuths from the center are +/- 45o or +/- 135o. To lowest order in r and the flattening f, the deviation is f (r/2a)3 r.

The conversions all take place using a Geodesic object (by default Geodesic::WGS84). For more information on geodesics see Geodesics on the ellipsoid.

CAUTION: The definition of this projection for a sphere is standard. However, there is no standard for how it should be extended to an ellipsoid. The choices are:

  • Declare that the projection is undefined for an ellipsoid.
  • Project to a tangent plane from the center of the ellipsoid. This causes great ellipses to appear as straight lines in the projection; i.e., it generalizes the spherical great circle to a great ellipse. This was proposed by independently by Bowring and Williams in 1997.
  • Project to the conformal sphere with the constant of integration chosen so that the values of the latitude match for the center point and perform a central projection onto the plane tangent to the conformal sphere at the center point. This causes normal sections through the center point to appear as straight lines in the projection; i.e., it generalizes the spherical great circle to a normal section. This was proposed by I. G. Letoval'tsev, Generalization of the Gnomonic Projection for a Spheroid and the Principal Geodetic Problems Involved in the Alignment of Surface Routes, Geodesy and Aerophotography (5), 271-274 (1963).
  • The projection given here. This causes geodesics close to the center point to appear as straight lines in the projection; i.e., it generalizes the spherical great circle to a geodesic.

Example of use:

// Example of using the GeographicLib::Gnomonic class
// $Id: 59ed16349fd55bdde98654feeb1225a046d85696 $

#include <iostream>
#include <exception>
#include <GeographicLib/Geodesic.hpp>
#include <GeographicLib/Gnomonic.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    Geodesic geod(Constants::WGS84_a(), Constants::WGS84_f());
    // Alternatively: const Geodesic& geod = Geodesic::WGS84;
    const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris
    Gnomonic proj(geod);
    {
      // Sample forward calculation
      double lat = 50.9, lon = 1.8; // Calais
      double x, y;
      proj.Forward(lat0, lon0, lat, lon, x, y);
      cout << x << " " << y << "\n";
    }
    {
      // Sample reverse calculation
      double x = -38e3, y = 230e3;
      double lat, lon;
      proj.Reverse(lat0, lon0, x, y, lat, lon);
      cout << lat << " " << lon << "\n";
    }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

GeodesicProj is a command-line utility providing access to the functionality of AzimuthalEquidistant, Gnomonic, and CassiniSoldner.


Constructor & Destructor Documentation

GeographicLib::Gnomonic::Gnomonic ( const Geodesic earth = Geodesic::WGS84) throw () [inline, explicit]

Constructor for Gnomonic.

Parameters:
[in]earththe Geodesic object to use for geodesic calculations. By default this uses the WGS84 ellipsoid.

Definition at line 123 of file Gnomonic.hpp.


Member Function Documentation

void GeographicLib::Gnomonic::Forward ( real  lat0,
real  lon0,
real  lat,
real  lon,
real &  x,
real &  y,
real &  azi,
real &  rk 
) const throw ()

Forward projection, from geographic to gnomonic.

Parameters:
[in]lat0latitude of center point of projection (degrees).
[in]lon0longitude of center point of projection (degrees).
[in]latlatitude of point (degrees).
[in]lonlongitude of point (degrees).
[out]xeasting of point (meters).
[out]ynorthing of point (meters).
[out]aziazimuth of geodesic at point (degrees).
[out]rkreciprocal of azimuthal scale at point.

lat0 and lat should be in the range [-90, 90] and lon0 and lon should be in the range [-180, 360]. The scale of the projection is 1/rk2 in the "radial" direction, azi clockwise from true north, and is 1/rk in the direction perpendicular to this. If the point lies "over the horizon", i.e., if rk <= 0, then NaNs are returned for x and y (the correct values are returned for azi and rk). A call to Forward followed by a call to Reverse will return the original (lat, lon) (to within roundoff) provided the point in not over the horizon.

Definition at line 25 of file Gnomonic.cpp.

Referenced by main().

void GeographicLib::Gnomonic::Reverse ( real  lat0,
real  lon0,
real  x,
real  y,
real &  lat,
real &  lon,
real &  azi,
real &  rk 
) const throw ()

Reverse projection, from gnomonic to geographic.

Parameters:
[in]lat0latitude of center point of projection (degrees).
[in]lon0longitude of center point of projection (degrees).
[in]xeasting of point (meters).
[in]ynorthing of point (meters).
[out]latlatitude of point (degrees).
[out]lonlongitude of point (degrees).
[out]aziazimuth of geodesic at point (degrees).
[out]rkreciprocal of azimuthal scale at point.

lat0 should be in the range [-90, 90] and lon0 should be in the range [-180, 360]. lat will be in the range [-90, 90] and lon will be in the range [-180, 180). The scale of the projection is 1/rk2 in the "radial" direction, azi clockwise from true north, and is 1/rk in the direction perpendicular to this. Even though all inputs should return a valid lat and lon, it's possible that the procedure fails to converge for very large x or y; in this case NaNs are returned for all the output arguments. A call to Reverse followed by a call to Forward will return the original (x, y) (to roundoff).

Definition at line 44 of file Gnomonic.cpp.

References GeographicLib::GeodesicLine::Position().

Referenced by main().

void GeographicLib::Gnomonic::Forward ( real  lat0,
real  lon0,
real  lat,
real  lon,
real &  x,
real &  y 
) const throw () [inline]

Gnomonic::Forward without returning the azimuth and scale.

Definition at line 184 of file Gnomonic.hpp.

void GeographicLib::Gnomonic::Reverse ( real  lat0,
real  lon0,
real  x,
real  y,
real &  lat,
real &  lon 
) const throw () [inline]

Gnomonic::Reverse without returning the azimuth and scale.

Definition at line 193 of file Gnomonic.hpp.

Math::real GeographicLib::Gnomonic::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value inherited from the Geodesic object used in the constructor.

Definition at line 206 of file Gnomonic.hpp.

Math::real GeographicLib::Gnomonic::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid. This is the value inherited from the Geodesic object used in the constructor.

Definition at line 212 of file Gnomonic.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/ellint.mac0000644000175000017500000000663011745620415017550 0ustar frankiefrankie/* Written by Charles Karney http://geographiclib.sourceforge.net/ $Id: 23c6d3303abe67aa05500f9f794547c8f3f122a5 $ */ /* Implementation of methods given in B. C. Carlson Computation of elliptic integrals Numerical Algorithms 10, 13-26 (1995) */ /* fpprec:120$ Should be set outside */ etol:0.1b0^fpprec$ /* For Carlson */ ca:sqrt(etol)$ /* For Bulirsch */ eps:0.1b0^fpprec$ /* For eirx */ pi:bfloat(%pi)$ ratprint:false$ rf(x,y,z) := block( [a0:(x+y+z)/3, q,x0:x,y0:y,z0:z,an,ln,xx,yy,zz,n,e2,e3], q:(3*etol)^(-1/6)*max(abs(a0-x),abs(a0-y),abs(a0-z)), an:a0, n:0, while q >= abs(an) do ( n:n+1, ln:sqrt(x0)*sqrt(y0)+sqrt(y0)*sqrt(z0)+sqrt(z0)*sqrt(x0), an:(an+ln)/4, x0:(x0+ln)/4, y0:(y0+ln)/4, z0:(z0+ln)/4, q:q/4), xx:(a0-x)/(4^n*an), yy:(a0-y)/(4^n*an), zz:-xx-yy, e2:xx*yy-zz^2, e3:xx*yy*zz, (1-e2/10+e3/14+e2^2/24-3*e2*e3/44) / sqrt(an))$ rd(x,y,z) := block( [a0:(x+y+3*z)/5, q,x0:x,y0:y,z0:z,an,ln,xx,yy,zz,n,e2,e3,e4,e5,s], q:(etol/4)^(-1/6)*max(abs(a0-x),abs(a0-y),abs(a0-z)), an:a0, n:0, s:0, while q >= abs(an) do ( ln:sqrt(x0)*sqrt(y0)+sqrt(y0)*sqrt(z0)+sqrt(z0)*sqrt(x0), s:s+1/(4^n*sqrt(z0)*(z0+ln)), n:n+1, an:(an+ln)/4, x0:(x0+ln)/4, y0:(y0+ln)/4, z0:(z0+ln)/4, q:q/4), xx:(a0-x)/(4^n*an), yy:(a0-y)/(4^n*an), zz:-(xx+yy)/3, e2:xx*yy-6*zz^2, e3:(3*xx*yy-8*zz^2)*zz, e4:3*(xx*yy-zz^2)*zz^2, e5:xx*yy*zz^3, (1-3*e2/14+e3/6+9*e2^2/88-3*e4/22-9*e2*e3/52+3*e5/26)/(4^n*an*sqrt(an)) +3*s)$ /* R_G(x,y,0) */ rg0(x,y) := block( [x0:sqrt(x),y0:sqrt(y),xn,yn,t,s,n], xn:x0, yn:y0, n:0, s:0, while abs(xn-yn) >= 2.7b0 * sqrt(etol) * abs(xn) do ( t:(xn+yn)/2, yn:sqrt(xn*yn), xn:t, n:n+1, s:s+(xn-yn)^2*2^(n-2)), ((x0+y0)^2/4 - s)*pi/(2*(xn+yn)) )$ /* k^2 = m */ ec(m):=2*rg0(1b0-m,1b0)$ kc(m):=rf(0b0,1b0-m,1b0)$ /* Implementation of methods given in Roland Bulirsch Numerical Calculation of Elliptic Integrals and Elliptic Functions Numericshe Mathematik 7, 78-90 (1965) */ sncndn(x,mc):=block([bo, a, b, c, d, l, sn, cn, dn, m, n], local(m, n), if mc # 0 then ( bo:is(mc < 0b0), if bo then ( d:1-mc, mc:-mc/d, d:sqrt(d), x:d*x), dn:a:1, for i:0 thru 12 do ( l:i, m[i]:a, n[i]:mc:sqrt(mc), c:(a+mc)/2, if abs(a-mc)<=ca*a then return(false), mc:a*mc, a:c ), x:c*x, sn:sin(x), cn:sin(pi/2-x), if sn#0b0 then ( a:cn/sn, c:a*c, for i:l step -1 thru 0 do ( b:m[i], a:c*a, c:dn*c, dn:(n[i]+a)/(b+a), a:c/b ), a:1/sqrt(c*c+1b0), sn:if sn<0b0 then -a else a, cn:c*sn ), if bo then ( a:dn, dn:cn, cn:a, sn:sn/d ) ) else /* mc = 0 */ ( sn:tanh(x), dn:cn:sech(x) /* d:exp(x), a:1/d, b:a+d, cn:dn:2/b, if x < 0.3b0 then ( d:x*x*x*x, d:(d*(d*(d*(d+93024b0)+3047466240b0)+24135932620800b0)+ 20274183401472000b0)/60822550204416000b0, sn:cn*(x*x*x*d+sin(x)) ) else sn:(d-a)/b */ ), [sn,cn,dn] )$ /* Versions of incomplete functions in terms of Jacobi elliptic function with u = am(phi) real and in [0,K(m)] */ eirx(sn,cn,dn,m,ec):=block([t], t:if abs(sn) < eps then abs(sn) else (rf((cn/sn)^2,(dn/sn)^2,1/sn^2)-m/3b0*rd((cn/sn)^2,(dn/sn)^2,1/sn^2)), if cn < 0 then t:2*ec - t, if sn < 0 then t:-t, t)$ geographiclib-1.21/doc/html/UTMUPS_8cpp_source.html0000644000175000017500000007661511745620415022046 0ustar frankiefrankie GeographicLib: UTMUPS.cpp Source File
UTMUPS.cpp
Go to the documentation of this file.
00001 /**
00002  * \file UTMUPS.cpp
00003  * \brief Implementation for GeographicLib::UTMUPS class
00004  *
00005  * Copyright (c) Charles Karney (2008-2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/UTMUPS.hpp>
00011 #include <iomanip>
00012 #include <GeographicLib/MGRS.hpp>
00013 #include <GeographicLib/PolarStereographic.hpp>
00014 #include <GeographicLib/TransverseMercator.hpp>
00015 #include <GeographicLib/Utility.hpp>
00016 
00017 #define GEOGRAPHICLIB_UTMUPS_CPP \
00018   "$Id: 5672b003ee47cd660377c111e3fca2b81da86323 $"
00019 
00020 RCSID_DECL(GEOGRAPHICLIB_UTMUPS_CPP)
00021 RCSID_DECL(GEOGRAPHICLIB_UTMUPS_HPP)
00022 
00023 namespace GeographicLib {
00024 
00025   using namespace std;
00026 
00027   const Math::real UTMUPS::falseeasting_[4] =
00028     { MGRS::upseasting_ * MGRS::tile_, MGRS::upseasting_ * MGRS::tile_,
00029       MGRS::utmeasting_ * MGRS::tile_, MGRS::utmeasting_ * MGRS::tile_ };
00030   const Math::real UTMUPS::falsenorthing_[4] =
00031     { MGRS::upseasting_ * MGRS::tile_, MGRS::upseasting_ * MGRS::tile_,
00032       MGRS::maxutmSrow_ * MGRS::tile_, MGRS::minutmNrow_ * MGRS::tile_ };
00033   const Math::real UTMUPS::mineasting_[4] =
00034     { MGRS::minupsSind_ * MGRS::tile_, MGRS::minupsNind_ * MGRS::tile_,
00035       MGRS::minutmcol_ * MGRS::tile_, MGRS::minutmcol_ * MGRS::tile_ };
00036   const Math::real UTMUPS::maxeasting_[4] =
00037     { MGRS::maxupsSind_ * MGRS::tile_, MGRS::maxupsNind_ * MGRS::tile_,
00038       MGRS::maxutmcol_ * MGRS::tile_, MGRS::maxutmcol_ * MGRS::tile_ };
00039   const Math::real UTMUPS::minnorthing_[4] =
00040     { MGRS::minupsSind_ * MGRS::tile_, MGRS::minupsNind_ * MGRS::tile_,
00041       MGRS::minutmSrow_ * MGRS::tile_,
00042       (MGRS::minutmNrow_ + MGRS::minutmSrow_ - MGRS::maxutmSrow_)
00043       * MGRS::tile_ };
00044   const Math::real UTMUPS::maxnorthing_[4] =
00045     { MGRS::maxupsSind_ * MGRS::tile_, MGRS::maxupsNind_ * MGRS::tile_,
00046       (MGRS::maxutmSrow_ + MGRS::maxutmNrow_ - MGRS::minutmNrow_) * MGRS::tile_,
00047       MGRS::maxutmNrow_ * MGRS::tile_ };
00048 
00049   int UTMUPS::StandardZone(real lat, real lon, int setzone) {
00050     if (!(setzone >= MINPSEUDOZONE && setzone <= MAXZONE))
00051       throw GeographicErr("Illegal zone requested " + Utility::str(setzone));
00052     if (setzone >= MINZONE || setzone == INVALID)
00053       return setzone;
00054     if (Math::isnan(lat) || Math::isnan(lon)) // Check if lat or lon is a NaN
00055       return INVALID;
00056     // Assume lon is in [-180, 360].
00057     if (setzone == UTM || (lat >= -80 && lat < 84)) {
00058       // Assume lon is in [-180, 360].
00059       int ilon = int(floor(lon));
00060       if (ilon >= 180)
00061         ilon -= 360;
00062       int zone = (ilon + 186)/6;
00063       int band = MGRS::LatitudeBand(lat);
00064       if (band == 7 && zone == 31 && ilon >= 3)
00065         zone = 32;
00066       else if (band == 9 && ilon >= 0 && ilon < 42)
00067         zone = 2 * ((ilon + 183)/12) + 1;
00068       return zone;
00069     } else
00070       return UPS;
00071   }
00072 
00073   void UTMUPS::Forward(real lat, real lon,
00074                        int& zone, bool& northp, real& x, real& y,
00075                        real& gamma, real& k,
00076                        int setzone, bool mgrslimits) {
00077     CheckLatLon(lat, lon);
00078     bool northp1 = lat >= 0;
00079     int zone1 = StandardZone(lat, lon, setzone);
00080     if (zone1 == INVALID) {
00081       zone = zone1;
00082       northp = northp1;
00083       x = y = gamma = k = Math::NaN<real>();
00084       return;
00085     }
00086     real x1, y1, gamma1, k1;
00087     bool utmp = zone1 != UPS;
00088     if (utmp) {
00089       real
00090         lon0 = CentralMeridian(zone1),
00091         dlon = lon - lon0;
00092       dlon = abs(dlon - 360 * floor((dlon + 180)/360));
00093       if (dlon > 60)
00094         // Check isn't really necessary because CheckCoords catches this case.
00095         // But this allows a more meaningful error message to be given.
00096         throw GeographicErr("Longitude " + Utility::str(lon)
00097                             + "d more than 60d from center of UTM zone "
00098                             + Utility::str(zone1));
00099       TransverseMercator::UTM.Forward(lon0, lat, lon, x1, y1, gamma1, k1);
00100     } else {
00101       if (abs(lat) < 70)
00102         // Check isn't really necessary ... (see above).
00103         throw GeographicErr("Latitude " + Utility::str(lat)
00104                             + "d more than 20d from "
00105                             + (northp1 ? "N" : "S") + " pole");
00106       PolarStereographic::UPS.Forward(northp1, lat, lon, x1, y1, gamma1, k1);
00107     }
00108     int ind = (utmp ? 2 : 0) + (northp1 ? 1 : 0);
00109     x1 += falseeasting_[ind];
00110     y1 += falsenorthing_[ind];
00111     if (! CheckCoords(zone1 != UPS, northp1, x1, y1, mgrslimits, false) )
00112       throw GeographicErr("Latitude " + Utility::str(lat)
00113                           + ", longitude " + Utility::str(lon)
00114                           + " out of legal range for "
00115                           + (utmp ? "UTM zone " + Utility::str(zone1) : "UPS"));
00116     zone = zone1;
00117     northp = northp1;
00118     x = x1;
00119     y = y1;
00120     gamma = gamma1;
00121     k = k1;
00122   }
00123 
00124   void UTMUPS::Reverse(int zone, bool northp, real x, real y,
00125                        real& lat, real& lon, real& gamma, real& k,
00126                        bool mgrslimits) {
00127     if (zone == INVALID || Math::isnan(x) || Math::isnan(y)) {
00128       lat = lon = gamma = k = Math::NaN<real>();
00129       return;
00130     }
00131     if (!(zone >= MINZONE && zone <= MAXZONE))
00132       throw GeographicErr("Zone " + Utility::str(zone)
00133                           + " not in range [0, 60]");
00134     bool utmp = zone != UPS;
00135     CheckCoords(utmp, northp, x, y, mgrslimits);
00136     int ind = (utmp ? 2 : 0) + (northp ? 1 : 0);
00137     x -= falseeasting_[ind];
00138     y -= falsenorthing_[ind];
00139     if (utmp)
00140       TransverseMercator::UTM.Reverse(CentralMeridian(zone),
00141                                       x, y, lat, lon, gamma, k);
00142     else
00143       PolarStereographic::UPS.Reverse(northp, x, y, lat, lon, gamma, k);
00144   }
00145 
00146   void UTMUPS::CheckLatLon(real lat, real lon) {
00147     if (lat < -90 || lat > 90)
00148       throw GeographicErr("Latitude " + Utility::str(lat)
00149                           + "d not in [-90d, 90d]");
00150     if (lon < -180 || lon > 360)
00151       throw GeographicErr("Latitude " + Utility::str(lon)
00152                           + "d not in [-180d, 360d]");
00153     }
00154 
00155   bool UTMUPS::CheckCoords(bool utmp, bool northp, real x, real y,
00156                            bool mgrslimits, bool throwp) {
00157     // Limits are all multiples of 100km and are all closed on the both ends.
00158     // Failure tests are such that NaNs succeed.
00159     real slop = mgrslimits ? 0 : MGRS::tile_;
00160     int ind = (utmp ? 2 : 0) + (northp ? 1 : 0);
00161     if (x < mineasting_[ind] - slop || x > maxeasting_[ind] + slop) {
00162       if (!throwp) return false;
00163       throw GeographicErr("Easting " + Utility::str(x/1000) + "km not in "
00164                           + (mgrslimits ? "MGRS/" : "")
00165                           + (utmp ? "UTM" : "UPS") + " range for "
00166                           + (northp ? "N" : "S" ) + " hemisphere ["
00167                           + Utility::str((mineasting_[ind] - slop)/1000)
00168                           + "km, "
00169                           + Utility::str((maxeasting_[ind] + slop)/1000)
00170                           + "km]");
00171     }
00172     if (y < minnorthing_[ind] - slop || y > maxnorthing_[ind] + slop) {
00173       if (!throwp) return false;
00174       throw GeographicErr("Northing " + Utility::str(y/1000) + "km not in "
00175                           + (mgrslimits ? "MGRS/" : "")
00176                           + (utmp ? "UTM" : "UPS") + " range for "
00177                           + (northp ? "N" : "S" ) + " hemisphere ["
00178                           + Utility::str((minnorthing_[ind] - slop)/1000)
00179                           + "km, "
00180                           + Utility::str((maxnorthing_[ind] + slop)/1000)
00181                           + "km]");
00182     }
00183     return true;
00184   }
00185 
00186   void UTMUPS::DecodeZone(const std::string& zonestr, int& zone, bool& northp) {
00187     unsigned zlen = unsigned(zonestr.size());
00188     if (zlen == 0)
00189       throw GeographicErr("Empty zone specification");
00190     if (zlen > 3)
00191       throw GeographicErr("More than 3 characters in zone specification "
00192                           + zonestr);
00193     if (zlen == 3 &&
00194         toupper(zonestr[0]) == 'I' &&
00195         toupper(zonestr[1]) == 'N' &&
00196         toupper(zonestr[2]) == 'V') {
00197       zone = INVALID;
00198       northp = false;
00199       return;
00200     }
00201     char hemi = toupper(zonestr[zlen - 1]);
00202     bool northp1 = hemi == 'N';
00203     if (! (northp1 || hemi == 'S'))
00204       throw GeographicErr(string("Illegal hemisphere letter ") + hemi + " in "
00205                           + zonestr + ", specify N or S");
00206     if (zlen == 1)
00207       zone = UPS;
00208     else {
00209       const char* c = zonestr.c_str();
00210       char* q;
00211       int zone1 = strtol(c, &q, 10);
00212       if (q == c)
00213         throw GeographicErr("No zone number found in " + zonestr);
00214       if (q - c != int(zlen) - 1)
00215         throw GeographicErr("Extra text " +
00216                             zonestr.substr(q - c, int(zlen) - 1 - (q - c)) +
00217                             " in UTM/UPS zone " + zonestr);
00218       if (zone1 == UPS)
00219         // Don't allow 0N as an alternative to N for UPS coordinates
00220         throw GeographicErr("Illegal zone 0 in " + zonestr +
00221                             ", use just " + hemi + " for UPS");
00222       if (!(zone1 >= MINUTMZONE && zone1 <= MAXUTMZONE))
00223         throw GeographicErr("Zone " + Utility::str(zone1)
00224                             + " not in range [1, 60]");
00225       zone = zone1;
00226     }
00227     northp = northp1;
00228   }
00229 
00230   std::string UTMUPS::EncodeZone(int zone, bool northp) {
00231     if (zone == INVALID)
00232       return string("INV");
00233     if (!(zone >= MINZONE && zone <= MAXZONE))
00234         throw GeographicErr("Zone " + Utility::str(zone)
00235                             + " not in range [0, 60]");
00236     ostringstream os;
00237     if (zone != UPS)
00238       os << setfill('0') << setw(2) << zone;
00239     os << (northp ? 'N' : 'S');
00240     return os.str();
00241   }
00242 
00243   Math::real UTMUPS::UTMShift() throw() { return real(MGRS::utmNshift_); }
00244 
00245 } // namespace GeographicLib
geographiclib-1.21/doc/html/functions_func_0x70.html0000644000175000017500000001254511745620414022267 0ustar frankiefrankie GeographicLib: Class Members - Functions geographiclib-1.21/doc/html/classGeographicLib_1_1PolarStereographic.html0000644000175000017500000007116111745620415026371 0ustar frankiefrankie GeographicLib: GeographicLib::PolarStereographic Class Reference
GeographicLib::PolarStereographic Class Reference

Polar Stereographic Projection. More...

#include <GeographicLib/PolarStereographic.hpp>

List of all members.

Public Member Functions

 PolarStereographic (real a, real f, real k0)
void SetScale (real lat, real k=real(1))
void Forward (bool northp, real lat, real lon, real &x, real &y, real &gamma, real &k) const throw ()
void Reverse (bool northp, real x, real y, real &lat, real &lon, real &gamma, real &k) const throw ()
void Forward (bool northp, real lat, real lon, real &x, real &y) const throw ()
void Reverse (bool northp, real x, real y, real &lat, real &lon) const throw ()
Inspector functions
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()
Math::real CentralScale () const throw ()

Static Public Attributes

static const PolarStereographic UPS

Detailed Description

Polar Stereographic Projection.

Implementation taken from the report,

This is a straightforward implementation of the equations in Snyder except that Newton's method is used to invert the projection.

Example of use:

// Example of using the GeographicLib::PolarStereographic class
// $Id: 76bd97693e4f711118164cc0cde1db7f5ca70e12 $

#include <iostream>
#include <exception>
#include <string>
#include <iomanip>
#include <GeographicLib/PolarStereographic.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    PolarStereographic proj(Constants::WGS84_a(), Constants::WGS84_f(),
                            Constants::UPS_k0());
    // Alternatively:
    // const PolarStereographic& proj = PolarStereographic::UPS;
    bool northp = true;
    {
      // Sample forward calculation
      double lat = 61.2, lon = -149.9; // Anchorage
      double x, y;
      proj.Forward(northp, lat, lon, x, y);
      cout << x << " " << y << "\n";
    }
    {
      // Sample reverse calculation
      double x = -1637e3, y = 2824e3;
      double lat, lon;
      proj.Reverse(northp, x, y, lat, lon);
      cout << lat << " " << lon << "\n";
    }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Constructor & Destructor Documentation

GeographicLib::PolarStereographic::PolarStereographic ( real  a,
real  f,
real  k0 
)

Constructor for a ellipsoid with

Parameters:
[in]aequatorial radius (meters).
[in]fflattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid. If f > 1, set flattening to 1/f.
[in]k0central scale factor.

An exception is thrown if either of the axes of the ellipsoid is not positive a or if k0 is not positive.

Definition at line 28 of file PolarStereographic.cpp.

References GeographicLib::Math::isfinite().


Member Function Documentation

void GeographicLib::PolarStereographic::SetScale ( real  lat,
real  k = real(1) 
)

Set the scale for the projection.

Parameters:
[in]lat(degrees) assuming northp = true.
[in]kscale at latitude lat (default 1).

This allows a "latitude of true scale" to be specified. An exception is thrown if k is not positive or if lat is not in the range (-90, 90].

Definition at line 126 of file PolarStereographic.cpp.

References GeographicLib::Math::isfinite(), and Forward().

void GeographicLib::PolarStereographic::Forward ( bool  northp,
real  lat,
real  lon,
real &  x,
real &  y,
real &  gamma,
real &  k 
) const throw ()

Forward projection, from geographic to polar stereographic.

Parameters:
[in]northpthe pole which is the center of projection (true means north, false means south).
[in]latlatitude of point (degrees).
[in]lonlongitude of point (degrees).
[out]xeasting of point (meters).
[out]ynorthing of point (meters).
[out]gammameridian convergence at point (degrees).
[out]kscale of projection at point.

No false easting or northing is added. lat should be in the range (-90, 90] for northp = true and in the range [-90, 90) for northp = false; lon should be in the range [-180, 360].

Definition at line 72 of file PolarStereographic.cpp.

References GeographicLib::Math::hypot(), and GeographicLib::Math::sq().

Referenced by SetScale(), and GeographicLib::UTMUPS::Forward().

void GeographicLib::PolarStereographic::Reverse ( bool  northp,
real  x,
real  y,
real &  lat,
real &  lon,
real &  gamma,
real &  k 
) const throw ()

Reverse projection, from polar stereographic to geographic.

Parameters:
[in]northpthe pole which is the center of projection (true means north, false means south).
[in]xeasting of point (meters).
[in]ynorthing of point (meters).
[out]latlatitude of point (degrees).
[out]lonlongitude of point (degrees).
[out]gammameridian convergence at point (degrees).
[out]kscale of projection at point.

No false easting or northing is added. The value of lon returned is in the range [-180, 180).

Definition at line 95 of file PolarStereographic.cpp.

References GeographicLib::Math::hypot(), and GeographicLib::Math::sq().

Referenced by GeographicLib::UTMUPS::Reverse().

void GeographicLib::PolarStereographic::Forward ( bool  northp,
real  lat,
real  lon,
real &  x,
real &  y 
) const throw () [inline]

PolarStereographic::Forward without returning the convergence and scale.

Definition at line 121 of file PolarStereographic.hpp.

void GeographicLib::PolarStereographic::Reverse ( bool  northp,
real  x,
real  y,
real &  lat,
real &  lon 
) const throw () [inline]

PolarStereographic::Reverse without returning the convergence and scale.

Definition at line 130 of file PolarStereographic.hpp.

Math::real GeographicLib::PolarStereographic::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value used in the constructor.

Definition at line 143 of file PolarStereographic.hpp.

Math::real GeographicLib::PolarStereographic::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid. This is the value used in the constructor.

Definition at line 149 of file PolarStereographic.hpp.

Math::real GeographicLib::PolarStereographic::CentralScale ( ) const throw () [inline]

The central scale for the projection. This is the value of k0 used in the constructor and is the scale at the pole unless overridden by PolarStereographic::SetScale.

Definition at line 164 of file PolarStereographic.hpp.


Member Data Documentation

A global instantiation of PolarStereographic with the WGS84 ellipsoid and the UPS scale factor. However, unlike UPS, no false easting or northing is added.

Definition at line 172 of file PolarStereographic.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/Gnomonic_8hpp_source.html0000644000175000017500000007163311745620414022561 0ustar frankiefrankie GeographicLib: Gnomonic.hpp Source File
Gnomonic.hpp
Go to the documentation of this file.
00001 /**
00002  * \file Gnomonic.hpp
00003  * \brief Header for GeographicLib::Gnomonic class
00004  *
00005  * Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_GNOMONIC_HPP)
00011 #define GEOGRAPHICLIB_GNOMONIC_HPP \
00012   "$Id: f2e7e429e56165c314a518fada607c225132b945 $"
00013 
00014 #include <GeographicLib/Geodesic.hpp>
00015 #include <GeographicLib/GeodesicLine.hpp>
00016 #include <GeographicLib/Constants.hpp>
00017 
00018 namespace GeographicLib {
00019 
00020   /**
00021    * \brief %Gnomonic Projection.
00022    *
00023    * %Gnomonic projection centered at an arbitrary position \e C on the
00024    * ellipsoid.  This projection is derived in Section 13 of
00025    * - C. F. F. Karney,
00026    *   <a href="http://arxiv.org/abs/1102.1215v1">Geodesics
00027    *   on an ellipsoid of revolution</a>,
00028    *   Feb. 2011;
00029    *   preprint
00030    *   <a href="http://arxiv.org/abs/1102.1215v1">arxiv:1102.1215v1</a>.
00031    * .
00032    * See also Section 8 of
00033    * - C. F. F. Karney,
00034    *   <a href="http://arxiv.org/abs/1109.4448">Algorithms for geodesics</a>,
00035    *   Sept. 2011;
00036    *   preprint
00037    *   <a href="http://arxiv.org/abs/1109.4448">arxiv:1109.4448</a>.
00038    * .
00039    * The projection of \e P is defined as follows: compute the
00040    * geodesic line from \e C to \e P; compute the reduced length \e m12,
00041    * geodesic scale \e M12, and \e rho = <i>m12</i>/\e M12; finally \e x = \e
00042    * rho sin \e azi1; \e y = \e rho cos \e azi1, where \e azi1 is the azimuth
00043    * of the geodesic at \e C.  The Gnomonic::Forward and Gnomonic::Reverse
00044    * methods also return the azimuth \e azi of the geodesic at \e P and
00045    * reciprocal scale \e rk in the azimuthal direction.  The scale in the
00046    * radial direction if 1/<i>rk</i><sup>2</sup>.
00047    *
00048    * For a sphere, \e rho is reduces to \e a tan(<i>s12</i>/<i>a</i>), where \e
00049    * s12 is the length of the geodesic from \e C to \e P, and the gnomonic
00050    * projection has the property that all geodesics appear as straight lines.
00051    * For an ellipsoid, this property holds only for geodesics interesting the
00052    * centers.  However geodesic segments close to the center are approximately
00053    * straight.
00054    *
00055    * Consider a geodesic segment of length \e l.  Let \e T be the point on the
00056    * geodesic (extended if necessary) closest to \e C the center of the
00057    * projection and \e t be the distance \e CT.  To lowest order, the maximum
00058    * deviation (as a true distance) of the corresponding gnomonic line segment
00059    * (i.e., with the same end points) from the geodesic is<br>
00060    * <br>
00061    * (<i>K</i>(<i>T</i>) - <i>K</i>(<i>C</i>))
00062    * <i>l</i><sup>2</sup> \e t / 32.<br>
00063    * <br>
00064    * where \e K is the Gaussian curvature.
00065    *
00066    * This result applies for any surface.  For an ellipsoid of revolution,
00067    * consider all geodesics whose end points are within a distance \e r of \e
00068    * C.  For a given \e r, the deviation is maximum when the latitude of \e C
00069    * is 45<sup>o</sup>, when endpoints are a distance \e r away, and when their
00070    * azimuths from the center are +/- 45<sup>o</sup> or +/- 135<sup>o</sup>.
00071    * To lowest order in \e r and the flattening \e f, the deviation is \e f
00072    * (<i>r</i>/2<i>a</i>)<sup>3</sup> \e r.
00073    *
00074    * The conversions all take place using a Geodesic object (by default
00075    * Geodesic::WGS84).  For more information on geodesics see \ref geodesic.
00076    *
00077    * <b>CAUTION:</b> The definition of this projection for a sphere is
00078    * standard.  However, there is no standard for how it should be extended to
00079    * an ellipsoid.  The choices are:
00080    * - Declare that the projection is undefined for an ellipsoid.
00081    * - Project to a tangent plane from the center of the ellipsoid.  This
00082    *   causes great ellipses to appear as straight lines in the projection;
00083    *   i.e., it generalizes the spherical great circle to a great ellipse.
00084    *   This was proposed by independently by Bowring and Williams in 1997.
00085    * - Project to the conformal sphere with the constant of integration chosen
00086    *   so that the values of the latitude match for the center point and
00087    *   perform a central projection onto the plane tangent to the conformal
00088    *   sphere at the center point.  This causes normal sections through the
00089    *   center point to appear as straight lines in the projection; i.e., it
00090    *   generalizes the spherical great circle to a normal section.  This was
00091    *   proposed by I. G. Letoval'tsev, Generalization of the %Gnomonic
00092    *   Projection for a Spheroid and the Principal Geodetic Problems Involved
00093    *   in the Alignment of Surface Routes, Geodesy and Aerophotography (5),
00094    *   271-274 (1963).
00095    * - The projection given here.  This causes geodesics close to the center
00096    *   point to appear as straight lines in the projection; i.e., it
00097    *   generalizes the spherical great circle to a geodesic.
00098    *
00099    * Example of use:
00100    * \include example-Gnomonic.cpp
00101    *
00102    * <a href="GeodesicProj.1.html">GeodesicProj</a> is a command-line utility
00103    * providing access to the functionality of AzimuthalEquidistant, Gnomonic,
00104    * and CassiniSoldner.
00105    **********************************************************************/
00106 
00107   class GEOGRAPHIC_EXPORT Gnomonic {
00108   private:
00109     typedef Math::real real;
00110     Geodesic _earth;
00111     real _a, _f;
00112     static const real eps0_;
00113     static const real eps_;
00114     static const int numit_ = 5;
00115   public:
00116 
00117     /**
00118      * Constructor for Gnomonic.
00119      *
00120      * @param[in] earth the Geodesic object to use for geodesic calculations.
00121      *   By default this uses the WGS84 ellipsoid.
00122      **********************************************************************/
00123     explicit Gnomonic(const Geodesic& earth = Geodesic::WGS84)
00124       throw()
00125       : _earth(earth)
00126       , _a(_earth.MajorRadius())
00127       , _f(_earth.Flattening())
00128     {}
00129 
00130     /**
00131      * Forward projection, from geographic to gnomonic.
00132      *
00133      * @param[in] lat0 latitude of center point of projection (degrees).
00134      * @param[in] lon0 longitude of center point of projection (degrees).
00135      * @param[in] lat latitude of point (degrees).
00136      * @param[in] lon longitude of point (degrees).
00137      * @param[out] x easting of point (meters).
00138      * @param[out] y northing of point (meters).
00139      * @param[out] azi azimuth of geodesic at point (degrees).
00140      * @param[out] rk reciprocal of azimuthal scale at point.
00141      *
00142      * \e lat0 and \e lat should be in the range [-90, 90] and \e lon0 and \e
00143      * lon should be in the range [-180, 360].  The scale of the projection is
00144      * 1/<i>rk</i><sup>2</sup> in the "radial" direction, \e azi clockwise from
00145      * true north, and is 1/\e rk in the direction perpendicular to this.  If
00146      * the point lies "over the horizon", i.e., if \e rk <= 0, then NaNs are
00147      * returned for \e x and \e y (the correct values are returned for \e azi
00148      * and \e rk).  A call to Forward followed by a call to Reverse will return
00149      * the original (\e lat, \e lon) (to within roundoff) provided the point in
00150      * not over the horizon.
00151      **********************************************************************/
00152     void Forward(real lat0, real lon0, real lat, real lon,
00153                  real& x, real& y, real& azi, real& rk) const throw();
00154 
00155     /**
00156      * Reverse projection, from gnomonic to geographic.
00157      *
00158      * @param[in] lat0 latitude of center point of projection (degrees).
00159      * @param[in] lon0 longitude of center point of projection (degrees).
00160      * @param[in] x easting of point (meters).
00161      * @param[in] y northing of point (meters).
00162      * @param[out] lat latitude of point (degrees).
00163      * @param[out] lon longitude of point (degrees).
00164      * @param[out] azi azimuth of geodesic at point (degrees).
00165      * @param[out] rk reciprocal of azimuthal scale at point.
00166      *
00167      * \e lat0 should be in the range [-90, 90] and \e lon0 should be in the
00168      * range [-180, 360].  \e lat will be in the range [-90, 90] and \e lon
00169      * will be in the range [-180, 180).  The scale of the projection is 1/\e
00170      * rk<sup>2</sup> in the "radial" direction, \e azi clockwise from true
00171      * north, and is 1/\e rk in the direction perpendicular to this.  Even
00172      * though all inputs should return a valid \e lat and \e lon, it's possible
00173      * that the procedure fails to converge for very large \e x or \e y; in
00174      * this case NaNs are returned for all the output arguments.  A call to
00175      * Reverse followed by a call to Forward will return the original (\e x, \e
00176      * y) (to roundoff).
00177      **********************************************************************/
00178     void Reverse(real lat0, real lon0, real x, real y,
00179                  real& lat, real& lon, real& azi, real& rk) const throw();
00180 
00181     /**
00182      * Gnomonic::Forward without returning the azimuth and scale.
00183      **********************************************************************/
00184     void Forward(real lat0, real lon0, real lat, real lon,
00185                  real& x, real& y) const throw() {
00186       real azi, rk;
00187       Forward(lat0, lon0, lat, lon, x, y, azi, rk);
00188     }
00189 
00190     /**
00191      * Gnomonic::Reverse without returning the azimuth and scale.
00192      **********************************************************************/
00193     void Reverse(real lat0, real lon0, real x, real y,
00194                  real& lat, real& lon) const throw() {
00195       real azi, rk;
00196       Reverse(lat0, lon0, x, y, lat, lon, azi, rk);
00197     }
00198 
00199     /** \name Inspector functions
00200      **********************************************************************/
00201     ///@{
00202     /**
00203      * @return \e a the equatorial radius of the ellipsoid (meters).  This is
00204      *   the value inherited from the Geodesic object used in the constructor.
00205      **********************************************************************/
00206     Math::real MajorRadius() const throw() { return _earth.MajorRadius(); }
00207 
00208     /**
00209      * @return \e f the flattening of the ellipsoid.  This is the value
00210      *   inherited from the Geodesic object used in the constructor.
00211      **********************************************************************/
00212     Math::real Flattening() const throw() { return _earth.Flattening(); }
00213     ///@}
00214 
00215     /// \cond SKIP
00216     /**
00217      * <b>DEPRECATED</b>
00218      * @return \e r the inverse flattening of the ellipsoid.
00219      **********************************************************************/
00220     Math::real InverseFlattening() const throw()
00221     { return _earth.InverseFlattening(); }
00222     /// \endcond
00223   };
00224 
00225 } // namespace GeographicLib
00226 
00227 #endif  // GEOGRAPHICLIB_GNOMONIC_HPP
geographiclib-1.21/doc/html/geodesic.html0000644000175000017500000006007211745620415020247 0ustar frankiefrankie GeographicLib: Geodesics on the ellipsoid
Geodesics on the ellipsoid
Back to Magnetic models. Forward to Transverse Mercator projection. Up to Contents.

GeographicLib::Geodesic and GeographicLib::GeodesicLine provide accurate solutions to the direct and inverse geodesic problems. The Geod utility provides an interface to these classes. GeographicLib::AzimuthalEquidistant implements the azimuthal equidistant projection in terms of geodesics. GeographicLib::CassiniSoldner implements a transverse cylindrical equidistant projection in terms of geodesics. The GeodesicProj utility provides an interface to these projections.

References

Test data for geodesics

A test set a geodesics is available at

This is about 39 MB (compressed). This consists of a set of geodesics for the WGS84 ellipsoid. A subset of this (consisting of 1/50 of the members — about 690 kB, compressed) is available at

Each line of the test set gives 10 space delimited numbers

  • latitude for point 1, lat1 (degrees, exact)
  • longitude for point 1, lon1 (degrees, always 0)
  • azimuth for point 1, azi1 (clockwise from north in degrees, exact)
  • latitude for point 2, lat2 (degrees, accurate to 10-18 deg)
  • longitude for point 2, lon2 (degrees, accurate to 10-18 deg)
  • azimuth for point 2, azi2 (degrees, accurate to 10-18 deg)
  • geodesic distance from point 1 to point 2, s12 (meters, exact)
  • arc distance on the auxiliary sphere, a12 (degrees, accurate to 10-18 deg)
  • reduced length of the geodesic, m12 (meters, accurate to 0.1 pm)
  • the area under the geodesic, S12 (m2, accurate to 1 mm2)

These are computed using as direct geodesic calculations with the given lat1, lon1, azi1, and s12. The distance s12 always corresponds to an arc length a12 <= 180o, so the given geodesics give the shortest paths from point 1 to point 2. For simplicity and without loss of generality, lat1 is chosen in [0o, 90o], lon1 is taken to be zero, azi1 is chosen in [0o, 180o]. Furthermore, lat1 and azi1 are taken to be multiples of 10-12 deg and s12 is a multiple of 0.1 um in [0 m, 20003931.4586254 m]. This results lon2 in [0o, 180o] and azi2 in [0o, 180o].

The direct calculation uses an expansion of the geodesic equations accurate to f30 (approximately 1 part in 1050) and is computed with with Maxima's bfloats and fpprec set to 100 (so the errors in the data are probably 1/2 of the values quoted above).

The contents of the file are as follows:

  • 100000 entries randomly distributed
  • 50000 entries which are nearly antipodal
  • 50000 entries with short distances
  • 50000 entries with one end near a pole
  • 50000 entries with both ends near opposite poles
  • 50000 entries which are nearly meridional
  • 50000 entries which are nearly equatorial
  • 50000 entries running between vertices (azi1 = azi2 = 90o)
  • 50000 entries ending close to vertices

(a total of 500000 entries). The values for s12 for the geodesics running between vertices are truncated to a multiple of 0.1 pm and this is used to determine point 2.

This data can be fed to the Geod utility as follows

  • Direct from point 1:
      gunzip -c GeodTest.dat.gz | cut -d' ' -f1,2,3,7 | ./Geod
    
    This should yield columns 4, 5, 6, and 9 of the test set.
  • Direct from point 2:
      gunzip -c GeodTest.dat.gz | cut -d' ' -f4,5,6,7 |
      sed "s/ \([^ ]*$\)/ -\1/" | ./Geod
    
    (The sed command negates the distance.) This should yield columns 1, 2, and 3, and the negative of column 9 of the test set.
  • Inverse between points 1 and 2:
      gunzip -c GeodTest.dat.gz | cut -d' ' -f1,2,4,5 | ./Geod -i
    
    This should yield columns 3, 6, 7, and 9 of the test set.

Add, e.g., "-p 6", to the call to Geod to change the precision of the output. Adding "-f" causes Geod to print 12 fields specifying the geodesic; these include the 10 fields in the test set plus the geodesic scales M12 and M21 which are inserted between m12 and S12.

Expansions for geodesics

We give here the series expansions for the various geodesic integrals valid to order f10. In this release of the code, we use a 6th-order expansions. This is sufficient to maintain accuracy for doubles for the SRMmax ellipsoid (a = 6400 km, f = 1/150). However, the preprocessor macro GEOD_ORD can be used to select any order up to 8. (If using long doubles, with a 64-bit fraction, the default order is 7.) The series expanded to order f30 are given in geodseries30.html.

In the formulas below ^ indicates exponentiation (f^3 = f*f*f) and / indicates real division (3/5 = 0.6). The equations need to be converted to Horner form, but are here left in expanded form so that they can be easily truncated to lower order. These expansions were obtained using the Maxima code, geod.mac.

In the expansions below, we have

  • alpha is the azimuth
  • alpha0 is the azimuth at the equator crossing
  • lambda is the longitude measured from the equator crossing
  • omega is the spherical longitude
  • sigma is the spherical arc length
  • a is the equatorial radius
  • b is the polar semi-axis
  • f is the flattening
  • e2 = f (2 - f)
  • e'2 = e2/(1 - e2)
  • k2 = e'2 cos2 alpha0 = 4 eps / (1 - eps)2
  • n = f / (2 - f)
  • c2 = a2/2 + b2/2 (tanh-1 e)/e
  • ep2 = e'2
  • k2 = k2

The formula for distance is

    s/b = I1(sigma)

where

    I1(sigma) = A1 (sigma + B1(sigma))
    B1(sigma) = sumj = 1 C1j sin(2 j sigma)

and

A1 = (1 + 1/4 * eps^2
        + 1/64 * eps^4
        + 1/256 * eps^6
        + 25/16384 * eps^8
        + 49/65536 * eps^10) / (1 - eps);
C1[1] = - 1/2 * eps
        + 3/16 * eps^3
        - 1/32 * eps^5
        + 19/2048 * eps^7
        - 3/4096 * eps^9;
C1[2] = - 1/16 * eps^2
        + 1/32 * eps^4
        - 9/2048 * eps^6
        + 7/4096 * eps^8
        + 1/65536 * eps^10;
C1[3] = - 1/48 * eps^3
        + 3/256 * eps^5
        - 3/2048 * eps^7
        + 17/24576 * eps^9;
C1[4] = - 5/512 * eps^4
        + 3/512 * eps^6
        - 11/16384 * eps^8
        + 3/8192 * eps^10;
C1[5] = - 7/1280 * eps^5
        + 7/2048 * eps^7
        - 3/8192 * eps^9;
C1[6] = - 7/2048 * eps^6
        + 9/4096 * eps^8
        - 117/524288 * eps^10;
C1[7] = - 33/14336 * eps^7
        + 99/65536 * eps^9;
C1[8] = - 429/262144 * eps^8
        + 143/131072 * eps^10;
C1[9] = - 715/589824 * eps^9;
C1[10] = - 2431/2621440 * eps^10;

The function tau(sigma) = s/(b A1) = sigma + B1(sigma) may be inverted by series reversion giving

    sigma(tau) = tau + sumj = 1 C1'j sin(2 j tau)

where

C1'[1] = + 1/2 * eps
         - 9/32 * eps^3
         + 205/1536 * eps^5
         - 4879/73728 * eps^7
         + 9039/327680 * eps^9;
C1'[2] = + 5/16 * eps^2
         - 37/96 * eps^4
         + 1335/4096 * eps^6
         - 86171/368640 * eps^8
         + 4119073/28311552 * eps^10;
C1'[3] = + 29/96 * eps^3
         - 75/128 * eps^5
         + 2901/4096 * eps^7
         - 443327/655360 * eps^9;
C1'[4] = + 539/1536 * eps^4
         - 2391/2560 * eps^6
         + 1082857/737280 * eps^8
         - 2722891/1548288 * eps^10;
C1'[5] = + 3467/7680 * eps^5
         - 28223/18432 * eps^7
         + 1361343/458752 * eps^9;
C1'[6] = + 38081/61440 * eps^6
         - 733437/286720 * eps^8
         + 10820079/1835008 * eps^10;
C1'[7] = + 459485/516096 * eps^7
         - 709743/163840 * eps^9;
C1'[8] = + 109167851/82575360 * eps^8
         - 550835669/74317824 * eps^10;
C1'[9] = + 83141299/41287680 * eps^9;
C1'[10] = + 9303339907/2972712960 * eps^10;

The reduced length is given by

    m/b = sqrt(1 + k2 sin2sigma2) cos sigma1 sin sigma2
            - sqrt(1 + k2 sin2sigma1) sin sigma1 cos sigma2
            - cos sigma1 cos sigma2 (J(sigma2) - J(sigma1))

where

    J(sigma) = I1(sigma) - I2(sigma)
    I2(sigma) = A2 (sigma + B2(sigma))
    B2(sigma) = sumj = 1 C2j sin(2 j sigma)

A2 = (1 + 1/4 * eps^2
        + 9/64 * eps^4
        + 25/256 * eps^6
        + 1225/16384 * eps^8
        + 3969/65536 * eps^10) * (1 - eps);
C2[1] = + 1/2 * eps
        + 1/16 * eps^3
        + 1/32 * eps^5
        + 41/2048 * eps^7
        + 59/4096 * eps^9;
C2[2] = + 3/16 * eps^2
        + 1/32 * eps^4
        + 35/2048 * eps^6
        + 47/4096 * eps^8
        + 557/65536 * eps^10;
C2[3] = + 5/48 * eps^3
        + 5/256 * eps^5
        + 23/2048 * eps^7
        + 191/24576 * eps^9;
C2[4] = + 35/512 * eps^4
        + 7/512 * eps^6
        + 133/16384 * eps^8
        + 47/8192 * eps^10;
C2[5] = + 63/1280 * eps^5
        + 21/2048 * eps^7
        + 51/8192 * eps^9;
C2[6] = + 77/2048 * eps^6
        + 33/4096 * eps^8
        + 2607/524288 * eps^10;
C2[7] = + 429/14336 * eps^7
        + 429/65536 * eps^9;
C2[8] = + 6435/262144 * eps^8
        + 715/131072 * eps^10;
C2[9] = + 12155/589824 * eps^9;
C2[10] = + 46189/2621440 * eps^10;

The longitude is given in terms of the spherical longitude by

    lambda = omega - f sin alpha0 I3(sigma)

where

    I3(sigma) = A3 (sigma + B3(sigma))
    B3(sigma) = sumj = 1 C3j sin(2 j sigma)

and

A3 = 1 - (1/2 - 1/2 * n) * eps
       - (1/4 + 1/8 * n - 3/8 * n^2) * eps^2
       - (1/16 + 3/16 * n + 1/16 * n^2 - 5/16 * n^3) * eps^3
       - (3/64 + 1/32 * n + 5/32 * n^2 + 5/128 * n^3 - 35/128 * n^4) * eps^4
       - (3/128 + 5/128 * n + 5/256 * n^2 + 35/256 * n^3 + 7/256 * n^4) * eps^5
       - (5/256 + 15/1024 * n + 35/1024 * n^2 + 7/512 * n^3) * eps^6
       - (25/2048 + 35/2048 * n + 21/2048 * n^2) * eps^7
       - (175/16384 + 35/4096 * n) * eps^8
       - 245/32768 * eps^9;
C3[1] = + (1/4 - 1/4 * n) * eps
        + (1/8 - 1/8 * n^2) * eps^2
        + (3/64 + 3/64 * n - 1/64 * n^2 - 5/64 * n^3) * eps^3
        + (5/128 + 1/64 * n + 1/64 * n^2 - 1/64 * n^3 - 7/128 * n^4) * eps^4
        + (3/128 + 11/512 * n + 3/512 * n^2 + 1/256 * n^3 - 7/512 * n^4) * eps^5
        + (21/1024 + 5/512 * n + 13/1024 * n^2 + 1/512 * n^3) * eps^6
        + (243/16384 + 189/16384 * n + 83/16384 * n^2) * eps^7
        + (435/32768 + 109/16384 * n) * eps^8
        + 345/32768 * eps^9;
C3[2] = + (1/16 - 3/32 * n + 1/32 * n^2) * eps^2
        + (3/64 - 1/32 * n - 3/64 * n^2 + 1/32 * n^3) * eps^3
        + (3/128 + 1/128 * n - 9/256 * n^2 - 3/128 * n^3 + 7/256 * n^4) * eps^4
        + (5/256 + 1/256 * n - 1/128 * n^2 - 7/256 * n^3 - 3/256 * n^4) * eps^5
        + (27/2048 + 69/8192 * n - 39/8192 * n^2 - 47/4096 * n^3) * eps^6
        + (187/16384 + 39/8192 * n + 31/16384 * n^2) * eps^7
        + (287/32768 + 47/8192 * n) * eps^8
        + 255/32768 * eps^9;
C3[3] = + (5/192 - 3/64 * n + 5/192 * n^2 - 1/192 * n^3) * eps^3
        + (3/128 - 5/192 * n - 1/64 * n^2 + 5/192 * n^3 - 1/128 * n^4) * eps^4
        + (7/512 - 1/384 * n - 77/3072 * n^2 + 5/3072 * n^3 + 65/3072 * n^4) * eps^5
        + (3/256 - 1/1024 * n - 71/6144 * n^2 - 47/3072 * n^3) * eps^6
        + (139/16384 + 143/49152 * n - 383/49152 * n^2) * eps^7
        + (243/32768 + 95/49152 * n) * eps^8
        + 581/98304 * eps^9;
C3[4] = + (7/512 - 7/256 * n + 5/256 * n^2 - 7/1024 * n^3 + 1/1024 * n^4) * eps^4
        + (7/512 - 5/256 * n - 7/2048 * n^2 + 9/512 * n^3 - 21/2048 * n^4) * eps^5
        + (9/1024 - 43/8192 * n - 129/8192 * n^2 + 39/4096 * n^3) * eps^6
        + (127/16384 - 23/8192 * n - 165/16384 * n^2) * eps^7
        + (193/32768 + 3/8192 * n) * eps^8
        + 171/32768 * eps^9;
C3[5] = + (21/2560 - 9/512 * n + 15/1024 * n^2 - 7/1024 * n^3 + 9/5120 * n^4) * eps^5
        + (9/1024 - 15/1024 * n + 3/2048 * n^2 + 57/5120 * n^3) * eps^6
        + (99/16384 - 91/16384 * n - 781/81920 * n^2) * eps^7
        + (179/32768 - 55/16384 * n) * eps^8
        + 141/32768 * eps^9;
C3[6] = + (11/2048 - 99/8192 * n + 275/24576 * n^2 - 77/12288 * n^3) * eps^6
        + (99/16384 - 275/24576 * n + 55/16384 * n^2) * eps^7
        + (143/32768 - 253/49152 * n) * eps^8
        + 33/8192 * eps^9;
C3[7] = + (429/114688 - 143/16384 * n + 143/16384 * n^2) * eps^7
        + (143/32768 - 143/16384 * n) * eps^8
        + 429/131072 * eps^9;
C3[8] = + (715/262144 - 429/65536 * n) * eps^8
        + 429/131072 * eps^9;
C3[9] = + 2431/1179648 * eps^9;

The formula for area between the geodesic and the equator is given in Sec. 15 of arxiv:1102.1215v1 in terms of S,

    S = c2 alpha + e2 a2 cos alpha0 sin alpha0 I4(sigma)

where

    I4(sigma) = sumj = 0 C4j cos((2j + 1) sigma)

with

C4[0] = + (2/3 - 1/15 * ep2 + 4/105 * ep2^2 - 8/315 * ep2^3 + 64/3465 * ep2^4 - 128/9009 * ep2^5 + 512/45045 * ep2^6 - 1024/109395 * ep2^7 + 16384/2078505 * ep2^8 - 32768/4849845 * ep2^9)
        - (1/20 - 1/35 * ep2 + 2/105 * ep2^2 - 16/1155 * ep2^3 + 32/3003 * ep2^4 - 128/15015 * ep2^5 + 256/36465 * ep2^6 - 4096/692835 * ep2^7 + 8192/1616615 * ep2^8) * k2
        + (1/42 - 1/63 * ep2 + 8/693 * ep2^2 - 80/9009 * ep2^3 + 64/9009 * ep2^4 - 128/21879 * ep2^5 + 2048/415701 * ep2^6 - 4096/969969 * ep2^7) * k2^2
        - (1/72 - 1/99 * ep2 + 10/1287 * ep2^2 - 8/1287 * ep2^3 + 112/21879 * ep2^4 - 1792/415701 * ep2^5 + 512/138567 * ep2^6) * k2^3
        + (1/110 - 1/143 * ep2 + 4/715 * ep2^2 - 56/12155 * ep2^3 + 896/230945 * ep2^4 - 768/230945 * ep2^5) * k2^4
        - (1/156 - 1/195 * ep2 + 14/3315 * ep2^2 - 224/62985 * ep2^3 + 64/20995 * ep2^4) * k2^5
        + (1/210 - 1/255 * ep2 + 16/4845 * ep2^2 - 32/11305 * ep2^3) * k2^6
        - (1/272 - 1/323 * ep2 + 6/2261 * ep2^2) * k2^7
        + (1/342 - 1/399 * ep2) * k2^8
        - 1/420 * k2^9;
C4[1] = + (1/180 - 1/315 * ep2 + 2/945 * ep2^2 - 16/10395 * ep2^3 + 32/27027 * ep2^4 - 128/135135 * ep2^5 + 256/328185 * ep2^6 - 4096/6235515 * ep2^7 + 8192/14549535 * ep2^8) * k2
        - (1/252 - 1/378 * ep2 + 4/2079 * ep2^2 - 40/27027 * ep2^3 + 32/27027 * ep2^4 - 64/65637 * ep2^5 + 1024/1247103 * ep2^6 - 2048/2909907 * ep2^7) * k2^2
        + (1/360 - 1/495 * ep2 + 2/1287 * ep2^2 - 8/6435 * ep2^3 + 112/109395 * ep2^4 - 1792/2078505 * ep2^5 + 512/692835 * ep2^6) * k2^3
        - (1/495 - 2/1287 * ep2 + 8/6435 * ep2^2 - 112/109395 * ep2^3 + 1792/2078505 * ep2^4 - 512/692835 * ep2^5) * k2^4
        + (5/3276 - 1/819 * ep2 + 2/1989 * ep2^2 - 32/37791 * ep2^3 + 64/88179 * ep2^4) * k2^5
        - (1/840 - 1/1020 * ep2 + 4/4845 * ep2^2 - 8/11305 * ep2^3) * k2^6
        + (7/7344 - 7/8721 * ep2 + 2/2907 * ep2^2) * k2^7
        - (2/2565 - 4/5985 * ep2) * k2^8
        + 1/1540 * k2^9;
C4[2] = + (1/2100 - 1/3150 * ep2 + 4/17325 * ep2^2 - 8/45045 * ep2^3 + 32/225225 * ep2^4 - 64/546975 * ep2^5 + 1024/10392525 * ep2^6 - 2048/24249225 * ep2^7) * k2^2
        - (1/1800 - 1/2475 * ep2 + 2/6435 * ep2^2 - 8/32175 * ep2^3 + 112/546975 * ep2^4 - 1792/10392525 * ep2^5 + 512/3464175 * ep2^6) * k2^3
        + (1/1925 - 2/5005 * ep2 + 8/25025 * ep2^2 - 16/60775 * ep2^3 + 256/1154725 * ep2^4 - 1536/8083075 * ep2^5) * k2^4
        - (1/2184 - 1/2730 * ep2 + 1/3315 * ep2^2 - 16/62985 * ep2^3 + 32/146965 * ep2^4) * k2^5
        + (1/2520 - 1/3060 * ep2 + 4/14535 * ep2^2 - 8/33915 * ep2^3) * k2^6
        - (7/20400 - 7/24225 * ep2 + 2/8075 * ep2^2) * k2^7
        + (14/47025 - 4/15675 * ep2) * k2^8
        - 1/3850 * k2^9;
C4[3] = + (1/17640 - 1/24255 * ep2 + 2/63063 * ep2^2 - 8/315315 * ep2^3 + 16/765765 * ep2^4 - 256/14549535 * ep2^5 + 512/33948915 * ep2^6) * k2^3
        - (1/10780 - 1/14014 * ep2 + 2/35035 * ep2^2 - 4/85085 * ep2^3 + 64/1616615 * ep2^4 - 384/11316305 * ep2^5) * k2^4
        + (5/45864 - 1/11466 * ep2 + 1/13923 * ep2^2 - 16/264537 * ep2^3 + 32/617253 * ep2^4) * k2^5
        - (1/8820 - 1/10710 * ep2 + 8/101745 * ep2^2 - 16/237405 * ep2^3) * k2^6
        + (1/8976 - 1/10659 * ep2 + 2/24871 * ep2^2) * k2^7
        - (1/9405 - 2/21945 * ep2) * k2^8
        + 1/10010 * k2^9;
C4[4] = + (1/124740 - 1/162162 * ep2 + 2/405405 * ep2^2 - 4/984555 * ep2^3 + 64/18706545 * ep2^4 - 128/43648605 * ep2^5) * k2^4
        - (1/58968 - 1/73710 * ep2 + 1/89505 * ep2^2 - 16/1700595 * ep2^3 + 32/3968055 * ep2^4) * k2^5
        + (1/41580 - 1/50490 * ep2 + 8/479655 * ep2^2 - 16/1119195 * ep2^3) * k2^6
        - (7/242352 - 7/287793 * ep2 + 2/95931 * ep2^2) * k2^7
        + (7/220077 - 2/73359 * ep2) * k2^8
        - 1/30030 * k2^9;
C4[5] = + (1/792792 - 1/990990 * ep2 + 1/1203345 * ep2^2 - 16/22863555 * ep2^3 + 32/53348295 * ep2^4) * k2^5
        - (1/304920 - 1/370260 * ep2 + 4/1758735 * ep2^2 - 8/4103715 * ep2^3) * k2^6
        + (7/1283568 - 7/1524237 * ep2 + 2/508079 * ep2^2) * k2^7
        - (2/268983 - 4/627627 * ep2) * k2^8
        + 1/110110 * k2^9;
C4[6] = + (1/4684680 - 1/5688540 * ep2 + 4/27020565 * ep2^2 - 8/63047985 * ep2^3) * k2^6
        - (1/1516944 - 1/1801371 * ep2 + 2/4203199 * ep2^2) * k2^7
        + (2/1589445 - 4/3708705 * ep2) * k2^8
        - 1/520520 * k2^9;
C4[7] = + (1/26254800 - 1/31177575 * ep2 + 2/72747675 * ep2^2) * k2^7
        - (1/7335900 - 1/8558550 * ep2) * k2^8
        + 1/3403400 * k2^9;
C4[8] = + (1/141338340 - 1/164894730 * ep2) * k2^8
        - 1/34714680 * k2^9;
C4[9] = + 1/737176440 * k2^9;
Back to Magnetic models. Forward to Transverse Mercator projection. Up to Contents.
geographiclib-1.21/doc/html/tabs.css0000644000175000017500000000210711745620415017235 0ustar frankiefrankie.tabs, .tabs2, .tabs3 { background-image: url('tab_b.png'); width: 100%; z-index: 101; font-size: 13px; } .tabs2 { font-size: 10px; } .tabs3 { font-size: 9px; } .tablist { margin: 0; padding: 0; display: table; } .tablist li { float: left; display: table-cell; background-image: url('tab_b.png'); line-height: 36px; list-style: none; } .tablist a { display: block; padding: 0 20px; font-weight: bold; background-image:url('tab_s.png'); background-repeat:no-repeat; background-position:right; color: #283A5D; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); text-decoration: none; outline: none; } .tabs3 .tablist a { padding: 0 10px; } .tablist a:hover { background-image: url('tab_h.png'); background-repeat:repeat-x; color: #fff; text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); text-decoration: none; } .tablist li.current a { background-image: url('tab_a.png'); background-repeat:repeat-x; color: #fff; text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); } geographiclib-1.21/doc/html/TransverseMercatorProj_8cpp.html0000644000175000017500000001354511745620414024105 0ustar frankiefrankie GeographicLib: TransverseMercatorProj.cpp File Reference
TransverseMercatorProj.cpp File Reference

Command line utility for transverse Mercator projections. More...

#include <iostream>
#include <sstream>
#include <string>
#include <fstream>
#include <GeographicLib/EllipticFunction.hpp>
#include <GeographicLib/TransverseMercatorExact.hpp>
#include <GeographicLib/TransverseMercator.hpp>
#include <GeographicLib/DMS.hpp>
#include <GeographicLib/Utility.hpp>
#include "TransverseMercatorProj.usage"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Detailed Description

Command line utility for transverse Mercator projections.

Copyright (c) Charles Karney (2008-2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Compile and link with g++ -g -O3 -I../include -I../man -o TransverseMercatorProj \ TransverseMercatorProj.cpp \ ../src/DMS.cpp \ ../src/EllipticFunction.cpp \ ../src/TransverseMercator.cpp \ ../src/TransverseMercatorExact.cpp

See the man page for usage information.

Definition in file TransverseMercatorProj.cpp.


Function Documentation

int main ( int  argc,
char *  argv[] 
)
geographiclib-1.21/doc/html/classGeographicLib_1_1Geoid-members.html0000644000175000017500000002513311745620414025250 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::Geoid Member List
This is the complete list of members for GeographicLib::Geoid, including all inherited members.
Cache() const GeographicLib::Geoid [inline]
CacheAll() const GeographicLib::Geoid [inline]
CacheArea(real south, real west, real north, real east) const GeographicLib::Geoid
CacheClear() const GeographicLib::Geoid
CacheEast() const GeographicLib::Geoid [inline]
CacheNorth() const GeographicLib::Geoid [inline]
CacheSouth() const GeographicLib::Geoid [inline]
CacheWest() const GeographicLib::Geoid [inline]
convertflag enum nameGeographicLib::Geoid
ConvertHeight(real lat, real lon, real h, convertflag d) const GeographicLib::Geoid [inline]
DateTime() const GeographicLib::Geoid [inline]
DefaultGeoidName()GeographicLib::Geoid [static]
DefaultGeoidPath()GeographicLib::Geoid [static]
Description() const GeographicLib::Geoid [inline]
ELLIPSOIDTOGEOID enum valueGeographicLib::Geoid
Flattening() const GeographicLib::Geoid [inline]
Geoid(const std::string &name, const std::string &path="", bool cubic=true, bool threadsafe=false)GeographicLib::Geoid [explicit]
GeoidDirectory() const GeographicLib::Geoid [inline]
GeoidFile() const GeographicLib::Geoid [inline]
GeoidName() const GeographicLib::Geoid [inline]
GEOIDTOELLIPSOID enum valueGeographicLib::Geoid
Interpolation() const GeographicLib::Geoid [inline]
MajorRadius() const GeographicLib::Geoid [inline]
MaxError() const GeographicLib::Geoid [inline]
NONE enum valueGeographicLib::Geoid
Offset() const GeographicLib::Geoid [inline]
operator()(real lat, real lon) const GeographicLib::Geoid [inline]
operator()(real lat, real lon, real &gradn, real &grade) const GeographicLib::Geoid [inline]
RMSError() const GeographicLib::Geoid [inline]
Scale() const GeographicLib::Geoid [inline]
ThreadSafe() const GeographicLib::Geoid [inline]
geographiclib-1.21/doc/html/Geodesic_8hpp.html0000644000175000017500000001423211745620414021142 0ustar frankiefrankie GeographicLib: Geodesic.hpp File Reference
Geodesic.hpp File Reference

Header for GeographicLib::Geodesic class. More...

Go to the source code of this file.

Classes

class  GeographicLib::Geodesic
 Geodesic calculations More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_GEODESIC_HPP   "$Id: c1b085aadd7b8eabe0f9518b29531a38c152d495 $"
#define GEOD_ORD   (GEOGRAPHICLIB_PREC == 1 ? 6 : (GEOGRAPHICLIB_PREC == 0 ? 3 : 7))

Detailed Description

Header for GeographicLib::Geodesic class.

Copyright (c) Charles Karney (2009-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file Geodesic.hpp.


Define Documentation

#define GEOGRAPHICLIB_GEODESIC_HPP   "$Id: c1b085aadd7b8eabe0f9518b29531a38c152d495 $"

Definition at line 11 of file Geodesic.hpp.

#define GEOD_ORD   (GEOGRAPHICLIB_PREC == 1 ? 6 : (GEOGRAPHICLIB_PREC == 0 ? 3 : 7))

The order of the expansions used by Geodesic.

Definition at line 20 of file Geodesic.hpp.

geographiclib-1.21/doc/html/MGRS_8cpp_source.html0000644000175000017500000011305511745620414021546 0ustar frankiefrankie GeographicLib: MGRS.cpp Source File
MGRS.cpp
Go to the documentation of this file.
00001 /**
00002  * \file MGRS.cpp
00003  * \brief Implementation for GeographicLib::MGRS class
00004  *
00005  * Copyright (c) Charles Karney (2008-2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/MGRS.hpp>
00011 #include <GeographicLib/Utility.hpp>
00012 
00013 #define GEOGRAPHICLIB_MGRS_CPP "$Id: e4e6b419c8cd8544b3edab85b3352add0d1dd7cb $"
00014 
00015 RCSID_DECL(GEOGRAPHICLIB_MGRS_CPP)
00016 RCSID_DECL(GEOGRAPHICLIB_MGRS_HPP)
00017 
00018 namespace GeographicLib {
00019 
00020   using namespace std;
00021 
00022   const Math::real MGRS::eps_ =
00023     // 25 = ceil(log_2(2e7)) -- use half circumference here because northing
00024     // 195e5 is a legal in the "southern" hemisphere.
00025     pow(real(0.5), numeric_limits<real>::digits - 25);
00026   const Math::real MGRS::angeps_ =
00027     // 7 = ceil(log_2(90))
00028     pow(real(0.5), numeric_limits<real>::digits - 7);
00029   const string MGRS::hemispheres_ = "SN";
00030   const string MGRS::utmcols_[3] = { "ABCDEFGH", "JKLMNPQR", "STUVWXYZ" };
00031   const string MGRS::utmrow_ = "ABCDEFGHJKLMNPQRSTUV";
00032   const string MGRS::upscols_[4] =
00033     { "JKLPQRSTUXYZ", "ABCFGHJKLPQR", "RSTUXYZ", "ABCFGHJ" };
00034   const string MGRS::upsrows_[2] =
00035     { "ABCDEFGHJKLMNPQRSTUVWXYZ", "ABCDEFGHJKLMNP" };
00036   const string MGRS::latband_ = "CDEFGHJKLMNPQRSTUVWX";
00037   const string MGRS::upsband_ = "ABYZ";
00038   const string MGRS::digits_ = "0123456789";
00039 
00040   const int MGRS::mineasting_[4] =
00041     { minupsSind_, minupsNind_, minutmcol_, minutmcol_ };
00042   const int MGRS::maxeasting_[4] =
00043     { maxupsSind_, maxupsNind_, maxutmcol_, maxutmcol_ };
00044   const int MGRS::minnorthing_[4] =
00045     { minupsSind_, minupsNind_,
00046       minutmSrow_, minutmSrow_ - (maxutmSrow_ - minutmNrow_) };
00047   const int MGRS::maxnorthing_[4] =
00048     { maxupsSind_, maxupsNind_,
00049       maxutmNrow_ + (maxutmSrow_ - minutmNrow_), maxutmNrow_ };
00050 
00051   void MGRS::Forward(int zone, bool northp, real x, real y, real lat,
00052                      int prec, std::string& mgrs) {
00053     if (zone == UTMUPS::INVALID ||
00054         Math::isnan(x) || Math::isnan(y) || Math::isnan(lat)) {
00055       prec = -1;
00056       mgrs = "INVALID";
00057       return;
00058     }
00059     bool utmp = zone != 0;
00060     CheckCoords(utmp, northp, x, y);
00061     if (!(zone >= UTMUPS::MINZONE && zone <= UTMUPS::MAXZONE))
00062       throw GeographicErr("Zone " + Utility::str(zone) + " not in [0,60]");
00063     if (!(prec >= 0 && prec <= maxprec_))
00064       throw GeographicErr("MGRS precision " + Utility::str(prec)
00065                           + " not in [0, "
00066                           + Utility::str(int(maxprec_)) + "]");
00067     // Fixed char array for accumulating string.  Allow space for zone, 3 block
00068     // letters, easting + northing.  Don't need to allow for terminating null.
00069     char mgrs1[2 + 3 + 2 * maxprec_];
00070     int
00071       zone1 = zone - 1,
00072       z = utmp ? 2 : 0,
00073       mlen = z + 3 + 2 * prec;
00074     if (utmp) {
00075       mgrs1[0] = digits_[ zone / base_ ];
00076       mgrs1[1] = digits_[ zone % base_ ];
00077       // This isn't necessary...!  Keep y non-neg
00078       // if (!northp) y -= maxutmSrow_ * tile_;
00079     }
00080     int
00081       xh = int(floor(x)) / tile_,
00082       yh = int(floor(y)) / tile_;
00083     real
00084       xf = x - tile_ * xh,
00085       yf = y - tile_ * yh;
00086     if (utmp) {
00087       int
00088         // Correct fuzziness in latitude near equator
00089         iband = abs(lat) > angeps_ ? LatitudeBand(lat) : (northp ? 0 : -1),
00090         icol = xh - minutmcol_,
00091         irow = UTMRow(iband, icol, yh % utmrowperiod_);
00092       if (irow != yh - (northp ? minutmNrow_ : maxutmSrow_))
00093         throw GeographicErr("Latitude " + Utility::str(lat)
00094                             + " is inconsistent with UTM coordinates");
00095       mgrs1[z++] = latband_[10 + iband];
00096       mgrs1[z++] = utmcols_[zone1 % 3][icol];
00097       mgrs1[z++] = utmrow_[(yh + (zone1 & 1 ? utmevenrowshift_ : 0))
00098                          % utmrowperiod_];
00099     } else {
00100       bool eastp = xh >= upseasting_;
00101       int iband = (northp ? 2 : 0) + (eastp ? 1 : 0);
00102       mgrs1[z++] = upsband_[iband];
00103       mgrs1[z++] = upscols_[iband][xh - (eastp ? upseasting_ :
00104                                          (northp ? minupsNind_ : minupsSind_))];
00105       mgrs1[z++] = upsrows_[northp][yh - (northp ? minupsNind_ : minupsSind_)];
00106     }
00107     real mult = pow(real(base_), max(tilelevel_ - prec, 0));
00108     int
00109       ix = int(floor(xf / mult)),
00110       iy = int(floor(yf / mult));
00111     for (int c = min(prec, int(tilelevel_)); c--;) {
00112       mgrs1[z + c] = digits_[ ix % base_ ];
00113       ix /= base_;
00114       mgrs1[z + c + prec] = digits_[ iy % base_ ];
00115       iy /= base_;
00116     }
00117     if (prec > tilelevel_) {
00118       xf -= floor(xf / mult);
00119       yf -= floor(yf / mult);
00120       mult = pow(real(base_), prec - tilelevel_);
00121       ix = int(floor(xf * mult));
00122       iy = int(floor(yf * mult));
00123       for (int c = prec - tilelevel_; c--;) {
00124         mgrs1[z + c + tilelevel_] = digits_[ ix % base_ ];
00125         ix /= base_;
00126         mgrs1[z + c + tilelevel_ + prec] = digits_[ iy % base_ ];
00127         iy /= base_;
00128       }
00129     }
00130     mgrs.resize(mlen);
00131     copy(mgrs1, mgrs1 + mlen, mgrs.begin());
00132   }
00133 
00134   void MGRS::Forward(int zone, bool northp, real x, real y,
00135                      int prec, std::string& mgrs) {
00136     real lat, lon;
00137     if (zone > 0)
00138       UTMUPS::Reverse(zone, northp, x, y, lat, lon);
00139     else
00140       // Latitude isn't needed for UPS specs or for INVALID
00141       lat = 0;
00142     Forward(zone, northp, x, y, lat, prec, mgrs);
00143   }
00144 
00145   void MGRS::Reverse(const std::string& mgrs,
00146                      int& zone, bool& northp, real& x, real& y,
00147                      int& prec, bool centerp) {
00148     int
00149       p = 0,
00150       len = int(mgrs.size());
00151     if (len >= 3 &&
00152         toupper(mgrs[0]) == 'I' &&
00153         toupper(mgrs[1]) == 'N' &&
00154         toupper(mgrs[2]) == 'V') {
00155       zone = UTMUPS::INVALID;
00156       northp = false;
00157       x = y = Math::NaN<real>();
00158       prec = -1;
00159       return;
00160     }
00161     int zone1 = 0;
00162     while (p < len) {
00163       int i = Utility::lookup(digits_, mgrs[p]);
00164       if (i < 0)
00165         break;
00166       zone1 = 10 * zone1 + i;
00167       ++p;
00168     }
00169     if (p > 0 && !(zone1 >= UTMUPS::MINUTMZONE && zone1 <= UTMUPS::MAXUTMZONE))
00170       throw GeographicErr("Zone " + Utility::str(zone1) + " not in [1,60]");
00171     if (p > 2)
00172       throw GeographicErr("More than 2 digits_ at start of MGRS "
00173                           + mgrs.substr(0, p));
00174     if (len - p < 3)
00175       throw GeographicErr("MGRS string too short " + mgrs);
00176     bool utmp = zone1 != UTMUPS::UPS;
00177     int zonem1 = zone1 - 1;
00178     const string& band = utmp ? latband_ : upsband_;
00179     int iband = Utility::lookup(band, mgrs[p++]);
00180     if (iband < 0)
00181       throw GeographicErr("Band letter " + Utility::str(mgrs[p-1]) + " not in "
00182                           + (utmp ? "UTM" : "UPS") + " set " + band);
00183     bool northp1 = iband >= (utmp ? 10 : 2);
00184     const string& col = utmp ? utmcols_[zonem1 % 3] : upscols_[iband];
00185     const string& row = utmp ? utmrow_ : upsrows_[northp1];
00186     int icol = Utility::lookup(col, mgrs[p++]);
00187     if (icol < 0)
00188       throw GeographicErr("Column letter " + Utility::str(mgrs[p-1])
00189                           + " not in "
00190                           + (utmp ? "zone " + mgrs.substr(0, p-2) :
00191                              "UPS band " + Utility::str(mgrs[p-2]))
00192                           + " set " + col );
00193     int irow = Utility::lookup(row, mgrs[p++]);
00194     if (irow < 0)
00195       throw GeographicErr("Row letter " + Utility::str(mgrs[p-1]) + " not in "
00196                           + (utmp ? "UTM" :
00197                              "UPS " + Utility::str(hemispheres_[northp1]))
00198                           + " set " + row);
00199     if (utmp) {
00200       if (zonem1 & 1)
00201         irow = (irow + utmrowperiod_ - utmevenrowshift_) % utmrowperiod_;
00202       iband -= 10;
00203       irow = UTMRow(iband, icol, irow);
00204       if (irow == maxutmSrow_)
00205         throw GeographicErr("Block " + mgrs.substr(p-2, 2)
00206                             + " not in zone/band " + mgrs.substr(0, p-2));
00207 
00208       irow = northp1 ? irow : irow + 100;
00209       icol = icol + minutmcol_;
00210     } else {
00211       bool eastp = iband & 1;
00212       icol += eastp ? upseasting_ : (northp1 ? minupsNind_ : minupsSind_);
00213       irow += northp1 ? minupsNind_ : minupsSind_;
00214     }
00215     int prec1 = (len - p)/2;
00216     real
00217       unit = tile_,
00218       x1 = unit * icol,
00219       y1 = unit * irow;
00220     for (int i = 0; i < prec1; ++i) {
00221       unit /= base_;
00222       int
00223         ix = Utility::lookup(digits_, mgrs[p + i]),
00224         iy = Utility::lookup(digits_, mgrs[p + i + prec1]);
00225       if (ix < 0 || iy < 0)
00226         throw GeographicErr("Encountered a non-digit in " + mgrs.substr(p));
00227       x1 += unit * ix;
00228       y1 += unit * iy;
00229     }
00230     if ((len - p) % 2) {
00231       if (Utility::lookup(digits_, mgrs[len - 1]) < 0)
00232         throw GeographicErr("Encountered a non-digit in " + mgrs.substr(p));
00233       else
00234         throw GeographicErr("Not an even number of digits_ in "
00235                             + mgrs.substr(p));
00236     }
00237     if (prec1 > maxprec_)
00238       throw GeographicErr("More than " + Utility::str(2*maxprec_)
00239                           + " digits_ in "
00240                           + mgrs.substr(p));
00241     if (centerp) {
00242       x1 += unit/2;
00243       y1 += unit/2;
00244     }
00245     zone = zone1;
00246     northp = northp1;
00247     x = x1;
00248     y = y1;
00249     prec = prec1;
00250   }
00251 
00252   void MGRS::CheckCoords(bool utmp, bool& northp, real& x, real& y) {
00253     // Limits are all multiples of 100km and are all closed on the lower end
00254     // and open on the upper end -- and this is reflected in the error
00255     // messages.  However if a coordinate lies on the excluded upper end (e.g.,
00256     // after rounding), it is shifted down by eps_.  This also folds UTM
00257     // northings to the correct N/S hemisphere.
00258     int
00259       ix = int(floor(x / tile_)),
00260       iy = int(floor(y / tile_)),
00261       ind = (utmp ? 2 : 0) + (northp ? 1 : 0);
00262     if (! (ix >= mineasting_[ind] && ix < maxeasting_[ind]) ) {
00263       if (ix == maxeasting_[ind] && x == maxeasting_[ind] * tile_)
00264         x -= eps_;
00265       else
00266         throw GeographicErr("Easting " + Utility::str(int(floor(x/1000)))
00267                             + "km not in MGRS/"
00268                             + (utmp ? "UTM" : "UPS") + " range for "
00269                             + (northp ? "N" : "S" ) + " hemisphere ["
00270                             + Utility::str(mineasting_[ind]*tile_/1000)
00271                             + "km, "
00272                             + Utility::str(maxeasting_[ind]*tile_/1000)
00273                             + "km)");
00274     }
00275     if (! (iy >= minnorthing_[ind] && iy < maxnorthing_[ind]) ) {
00276       if (iy == maxnorthing_[ind] && y == maxnorthing_[ind] * tile_)
00277         y -= eps_;
00278       else
00279         throw GeographicErr("Northing " + Utility::str(int(floor(y/1000)))
00280                             + "km not in MGRS/"
00281                             + (utmp ? "UTM" : "UPS") + " range for "
00282                             + (northp ? "N" : "S" ) + " hemisphere ["
00283                             + Utility::str(minnorthing_[ind]*tile_/1000)
00284                             + "km, "
00285                             + Utility::str(maxnorthing_[ind]*tile_/1000)
00286                             + "km)");
00287     }
00288 
00289     // Correct the UTM northing and hemisphere if necessary
00290     if (utmp) {
00291       if (northp && iy < minutmNrow_) {
00292         northp = false;
00293         y += utmNshift_;
00294       } else if (!northp && iy >= maxutmSrow_) {
00295         if (y == maxutmSrow_ * tile_)
00296           // If on equator retain S hemisphere
00297           y -= eps_;
00298         else {
00299           northp = true;
00300           y -= utmNshift_;
00301         }
00302       }
00303     }
00304   }
00305 
00306   int MGRS::UTMRow(int iband, int icol, int irow) throw() {
00307     // Input is MGRS (periodic) row index and output is true row index.  Band
00308     // index is in [-10, 10) (as returned by LatitudeBand).  Column index
00309     // origin is easting = 100km.  Returns maxutmSrow_ if irow and iband are
00310     // incompatible.  Row index origin is equator.
00311 
00312     // Estimate center row number for latitude band
00313     // 90 deg = 100 tiles; 1 band = 8 deg = 100*8/90 tiles
00314     real c = 100 * (8 * iband + 4)/real(90);
00315     bool northp = iband >= 0;
00316     int
00317       minrow = iband > -10 ?
00318       int(floor(c - real(4.3) - real(0.1) * northp)) : -90,
00319       maxrow = iband <   9 ?
00320       int(floor(c + real(4.4) - real(0.1) * northp)) :  94,
00321       baserow = (minrow + maxrow) / 2 - utmrowperiod_ / 2;
00322     // Add maxutmSrow_ = 5 * utmrowperiod_ to ensure operand is positive
00323     irow = (irow - baserow + maxutmSrow_) % utmrowperiod_ + baserow;
00324     if (irow < minrow || irow > maxrow) {
00325       // Northing = 71*100km and 80*100km intersect band boundaries
00326       // The following deals with these special cases.
00327       int
00328         // Fold [-10,-1] -> [9,0]
00329         sband = iband >= 0 ? iband : -iband - 1,
00330         // Fold [-90,-1] -> [89,0]
00331         srow = irow >= 0 ? irow : -irow - 1,
00332         // Fold [4,7] -> [3,0]
00333         scol = icol < 4 ? icol : -icol + 7;
00334       if ( ! ( (srow == 70 && sband == 8 && scol >= 2) ||
00335                (srow == 71 && sband == 7 && scol <= 2) ||
00336                (srow == 79 && sband == 9 && scol >= 1) ||
00337                (srow == 80 && sband == 8 && scol <= 1) ) )
00338         irow = maxutmSrow_;
00339     }
00340     return irow;
00341   }
00342 
00343 } // namespace GeographicLib
geographiclib-1.21/doc/html/SphericalEngine_8hpp_source.html0000644000175000017500000013216011745620414024041 0ustar frankiefrankie GeographicLib: SphericalEngine.hpp Source File
SphericalEngine.hpp
Go to the documentation of this file.
00001 /**
00002  * \file SphericalEngine.hpp
00003  * \brief Header for GeographicLib::SphericalEngine class
00004  *
00005  * Copyright (c) Charles Karney (2011, 2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_SPHERICALENGINE_HPP)
00011 #define GEOGRAPHICLIB_SPHERICALENGINE_HPP \
00012   "$Id: f48320a694ecf901d997b23d32ea625e589f9534 $"
00013 
00014 #include <vector>
00015 #include <istream>
00016 #include <GeographicLib/Constants.hpp>
00017 
00018 #if defined(_MSC_VER)
00019 // Squelch warnings about dll vs vector
00020 #pragma warning (push)
00021 #pragma warning (disable: 4251)
00022 #endif
00023 
00024 namespace GeographicLib {
00025 
00026   class CircularEngine;
00027 
00028   /**
00029    * \brief The evaluation engine for SphericalHarmonic
00030    *
00031    * This serves as the backend to SphericalHarmonic, SphericalHarmonic1, and
00032    * SphericalHarmonic2.  Typically end-users will not have to access this
00033    * class directly.
00034    *
00035    * See SphericalEngine.cpp for more information on the implementation.
00036    *
00037    * Example of use:
00038    * \include example-SphericalEngine.cpp
00039    **********************************************************************/
00040 
00041   class GEOGRAPHIC_EXPORT SphericalEngine {
00042   private:
00043     typedef Math::real real;
00044     // A table of the square roots of integers
00045     static std::vector<real> root_;
00046     friend class CircularEngine; // CircularEngine needs access to root_, scale_
00047     // An internal scaling of the coefficients to avoid overflow in
00048     // intermediate calculations.
00049     static const real scale_;
00050     // Move latitudes near the pole off the axis by this amount.
00051     static const real eps_;
00052     static const std::vector<real> Z_;
00053     SphericalEngine();          // Disable constructor
00054   public:
00055     /**
00056      * Supported normalizations for associated Legendre polynomials.
00057      **********************************************************************/
00058     enum normalization {
00059       /**
00060        * Fully normalized associated Legendre polynomials.  See
00061        * SphericalHarmonic::FULL for documentation.
00062        *
00063        * @hideinitializer
00064        **********************************************************************/
00065       FULL = 0,
00066       /**
00067        * Schmidt semi-normalized associated Legendre polynomials.  See
00068        * SphericalHarmonic::SCHMIDT for documentation.
00069        *
00070        * @hideinitializer
00071        **********************************************************************/
00072       SCHMIDT = 1,
00073       /// \cond SKIP
00074       // These are deprecated...
00075       full = FULL,
00076       schmidt = SCHMIDT,
00077       /// \endcond
00078     };
00079 
00080     /**
00081      * \brief Package up coefficients for SphericalEngine
00082      *
00083      * This packages up the \e C, \e S coefficients and information about how
00084      * the coefficients are stored into a single structure.  This allows a
00085      * vector of type SphericalEngine::coeff to be passed to
00086      * SphericalEngine::Value.  This class also includes functions to aid
00087      * indexing into \e C and \e S.
00088      *
00089      * The storage layout of the coefficients is documented in
00090      * SphericalHarmonic and SphericalHarmonic::SphericalHarmonic.
00091      **********************************************************************/
00092     class GEOGRAPHIC_EXPORT coeff {
00093     private:
00094       int _N, _nmx, _mmx;
00095       std::vector<real>::const_iterator _Cnm;
00096       std::vector<real>::const_iterator _Snm;
00097     public:
00098       /**
00099        * A default constructor
00100        **********************************************************************/
00101       coeff()
00102         : _N(-1)
00103         , _nmx(-1)
00104         , _mmx(-1)
00105         , _Cnm(Z_.begin())
00106         , _Snm(Z_.begin()) {}
00107       /**
00108        * The general constructor.
00109        *
00110        * @param[in] C a vector of coefficients for the cosine terms.
00111        * @param[in] S a vector of coefficients for the sine terms.
00112        * @param[in] N the degree giving storage layout for \e C and \e S.
00113        * @param[in] nmx the maximum degree to be used.
00114        * @param[in] mmx the maximum order to be used.
00115        *
00116        * This requires \e N >= \e nmx >= \e mmx >= -1.  \e C and \e S must also
00117        * be large enough to hold the coefficients.  Otherwise an exception is
00118        * thrown.
00119        **********************************************************************/
00120       coeff(const std::vector<real>& C,
00121             const std::vector<real>& S,
00122             int N, int nmx, int mmx)
00123         : _N(N)
00124         , _nmx(nmx)
00125         , _mmx(mmx)
00126         , _Cnm(C.begin())
00127         , _Snm(S.begin())
00128       {
00129         if (!(_N >= _nmx && _nmx >= _mmx && _mmx >= -1))
00130           throw GeographicErr("Bad indices for coeff");
00131         if (!(index(_nmx, _mmx) < int(C.size()) &&
00132               index(_nmx, _mmx) < int(S.size()) + (_N + 1)))
00133           throw GeographicErr("Arrays too small in coeff");
00134         SphericalEngine::RootTable(_nmx);
00135       }
00136       /**
00137        * The constructor for full coefficient vectors.
00138        *
00139        * @param[in] C a vector of coefficients for the cosine terms.
00140        * @param[in] S a vector of coefficients for the sine terms.
00141        * @param[in] N the maximum degree and order.
00142        *
00143        * This requires \e N >= -1.  \e C and \e S must also be large enough to
00144        * hold the coefficients.  Otherwise an exception is thrown.
00145        **********************************************************************/
00146       coeff(const std::vector<real>& C,
00147             const std::vector<real>& S,
00148             int N)
00149         : _N(N)
00150         , _nmx(N)
00151         , _mmx(N)
00152         , _Cnm(C.begin())
00153         , _Snm(S.begin())
00154       {
00155         if (!(_N >= -1))
00156           throw GeographicErr("Bad indices for coeff");
00157         if (!(index(_nmx, _mmx) < int(C.size()) &&
00158               index(_nmx, _mmx) < int(S.size()) + (_N + 1)))
00159           throw GeographicErr("Arrays too small in coeff");
00160         SphericalEngine::RootTable(_nmx);
00161       }
00162       /**
00163        * @return \e N the degree giving storage layout for \e C and \e S.
00164        **********************************************************************/
00165       inline int N() const throw() { return _N; }
00166       /**
00167        * @return \e nmx the maximum degree to be used.
00168        **********************************************************************/
00169       inline int nmx() const throw() { return _nmx; }
00170       /**
00171        * @return \e mmx the maximum order to be used.
00172        **********************************************************************/
00173       inline int mmx() const throw() { return _mmx; }
00174       /**
00175        * The one-dimensional index into \e C and \e S.
00176        *
00177        * @param[in] n the degree.
00178        * @param[in] m the order.
00179        * @return the one-dimensional index.
00180        **********************************************************************/
00181       inline int index(int n, int m) const throw()
00182       { return m * _N - m * (m - 1) / 2 + n; }
00183       /**
00184        * An element of \e C.
00185        *
00186        * @param[in] k the one-dimensional index.
00187        * @return the value of the \e C coefficient.
00188        **********************************************************************/
00189       inline Math::real Cv(int k) const { return *(_Cnm + k); }
00190       /**
00191        * An element of \e S.
00192        *
00193        * @param[in] k the one-dimensional index.
00194        * @return the value of the \e S coefficient.
00195        **********************************************************************/
00196       inline Math::real Sv(int k) const { return *(_Snm + (k - (_N + 1))); }
00197       /**
00198        * An element of \e C with checking.
00199        *
00200        * @param[in] k the one-dimensional index.
00201        * @param[in] n the requested degree.
00202        * @param[in] m the requested order.
00203        * @param[in] f a multiplier.
00204        * @return the value of the \e C coefficient multiplied by \e f in \e n
00205        *   and \e m are in range else 0.
00206        **********************************************************************/
00207       inline Math::real Cv(int k, int n, int m, real f) const
00208       { return m > _mmx || n > _nmx ? 0 : *(_Cnm + k) * f; }
00209       /**
00210        * An element of \e S with checking.
00211        *
00212        * @param[in] k the one-dimensional index.
00213        * @param[in] n the requested degree.
00214        * @param[in] m the requested order.
00215        * @param[in] f a multiplier.
00216        * @return the value of the \e S coefficient multiplied by \e f in \e n
00217        *   and \e m are in range else 0.
00218        **********************************************************************/
00219       inline Math::real Sv(int k, int n, int m, real f) const
00220       { return m > _mmx || n > _nmx ? 0 : *(_Snm + (k - (_N + 1))) * f; }
00221 
00222       /**
00223        * The size of the coefficient vector for the cosine terms.
00224        *
00225        * @param[in] N the maximum degree.
00226        * @param[in] M the maximum order.
00227        * @return the size of the vector of cosine terms as stored in column
00228        *   major order.
00229        **********************************************************************/
00230       static inline int Csize(int N, int M)
00231       { return (M + 1) * (2 * N - M + 2) / 2; }
00232 
00233       /**
00234        * The size of the coefficient vector for the sine terms.
00235        *
00236        * @param[in] N the maximum degree.
00237        * @param[in] M the maximum order.
00238        * @return the size of the vector of cosine terms as stored in column
00239        *   major order.
00240        **********************************************************************/
00241       static inline int Ssize(int N, int M)
00242       { return Csize(N, M) - (N + 1); }
00243 
00244       /**
00245        * Load coefficients from a binary stream.
00246        *
00247        * @param[in] stream the input stream.
00248        * @param[out] N The maximum degree of the coefficients.
00249        * @param[out] M The maximum order of the coefficients.
00250        * @param[out] C The vector of cosine coefficients.
00251        * @param[out] S The vector of sine coefficients.
00252        *
00253        * \e N and \e M are read as 4-byte ints.  \e C and \e S are resized to
00254        * accommodate all the coefficients (with the \e m = 0 coefficients for
00255        * \e S excluded) and the data for these coefficients read as 8-byte
00256        * doubles.  The coefficients are stored in column major order.  The
00257        * bytes in the stream should use little-endian ordering.  IEEE floating
00258        * point is assumed for the coefficients.
00259        **********************************************************************/
00260       static void readcoeffs(std::istream& stream, int& N, int& M,
00261                              std::vector<real>& C, std::vector<real>& S);
00262     };
00263 
00264     /**
00265      * Evaluate a spherical harmonic sum and its gradient.
00266      *
00267      * @tparam gradp should the gradient be calculated.
00268      * @tparam norm the normalization for the associated Legendre polynomials.
00269      * @tparam L the number of terms in the coefficients.
00270      * @param[in] c an array of coeff objects.
00271      * @param[in] f array of coefficient multipliers.  f[0] should be 1.
00272      * @param[in] x the \e x component of the cartesian position.
00273      * @param[in] y the \e y component of the cartesian position.
00274      * @param[in] z the \e z component of the cartesian position.
00275      * @param[in] a the normalizing radius.
00276      * @param[out] gradx the \e x component of the gradient.
00277      * @param[out] grady the \e y component of the gradient.
00278      * @param[out] gradz the \e z component of the gradient.
00279      * @result the spherical harmonic sum.
00280      *
00281      * See the SphericalHarmonic class for the definition of the sum.
00282      * The coefficients used by this function are, for example,
00283      * c[0].Cv + f[1] * c[1].Cv + ... + f[L-1] * c[L-1].Cv.  (Note
00284      * that f[0] is \e not used.)  The upper limits on the sum are
00285      * determined by c[0].nmx() and c[0].mmx(); these limits apply to
00286      * \e all the components of the coefficients.  The parameters \e
00287      * gradp, \e norm, and \e L are template parameters, to allow more
00288      * optimization to be done at compile time.
00289      *
00290      * Clenshaw summation is used which permits the evaluation of the sum
00291      * without the need to allocate temporary arrays.  Thus this function never
00292      * throws an exception.
00293      **********************************************************************/
00294     template<bool gradp, normalization norm, int L>
00295       static Math::real Value(const coeff c[], const real f[],
00296                               real x, real y, real z, real a,
00297                               real& gradx, real& grady, real& gradz) throw();
00298 
00299     /**
00300      * Create a CircularEngine object
00301      *
00302      * @tparam gradp should the gradient be calculated.
00303      * @tparam norm the normalization for the associated Legendre polynomials.
00304      * @tparam L the number of terms in the coefficients.
00305      * @param[in] c an array of coeff objects.
00306      * @param[in] f array of coefficient multipliers.  f[0] should be 1.
00307      * @param[in] p the radius of the circle = sqrt(<i>x</i><sup>2</sup> + 
00308      *   <i>y</i><sup>2</sup>).
00309      * @param[in] z the height of the circle.
00310      * @param[in] a the normalizing radius.
00311      * @result the CircularEngine object.
00312      *
00313      * If you need to evaluate the spherical harmonic sum for several points
00314      * with constant \e f, \e p = sqrt(<i>x</i><sup>2</sup> +
00315      * <i>y</i><sup>2</sup>), \e z, and \e a, it is more efficient to construct
00316      * call SphericalEngine::Circle to give a CircularEngine object and then
00317      * call CircularEngine::operator()() with arguments <i>x</i>/\e p and
00318      * <i>y</i>/\e p.
00319      **********************************************************************/
00320     template<bool gradp, normalization norm, int L>
00321       static CircularEngine Circle(const coeff c[], const real f[],
00322                                    real p, real z, real a);
00323     /**
00324      * Check that the static table of square roots is big enough and enlarge it
00325      * if necessary.
00326      *
00327      * @param[in] N the maximum degree to be used in SphericalEngine.
00328      *
00329      * Typically, there's no need for an end-user to call this routine, because
00330      * the constructors for SphericalEngine::coeff do so.  However, since this
00331      * updates a static table, there's a possible race condition in a
00332      * multi-threaded environment.  Because this routine does nothing if the
00333      * table is already large enough, one way to avoid race conditions is to
00334      * call this routine at program start up (when it's still single threaded),
00335      * supplying the largest degree that your program will use.  E.g.,
00336      \code
00337   GeographicLib::SphericalEngine::RootTable(2190);
00338      \endcode
00339      * suffices to accommodate extant magnetic and gravity models.
00340      **********************************************************************/
00341     static void RootTable(int N);
00342 
00343     /**
00344      * Clear the static table of square roots and release the memory.  Call
00345      * this only when you are sure you no longer will be using SphericalEngine.
00346      * Your program will crash if you call SphericalEngine after calling this
00347      * routine.  <b>It's safest not to call this routine at all.</b> (The space
00348      * used by the table is modest.)
00349      **********************************************************************/
00350     static void ClearRootTable() {
00351       std::vector<real> temp(0);
00352       root_.swap(temp);
00353     }
00354   };
00355 
00356 } // namespace GeographicLib
00357 
00358 #if defined(_MSC_VER)
00359 #pragma warning (pop)
00360 #endif
00361 
00362 #endif  // GEOGRAPHICLIB_SPHERICALENGINE_HPP
geographiclib-1.21/doc/html/functions_func_0x72.html0000644000175000017500000002077011745620415022271 0ustar frankiefrankie GeographicLib: Class Members - Functions geographiclib-1.21/doc/html/Geodesic_8cpp.html0000644000175000017500000001272711745620414021144 0ustar frankiefrankie GeographicLib: Geodesic.cpp File Reference
Geodesic.cpp File Reference

Implementation for GeographicLib::Geodesic class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_GEODESIC_CPP   "$Id: dd137806b8a5ba58211a37eb87e163b8a9bd7aa7 $"

Detailed Description

Implementation for GeographicLib::Geodesic class.

Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

This is a reformulation of the geodesic problem. The notation is as follows:

  • at a general point (no suffix or 1 or 2 as suffix)
    • phi = latitude
    • beta = latitude on auxiliary sphere
    • omega = longitude on auxiliary sphere
    • lambda = longitude
    • alpha = azimuth of great circle
    • sigma = arc length along great circle
    • s = distance
    • tau = scaled distance (= sigma at multiples of pi/2)
  • at northwards equator crossing
    • beta = phi = 0
    • omega = lambda = 0
    • alpha = alpha0
    • sigma = s = 0
  • a 12 suffix means a difference, e.g., s12 = s2 - s1.
  • s and c prefixes mean sin and cos

Definition in file Geodesic.cpp.


Define Documentation

#define GEOGRAPHICLIB_GEODESIC_CPP   "$Id: dd137806b8a5ba58211a37eb87e163b8a9bd7aa7 $"

Definition at line 32 of file Geodesic.cpp.

geographiclib-1.21/doc/html/classGeographicLib_1_1TransverseMercatorExact-members.html0000644000175000017500000001272311745620414031040 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::TransverseMercatorExact Member List
This is the complete list of members for GeographicLib::TransverseMercatorExact, including all inherited members.
CentralScale() const GeographicLib::TransverseMercatorExact [inline]
Flattening() const GeographicLib::TransverseMercatorExact [inline]
Forward(real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const GeographicLib::TransverseMercatorExact
Forward(real lon0, real lat, real lon, real &x, real &y) const GeographicLib::TransverseMercatorExact [inline]
MajorRadius() const GeographicLib::TransverseMercatorExact [inline]
Reverse(real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const GeographicLib::TransverseMercatorExact
Reverse(real lon0, real x, real y, real &lat, real &lon) const GeographicLib::TransverseMercatorExact [inline]
TransverseMercatorExact(real a, real f, real k0, bool extendp=false)GeographicLib::TransverseMercatorExact
UTMGeographicLib::TransverseMercatorExact [static]
geographiclib-1.21/doc/html/functions_enum.html0000644000175000017500000000760711745620414021525 0ustar frankiefrankie GeographicLib: Class Members - Enumerations geographiclib-1.21/doc/html/classGeographicLib_1_1GeodesicLine-members.html0000644000175000017500000003451711745620414026561 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::GeodesicLine Member List
This is the complete list of members for GeographicLib::GeodesicLine, including all inherited members.
ALL enum valueGeographicLib::GeodesicLine
ArcPosition(real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const GeographicLib::GeodesicLine [inline]
ArcPosition(real a12, real &lat2, real &lon2) const GeographicLib::GeodesicLine [inline]
ArcPosition(real a12, real &lat2, real &lon2, real &azi2) const GeographicLib::GeodesicLine [inline]
ArcPosition(real a12, real &lat2, real &lon2, real &azi2, real &s12) const GeographicLib::GeodesicLine [inline]
ArcPosition(real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12) const GeographicLib::GeodesicLine [inline]
ArcPosition(real a12, real &lat2, real &lon2, real &azi2, real &s12, real &M12, real &M21) const GeographicLib::GeodesicLine [inline]
ArcPosition(real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21) const GeographicLib::GeodesicLine [inline]
AREA enum valueGeographicLib::GeodesicLine
Azimuth() const GeographicLib::GeodesicLine [inline]
AZIMUTH enum valueGeographicLib::GeodesicLine
Capabilities() const GeographicLib::GeodesicLine [inline]
Capabilities(unsigned testcaps) const GeographicLib::GeodesicLine [inline]
DISTANCE enum valueGeographicLib::GeodesicLine
DISTANCE_IN enum valueGeographicLib::GeodesicLine
EquatorialArc() const GeographicLib::GeodesicLine [inline]
EquatorialAzimuth() const GeographicLib::GeodesicLine [inline]
Flattening() const GeographicLib::GeodesicLine [inline]
GenPosition(bool arcmode, real s12_a12, unsigned outmask, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const GeographicLib::GeodesicLine
Geodesic classGeographicLib::GeodesicLine [friend]
GeodesicLine(const Geodesic &g, real lat1, real lon1, real azi1, unsigned caps=ALL)GeographicLib::GeodesicLine
GeodesicLine()GeographicLib::GeodesicLine [inline]
GEODESICSCALE enum valueGeographicLib::GeodesicLine
Init() const GeographicLib::GeodesicLine [inline]
Latitude() const GeographicLib::GeodesicLine [inline]
LATITUDE enum valueGeographicLib::GeodesicLine
LONGITUDE enum valueGeographicLib::GeodesicLine
Longitude() const GeographicLib::GeodesicLine [inline]
MajorRadius() const GeographicLib::GeodesicLine [inline]
mask enum nameGeographicLib::GeodesicLine
NONE enum valueGeographicLib::GeodesicLine
Position(real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21, real &S12) const GeographicLib::GeodesicLine [inline]
Position(real s12, real &lat2, real &lon2) const GeographicLib::GeodesicLine [inline]
Position(real s12, real &lat2, real &lon2, real &azi2) const GeographicLib::GeodesicLine [inline]
Position(real s12, real &lat2, real &lon2, real &azi2, real &m12) const GeographicLib::GeodesicLine [inline]
Position(real s12, real &lat2, real &lon2, real &azi2, real &M12, real &M21) const GeographicLib::GeodesicLine [inline]
Position(real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21) const GeographicLib::GeodesicLine [inline]
REDUCEDLENGTH enum valueGeographicLib::GeodesicLine
geographiclib-1.21/doc/html/classGeographicLib_1_1Accumulator.html0000644000175000017500000005436211745620414025056 0ustar frankiefrankie GeographicLib: GeographicLib::Accumulator Class Reference
GeographicLib::Accumulator Class Reference

An accumulator for sums. More...

#include <GeographicLib/Accumulator.hpp>

List of all members.

Public Member Functions

 Accumulator (T y=T(0)) throw ()
Accumulatoroperator= (T y) throw ()
operator() () const throw ()
operator() (T y) const throw ()
Accumulatoroperator+= (T y) throw ()
Accumulatoroperator-= (T y) throw ()
Accumulatoroperator*= (int n) throw ()
bool operator== (T y) const throw ()
bool operator!= (T y) const throw ()
bool operator< (T y) const throw ()
bool operator<= (T y) const throw ()
bool operator> (T y) const throw ()
bool operator>= (T y) const throw ()

Detailed Description

An accumulator for sums.

This allow many numbers of floating point type T to be added together with twice the normal precision. Thus if T is double, the effective precision of the sum is 106 bits or about 32 decimal places. The core idea is the error free transformation of a sum, D. E. Knuth, TAOCP, Vol 2, 4.2.2, Theorem B.

The implementation follows J. R. Shewchuk, Adaptive Precision Floating-Point Arithmetic and Fast Robust Geometric Predicates, Discrete & Computational Geometry 18(3) 305-363 (1997).

Approximate timings (summing a vector<double>)

  • double: 2ns
  • Accumulator<double>: 23ns

In the documentation of the member functions, sum stands for the value currently held in the accumulator.

Example of use:

// Example of using the GeographicLib::Accumulator class
// $Id: cd6505cf47fbae653b439ba63ea927050cbf0a45 $

#include <iostream>
#include <exception>
#include <GeographicLib/Accumulator.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    // Compare using Accumulator and ordinary summation for a sum of large and
    // small terms.
    double sum = 0;
    Accumulator<double> acc = 0;
    sum += 1e20; sum += 1; sum += 2; sum += 100; sum += 5000; sum += -1e20;
    acc += 1e20; acc += 1; acc += 2; acc += 100; acc += 5000; acc += -1e20;
    cout << sum << " " << acc() << "\n";
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Constructor & Destructor Documentation

GeographicLib::Accumulator::Accumulator ( y = T(0)) throw () [inline]

Construct from a T. This is not declared explicit, so that you can write Accumulator<double> a = 5;.

Parameters:
[in]yset sum = y.

Definition at line 116 of file Accumulator.hpp.


Member Function Documentation

Accumulator& GeographicLib::Accumulator::operator= ( y) throw () [inline]

Set the accumulator to a number.

Parameters:
[in]yset sum = y.

Definition at line 125 of file Accumulator.hpp.

T GeographicLib::Accumulator::operator() ( ) const throw () [inline]

Return the value held in the accumulator.

Returns:
sum.

Definition at line 131 of file Accumulator.hpp.

T GeographicLib::Accumulator::operator() ( y) const throw () [inline]

Return the result of adding a number to sum (but don't change sum).

Parameters:
[in]ythe number to be added to the sum.
Returns:
sum + y.

Definition at line 138 of file Accumulator.hpp.

Accumulator& GeographicLib::Accumulator::operator+= ( y) throw () [inline]

Add a number to the accumulator.

Parameters:
[in]yset sum += y.

Definition at line 144 of file Accumulator.hpp.

Accumulator& GeographicLib::Accumulator::operator-= ( y) throw () [inline]

Subtract a number from the accumulator.

Parameters:
[in]yset sum -= y.

Definition at line 150 of file Accumulator.hpp.

Accumulator& GeographicLib::Accumulator::operator*= ( int  n) throw () [inline]

Multiply accumulator by an integer. To avoid loss of accuracy, use only integers such that n * T is exactly representable as a T (i.e., +/- powers of two). Use n = -1 to negate sum.

Parameters:
[in]nset sum *= n.

Definition at line 158 of file Accumulator.hpp.

bool GeographicLib::Accumulator::operator== ( y) const throw () [inline]

Test equality of an Accumulator with a number.

Definition at line 162 of file Accumulator.hpp.

bool GeographicLib::Accumulator::operator!= ( y) const throw () [inline]

Test inequality of an Accumulator with a number.

Definition at line 166 of file Accumulator.hpp.

bool GeographicLib::Accumulator::operator< ( y) const throw () [inline]

Less operator on an Accumulator and a number.

Definition at line 170 of file Accumulator.hpp.

bool GeographicLib::Accumulator::operator<= ( y) const throw () [inline]

Less or equal operator on an Accumulator and a number.

Definition at line 174 of file Accumulator.hpp.

bool GeographicLib::Accumulator::operator> ( y) const throw () [inline]

Greater operator on an Accumulator and a number.

Definition at line 178 of file Accumulator.hpp.

bool GeographicLib::Accumulator::operator>= ( y) const throw () [inline]

Greater or equal operator on an Accumulator and a number.

Definition at line 182 of file Accumulator.hpp.


The documentation for this class was generated from the following file:
geographiclib-1.21/doc/html/ConicProj_8cpp.html0000644000175000017500000001304411745620415021302 0ustar frankiefrankie GeographicLib: ConicProj.cpp File Reference
ConicProj.cpp File Reference

Command line utility for conical projections. More...

#include <iostream>
#include <sstream>
#include <string>
#include <fstream>
#include <GeographicLib/LambertConformalConic.hpp>
#include <GeographicLib/AlbersEqualArea.hpp>
#include <GeographicLib/DMS.hpp>
#include <GeographicLib/Utility.hpp>
#include "ConicProj.usage"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Detailed Description

Command line utility for conical projections.

Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Compile and link with g++ -g -O3 -I../include -I../man -o ConicProj \ ConicProj.cpp \ ../src/AlbersEqualArea.cpp \ ../src/DMS.cpp \ ../src/LambertConformalConic.cpp

See the man page for usage information.

Definition in file ConicProj.cpp.


Function Documentation

int main ( int  argc,
char *  argv[] 
)
geographiclib-1.21/doc/html/functions_func_0x73.html0000644000175000017500000001755311745620414022276 0ustar frankiefrankie GeographicLib: Class Members - Functions geographiclib-1.21/doc/html/LICENSE.txt0000644000175000017500000000215211745620414017414 0ustar frankiefrankieThis license applies to GeographicLib, versions 1.12 and later. Copyright (c) 2008-2012, Charles Karney Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. geographiclib-1.21/doc/html/Geod_8cpp_source.html0000644000175000017500000011463111745620414021655 0ustar frankiefrankie GeographicLib: Geod.cpp Source File
Geod.cpp
Go to the documentation of this file.
00001 /**
00002  * \file Geod.cpp
00003  * \brief Command line utility for geodesic calculations
00004  *
00005  * Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  *
00009  * Compile and link with
00010  *   g++ -g -O3 -I../include -I../man -o Geod \
00011  *       Geod.cpp \
00012  *       ../src/DMS.cpp \
00013  *       ../src/Geodesic.cpp \
00014  *       ../src/GeodesicLine.cpp
00015  *
00016  * See the <a href="Geod.1.html">man page</a> for usage
00017  * information.
00018  **********************************************************************/
00019 
00020 #include <iostream>
00021 #include <sstream>
00022 #include <string>
00023 #include <sstream>
00024 #include <fstream>
00025 #include <GeographicLib/Geodesic.hpp>
00026 #include <GeographicLib/GeodesicLine.hpp>
00027 #include <GeographicLib/DMS.hpp>
00028 #include <GeographicLib/Utility.hpp>
00029 
00030 #include "Geod.usage"
00031 
00032 typedef GeographicLib::Math::real real;
00033 
00034 std::string LatLonString(real lat, real lon, int prec, bool dms, char dmssep) {
00035   using namespace GeographicLib;
00036   return dms ?
00037     DMS::Encode(lat, prec + 5, DMS::LATITUDE, dmssep) + " " +
00038     DMS::Encode(lon, prec + 5, DMS::LONGITUDE, dmssep) :
00039     DMS::Encode(lat, prec + 5, DMS::NUMBER) + " " +
00040     DMS::Encode(lon, prec + 5, DMS::NUMBER);
00041 }
00042 
00043 std::string AzimuthString(real azi, int prec, bool dms, char dmssep) {
00044   using namespace GeographicLib;
00045   return dms ? DMS::Encode(azi, prec + 5, DMS::AZIMUTH, dmssep) :
00046     DMS::Encode(azi >= 180 ? azi - 360 : azi, prec + 5, DMS::NUMBER);
00047 }
00048 
00049 std::string DistanceStrings(real s12, real a12,
00050                             bool full, bool arcmode, int prec, bool dms) {
00051   using namespace GeographicLib;
00052   std::string s;
00053   if (full || !arcmode)
00054     s += Utility::str<real>(s12, prec);
00055   if (full)
00056     s += " ";
00057   if (full || arcmode)
00058     s += DMS::Encode(a12, prec + 5, dms ? DMS::NONE : DMS::NUMBER);
00059   return s;
00060 }
00061 
00062 real ReadDistance(const std::string& s, bool arcmode) {
00063   using namespace GeographicLib;
00064   return arcmode ? DMS::DecodeAngle(s) : Utility::num<real>(s);
00065 }
00066 
00067 int main(int argc, char* argv[]) {
00068   try {
00069     using namespace GeographicLib;
00070     bool linecalc = false, inverse = false, arcmode = false,
00071       dms = false, full = false;
00072     real
00073       a = Constants::WGS84_a<real>(),
00074       f = Constants::WGS84_f<real>();
00075     real lat1, lon1, azi1, lat2, lon2, azi2, s12, m12, a12, M12, M21, S12;
00076     real azi2sense = 0;
00077     int prec = 3;
00078     std::string istring, ifile, ofile, cdelim;
00079     char lsep = ';', dmssep = char(0);
00080 
00081     for (int m = 1; m < argc; ++m) {
00082       std::string arg(argv[m]);
00083       if (arg == "-i") {
00084         inverse = true;
00085         linecalc = false;
00086       } else if (arg == "-a")
00087         arcmode = true;
00088       else if (arg == "-l") {
00089         inverse = false;
00090         linecalc = true;
00091         if (m + 3 >= argc) return usage(1, true);
00092         try {
00093           DMS::DecodeLatLon(std::string(argv[m + 1]), std::string(argv[m + 2]),
00094                             lat1, lon1);
00095           azi1 = DMS::DecodeAzimuth(std::string(argv[m + 3]));
00096         }
00097         catch (const std::exception& e) {
00098           std::cerr << "Error decoding arguments of -l: " << e.what() << "\n";
00099           return 1;
00100         }
00101         m += 3;
00102       } else if (arg == "-e") {
00103         if (m + 2 >= argc) return usage(1, true);
00104         try {
00105           a = Utility::num<real>(std::string(argv[m + 1]));
00106           f = Utility::fract<real>(std::string(argv[m + 2]));
00107         }
00108         catch (const std::exception& e) {
00109           std::cerr << "Error decoding arguments of -e: " << e.what() << "\n";
00110           return 1;
00111         }
00112         m += 2;
00113       }
00114       else if (arg == "-d") {
00115         dms = true;
00116         dmssep = '\0';
00117       } else if (arg == "-:") {
00118         dms = true;
00119         dmssep = ':';
00120       } else if (arg == "-b")
00121         azi2sense = 180;
00122       else if (arg == "-f")
00123         full = true;
00124       else if (arg == "-p") {
00125         if (++m == argc) return usage(1, true);
00126         try {
00127           prec = Utility::num<int>(std::string(argv[m]));
00128         }
00129         catch (const std::exception&) {
00130           std::cerr << "Precision " << argv[m] << " is not a number\n";
00131           return 1;
00132         }
00133       } else if (arg == "--input-string") {
00134         if (++m == argc) return usage(1, true);
00135         istring = argv[m];
00136       } else if (arg == "--input-file") {
00137         if (++m == argc) return usage(1, true);
00138         ifile = argv[m];
00139       } else if (arg == "--output-file") {
00140         if (++m == argc) return usage(1, true);
00141         ofile = argv[m];
00142       } else if (arg == "--line-separator") {
00143         if (++m == argc) return usage(1, true);
00144         if (std::string(argv[m]).size() != 1) {
00145           std::cerr << "Line separator must be a single character\n";
00146           return 1;
00147         }
00148         lsep = argv[m][0];
00149       } else if (arg == "--comment-delimiter") {
00150         if (++m == argc) return usage(1, true);
00151         cdelim = argv[m];
00152       } else if (arg == "--version") {
00153         std::cout
00154           << argv[0]
00155           << ": $Id: 68e3a8ec4a5717094498179912279a756f6e3f8b $\n"
00156           << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n";
00157         return 0;
00158       } else
00159         return usage(!(arg == "-h" || arg == "--help"), arg != "--help");
00160     }
00161 
00162     if (!ifile.empty() && !istring.empty()) {
00163       std::cerr << "Cannot specify --input-string and --input-file together\n";
00164       return 1;
00165     }
00166     if (ifile == "-") ifile.clear();
00167     std::ifstream infile;
00168     std::istringstream instring;
00169     if (!ifile.empty()) {
00170       infile.open(ifile.c_str());
00171       if (!infile.is_open()) {
00172         std::cerr << "Cannot open " << ifile << " for reading\n";
00173         return 1;
00174       }
00175     } else if (!istring.empty()) {
00176       std::string::size_type m = 0;
00177       while (true) {
00178         m = istring.find(lsep, m);
00179         if (m == std::string::npos)
00180           break;
00181         istring[m] = '\n';
00182       }
00183       instring.str(istring);
00184     }
00185     std::istream* input = !ifile.empty() ? &infile :
00186       (!istring.empty() ? &instring : &std::cin);
00187 
00188     std::ofstream outfile;
00189     if (ofile == "-") ofile.clear();
00190     if (!ofile.empty()) {
00191       outfile.open(ofile.c_str());
00192       if (!outfile.is_open()) {
00193         std::cerr << "Cannot open " << ofile << " for writing\n";
00194         return 1;
00195       }
00196     }
00197     std::ostream* output = !ofile.empty() ? &outfile : &std::cout;
00198 
00199     const Geodesic geod(a, f);
00200     GeodesicLine l;
00201     if (linecalc)
00202       l = geod.Line(lat1, lon1, azi1);
00203 
00204     // Max precision = 10: 0.1 nm in distance, 10^-15 deg (= 0.11 nm),
00205     // 10^-11 sec (= 0.3 nm).
00206     prec = std::min(10, std::max(0, prec));
00207     std::string s;
00208     int retval = 0;
00209     while (std::getline(*input, s)) {
00210       try {
00211         std::string eol("\n");
00212         if (!cdelim.empty()) {
00213           std::string::size_type m = s.find(cdelim);
00214           if (m != std::string::npos) {
00215             eol = " " + s.substr(m) + "\n";
00216             s = s.substr(0, m);
00217           }
00218         }
00219         std::istringstream str(s);
00220         if (inverse) {
00221           std::string slat1, slon1, slat2, slon2;
00222           if (!(str >> slat1 >> slon1 >> slat2 >> slon2))
00223             throw GeographicErr("Incomplete input: " + s);
00224           std::string strc;
00225           if (str >> strc)
00226             throw GeographicErr("Extraneous input: " + strc);
00227           DMS::DecodeLatLon(slat1, slon1, lat1, lon1);
00228           DMS::DecodeLatLon(slat2, slon2, lat2, lon2);
00229           a12 = geod.Inverse(lat1, lon1, lat2, lon2, s12, azi1, azi2,
00230                              m12, M12, M21, S12);
00231           if (full)
00232             *output << LatLonString(lat1, lon1, prec, dms, dmssep) << " ";
00233           *output << AzimuthString(azi1, prec, dms, dmssep) << " ";
00234           if (full)
00235             *output << LatLonString(lat2, lon2, prec, dms, dmssep) << " ";
00236           *output << AzimuthString(azi2 + azi2sense, prec, dms, dmssep) << " "
00237                   << DistanceStrings(s12, a12, full, arcmode, prec, dms);
00238           if (full)
00239             *output << " " << Utility::str<real>(m12, prec)
00240                     << " " << Utility::str<real>(M12, prec+7)
00241                     << " " << Utility::str<real>(M21, prec+7)
00242                     << " " << Utility::str<real>(S12, std::max(prec-7, 0));
00243           *output << eol;
00244         } else {
00245           if (linecalc) {
00246             std::string ss12;
00247             if (!(str >> ss12))
00248               throw GeographicErr("Incomplete input: " + s);
00249             std::string strc;
00250             if (str >> strc)
00251               throw GeographicErr("Extraneous input: " + strc);
00252             s12 = ReadDistance(ss12, arcmode);
00253             if (arcmode)
00254               l.ArcPosition(s12, lat2, lon2, azi2, a12, m12, M12, M21, S12);
00255             else
00256               a12 = l.Position(s12, lat2, lon2, azi2, m12, M12, M21, S12);
00257           } else {
00258             std::string slat1, slon1, sazi1, ss12;
00259             if (!(str >> slat1 >> slon1 >> sazi1 >> ss12))
00260               throw GeographicErr("Incomplete input: " + s);
00261             std::string strc;
00262             if (str >> strc)
00263               throw GeographicErr("Extraneous input: " + strc);
00264             DMS::DecodeLatLon(slat1, slon1, lat1, lon1);
00265             azi1 = DMS::DecodeAzimuth(sazi1);
00266             s12 = ReadDistance(ss12, arcmode);
00267             if (arcmode)
00268               geod.ArcDirect(lat1, lon1, azi1, s12, lat2, lon2, azi2, a12,
00269                              m12, M12, M21, S12);
00270             else
00271               a12 = geod.Direct(lat1, lon1, azi1, s12, lat2, lon2, azi2,
00272                                 m12, M12, M21, S12);
00273           }
00274           if (arcmode)
00275             std::swap(s12, a12);
00276           if (full)
00277             *output << LatLonString(lat1, lon1, prec, dms, dmssep) << " "
00278                     << AzimuthString(azi1, prec, dms, dmssep) << " ";
00279           *output << LatLonString(lat2, lon2, prec, dms, dmssep) << " "
00280                   << AzimuthString(azi2 + azi2sense, prec, dms, dmssep);
00281           if (full)
00282             *output << " "
00283                     << DistanceStrings(s12, a12, full, arcmode, prec, dms)
00284                     << " " << Utility::str<real>(m12, prec)
00285                     << " " << Utility::str<real>(M12, prec+7)
00286                     << " " << Utility::str<real>(M21, prec+7)
00287                     << " " << Utility::str<real>(S12, std::max(prec-7, 0));
00288           *output << eol;
00289         }
00290       }
00291       catch (const std::exception& e) {
00292         // Write error message cout so output lines match input lines
00293         *output << "ERROR: " << e.what() << "\n";
00294         retval = 1;
00295       }
00296     }
00297     return retval;
00298   }
00299   catch (const std::exception& e) {
00300     std::cerr << "Caught exception: " << e.what() << "\n";
00301     return 1;
00302   }
00303   catch (...) {
00304     std::cerr << "Caught unknown exception\n";
00305     return 1;
00306   }
00307 }
geographiclib-1.21/doc/html/dir_b4d36717c8020107727c093197410e9d.html0000644000175000017500000004402111745620415023234 0ustar frankiefrankie GeographicLib: include/GeographicLib/ Directory Reference
GeographicLib Directory Reference

Files

file  Accumulator.hpp [code]
 

Header for GeographicLib::Accumulator class.


file  AlbersEqualArea.hpp [code]
 

Header for GeographicLib::AlbersEqualArea class.


file  AzimuthalEquidistant.hpp [code]
 

Header for GeographicLib::AzimuthalEquidistant class.


file  CassiniSoldner.hpp [code]
 

Header for GeographicLib::CassiniSoldner class.


file  CircularEngine.hpp [code]
 

Header for GeographicLib::CircularEngine class.


file  Constants.hpp [code]
 

Header for GeographicLib::Constants class.


file  DMS.hpp [code]
 

Header for GeographicLib::DMS class.


file  EllipticFunction.hpp [code]
 

Header for GeographicLib::EllipticFunction class.


file  Geocentric.hpp [code]
 

Header for GeographicLib::Geocentric class.


file  GeoCoords.hpp [code]
 

Header for GeographicLib::GeoCoords class.


file  Geodesic.hpp [code]
 

Header for GeographicLib::Geodesic class.


file  GeodesicLine.hpp [code]
 

Header for GeographicLib::GeodesicLine class.


file  Geoid.hpp [code]
 

Header for GeographicLib::Geoid class.


file  Gnomonic.hpp [code]
 

Header for GeographicLib::Gnomonic class.


file  GravityCircle.hpp [code]
 

Header for GeographicLib::GravityCircle class.


file  GravityModel.hpp [code]
 

Header for GeographicLib::GravityModel class.


file  LambertConformalConic.hpp [code]
 

Header for GeographicLib::LambertConformalConic class.


file  LocalCartesian.hpp [code]
 

Header for GeographicLib::LocalCartesian class.


file  MagneticCircle.hpp [code]
 

Header for GeographicLib::MagneticCircle class.


file  MagneticModel.hpp [code]
 

Header for GeographicLib::MagneticModel class.


file  Math.hpp [code]
 

Header for GeographicLib::Math class.


file  MGRS.hpp [code]
 

Header for GeographicLib::MGRS class.


file  NormalGravity.hpp [code]
 

Header for GeographicLib::NormalGravity class.


file  OSGB.hpp [code]
 

Header for GeographicLib::OSGB class.


file  PolarStereographic.hpp [code]
 

Header for GeographicLib::PolarStereographic class.


file  PolygonArea.hpp [code]
 

Header for GeographicLib::PolygonArea class.


file  SphericalEngine.hpp [code]
 

Header for GeographicLib::SphericalEngine class.


file  SphericalHarmonic.hpp [code]
 

Header for GeographicLib::SphericalHarmonic class.


file  SphericalHarmonic1.hpp [code]
 

Header for GeographicLib::SphericalHarmonic1 class.


file  SphericalHarmonic2.hpp [code]
 

Header for GeographicLib::SphericalHarmonic2 class.


file  TransverseMercator.hpp [code]
 

Header for GeographicLib::TransverseMercator class.


file  TransverseMercatorExact.hpp [code]
 

Header for GeographicLib::TransverseMercatorExact class.


file  Utility.hpp [code]
 

Header for GeographicLib::Utility class.


file  UTMUPS.hpp [code]
 

Header for GeographicLib::UTMUPS class.


geographiclib-1.21/doc/html/dir_20dd3cf0f425f295158796088ceb05f4.html0000644000175000017500000003634111745620414023555 0ustar frankiefrankie GeographicLib: src/ Directory Reference
src Directory Reference

Files

file  AlbersEqualArea.cpp [code]
 

Implementation for GeographicLib::AlbersEqualArea class.


file  AzimuthalEquidistant.cpp [code]
 

Implementation for GeographicLib::AzimuthalEquidistant class.


file  CassiniSoldner.cpp [code]
 

Implementation for GeographicLib::CassiniSoldner class.


file  CircularEngine.cpp [code]
 

Implementation for GeographicLib::CircularEngine class.


file  DMS.cpp [code]
 

Implementation for GeographicLib::DMS class.


file  EllipticFunction.cpp [code]
 

Implementation for GeographicLib::EllipticFunction class.


file  Geocentric.cpp [code]
 

Implementation for GeographicLib::Geocentric class.


file  GeoCoords.cpp [code]
 

Implementation for GeographicLib::GeoCoords class.


file  Geodesic.cpp [code]
 

Implementation for GeographicLib::Geodesic class.


file  GeodesicLine.cpp [code]
 

Implementation for GeographicLib::GeodesicLine class.


file  Geoid.cpp [code]
 

Implementation for GeographicLib::Geoid class.


file  Gnomonic.cpp [code]
 

Implementation for GeographicLib::Gnomonic class.


file  GravityCircle.cpp [code]
 

Implementation for GeographicLib::GravityCircle class.


file  GravityModel.cpp [code]
 

Implementation for GeographicLib::GravityModel class.


file  LambertConformalConic.cpp [code]
 

Implementation for GeographicLib::LambertConformalConic class.


file  LocalCartesian.cpp [code]
 

Implementation for GeographicLib::LocalCartesian class.


file  MagneticCircle.cpp [code]
 

Implementation for GeographicLib::MagneticCircle class.


file  MagneticModel.cpp [code]
 

Implementation for GeographicLib::MagneticModel class.


file  MGRS.cpp [code]
 

Implementation for GeographicLib::MGRS class.


file  NormalGravity.cpp [code]
 

Implementation for GeographicLib::NormalGravity class.


file  OSGB.cpp [code]
 

Implementation for GeographicLib::OSGB class.


file  PolarStereographic.cpp [code]
 

Implementation for GeographicLib::PolarStereographic class.


file  PolygonArea.cpp [code]
 

Implementation for GeographicLib::PolygonArea class.


file  SphericalEngine.cpp [code]
 

Implementation for GeographicLib::SphericalEngine class.


file  TransverseMercator.cpp [code]
 

Implementation for GeographicLib::TransverseMercator class.


file  TransverseMercatorExact.cpp [code]
 

Implementation for GeographicLib::TransverseMercatorExact class.


file  Utility.cpp [code]
 

Implementation for GeographicLib::Utility class.


file  UTMUPS.cpp [code]
 

Implementation for GeographicLib::UTMUPS class.


geographiclib-1.21/doc/html/SphericalHarmonic2_8hpp.html0000644000175000017500000001352011745620414023074 0ustar frankiefrankie GeographicLib: SphericalHarmonic2.hpp File Reference
SphericalHarmonic2.hpp File Reference

Header for GeographicLib::SphericalHarmonic2 class. More...

Go to the source code of this file.

Classes

class  GeographicLib::SphericalHarmonic2
 Spherical Harmonic series with two corrections to the coefficients. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_SPHERICALHARMONIC2_HPP   "$Id: ce4cda614c1966dea65610bc73bc4db562677fa8 $"

Detailed Description

Header for GeographicLib::SphericalHarmonic2 class.

Copyright (c) Charles Karney (2011, 2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file SphericalHarmonic2.hpp.


Define Documentation

#define GEOGRAPHICLIB_SPHERICALHARMONIC2_HPP   "$Id: ce4cda614c1966dea65610bc73bc4db562677fa8 $"

Definition at line 11 of file SphericalHarmonic2.hpp.

geographiclib-1.21/doc/html/functions_func_0x74.html0000644000175000017500000001237711745620415022277 0ustar frankiefrankie GeographicLib: Class Members - Functions geographiclib-1.21/doc/html/LambertConformalConic_8cpp_source.html0000644000175000017500000014556011745620414025207 0ustar frankiefrankie GeographicLib: LambertConformalConic.cpp Source File
LambertConformalConic.cpp
Go to the documentation of this file.
00001 /**
00002  * \file LambertConformalConic.cpp
00003  * \brief Implementation for GeographicLib::LambertConformalConic class
00004  *
00005  * Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/LambertConformalConic.hpp>
00011 
00012 #define GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_CPP \
00013   "$Id: da8f6ce89092006a26946d671edca1a7836e7ce6 $"
00014 
00015 RCSID_DECL(GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_CPP)
00016 RCSID_DECL(GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP)
00017 
00018 namespace GeographicLib {
00019 
00020   using namespace std;
00021 
00022   const Math::real LambertConformalConic::eps_ =
00023     numeric_limits<real>::epsilon();
00024   const Math::real LambertConformalConic::epsx_ = Math::sq(eps_);
00025   const Math::real LambertConformalConic::tol_ = real(0.1) * sqrt(eps_);
00026   const Math::real LambertConformalConic::ahypover_ =
00027     real(numeric_limits<real>::digits) * log(real(numeric_limits<real>::radix))
00028     + 2;
00029 
00030   LambertConformalConic::LambertConformalConic(real a, real f,
00031                                                real stdlat, real k0)
00032     : _a(a)
00033     , _f(f <= 1 ? f : 1/f)
00034     , _fm(1 - _f)
00035     , _e2(_f * (2 - _f))
00036     , _e(sqrt(abs(_e2)))
00037     , _e2m(1 - _e2)
00038   {
00039     if (!(Math::isfinite(_a) && _a > 0))
00040       throw GeographicErr("Major radius is not positive");
00041     if (!(Math::isfinite(_f) && _f < 1))
00042       throw GeographicErr("Minor radius is not positive");
00043     if (!(Math::isfinite(k0) && k0 > 0))
00044       throw GeographicErr("Scale is not positive");
00045     if (!(abs(stdlat) <= 90))
00046       throw GeographicErr("Standard latitude not in [-90, 90]");
00047     real
00048       phi = stdlat * Math::degree<real>(),
00049       sphi = sin(phi),
00050       cphi = abs(stdlat) != 90 ? cos(phi) : 0;
00051     Init(sphi, cphi, sphi, cphi, k0);
00052   }
00053 
00054   LambertConformalConic::LambertConformalConic(real a, real f,
00055                                                real stdlat1, real stdlat2,
00056                                                real k1)
00057     : _a(a)
00058     , _f(f <= 1 ? f : 1/f)
00059     , _fm(1 - _f)
00060     , _e2(_f * (2 - _f))
00061     , _e(sqrt(abs(_e2)))
00062     , _e2m(1 - _e2)
00063   {
00064     if (!(Math::isfinite(_a) && _a > 0))
00065       throw GeographicErr("Major radius is not positive");
00066     if (!(Math::isfinite(_f) && _f < 1))
00067       throw GeographicErr("Minor radius is not positive");
00068     if (!(Math::isfinite(k1) && k1 > 0))
00069       throw GeographicErr("Scale is not positive");
00070     if (!(abs(stdlat1) <= 90))
00071       throw GeographicErr("Standard latitude 1 not in [-90, 90]");
00072     if (!(abs(stdlat2) <= 90))
00073       throw GeographicErr("Standard latitude 2 not in [-90, 90]");
00074     real
00075       phi1 = stdlat1 * Math::degree<real>(),
00076       phi2 = stdlat2 * Math::degree<real>();
00077     Init(sin(phi1), abs(stdlat1) != 90 ? cos(phi1) : 0,
00078          sin(phi2), abs(stdlat2) != 90 ? cos(phi2) : 0, k1);
00079   }
00080 
00081   LambertConformalConic::LambertConformalConic(real a, real f,
00082                                                real sinlat1, real coslat1,
00083                                                real sinlat2, real coslat2,
00084                                                real k1)
00085     : _a(a)
00086     , _f(f <= 1 ? f : 1/f)
00087     , _fm(1 - _f)
00088     , _e2(_f * (2 - _f))
00089     , _e(sqrt(abs(_e2)))
00090     , _e2m(1 - _e2)
00091   {
00092     if (!(Math::isfinite(_a) && _a > 0))
00093       throw GeographicErr("Major radius is not positive");
00094     if (!(Math::isfinite(_f) && _f < 1))
00095       throw GeographicErr("Minor radius is not positive");
00096     if (!(Math::isfinite(k1) && k1 > 0))
00097       throw GeographicErr("Scale is not positive");
00098     if (!(coslat1 >= 0))
00099       throw GeographicErr("Standard latitude 1 not in [-90, 90]");
00100     if (!(coslat2 >= 0))
00101       throw GeographicErr("Standard latitude 2 not in [-90, 90]");
00102     if (!(abs(sinlat1) <= 1 && coslat1 <= 1) || (coslat1 == 0 && sinlat1 == 0))
00103       throw GeographicErr("Bad sine/cosine of standard latitude 1");
00104     if (!(abs(sinlat2) <= 1 && coslat2 <= 1) || (coslat2 == 0 && sinlat2 == 0))
00105       throw GeographicErr("Bad sine/cosine of standard latitude 2");
00106     if (coslat1 == 0 || coslat2 == 0)
00107       if (!(coslat1 == coslat2 && sinlat1 == sinlat2))
00108         throw GeographicErr
00109           ("Standard latitudes must be equal is either is a pole");
00110     Init(sinlat1, coslat1, sinlat2, coslat2, k1);
00111   }
00112 
00113   void LambertConformalConic::Init(real sphi1, real cphi1,
00114                                    real sphi2, real cphi2, real k1) throw() {
00115     {
00116       real r;
00117       r = Math::hypot(sphi1, cphi1);
00118       sphi1 /= r; cphi1 /= r;
00119       r = Math::hypot(sphi2, cphi2);
00120       sphi2 /= r; cphi2 /= r;
00121     }
00122     bool polar = (cphi1 == 0);
00123     cphi1 = max(epsx_, cphi1);   // Avoid singularities at poles
00124     cphi2 = max(epsx_, cphi2);
00125     // Determine hemisphere of tangent latitude
00126     _sign = sphi1 + sphi2 >= 0 ? 1 : -1;
00127     // Internally work with tangent latitude positive
00128     sphi1 *= _sign; sphi2 *= _sign;
00129     if (sphi1 > sphi2) {
00130       swap(sphi1, sphi2); swap(cphi1, cphi2); // Make phi1 < phi2
00131     }
00132     real
00133       tphi1 = sphi1/cphi1, tphi2 = sphi2/cphi2, tphi0;
00134     //
00135     // Snyder: 15-8: n = (log(m1) - log(m2))/(log(t1)-log(t2))
00136     //
00137     // m = cos(bet) = 1/sec(bet) = 1/sqrt(1+tan(bet)^2)
00138     // bet = parametric lat, tan(bet) = (1-f)*tan(phi)
00139     //
00140     // t = tan(pi/4-chi/2) = 1/(sec(chi) + tan(chi)) = sec(chi) - tan(chi)
00141     // log(t) = -asinh(tan(chi)) = -psi
00142     // chi = conformal lat
00143     // tan(chi) = tan(phi)*cosh(xi) - sinh(xi)*sec(phi)
00144     // xi = eatanhe(sin(phi)), eatanhe(x) = e * atanh(e*x)
00145     //
00146     // n = (log(sec(bet2))-log(sec(bet1)))/(asinh(tan(chi2))-asinh(tan(chi1)))
00147     //
00148     // Let log(sec(bet)) = b(tphi), asinh(tan(chi)) = c(tphi)
00149     // Then n = Db(tphi2, tphi1)/Dc(tphi2, tphi1)
00150     // In limit tphi2 -> tphi1, n -> sphi1
00151     //
00152     real
00153       tbet1 = _fm * tphi1, scbet1 = hyp(tbet1),
00154       tbet2 = _fm * tphi2, scbet2 = hyp(tbet2);
00155     real
00156       scphi1 = 1/cphi1,
00157       xi1 = eatanhe(sphi1), shxi1 = sinh(xi1), chxi1 = hyp(shxi1),
00158       tchi1 = chxi1 * tphi1 - shxi1 * scphi1, scchi1 = hyp(tchi1),
00159       scphi2 = 1/cphi2,
00160       xi2 = eatanhe(sphi2), shxi2 = sinh(xi2), chxi2 = hyp(shxi2),
00161       tchi2 = chxi2 * tphi2 - shxi2 * scphi2, scchi2 = hyp(tchi2),
00162       psi1 = Math::asinh(tchi1);
00163     if (tphi2 - tphi1 != 0) {
00164       // Db(tphi2, tphi1)
00165       real num = Dlog1p(Math::sq(tbet2)/(1 + scbet2),
00166                         Math::sq(tbet1)/(1 + scbet1))
00167         * Dhyp(tbet2, tbet1, scbet2, scbet1) * _fm;
00168       // Dc(tphi2, tphi1)
00169       real den = Dasinh(tphi2, tphi1, scphi2, scphi1)
00170         - Deatanhe(sphi2, sphi1) * Dsn(tphi2, tphi1, sphi2, sphi1);
00171       _n = num/den;
00172 
00173       if (_n < 0.25)
00174         _nc = sqrt((1 - _n) * (1 + _n));
00175       else {
00176         // Compute nc = cos(phi0) = sqrt((1 - n) * (1 + n)), evaluating 1 - n
00177         // carefully.  First write
00178         //
00179         // Dc(tphi2, tphi1) * (tphi2 - tphi1)
00180         //   = log(tchi2 + scchi2) - log(tchi1 + scchi1)
00181         //
00182         // then den * (1 - n) =
00183         // (log((tchi2 + scchi2)/(2*scbet2)) - log((tchi1 + scchi1)/(2*scbet1)))
00184         // / (tphi2 - tphi1)
00185         // = Dlog1p(a2, a1) * (tchi2+scchi2 + tchi1+scchi1)/(4*scbet1*scbet2)
00186         //   * fm * Q
00187         //
00188         // where
00189         // a1 = ( (tchi1 - scbet1) + (scchi1 - scbet1) ) / (2 * scbet1)
00190         // Q = ((scbet2 + scbet1)/fm)/((scchi2 + scchi1)/D(tchi2, tchi1))
00191         //     - (tbet2 + tbet1)/(scbet2 + scbet1)
00192         real t;
00193         {
00194           real
00195             // s1 = (scbet1 - scchi1) * (scbet1 + scchi1)
00196             s1 = (tphi1 * (2 * shxi1 * chxi1 * scphi1 - _e2 * tphi1) -
00197                   Math::sq(shxi1) * (1 + 2 * Math::sq(tphi1))),
00198             s2 = (tphi2 * (2 * shxi2 * chxi2 * scphi2 - _e2 * tphi2) -
00199                   Math::sq(shxi2) * (1 + 2 * Math::sq(tphi2))),
00200             // t1 = scbet1 - tchi1
00201             t1 = tchi1 < 0 ? scbet1 - tchi1 : (s1 + 1)/(scbet1 + tchi1),
00202             t2 = tchi2 < 0 ? scbet2 - tchi2 : (s2 + 1)/(scbet2 + tchi2),
00203             a2 = -(s2 / (scbet2 + scchi2) + t2) / (2 * scbet2),
00204             a1 = -(s1 / (scbet1 + scchi1) + t1) / (2 * scbet1);
00205           t = Dlog1p(a2, a1) / den;
00206         }
00207         // multiply by (tchi2 + scchi2 + tchi1 + scchi1)/(4*scbet1*scbet2) * fm
00208         t *= ( ( (tchi2 >= 0 ? scchi2 + tchi2 : 1/(scchi2 - tchi2)) +
00209                  (tchi1 >= 0 ? scchi1 + tchi1 : 1/(scchi1 - tchi1)) ) /
00210                (4 * scbet1 * scbet2) ) * _fm;
00211 
00212         // Rewrite
00213         // Q = (1 - (tbet2 + tbet1)/(scbet2 + scbet1)) -
00214         //     (1 - ((scbet2 + scbet1)/fm)/((scchi2 + scchi1)/D(tchi2, tchi1)))
00215         //   = tbm - tam
00216         // where
00217         real tbm = ( ((tbet1 > 0 ? 1/(scbet1+tbet1) : scbet1 - tbet1) +
00218                       (tbet2 > 0 ? 1/(scbet2+tbet2) : scbet2 - tbet2)) /
00219                      (scbet1+scbet2) );
00220 
00221         // tam = (1 - ((scbet2+scbet1)/fm)/((scchi2+scchi1)/D(tchi2, tchi1)))
00222         //
00223         // Let
00224         //   (scbet2 + scbet1)/fm = scphi2 + scphi1 + dbet
00225         //   (scchi2 + scchi1)/D(tchi2, tchi1) = scphi2 + scphi1 + dchi
00226         // then
00227         //   tam = D(tchi2, tchi1) * (dchi - dbet) / (scchi1 + scchi2)
00228         real
00229           // D(tchi2, tchi1)
00230           dtchi = den / Dasinh(tchi2, tchi1, scchi2, scchi1),
00231           // (scbet2 + scbet1)/fm - (scphi2 + scphi1)
00232           dbet = (_e2/_fm) * ( 1 / (scbet2 + _fm * scphi2) +
00233                                1 / (scbet1 + _fm * scphi1) );
00234 
00235         // dchi = (scchi2 + scchi1)/D(tchi2, tchi1) - (scphi2 + scphi1)
00236         // Let
00237         //    tzet = chxiZ * tphi - shxiZ * scphi
00238         //    tchi = tzet + nu
00239         //    scchi = sczet + mu
00240         // where
00241         //    xiZ = eatanhe(1), shxiZ = sinh(xiZ), chxiZ = cosh(xiZ)
00242         //    nu =   scphi * (shxiZ - shxi) - tphi * (chxiZ - chxi)
00243         //    mu = - scphi * (chxiZ - chxi) + tphi * (shxiZ - shxi)
00244         // then
00245         // dchi = ((mu2 + mu1) - D(nu2, nu1) * (scphi2 + scphi1)) /
00246         //         D(tchi2, tchi1)
00247         real
00248           xiZ = eatanhe(real(1)), shxiZ = sinh(xiZ), chxiZ = hyp(shxiZ),
00249           // These are differences not divided differences
00250           // dxiZ1 = xiZ - xi1; dshxiZ1 = shxiZ - shxi; dchxiZ1 = chxiZ - chxi
00251           dxiZ1 = Deatanhe(real(1), sphi1)/(scphi1*(tphi1+scphi1)),
00252           dxiZ2 = Deatanhe(real(1), sphi2)/(scphi2*(tphi2+scphi2)),
00253           dshxiZ1 = Dsinh(xiZ, xi1, shxiZ, shxi1, chxiZ, chxi1) * dxiZ1,
00254           dshxiZ2 = Dsinh(xiZ, xi2, shxiZ, shxi2, chxiZ, chxi2) * dxiZ2,
00255           dchxiZ1 = Dhyp(shxiZ, shxi1, chxiZ, chxi1) * dshxiZ1,
00256           dchxiZ2 = Dhyp(shxiZ, shxi2, chxiZ, chxi2) * dshxiZ2,
00257           // mu1 + mu2
00258           amu12 = (- scphi1 * dchxiZ1 + tphi1 * dshxiZ1
00259                    - scphi2 * dchxiZ2 + tphi2 * dshxiZ2),
00260           // D(xi2, xi1)
00261           dxi = Deatanhe(sphi1, sphi2) * Dsn(tphi2, tphi1, sphi2, sphi1),
00262           // D(nu2, nu1)
00263           dnu12 =
00264           ( (_f * 4 * scphi2 * dshxiZ2 > _f * scphi1 * dshxiZ1 ?
00265              // Use divided differences
00266              (dshxiZ1 + dshxiZ2)/2 * Dhyp(tphi1, tphi2, scphi1, scphi2)
00267              - ( (scphi1 + scphi2)/2
00268                  * Dsinh(xi1, xi2, shxi1, shxi2, chxi1, chxi2) * dxi ) :
00269              // Use ratio of differences
00270              (scphi2 * dshxiZ2 - scphi1 * dshxiZ1)/(tphi2 - tphi1))
00271             + ( (tphi1 + tphi2)/2 * Dhyp(shxi1, shxi2, chxi1, chxi2)
00272                 * Dsinh(xi1, xi2, shxi1, shxi2, chxi1, chxi2) * dxi )
00273             - (dchxiZ1 + dchxiZ2)/2 ),
00274           // dtchi * dchi
00275           dchia = (amu12 - dnu12 * (scphi2 + scphi1)),
00276           tam = (dchia - dtchi * dbet) / (scchi1 + scchi2);
00277         t *= tbm - tam;
00278         _nc = sqrt(max(real(0), t) * (1 + _n));
00279       }
00280       {
00281         real r = Math::hypot(_n, _nc);
00282         _n /= r;
00283         _nc /= r;
00284       }
00285       tphi0 = _n / _nc;
00286     } else {
00287       tphi0 = tphi1;
00288       _nc = 1/hyp(tphi0);
00289       _n = tphi0 * _nc;
00290       if (polar)
00291         _nc = 0;
00292     }
00293 
00294     _scbet0 = hyp(_fm * tphi0);
00295     real shxi0 = sinh(eatanhe(_n));
00296     _tchi0 = tphi0 * hyp(shxi0) - shxi0 * hyp(tphi0); _scchi0 = hyp(_tchi0);
00297     _psi0 = Math::asinh(_tchi0);
00298 
00299     _lat0 = atan(_sign * tphi0) / Math::degree<real>();
00300     _t0nm1 = Math::expm1(- _n * _psi0); // Snyder's t0^n - 1
00301     // a * k1 * m1/t1^n = a * k1 * m2/t2^n = a * k1 * n * (Snyder's F)
00302     // = a * k1 / (scbet1 * exp(-n * psi1))
00303     _scale = _a * k1 / scbet1 *
00304       // exp(n * psi1) = exp(- (1 - n) * psi1) * exp(psi1)
00305       // with (1-n) = nc^2/(1+n) and exp(-psi1) = scchi1 + tchi1
00306       exp( - (Math::sq(_nc)/(1 + _n)) * psi1 )
00307       * (tchi1 >= 0 ? scchi1 + tchi1 : 1 / (scchi1 - tchi1));
00308     // Scale at phi0 = k0 = k1 * (scbet0*exp(-n*psi0))/(scbet1*exp(-n*psi1))
00309     //                    = k1 * scbet0/scbet1 * exp(n * (psi1 - psi0))
00310     // psi1 - psi0 = Dasinh(tchi1, tchi0) * (tchi1 - tchi0)
00311     _k0 = k1 * (_scbet0/scbet1) *
00312       exp( - (Math::sq(_nc)/(1 + _n)) *
00313            Dasinh(tchi1, _tchi0, scchi1, _scchi0) * (tchi1 - _tchi0))
00314       * (tchi1 >= 0 ? scchi1 + tchi1 : 1 / (scchi1 - tchi1)) /
00315       (_scchi0 + _tchi0);
00316     _nrho0 = polar ? 0 : _a * _k0 / _scbet0;
00317   }
00318 
00319   const LambertConformalConic
00320   LambertConformalConic::Mercator(Constants::WGS84_a<real>(),
00321                                   Constants::WGS84_f<real>(),
00322                                   real(0), real(1));
00323 
00324   void LambertConformalConic::Forward(real lon0, real lat, real lon,
00325                                       real& x, real& y, real& gamma, real& k)
00326     const throw() {
00327     if (lon - lon0 >= 180)
00328       lon -= lon0 + 360;
00329     else if (lon - lon0 < -180)
00330       lon -= lon0 - 360;
00331     else
00332       lon -= lon0;
00333     lat *= _sign;
00334     // From Snyder, we have
00335     //
00336     // theta = n * lambda
00337     // x = rho * sin(theta)
00338     //   = (nrho0 + n * drho) * sin(theta)/n
00339     // y = rho0 - rho * cos(theta)
00340     //   = nrho0 * (1-cos(theta))/n - drho * cos(theta)
00341     //
00342     // where nrho0 = n * rho0, drho = rho - rho0
00343     // and drho is evaluated with divided differences
00344     real
00345       lam = lon * Math::degree<real>(),
00346       phi = lat * Math::degree<real>(),
00347       sphi = sin(phi), cphi = abs(lat) != 90 ? cos(phi) : epsx_,
00348       tphi = sphi/cphi, tbet = _fm * tphi, scbet = hyp(tbet),
00349       scphi = 1/cphi, shxi = sinh(eatanhe(sphi)),
00350       tchi = hyp(shxi) * tphi - shxi * scphi, scchi = hyp(tchi),
00351       psi = Math::asinh(tchi),
00352       theta = _n * lam, stheta = sin(theta), ctheta = cos(theta),
00353       dpsi = Dasinh(tchi, _tchi0, scchi, _scchi0) * (tchi - _tchi0),
00354       drho = - _scale * (2 * _nc < 1 && dpsi != 0 ?
00355                          (exp(Math::sq(_nc)/(1 + _n) * psi ) *
00356                           (tchi > 0 ? 1/(scchi + tchi) : (scchi - tchi))
00357                           - (_t0nm1 + 1))/(-_n) :
00358                          Dexp(-_n * psi, -_n * _psi0) * dpsi);
00359     x = (_nrho0 + _n * drho) * (_n != 0 ? stheta / _n : lam);
00360     y = _nrho0 *
00361       (_n != 0 ?
00362        (ctheta < 0 ? 1 - ctheta : Math::sq(stheta)/(1 + ctheta)) / _n : 0)
00363       - drho * ctheta;
00364     k = _k0 * (scbet/_scbet0) /
00365       (exp( - (Math::sq(_nc)/(1 + _n)) * dpsi )
00366        * (tchi >= 0 ? scchi + tchi : 1 / (scchi - tchi)) / (_scchi0 + _tchi0));
00367     y *= _sign;
00368     gamma = _sign * theta / Math::degree<real>();
00369   }
00370 
00371   void LambertConformalConic::Reverse(real lon0, real x, real y,
00372                                       real& lat, real& lon,
00373                                       real& gamma, real& k)
00374     const throw() {
00375     // From Snyder, we have
00376     //
00377     //        x = rho * sin(theta)
00378     // rho0 - y = rho * cos(theta)
00379     //
00380     // rho = hypot(x, rho0 - y)
00381     // drho = (n*x^2 - 2*y*nrho0 + n*y^2)/(hypot(n*x, nrho0-n*y) + nrho0)
00382     // theta = atan2(n*x, nrho0-n*y)
00383     //
00384     // From drho, obtain t^n-1
00385     // psi = -log(t), so
00386     // dpsi = - Dlog1p(t^n-1, t0^n-1) * drho / scale
00387     y *= _sign;
00388     real
00389       nx = _n * x, ny = _n * y, y1 = _nrho0 - ny,
00390       den = Math::hypot(nx, y1) + _nrho0, // 0 implies origin with polar aspect
00391       drho = den != 0 ? (x*nx - 2*y*_nrho0 + y*ny) / den : 0,
00392       tnm1 = _t0nm1 + _n * drho/_scale,
00393       dpsi = (den == 0 ? 0 :
00394               (tnm1 + 1 != 0 ? - Dlog1p(tnm1, _t0nm1) * drho / _scale :
00395                ahypover_));
00396     real tchi;
00397     if (2 * _n <= 1) {
00398       // tchi = sinh(psi)
00399       real
00400         psi = _psi0 + dpsi, tchia = sinh(psi), scchi = hyp(tchia),
00401         dtchi = Dsinh(psi, _psi0, tchia, _tchi0, scchi, _scchi0) * dpsi;
00402       tchi = _tchi0 + dtchi;    // Update tchi using divided difference
00403     } else {
00404       // tchi = sinh(-1/n * log(tn))
00405       //      = sinh((1-1/n) * log(tn) - log(tn))
00406       //      = + sinh((1-1/n) * log(tn)) * cosh(log(tn))
00407       //        - cosh((1-1/n) * log(tn)) * sinh(log(tn))
00408       // (1-1/n) = - nc^2/(n*(1+n))
00409       // cosh(log(tn)) = (tn + 1/tn)/2; sinh(log(tn)) = (tn - 1/tn)/2
00410       real
00411         tn = tnm1 + 1 == 0 ? epsx_ : tnm1 + 1,
00412         sh = sinh( -Math::sq(_nc)/(_n * (1 + _n)) *
00413                    (2 * tn > 1 ? Math::log1p(tnm1) : log(tn)) );
00414       tchi = sh * (tn + 1/tn)/2 - hyp(sh) * (tnm1 * (tn + 1)/tn)/2;
00415     }
00416 
00417     // Use Newton's method to solve for tphi
00418     real
00419       // See comment in TransverseMercator.cpp about the initial guess
00420       tphi = tchi/_e2m,
00421       stol = tol_ * max(real(1), abs(tchi));
00422     // min iterations = 1, max iterations = 2; mean = 1.94
00423     for (int i = 0; i < numit_; ++i) {
00424       real
00425         scphi = hyp(tphi),
00426         shxi = sinh( eatanhe( tphi / scphi ) ),
00427         tchia = hyp(shxi) * tphi - shxi * scphi,
00428         dtphi = (tchi - tchia) * (1 + _e2m * Math::sq(tphi)) /
00429         ( _e2m * scphi * hyp(tchia) );
00430       tphi += dtphi;
00431       if (!(abs(dtphi) >= stol))
00432         break;
00433     }
00434     // log(t) = -asinh(tan(chi)) = -psi
00435     gamma = atan2(nx, y1);
00436     real
00437       phi = _sign * atan(tphi),
00438       scbet = hyp(_fm * tphi), scchi = hyp(tchi),
00439       lam = _n != 0 ? gamma / _n : x / y1;
00440     lat = phi / Math::degree<real>();
00441     lon = lam / Math::degree<real>();
00442     // Avoid losing a bit of accuracy in lon (assuming lon0 is an integer)
00443     if (lon + lon0 >= 180)
00444       lon += lon0 - 360;
00445     else if (lon + lon0 < -180)
00446       lon += lon0 + 360;
00447     else
00448       lon += lon0;
00449     k = _k0 * (scbet/_scbet0) /
00450       (exp(_nc != 0 ? - (Math::sq(_nc)/(1 + _n)) * dpsi : 0)
00451        * (tchi >= 0 ? scchi + tchi : 1 / (scchi - tchi)) / (_scchi0 + _tchi0));
00452     gamma /= _sign * Math::degree<real>();
00453   }
00454 
00455   void LambertConformalConic::SetScale(real lat, real k) {
00456     if (!(Math::isfinite(k) && k > 0))
00457       throw GeographicErr("Scale is not positive");
00458     if (!(abs(lat) <= 90))
00459       throw GeographicErr("Latitude for SetScale not in [-90, 90]");
00460     if (abs(lat) == 90 && !(_nc == 0 && lat * _n > 0))
00461       throw GeographicErr("Incompatible polar latitude in SetScale");
00462     real x, y, gamma, kold;
00463     Forward(0, lat, 0, x, y, gamma, kold);
00464     k /= kold;
00465     _scale *= k;
00466     _k0 *= k;
00467   }
00468 
00469 } // namespace GeographicLib
geographiclib-1.21/doc/html/classGeographicLib_1_1PolygonArea-members.html0000644000175000017500000001063311745620414026440 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::PolygonArea Member List
This is the complete list of members for GeographicLib::PolygonArea, including all inherited members.
AddPoint(real lat, real lon)GeographicLib::PolygonArea
Clear()GeographicLib::PolygonArea [inline]
Compute(bool reverse, bool sign, real &perimeter, real &area) const GeographicLib::PolygonArea
Flattening() const GeographicLib::PolygonArea [inline]
MajorRadius() const GeographicLib::PolygonArea [inline]
PolygonArea(const Geodesic &earth, bool polyline=false)GeographicLib::PolygonArea [inline]
TestCompute(real lat, real lon, bool reverse, bool sign, real &perimeter, real &area) const GeographicLib::PolygonArea
geographiclib-1.21/doc/html/classGeographicLib_1_1Constants-members.html0000644000175000017500000003012311745620414026170 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::Constants Member List
This is the complete list of members for GeographicLib::Constants, including all inherited members.
acre()GeographicLib::Constants [inline, static]
arcminute()GeographicLib::Constants [inline, static]
arcsecond()GeographicLib::Constants [inline, static]
chain()GeographicLib::Constants [inline, static]
degree()GeographicLib::Constants [inline, static]
fathom()GeographicLib::Constants [inline, static]
foot()GeographicLib::Constants [inline, static]
furlong()GeographicLib::Constants [inline, static]
GRS80_a()GeographicLib::Constants [inline, static]
GRS80_GM()GeographicLib::Constants [inline, static]
GRS80_J2()GeographicLib::Constants [inline, static]
GRS80_omega()GeographicLib::Constants [inline, static]
hectare()GeographicLib::Constants [inline, static]
kilometer()GeographicLib::Constants [inline, static]
meter()GeographicLib::Constants [inline, static]
meter()GeographicLib::Constants [inline, static]
mile()GeographicLib::Constants [inline, static]
nauticalmile()GeographicLib::Constants [inline, static]
square_kilometer()GeographicLib::Constants [inline, static]
square_meter()GeographicLib::Constants [inline, static]
square_meter()GeographicLib::Constants [inline, static]
square_mile()GeographicLib::Constants [inline, static]
square_nauticalmile()GeographicLib::Constants [inline, static]
surveyfoot()GeographicLib::Constants [inline, static]
UPS_k0()GeographicLib::Constants [inline, static]
UPS_k0()GeographicLib::Constants [inline, static]
UTM_k0()GeographicLib::Constants [inline, static]
UTM_k0()GeographicLib::Constants [inline, static]
WGS84_a()GeographicLib::Constants [inline, static]
WGS84_a()GeographicLib::Constants [inline, static]
WGS84_f()GeographicLib::Constants [inline, static]
WGS84_f()GeographicLib::Constants [inline, static]
WGS84_GM()GeographicLib::Constants [inline, static]
WGS84_omega()GeographicLib::Constants [inline, static]
WGS84_r()GeographicLib::Constants [inline, static]
yard()GeographicLib::Constants [inline, static]
geographiclib-1.21/doc/html/classGeographicLib_1_1GravityModel-members.html0000644000175000017500000003073311745620414026631 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::GravityModel Member List
This is the complete list of members for GeographicLib::GravityModel, including all inherited members.
ALL enum valueGeographicLib::GravityModel
AngularVelocity() const GeographicLib::GravityModel [inline]
Circle(real lat, real h, unsigned caps=ALL) const GeographicLib::GravityModel
DateTime() const GeographicLib::GravityModel [inline]
DefaultGravityName()GeographicLib::GravityModel [static]
DefaultGravityPath()GeographicLib::GravityModel [static]
Description() const GeographicLib::GravityModel [inline]
DISTURBANCE enum valueGeographicLib::GravityModel
Disturbance(real lat, real lon, real h, real &deltax, real &deltay, real &deltaz) const GeographicLib::GravityModel
DISTURBING_POTENTIAL enum valueGeographicLib::GravityModel
Flattening() const GeographicLib::GravityModel [inline]
GEOID_HEIGHT enum valueGeographicLib::GravityModel
GeoidHeight(real lat, real lon) const GeographicLib::GravityModel
Gravity(real lat, real lon, real h, real &gx, real &gy, real &gz) const GeographicLib::GravityModel
GRAVITY enum valueGeographicLib::GravityModel
GravityCircle classGeographicLib::GravityModel [friend]
GravityFile() const GeographicLib::GravityModel [inline]
GravityModel(const std::string &name, const std::string &path="")GeographicLib::GravityModel [explicit]
GravityModelDirectory() const GeographicLib::GravityModel [inline]
GravityModelName() const GeographicLib::GravityModel [inline]
MajorRadius() const GeographicLib::GravityModel [inline]
mask enum nameGeographicLib::GravityModel
MassConstant() const GeographicLib::GravityModel [inline]
NONE enum valueGeographicLib::GravityModel
Phi(real X, real Y, real &fX, real &fY) const GeographicLib::GravityModel [inline]
ReferenceEllipsoid() const GeographicLib::GravityModel [inline]
ReferenceMassConstant() const GeographicLib::GravityModel [inline]
SPHERICAL_ANOMALY enum valueGeographicLib::GravityModel
SphericalAnomaly(real lat, real lon, real h, real &Dg01, real &xi, real &eta) const GeographicLib::GravityModel
T(real X, real Y, real Z, real &deltaX, real &deltaY, real &deltaZ) const GeographicLib::GravityModel [inline]
T(real X, real Y, real Z) const GeographicLib::GravityModel [inline]
U(real X, real Y, real Z, real &gammaX, real &gammaY, real &gammaZ) const GeographicLib::GravityModel [inline]
V(real X, real Y, real Z, real &GX, real &GY, real &GZ) const GeographicLib::GravityModel
W(real X, real Y, real Z, real &gX, real &gY, real &gZ) const GeographicLib::GravityModel
geographiclib-1.21/doc/html/classGeographicLib_1_1GravityCircle.html0000644000175000017500000011721411745620415025343 0ustar frankiefrankie GeographicLib: GeographicLib::GravityCircle Class Reference
GeographicLib::GravityCircle Class Reference

Gravity on a circle of latitude. More...

#include <GeographicLib/GravityCircle.hpp>

List of all members.

Public Member Functions

 GravityCircle ()
Compute the gravitational field
Math::real Gravity (real lon, real &gx, real &gy, real &gz) const throw ()
Math::real Disturbance (real lon, real &deltax, real &deltay, real &deltaz) const throw ()
Math::real GeoidHeight (real lon) const throw ()
void SphericalAnomaly (real lon, real &Dg01, real &xi, real &eta) const throw ()
Math::real W (real lon, real &gX, real &gY, real &gZ) const throw ()
Math::real V (real lon, real &GX, real &GY, real &GZ) const throw ()
Math::real T (real lon, real &deltaX, real &deltaY, real &deltaZ) const throw ()
Math::real T (real lon) const throw ()
Inspector functions
bool Init () const throw ()
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()
Math::real Latitude () const throw ()
Math::real Height () const throw ()
unsigned Capabilities () const throw ()
bool Capabilities (unsigned testcaps) const throw ()

Friends

class GravityModel

Detailed Description

Gravity on a circle of latitude.

Evaluate the earth's gravity field on a circle of constant height and latitude. This uses a CircleEngine to pre-evaluate the inner sum of the spherical harmonic sum, allowing the values of the field at several different longitudes to be evaluated rapidly.

Use GravityModel::Circle to create a GravityCircle object. (The constructor for this class is private.)

See Geoid heights on a multi-processor system for an example of using GravityCircle (together with OpenMP) to speed up the computation of geoid heights.

Example of use:

// Example of using the GeographicLib::GravityCircle class
// $Id: dc7c895cc248cee01a434ea3df1b31771ffb6ad2 $

#include <iostream>
#include <exception>
#include <GeographicLib/GravityModel.hpp>
#include <GeographicLib/GravityCircle.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    GravityModel grav("egm96");
    double lat = 27.99, lon0 = 86.93, h = 8820; // Mt Everest
    {
      // Slow method of evaluating the values at several points on a circle of
      // latitude.
      for (int i = -5; i <= 5; ++i) {
        double lon = lon0 + i * 0.2;
        double gx, gy, gz;
        grav.Gravity(lat, lon, h, gx, gy, gz);
        cout << lon << " " << gx << " " << gy << " " << gz << "\n";
      }
    }
    {
      // Fast method of evaluating the values at several points on a circle of
      // latitude using GravityCircle.
      GravityCircle circ = grav.Circle(lat, h);
      for (int i = -5; i <= 5; ++i) {
        double lon = lon0 + i * 0.2;
        double gx, gy, gz;
        circ.Gravity(lon, gx, gy, gz);
        cout << lon << " " << gx << " " << gy << " " << gz << "\n";
      }
    }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Gravity is a command-line utility providing access to the functionality of GravityModel and GravityCircle.


Constructor & Destructor Documentation

GeographicLib::GravityCircle::GravityCircle ( ) [inline]

A default constructor for the normal gravity. This sets up an uninitialized object which can be later replaced by the GravityModel::Circle.

Definition at line 107 of file GravityCircle.hpp.


Member Function Documentation

Math::real GeographicLib::GravityCircle::Gravity ( real  lon,
real &  gx,
real &  gy,
real &  gz 
) const throw ()

Evaluate the gravity.

Parameters:
[in]lonthe geographic longitude (degrees).
[out]gxthe easterly component of the acceleration (m s-2).
[out]gythe northerly component of the acceleration (m s-2).
[out]gzthe upward component of the acceleration (m s-2); this is usually negative.
Returns:
W the sum of the gravitational and centrifugal potentials.

The function includes the effects of the earth's rotation.

Definition at line 27 of file GravityCircle.cpp.

Math::real GeographicLib::GravityCircle::Disturbance ( real  lon,
real &  deltax,
real &  deltay,
real &  deltaz 
) const throw ()

Evaluate the gravity disturbance vector.

Parameters:
[in]lonthe geographic longitude (degrees).
[out]deltaxthe easterly component of the disturbance vector (m s-2).
[out]deltaythe northerly component of the disturbance vector (m s-2).
[out]deltazthe upward component of the disturbance vector (m s-2).
Returns:
T the corresponding disturbing potential.

Definition at line 37 of file GravityCircle.cpp.

Math::real GeographicLib::GravityCircle::GeoidHeight ( real  lon) const throw ()

Evaluate the geoid height.

Parameters:
[in]lonthe geographic longitude (degrees).
Returns:
N the height of the geoid above the reference ellipsoid (meters).

Some approximations are made in computing the geoid height so that the results of the NGA codes are reproduced accurately. Details are given in Details of the geoid height and anomaly calculations.

Definition at line 47 of file GravityCircle.cpp.

void GeographicLib::GravityCircle::SphericalAnomaly ( real  lon,
real &  Dg01,
real &  xi,
real &  eta 
) const throw ()

Evaluate the components of the gravity anomaly vector using the spherical approximation.

Parameters:
[in]lonthe geographic longitude (degrees).
[out]Dg01the gravity anomaly (m s-2).
[out]xithe northerly component of the deflection of the vertical (degrees).
[out]etathe easterly component of the deflection of the vertical (degrees).

The spherical approximation (see Heiskanen and Moritz, Sec 2-14) is used so that the results of the NGA codes are reproduced accurately. approximations used here. Details are given in Details of the geoid height and anomaly calculations.

Definition at line 57 of file GravityCircle.cpp.

Math::real GeographicLib::GravityCircle::W ( real  lon,
real &  gX,
real &  gY,
real &  gZ 
) const throw () [inline]

Evaluate the components of the acceleration due to gravity and the centrifugal acceleration in geocentric coordinates.

Parameters:
[in]lonthe geographic longitude (degrees).
[out]gXthe X component of the acceleration (m s-2).
[out]gYthe Y component of the acceleration (m s-2).
[out]gZthe Z component of the acceleration (m s-2).
Returns:
W = V + Phi the sum of the gravitational and centrifugal potentials (m2 s-2).

Definition at line 188 of file GravityCircle.hpp.

Math::real GeographicLib::GravityCircle::V ( real  lon,
real &  GX,
real &  GY,
real &  GZ 
) const throw () [inline]

Evaluate the components of the acceleration due to gravity in geocentric coordinates.

Parameters:
[in]lonthe geographic longitude (degrees).
[out]GXthe X component of the acceleration (m s-2).
[out]GYthe Y component of the acceleration (m s-2).
[out]GZthe Z component of the acceleration (m s-2).
Returns:
V = W - Phi the gravitational potential (m2 s-2).

Definition at line 208 of file GravityCircle.hpp.

Math::real GeographicLib::GravityCircle::T ( real  lon,
real &  deltaX,
real &  deltaY,
real &  deltaZ 
) const throw () [inline]

Evaluate the components of the gravity disturbance in geocentric coordinates.

Parameters:
[in]lonthe geographic longitude (degrees).
[out]deltaXthe X component of the gravity disturbance (m s-2).
[out]deltaYthe Y component of the gravity disturbance (m s-2).
[out]deltaZthe Z component of the gravity disturbance (m s-2).
Returns:
T = W - U the disturbing potential (also called the anomalous potential) (m2 s-2).

Definition at line 229 of file GravityCircle.hpp.

Math::real GeographicLib::GravityCircle::T ( real  lon) const throw () [inline]

Evaluate disturbing potential in geocentric coordinates.

Parameters:
[in]lonthe geographic longitude (degrees).
Returns:
T = W - U the disturbing potential (also called the anomalous potential) (m2 s-2).

Definition at line 243 of file GravityCircle.hpp.

bool GeographicLib::GravityCircle::Init ( ) const throw () [inline]
Returns:
true if the object has been initialized.

Definition at line 257 of file GravityCircle.hpp.

Math::real GeographicLib::GravityCircle::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value inherited from the GravityModel object used in the constructor.

Definition at line 264 of file GravityCircle.hpp.

Math::real GeographicLib::GravityCircle::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid. This is the value inherited from the GravityModel object used in the constructor.

Definition at line 271 of file GravityCircle.hpp.

Math::real GeographicLib::GravityCircle::Latitude ( ) const throw () [inline]
Returns:
the latitude of the circle (degrees).

Definition at line 277 of file GravityCircle.hpp.

Math::real GeographicLib::GravityCircle::Height ( ) const throw () [inline]
Returns:
the height of the circle (meters).

Definition at line 283 of file GravityCircle.hpp.

unsigned GeographicLib::GravityCircle::Capabilities ( ) const throw () [inline]
Returns:
caps the computational capabilities that this object was constructed with.

Definition at line 290 of file GravityCircle.hpp.

bool GeographicLib::GravityCircle::Capabilities ( unsigned  testcaps) const throw () [inline]
Parameters:
[in]testcapsa set of bitor'ed GeodesicLine::mask values.
Returns:
true if the GeodesicLine object has all these capabilities.

Definition at line 296 of file GravityCircle.hpp.


Friends And Related Function Documentation

friend class GravityModel [friend]

Definition at line 93 of file GravityCircle.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/OSGB_8hpp.html0000644000175000017500000001265511745620415020162 0ustar frankiefrankie GeographicLib: OSGB.hpp File Reference
OSGB.hpp File Reference

Header for GeographicLib::OSGB class. More...

#include <string>
#include <sstream>
#include <GeographicLib/Constants.hpp>
#include <GeographicLib/TransverseMercator.hpp>

Go to the source code of this file.

Classes

class  GeographicLib::OSGB
 Ordnance Survey grid system for Great Britain. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_OSGB_HPP   "$Id: e91367e693ad63bb500c953e9c21445bef017464 $"

Detailed Description

Header for GeographicLib::OSGB class.

Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file OSGB.hpp.


Define Documentation

#define GEOGRAPHICLIB_OSGB_HPP   "$Id: e91367e693ad63bb500c953e9c21445bef017464 $"

Definition at line 11 of file OSGB.hpp.

geographiclib-1.21/doc/html/functions_func_0x75.html0000644000175000017500000001204311745620414022265 0ustar frankiefrankie GeographicLib: Class Members - Functions geographiclib-1.21/doc/html/transversemercator.html0000644000175000017500000003260111745620414022412 0ustar frankiefrankie GeographicLib: Transverse Mercator projection
Transverse Mercator projection
Back to Geodesics on the ellipsoid. Forward to Geocentric coordinates. Up to Contents.

GeographicLib::TransverseMercator and GeographicLib::TransverseMercatorExact provide accurate implementations of the transverse Mercator projection. The TransverseMercatorProj utility provides an interface to these classes.

References

The algorithm for GeographicLib::TransverseMercator is based on Krüger (1912); that for GeographicLib::TransverseMercatorExact is based on Lee (1976).

See tm-grid.kmz, for an illustration of the exact transverse Mercator grid in Google Earth.

Test data for the transverse Mercator projection

A test set for the transverse Mercator projection is available at

This is about 17 MB (compressed). This test set consists of a set of geographic coordinates together with the corresponding transverse Mercator coordinates. The WGS84 ellipsoid is used, with central meridian 0o, central scale factor 0.9996 (the UTM value), false easting = false northing = 0 m.

Each line of the test set gives 6 space delimited numbers

  • latitude (degrees, exact)
  • longitude (degrees, exact — see below)
  • easting (meters, accurate to 0.1 pm)
  • northing (meters, accurate to 0.1 pm)
  • meridian convergence (degrees, accurate to 10-18 deg)
  • scale (accurate to 10-20)

The latitude and longitude are all multiples of 10-12 deg and should be regarded as exact, except that longitude = 82.63627282416406551 should be interpreted as exactly 90 (1 - e) degrees. These results are computed using Lee's formulas with Maxima's bfloats and fpprec set to 80 (so the errors in the data are probably 1/2 of the values quoted above). The Maxima code, tm.mac and ellint.mac, used to prepare this data set is included in the distribution. You will need to have Maxima installed to use this code. The comments at the top of tm.mac illustrate how to run it.

The contents of the file are as follows:

  • 250000 entries randomly distributed in lat in [0, 90], lon in [0, 90];
  • 1000 entries randomly distributed on lat in [0, 90], lon = 0;
  • 1000 entries randomly distributed on lat = 0, lon in [0, 90];
  • 1000 entries randomly distributed on lat in [0, 90], lon = 90;
  • 1000 entries close to lat = 90 with lon in [0, 90];
  • 1000 entries close to lat = 0, lon = 0 with lat >= 0, lon >= 0;
  • 1000 entries close to lat = 0, lon = 90 with lat >= 0, lon <= 90;
  • 2000 entries close to lat = 0, lon = 90 (1 - e) with lat >= 0;
  • 25000 entries randomly distributed in lat in [-89, 0], lon in [90 (1 - e), 90];
  • 1000 entries randomly distributed on lat in [-89, 0], lon = 90;
  • 1000 entries randomly distributed on lat in [-89, 0], lon = 90 (1 - e);
  • 1000 entries close to lat = 0, lon = 90 (lat < 0, lon <= 90);
  • 1000 entries close to lat = 0, lon = 90 (1 - e) (lat < 0, lon <= 90 (1 - e));

(a total of 287000 entries). The entries for lat < 0o and lon in [90o (1 - e), 90o] use the "extended" domain for the transverse Mercator projection explained in Sec. 5 of arXiv:1002.1417. The first 258000 entries have lat >= 0o and are suitable for testing implementations following the standard convention.

Series approximation for transverse Mercator

Krüger (1912) gives a 4th-order approximation to the transverse Mercator projection. This is accurate to about 200 nm (200 nanometers) within the UTM domain. Here we present the series extended to 10th order. By default, GeographicLib::TransverseMercator uses the 6th-order approximation. The preprocessor variable TM_TX_MAXPOW can be used to select an order from 4 thru 8. The series expanded to order n30 are given in tmseries30.html.

In the formulas below ^ indicates exponentiation (n^3 = n*n*n) and / indicates real division (3/5 = 0.6). The equations need to be converted to Horner form, but are here left in expanded form so that they can be easily truncated to lower order in n. Some of the integers here are not representable as 32-bit integers and will need to be included as double literals.

A in Krüger, p. 12, eq. (5)

  A = a/(n + 1) * (1 + 1/4 * n^2
                     + 1/64 * n^4
                     + 1/256 * n^6
                     + 25/16384 * n^8
                     + 49/65536 * n^10);

gamma in Krüger, p. 21, eq. (41)

alpha[1] =   1/2 * n
           - 2/3 * n^2
           + 5/16 * n^3
           + 41/180 * n^4
           - 127/288 * n^5
           + 7891/37800 * n^6
           + 72161/387072 * n^7
           - 18975107/50803200 * n^8
           + 60193001/290304000 * n^9
           + 134592031/1026432000 * n^10;
alpha[2] =   13/48 * n^2
           - 3/5 * n^3
           + 557/1440 * n^4
           + 281/630 * n^5
           - 1983433/1935360 * n^6
           + 13769/28800 * n^7
           + 148003883/174182400 * n^8
           - 705286231/465696000 * n^9
           + 1703267974087/3218890752000 * n^10;
alpha[3] =   61/240 * n^3
           - 103/140 * n^4
           + 15061/26880 * n^5
           + 167603/181440 * n^6
           - 67102379/29030400 * n^7
           + 79682431/79833600 * n^8
           + 6304945039/2128896000 * n^9
           - 6601904925257/1307674368000 * n^10;
alpha[4] =   49561/161280 * n^4
           - 179/168 * n^5
           + 6601661/7257600 * n^6
           + 97445/49896 * n^7
           - 40176129013/7664025600 * n^8
           + 138471097/66528000 * n^9
           + 48087451385201/5230697472000 * n^10;
alpha[5] =   34729/80640 * n^5
           - 3418889/1995840 * n^6
           + 14644087/9123840 * n^7
           + 2605413599/622702080 * n^8
           - 31015475399/2583060480 * n^9
           + 5820486440369/1307674368000 * n^10;
alpha[6] =   212378941/319334400 * n^6
           - 30705481/10378368 * n^7
           + 175214326799/58118860800 * n^8
           + 870492877/96096000 * n^9
           - 1328004581729009/47823519744000 * n^10;
alpha[7] =   1522256789/1383782400 * n^7
           - 16759934899/3113510400 * n^8
           + 1315149374443/221405184000 * n^9
           + 71809987837451/3629463552000 * n^10;
alpha[8] =   1424729850961/743921418240 * n^8
           - 256783708069/25204608000 * n^9
           + 2468749292989891/203249958912000 * n^10;
alpha[9] =   21091646195357/6080126976000 * n^9
           - 67196182138355857/3379030566912000 * n^10;
alpha[10]=   77911515623232821/12014330904576000 * n^10;

beta in Krüger, p. 18, eq. (26*)

 beta[1] =   1/2 * n
           - 2/3 * n^2
           + 37/96 * n^3
           - 1/360 * n^4
           - 81/512 * n^5
           + 96199/604800 * n^6
           - 5406467/38707200 * n^7
           + 7944359/67737600 * n^8
           - 7378753979/97542144000 * n^9
           + 25123531261/804722688000 * n^10;
 beta[2] =   1/48 * n^2
           + 1/15 * n^3
           - 437/1440 * n^4
           + 46/105 * n^5
           - 1118711/3870720 * n^6
           + 51841/1209600 * n^7
           + 24749483/348364800 * n^8
           - 115295683/1397088000 * n^9
           + 5487737251099/51502252032000 * n^10;
 beta[3] =   17/480 * n^3
           - 37/840 * n^4
           - 209/4480 * n^5
           + 5569/90720 * n^6
           + 9261899/58060800 * n^7
           - 6457463/17740800 * n^8
           + 2473691167/9289728000 * n^9
           - 852549456029/20922789888000 * n^10;
 beta[4] =   4397/161280 * n^4
           - 11/504 * n^5
           - 830251/7257600 * n^6
           + 466511/2494800 * n^7
           + 324154477/7664025600 * n^8
           - 937932223/3891888000 * n^9
           - 89112264211/5230697472000 * n^10;
 beta[5] =   4583/161280 * n^5
           - 108847/3991680 * n^6
           - 8005831/63866880 * n^7
           + 22894433/124540416 * n^8
           + 112731569449/557941063680 * n^9
           - 5391039814733/10461394944000 * n^10;
 beta[6] =   20648693/638668800 * n^6
           - 16363163/518918400 * n^7
           - 2204645983/12915302400 * n^8
           + 4543317553/18162144000 * n^9
           + 54894890298749/167382319104000 * n^10;
 beta[7] =   219941297/5535129600 * n^7
           - 497323811/12454041600 * n^8
           - 79431132943/332107776000 * n^9
           + 4346429528407/12703122432000 * n^10;
 beta[8] =   191773887257/3719607091200 * n^8
           - 17822319343/336825216000 * n^9
           - 497155444501631/1422749712384000 * n^10;
 beta[9] =   11025641854267/158083301376000 * n^9
           - 492293158444691/6758061133824000 * n^10;
 beta[10]=   7028504530429621/72085985427456000 * n^10;

The high-order expansions for alpha and beta were produced by the Maxima program tmseries.mac (included in the distribution). To run, start Maxima and enter

  load("tmseries.mac")$

Further instructions are included at the top of the file.

Back to Geodesics on the ellipsoid. Forward to Geocentric coordinates. Up to Contents.
geographiclib-1.21/doc/html/SphericalHarmonic1_8hpp_source.html0000644000175000017500000010216211745620414024454 0ustar frankiefrankie GeographicLib: SphericalHarmonic1.hpp Source File
SphericalHarmonic1.hpp
Go to the documentation of this file.
00001 /**
00002  * \file SphericalHarmonic1.hpp
00003  * \brief Header for GeographicLib::SphericalHarmonic1 class
00004  *
00005  * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under
00006  * the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_SPHERICALHARMONIC1_HPP)
00011 #define GEOGRAPHICLIB_SPHERICALHARMONIC1_HPP \
00012   "$Id: 9dd895ded08db0f7fdd82159399da511f40a17e1 $"
00013 
00014 #include <vector>
00015 #include <GeographicLib/Constants.hpp>
00016 #include <GeographicLib/SphericalEngine.hpp>
00017 #include <GeographicLib/CircularEngine.hpp>
00018 
00019 namespace GeographicLib {
00020 
00021   /**
00022    * \brief Spherical Harmonic series with a correction to the coefficients.
00023    *
00024    * This classes is similar to SphericalHarmonic, except that the coefficients
00025    * \e C<sub>\e nm</sub> are replaced by \e C<sub>\e nm</sub> + \e tau
00026    * C'<sub>\e nm</sub> (and similarly for \e S<sub>\e nm</sub>).
00027    *
00028    * Example of use:
00029    * \include example-SphericalHarmonic1.cpp
00030    **********************************************************************/
00031 
00032   class GEOGRAPHIC_EXPORT SphericalHarmonic1 {
00033   public:
00034     /**
00035      * Supported normalizations for associate Legendre polynomials.
00036      **********************************************************************/
00037     enum normalization {
00038       /**
00039        * Fully normalized associated Legendre polynomials.  See
00040        * SphericalHarmonic::FULL for documentation.
00041        *
00042        * @hideinitializer
00043        **********************************************************************/
00044       FULL = SphericalEngine::FULL,
00045       /**
00046        * Schmidt semi-normalized associated Legendre polynomials.  See
00047        * SphericalHarmonic::SCHMIDT for documentation.
00048        *
00049        * @hideinitializer
00050        **********************************************************************/
00051       SCHMIDT = SphericalEngine::SCHMIDT,
00052       /// \cond SKIP
00053       // These are deprecated...
00054       full = FULL,
00055       schmidt = SCHMIDT,
00056       /// \endcond
00057     };
00058 
00059   private:
00060     typedef Math::real real;
00061     SphericalEngine::coeff _c[2];
00062     real _a;
00063     unsigned _norm;
00064 
00065   public:
00066     /**
00067      * Constructor with a full set of coefficients specified.
00068      *
00069      * @param[in] C the coefficients \e C<sub>\e nm</sub>.
00070      * @param[in] S the coefficients \e S<sub>\e nm</sub>.
00071      * @param[in] N the maximum degree and order of the sum
00072      * @param[in] C1 the coefficients \e C'<sub>\e nm</sub>.
00073      * @param[in] S1 the coefficients \e S'<sub>\e nm</sub>.
00074      * @param[in] N1 the maximum degree and order of the correction
00075      *   coefficients \e C'<sub>\e nm</sub> and \e S'<sub>\e nm</sub>.
00076      * @param[in] a the reference radius appearing in the definition of the
00077      *   sum.
00078      * @param[in] norm the normalization for the associated Legendre
00079      *   polynomials, either SphericalHarmonic1::FULL (the default) or
00080      *   SphericalHarmonic1::SCHMIDT.
00081      *
00082      * See SphericalHarmonic for the way the coefficients should be stored.  \e
00083      * N1 should satisfy \e N1 <= \e N.
00084      *
00085      * The class stores <i>pointers</i> to the first elements of \e C, \e S, \e
00086      * C', and \e S'.  These arrays should not be altered or destroyed during
00087      * the lifetime of a SphericalHarmonic object.
00088      **********************************************************************/
00089     SphericalHarmonic1(const std::vector<real>& C,
00090                        const std::vector<real>& S,
00091                        int N,
00092                        const std::vector<real>& C1,
00093                        const std::vector<real>& S1,
00094                        int N1,
00095                        real a, unsigned norm = FULL)
00096       : _a(a)
00097       , _norm(norm) {
00098       if (!(N1 <= N))
00099         throw GeographicErr("N1 cannot be larger that N");
00100       _c[0] = SphericalEngine::coeff(C, S, N);
00101       _c[1] = SphericalEngine::coeff(C1, S1, N1);
00102     }
00103 
00104     /**
00105      * Constructor with a subset of coefficients specified.
00106      *
00107      * @param[in] C the coefficients \e C<sub>\e nm</sub>.
00108      * @param[in] S the coefficients \e S<sub>\e nm</sub>.
00109      * @param[in] N the degree used to determine the layout of \e C and \e S.
00110      * @param[in] nmx the maximum degree used in the sum.  The sum over \e n is
00111      *   from 0 thru \e nmx.
00112      * @param[in] mmx the maximum order used in the sum.  The sum over \e m is
00113      *   from 0 thru min(\e n, \e mmx).
00114      * @param[in] C1 the coefficients \e C'<sub>\e nm</sub>.
00115      * @param[in] S1 the coefficients \e S'<sub>\e nm</sub>.
00116      * @param[in] N1 the degree used to determine the layout of \e C' and \e
00117      *   S'.
00118      * @param[in] nmx1 the maximum degree used for \e C' and \e S'.
00119      * @param[in] mmx1 the maximum order used for \e C' and \e S'.
00120      * @param[in] a the reference radius appearing in the definition of the
00121      *   sum.
00122      * @param[in] norm the normalization for the associated Legendre
00123      *   polynomials, either SphericalHarmonic1::FULL (the default) or
00124      *   SphericalHarmonic1::SCHMIDT.
00125      *
00126      * The class stores <i>pointers</i> to the first elements of \e C, \e S, \e
00127      * C', and \e S'.  These arrays should not be altered or destroyed during
00128      * the lifetime of a SphericalHarmonic object.
00129      **********************************************************************/
00130     SphericalHarmonic1(const std::vector<real>& C,
00131                        const std::vector<real>& S,
00132                        int N, int nmx, int mmx,
00133                        const std::vector<real>& C1,
00134                        const std::vector<real>& S1,
00135                        int N1, int nmx1, int mmx1,
00136                        real a, unsigned norm = FULL)
00137       : _a(a)
00138       , _norm(norm) {
00139       if (!(nmx1 <= nmx))
00140         throw GeographicErr("nmx1 cannot be larger that nmx");
00141       if (!(mmx1 <= mmx))
00142         throw GeographicErr("mmx1 cannot be larger that mmx");
00143       _c[0] = SphericalEngine::coeff(C, S, N, nmx, mmx);
00144       _c[1] = SphericalEngine::coeff(C1, S1, N1, nmx1, mmx1);
00145     }
00146 
00147     /**
00148      * A default constructor so that the object can be created when the
00149      * constructor for another object is initialized.  This default object can
00150      * then be reset with the default copy assignment operator.
00151      **********************************************************************/
00152     SphericalHarmonic1() {}
00153 
00154     /**
00155      * Compute a spherical harmonic sum with a correction term.
00156      *
00157      * @param[in] tau multiplier for correction coefficients \e C' and \e S'.
00158      * @param[in] x cartesian coordinate.
00159      * @param[in] y cartesian coordinate.
00160      * @param[in] z cartesian coordinate.
00161      * @return \e V the spherical harmonic sum.
00162      *
00163      * This routine requires constant memory and thus never throws
00164      * an exception.
00165      **********************************************************************/
00166     Math::real operator()(real tau, real x, real y, real z) const throw() {
00167       real f[] = {1, tau};
00168       real v = 0;
00169       real dummy;
00170       switch (_norm) {
00171       case FULL:
00172         v = SphericalEngine::Value<false, SphericalEngine::FULL, 2>
00173           (_c, f, x, y, z, _a, dummy, dummy, dummy);
00174         break;
00175       case SCHMIDT:
00176         v = SphericalEngine::Value<false, SphericalEngine::SCHMIDT, 2>
00177           (_c, f, x, y, z, _a, dummy, dummy, dummy);
00178         break;
00179       }
00180       return v;
00181     }
00182 
00183     /**
00184      * Compute a spherical harmonic sum with a correction term and its
00185      * gradient.
00186      *
00187      * @param[in] tau multiplier for correction coefficients \e C' and \e S'.
00188      * @param[in] x cartesian coordinate.
00189      * @param[in] y cartesian coordinate.
00190      * @param[in] z cartesian coordinate.
00191      * @param[out] gradx \e x component of the gradient
00192      * @param[out] grady \e y component of the gradient
00193      * @param[out] gradz \e z component of the gradient
00194      * @return \e V the spherical harmonic sum.
00195      *
00196      * This is the same as the previous function, except that the components of
00197      * the gradients of the sum in the \e x, \e y, and \e z directions are
00198      * computed.  This routine requires constant memory and thus never throws
00199      * an exception.
00200      **********************************************************************/
00201     Math::real operator()(real tau, real x, real y, real z,
00202                           real& gradx, real& grady, real& gradz) const throw() {
00203       real f[] = {1, tau};
00204       real v = 0;
00205       switch (_norm) {
00206       case FULL:
00207         v = SphericalEngine::Value<true, SphericalEngine::FULL, 2>
00208           (_c, f, x, y, z, _a, gradx, grady, gradz);
00209         break;
00210       case SCHMIDT:
00211         v = SphericalEngine::Value<true, SphericalEngine::SCHMIDT, 2>
00212           (_c, f, x, y, z, _a, gradx, grady, gradz);
00213         break;
00214       }
00215       return v;
00216     }
00217 
00218     /**
00219      * Create a CircularEngine to allow the efficient evaluation of several
00220      * points on a circle of latitude at a fixed value of \e tau.
00221      *
00222      * @param[in] tau the multiplier for the correction coefficients.
00223      * @param[in] p the radius of the circle.
00224      * @param[in] z the height of the circle above the equatorial plane.
00225      * @param[in] gradp if true the returned object will be able to compute the
00226      *   gradient of the sum.
00227      * @return the CircularEngine object.
00228      *
00229      * SphericalHarmonic1::operator()() exchanges the order of the sums in the
00230      * definition, i.e., sum(n = 0..N)[sum(m = 0..n)[...]] becomes sum(m =
00231      * 0..N)[sum(n = m..N)[...]].  SphericalHarmonic1::Circle performs the
00232      * inner sum over degree \e n (which entails about <i>N</i><sup>2</sup>
00233      * operations).  Calling CircularEngine::operator()() on the returned
00234      * object performs the outer sum over the order \e m (about \e N
00235      * operations).  This routine may throw a bad_alloc exception in the
00236      * CircularEngine constructor.
00237      *
00238      * See SphericalHarmonic::Circle for an example of its use.
00239      **********************************************************************/
00240     CircularEngine Circle(real tau, real p, real z, bool gradp) const {
00241       real f[] = {1, tau};
00242       switch (_norm) {
00243       case FULL:
00244         return gradp ?
00245           SphericalEngine::Circle<true, SphericalEngine::FULL, 2>
00246           (_c, f, p, z, _a) :
00247           SphericalEngine::Circle<false, SphericalEngine::FULL, 2>
00248           (_c, f, p, z, _a);
00249         break;
00250       case SCHMIDT:
00251       default:                  // To avoid compiler warnings
00252         return gradp ?
00253           SphericalEngine::Circle<true, SphericalEngine::SCHMIDT, 2>
00254           (_c, f, p, z, _a) :
00255           SphericalEngine::Circle<false, SphericalEngine::SCHMIDT, 2>
00256           (_c, f, p, z, _a);
00257         break;
00258       }
00259     }
00260 
00261     /**
00262      * @return the zeroth SphericalEngine::coeff object.
00263      **********************************************************************/
00264     const SphericalEngine::coeff& Coefficients() const throw()
00265     { return _c[0]; }
00266     /**
00267      * @return the first SphericalEngine::coeff object.
00268      **********************************************************************/
00269     const SphericalEngine::coeff& Coefficients1() const throw()
00270     { return _c[1]; }
00271   };
00272 
00273 } // namespace GeographicLib
00274 
00275 #endif  // GEOGRAPHICLIB_SPHERICALHARMONIC1_HPP
geographiclib-1.21/doc/html/OSGB_8cpp.html0000644000175000017500000001132211745620414020142 0ustar frankiefrankie GeographicLib: OSGB.cpp File Reference
OSGB.cpp File Reference

Implementation for GeographicLib::OSGB class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_OSGB_CPP   "$Id: 4bfb35c88866ed936faad797f3cef6f4ece36196 $"

Detailed Description

Implementation for GeographicLib::OSGB class.

Copyright (c) Charles Karney (2010-2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file OSGB.cpp.


Define Documentation

#define GEOGRAPHICLIB_OSGB_CPP   "$Id: 4bfb35c88866ed936faad797f3cef6f4ece36196 $"

Definition at line 13 of file OSGB.cpp.

geographiclib-1.21/doc/html/functions_func_0x76.html0000644000175000017500000001141411745620414022267 0ustar frankiefrankie GeographicLib: Class Members - Functions geographiclib-1.21/doc/html/Gravity_8cpp_source.html0000644000175000017500000011177311745620415022431 0ustar frankiefrankie GeographicLib: Gravity.cpp Source File
Gravity.cpp
Go to the documentation of this file.
00001 /**
00002  * \file Gravity.cpp
00003  * \brief Command line utility for evaluating gravity fields
00004  *
00005  * Copyright (c) Charles Karney (2011, 2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  *
00009  * Compile and link with
00010  *   g++ -g -O3 -I../include -I../man -o Gravity \
00011  *       Gravity.cpp \
00012  *       ../src/CircularEngine.cpp \
00013  *       ../src/DMS.cpp \
00014  *       ../src/Geocentric.cpp \
00015  *       ../src/GravityCircle.cpp \
00016  *       ../src/GravityModel.cpp \
00017  *       ../src/NormalGravity.cpp \
00018  *       ../src/SphericalEngine.cpp \
00019  *       ../src/Utility.cpp
00020  *
00021  * See the <a href="Gravity.1.html">man page</a> for usage
00022  * information.
00023  **********************************************************************/
00024 
00025 #include <iostream>
00026 #include <string>
00027 #include <sstream>
00028 #include <fstream>
00029 #include <GeographicLib/GravityModel.hpp>
00030 #include <GeographicLib/GravityCircle.hpp>
00031 #include <GeographicLib/DMS.hpp>
00032 #include <GeographicLib/Utility.hpp>
00033 
00034 #include "Gravity.usage"
00035 
00036 int main(int argc, char* argv[]) {
00037   try {
00038     using namespace GeographicLib;
00039     typedef Math::real real;
00040     bool verbose = false;
00041     std::string dir;
00042     std::string model = GravityModel::DefaultGravityName();
00043     std::string istring, ifile, ofile, cdelim;
00044     char lsep = ';';
00045     real lat = 0, h = 0;
00046     bool circle = false;
00047     int prec = -1;
00048     enum {
00049       GRAVITY = 0,
00050       DISTURBANCE = 1,
00051       ANOMALY = 2,
00052       UNDULATION = 3,
00053     };
00054     unsigned mode = GRAVITY;
00055     for (int m = 1; m < argc; ++m) {
00056       std::string arg(argv[m]);
00057       if (arg == "-n") {
00058         if (++m == argc) return usage(1, true);
00059         model = argv[m];
00060       } else if (arg == "-d") {
00061         if (++m == argc) return usage(1, true);
00062         dir = argv[m];
00063       } else if (arg == "-G")
00064         mode = GRAVITY;
00065       else if (arg == "-D")
00066         mode = DISTURBANCE;
00067       else if (arg == "-A")
00068         mode = ANOMALY;
00069       else if (arg == "-H")
00070         mode = UNDULATION;
00071       else if (arg == "-c") {
00072         if (m + 2 >= argc) return usage(1, true);
00073         try {
00074           DMS::flag ind;
00075           lat = DMS::Decode(std::string(argv[++m]), ind);
00076           if (ind == DMS::LONGITUDE)
00077             throw GeographicErr("Bad hemisphere letter on latitude");
00078           if (!(std::abs(lat) <= 90))
00079             throw GeographicErr("Latitude not in [-90d, 90d]");
00080           h = Utility::num<real>(std::string(argv[++m]));
00081           circle = true;
00082         }
00083         catch (const std::exception& e) {
00084           std::cerr << "Error decoding argument of " << arg << ": "
00085                     << e.what() << "\n";
00086           return 1;
00087         }
00088       } else if (arg == "-p") {
00089         if (++m == argc) return usage(1, true);
00090         try {
00091           prec = Utility::num<int>(std::string(argv[m]));
00092         }
00093         catch (const std::exception&) {
00094           std::cerr << "Precision " << argv[m] << " is not a number\n";
00095           return 1;
00096         }
00097       } else if (arg == "-v")
00098         verbose = true;
00099       else if (arg == "--input-string") {
00100         if (++m == argc) return usage(1, true);
00101         istring = argv[m];
00102       } else if (arg == "--input-file") {
00103         if (++m == argc) return usage(1, true);
00104         ifile = argv[m];
00105       } else if (arg == "--output-file") {
00106         if (++m == argc) return usage(1, true);
00107         ofile = argv[m];
00108       } else if (arg == "--line-separator") {
00109         if (++m == argc) return usage(1, true);
00110         if (std::string(argv[m]).size() != 1) {
00111           std::cerr << "Line separator must be a single character\n";
00112           return 1;
00113         }
00114         lsep = argv[m][0];
00115       } else if (arg == "--comment-delimiter") {
00116         if (++m == argc) return usage(1, true);
00117         cdelim = argv[m];
00118       } else if (arg == "--version") {
00119         std::cout
00120           << argv[0]
00121           << ": $Id: c87c647c3e973929010cdb2fd5d1eaa6aa739eca $\n"
00122           << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n";
00123         return 0;
00124       } else {
00125         int retval = usage(!(arg == "-h" || arg == "--help"), arg != "--help");
00126         if (arg == "-h")
00127           std::cout<< "\nDefault gravity path = \""
00128                    << GravityModel::DefaultGravityPath()
00129                    << "\"\nDefault gravity name = \""
00130                    << GravityModel::DefaultGravityName()
00131                    << "\"\n";
00132         return retval;
00133       }
00134     }
00135 
00136     if (!ifile.empty() && !istring.empty()) {
00137       std::cerr << "Cannot specify --input-string and --input-file together\n";
00138       return 1;
00139     }
00140     if (ifile == "-") ifile.clear();
00141     std::ifstream infile;
00142     std::istringstream instring;
00143     if (!ifile.empty()) {
00144       infile.open(ifile.c_str());
00145       if (!infile.is_open()) {
00146         std::cerr << "Cannot open " << ifile << " for reading\n";
00147         return 1;
00148       }
00149     } else if (!istring.empty()) {
00150       std::string::size_type m = 0;
00151       while (true) {
00152         m = istring.find(lsep, m);
00153         if (m == std::string::npos)
00154           break;
00155         istring[m] = '\n';
00156       }
00157       instring.str(istring);
00158     }
00159     std::istream* input = !ifile.empty() ? &infile :
00160       (!istring.empty() ? &instring : &std::cin);
00161 
00162     std::ofstream outfile;
00163     if (ofile == "-") ofile.clear();
00164     if (!ofile.empty()) {
00165       outfile.open(ofile.c_str());
00166       if (!outfile.is_open()) {
00167         std::cerr << "Cannot open " << ofile << " for writing\n";
00168         return 1;
00169       }
00170     }
00171     std::ostream* output = !ofile.empty() ? &outfile : &std::cout;
00172 
00173     switch (mode) {
00174     case GRAVITY:
00175       prec = std::min(16, prec < 0 ? 5 : prec);
00176       break;
00177     case DISTURBANCE:
00178     case ANOMALY:
00179       prec = std::min(14, prec < 0 ? 3 : prec);
00180       break;
00181     case UNDULATION:
00182     default:
00183       prec = std::min(12, prec < 0 ? 4 : prec);
00184       break;
00185     }
00186     int retval = 0;
00187     try {
00188       const GravityModel g(model, dir);
00189       if (circle) {
00190         if (!Math::isfinite<real>(h))
00191           throw GeographicErr("Bad height");
00192         else if (mode == UNDULATION && h != 0)
00193           throw GeographicErr("Height should be zero for geoid undulations");
00194       }
00195       if (verbose) {
00196         std::cerr << "Gravity file: " << g.GravityFile()      << "\n"
00197                   << "Name: "         << g.GravityModelName() << "\n"
00198                   << "Description: "  << g.Description()      << "\n"
00199                   << "Date & Time: "  << g.DateTime()         << "\n";
00200       }
00201       unsigned mask = (mode == GRAVITY ? GravityModel::GRAVITY :
00202                        (mode == DISTURBANCE ? GravityModel::DISTURBANCE :
00203                         (mode == ANOMALY ? GravityModel::SPHERICAL_ANOMALY :
00204                          GravityModel::GEOID_HEIGHT))); // mode == UNDULATION
00205       const GravityCircle c(circle ? g.Circle(lat, h, mask) : GravityCircle());
00206       std::string s, stra, strb;
00207       while (std::getline(*input, s)) {
00208         try {
00209           std::string eol("\n");
00210           if (!cdelim.empty()) {
00211             std::string::size_type m = s.find(cdelim);
00212             if (m != std::string::npos) {
00213               eol = " " + s.substr(m) + "\n";
00214               s = s.substr(0, m);
00215             }
00216           }
00217           std::istringstream str(s);
00218           real lon;
00219           if (circle) {
00220             if (!(str >> strb))
00221               throw GeographicErr("Incomplete input: " + s);
00222             DMS::flag ind;
00223             lon = DMS::Decode(strb, ind);
00224             if (ind == DMS::LATITUDE)
00225               throw GeographicErr("Bad hemisphere letter on " + strb);
00226             if (lon < -180 || lon > 360)
00227               throw GeographicErr("Longitude " + strb + "not in [-180d, 360d]");
00228           } else {
00229             if (!(str >> stra >> strb))
00230               throw GeographicErr("Incomplete input: " + s);
00231             DMS::DecodeLatLon(stra, strb, lat, lon);
00232             h = 0;
00233             if (!(str >> h))    // h is optional
00234               str.clear();
00235             if (mode == UNDULATION && h != 0)
00236                 throw GeographicErr("Height must be zero for geoid heights");
00237           }
00238           if (str >> stra)
00239             throw GeographicErr("Extra junk in input: " + s);
00240           switch (mode) {
00241           case GRAVITY:
00242             {
00243               real gx, gy, gz;
00244               if (circle) {
00245                 c.Gravity(lon, gx, gy, gz);
00246               } else {
00247                 g.Gravity(lat, lon, h, gx, gy, gz);
00248               }
00249               *output << Utility::str<real>(gx, prec) << " "
00250                       << Utility::str<real>(gy, prec) << " "
00251                       << Utility::str<real>(gz, prec) << eol;
00252             }
00253             break;
00254           case DISTURBANCE:
00255             {
00256               real deltax, deltay, deltaz;
00257               if (circle) {
00258                 c.Disturbance(lon, deltax, deltay, deltaz);
00259               } else {
00260                 g.Disturbance(lat, lon, h, deltax, deltay, deltaz);
00261               }
00262               // Convert to mGals
00263               *output << Utility::str<real>(deltax * 1e5, prec) << " "
00264                       << Utility::str<real>(deltay * 1e5, prec) << " "
00265                       << Utility::str<real>(deltaz * 1e5, prec)
00266                       << eol;
00267             }
00268             break;
00269           case ANOMALY:
00270             {
00271               real Dg01, xi, eta;
00272               if (circle)
00273                 c.SphericalAnomaly(lon, Dg01, xi, eta);
00274               else
00275                 g.SphericalAnomaly(lat, lon, h, Dg01, xi, eta);
00276               Dg01 *= 1e5;      // Convert to mGals
00277               xi *= 3600;       // Convert to arcsecs
00278               eta *= 3600;
00279               *output << Utility::str<real>(Dg01, prec) << " "
00280                       << Utility::str<real>(xi, prec) << " "
00281                       << Utility::str<real>(eta, prec) << eol;
00282             }
00283             break;
00284           case UNDULATION:
00285           default:
00286             {
00287               real N = circle ? c.GeoidHeight(lon) : g.GeoidHeight(lat, lon);
00288               *output << Utility::str<real>(N, prec) << eol;
00289             }
00290             break;
00291           }
00292         }
00293         catch (const std::exception& e) {
00294           *output << "ERROR: " << e.what() << "\n";
00295           retval = 1;
00296         }
00297       }
00298     }
00299     catch (const std::exception& e) {
00300       std::cerr << "Error reading " << model << ": " << e.what() << "\n";
00301       retval = 1;
00302     }
00303     return retval;
00304   }
00305   catch (const std::exception& e) {
00306     std::cerr << "Caught exception: " << e.what() << "\n";
00307     return 1;
00308   }
00309   catch (...) {
00310     std::cerr << "Caught unknown exception\n";
00311     return 1;
00312   }
00313 }
geographiclib-1.21/doc/html/LocalCartesian_8hpp.html0000644000175000017500000001273111745620415022307 0ustar frankiefrankie GeographicLib: LocalCartesian.hpp File Reference
LocalCartesian.hpp File Reference

Header for GeographicLib::LocalCartesian class. More...

Go to the source code of this file.

Classes

class  GeographicLib::LocalCartesian
 Local Cartesian coordinates. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_LOCALCARTESIAN_HPP   "$Id: 133014a30695adf3bdea9f4b52613fab458c505a $"

Detailed Description

Header for GeographicLib::LocalCartesian class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file LocalCartesian.hpp.


Define Documentation

#define GEOGRAPHICLIB_LOCALCARTESIAN_HPP   "$Id: 133014a30695adf3bdea9f4b52613fab458c505a $"

Definition at line 11 of file LocalCartesian.hpp.

geographiclib-1.21/doc/html/MagneticField_8cpp_source.html0000644000175000017500000014242111745620415023471 0ustar frankiefrankie GeographicLib: MagneticField.cpp Source File
MagneticField.cpp
Go to the documentation of this file.
00001 /**
00002  * \file MagneticField.cpp
00003  * \brief Command line utility for evaluating magnetic fields
00004  *
00005  * Copyright (c) Charles Karney (2011, 2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  *
00009  * Compile and link with
00010  *   g++ -g -O3 -I../include -I../man -o MagneticField \
00011  *       MagneticField.cpp \
00012  *       ../src/CircularEngine.cpp \
00013  *       ../src/DMS.cpp \
00014  *       ../src/Geocentric.cpp \
00015  *       ../src/MagneticCircle.cpp \
00016  *       ../src/MagneticModel.cpp \
00017  *       ../src/SphericalEngine.cpp \
00018  *       ../src/Utility.cpp
00019  *
00020  * See the <a href="MagneticField.1.html">man page</a> for usage
00021  * information.
00022  **********************************************************************/
00023 
00024 #include <iostream>
00025 #include <string>
00026 #include <sstream>
00027 #include <fstream>
00028 #include <GeographicLib/MagneticModel.hpp>
00029 #include <GeographicLib/MagneticCircle.hpp>
00030 #include <GeographicLib/DMS.hpp>
00031 #include <GeographicLib/Utility.hpp>
00032 
00033 #include "MagneticField.usage"
00034 
00035 int main(int argc, char* argv[]) {
00036   try {
00037     using namespace GeographicLib;
00038     typedef Math::real real;
00039     bool verbose = false;
00040     std::string dir;
00041     std::string model = MagneticModel::DefaultMagneticName();
00042     std::string istring, ifile, ofile, cdelim;
00043     char lsep = ';';
00044     real time = 0, lat = 0, h = 0;
00045     bool timeset = false, circle = false, rate = false;
00046     real hguard = 500000, tguard = 50;
00047     int prec = 1;
00048 
00049     for (int m = 1; m < argc; ++m) {
00050       std::string arg(argv[m]);
00051       if (arg == "-n") {
00052         if (++m == argc) return usage(1, true);
00053         model = argv[m];
00054       } else if (arg == "-d") {
00055         if (++m == argc) return usage(1, true);
00056         dir = argv[m];
00057       } else if (arg == "-t") {
00058         if (++m == argc) return usage(1, true);
00059         try {
00060           time = Utility::fractionalyear<real>(std::string(argv[m]));
00061           timeset = true;
00062           circle = false;
00063         }
00064         catch (const std::exception& e) {
00065           std::cerr << "Error decoding argument of " << arg << ": "
00066                     << e.what() << "\n";
00067           return 1;
00068         }
00069       } else if (arg == "-c") {
00070         if (m + 3 >= argc) return usage(1, true);
00071         try {
00072           time = Utility::fractionalyear<real>(std::string(argv[++m]));
00073           DMS::flag ind;
00074           lat = DMS::Decode(std::string(argv[++m]), ind);
00075           if (ind == DMS::LONGITUDE)
00076             throw GeographicErr("Bad hemisphere letter on latitude");
00077           if (!(std::abs(lat) <= 90))
00078             throw GeographicErr("Latitude not in [-90d, 90d]");
00079           h = Utility::num<real>(std::string(argv[++m]));
00080           timeset = false;
00081           circle = true;
00082         }
00083         catch (const std::exception& e) {
00084           std::cerr << "Error decoding argument of " << arg << ": "
00085                     << e.what() << "\n";
00086           return 1;
00087         }
00088       } else if (arg == "-r")
00089         rate = !rate;
00090       else if (arg == "-p") {
00091         if (++m == argc) return usage(1, true);
00092         try {
00093           prec = Utility::num<int>(std::string(argv[m]));
00094         }
00095         catch (const std::exception&) {
00096           std::cerr << "Precision " << argv[m] << " is not a number\n";
00097           return 1;
00098         }
00099       } else if (arg == "-T") {
00100         if (++m == argc) return usage(1, true);
00101         try {
00102           tguard = Utility::num<real>(std::string(argv[m]));
00103         }
00104         catch (const std::exception& e) {
00105           std::cerr << "Error decoding argument of " << arg << ": "
00106                     << e.what() << "\n";
00107           return 1;
00108         }
00109       } else if (arg == "-H") {
00110         if (++m == argc) return usage(1, true);
00111         try {
00112           hguard = Utility::num<real>(std::string(argv[m]));
00113         }
00114         catch (const std::exception& e) {
00115           std::cerr << "Error decoding argument of " << arg << ": "
00116                     << e.what() << "\n";
00117           return 1;
00118         }
00119       } else if (arg == "-v")
00120         verbose = true;
00121       else if (arg == "--input-string") {
00122         if (++m == argc) return usage(1, true);
00123         istring = argv[m];
00124       } else if (arg == "--input-file") {
00125         if (++m == argc) return usage(1, true);
00126         ifile = argv[m];
00127       } else if (arg == "--output-file") {
00128         if (++m == argc) return usage(1, true);
00129         ofile = argv[m];
00130       } else if (arg == "--line-separator") {
00131         if (++m == argc) return usage(1, true);
00132         if (std::string(argv[m]).size() != 1) {
00133           std::cerr << "Line separator must be a single character\n";
00134           return 1;
00135         }
00136         lsep = argv[m][0];
00137       } else if (arg == "--comment-delimiter") {
00138         if (++m == argc) return usage(1, true);
00139         cdelim = argv[m];
00140       } else if (arg == "--version") {
00141         std::cout
00142           << argv[0]
00143           << ": $Id: cd55a73582dee908c12a23bee33362e7607268af $\n"
00144           << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n";
00145         return 0;
00146       } else {
00147         int retval = usage(!(arg == "-h" || arg == "--help"), arg != "--help");
00148         if (arg == "-h")
00149           std::cout<< "\nDefault magnetic path = \""
00150                    << MagneticModel::DefaultMagneticPath()
00151                    << "\"\nDefault magnetic name = \""
00152                    << MagneticModel::DefaultMagneticName()
00153                    << "\"\n";
00154         return retval;
00155       }
00156     }
00157 
00158     if (!ifile.empty() && !istring.empty()) {
00159       std::cerr << "Cannot specify --input-string and --input-file together\n";
00160       return 1;
00161     }
00162     if (ifile == "-") ifile.clear();
00163     std::ifstream infile;
00164     std::istringstream instring;
00165     if (!ifile.empty()) {
00166       infile.open(ifile.c_str());
00167       if (!infile.is_open()) {
00168         std::cerr << "Cannot open " << ifile << " for reading\n";
00169         return 1;
00170       }
00171     } else if (!istring.empty()) {
00172       std::string::size_type m = 0;
00173       while (true) {
00174         m = istring.find(lsep, m);
00175         if (m == std::string::npos)
00176           break;
00177         istring[m] = '\n';
00178       }
00179       instring.str(istring);
00180     }
00181     std::istream* input = !ifile.empty() ? &infile :
00182       (!istring.empty() ? &instring : &std::cin);
00183 
00184     std::ofstream outfile;
00185     if (ofile == "-") ofile.clear();
00186     if (!ofile.empty()) {
00187       outfile.open(ofile.c_str());
00188       if (!outfile.is_open()) {
00189         std::cerr << "Cannot open " << ofile << " for writing\n";
00190         return 1;
00191       }
00192     }
00193     std::ostream* output = !ofile.empty() ? &outfile : &std::cout;
00194 
00195     tguard = std::max(real(0), tguard);
00196     hguard = std::max(real(0), hguard);
00197     prec = std::min(10, std::max(0, prec));
00198     int retval = 0;
00199     try {
00200       const MagneticModel m(model, dir);
00201       if ((timeset || circle)
00202           && (!Math::isfinite<real>(time) ||
00203               time < m.MinTime() - tguard ||
00204               time > m.MaxTime() + tguard))
00205         throw GeographicErr("Time " + Utility::str(time) +
00206                             " too far outside allowed range [" +
00207                             Utility::str(m.MinTime()) + "," +
00208                             Utility::str(m.MaxTime()) + "]");
00209       if (circle
00210           && (!Math::isfinite<real>(h) ||
00211               h < m.MinHeight() - hguard ||
00212               h > m.MaxHeight() + hguard))
00213         throw GeographicErr("Height " + Utility::str(h/1000) +
00214                             "km too far outside allowed range [" +
00215                             Utility::str(m.MinHeight()/1000) + "km," +
00216                             Utility::str(m.MaxHeight()/1000) + "km]");
00217       if (verbose) {
00218         std::cerr << "Magnetic file: " << m.MagneticFile()      << "\n"
00219                   << "Name: "          << m.MagneticModelName() << "\n"
00220                   << "Description: "   << m.Description()       << "\n"
00221                   << "Date & Time: "   << m.DateTime()          << "\n"
00222                   << "Time range: ["
00223                   << m.MinTime() << ","
00224                   << m.MaxTime() << "]\n"
00225                   << "Height range: ["
00226                   << m.MinHeight()/1000 << "km,"
00227                   << m.MaxHeight()/1000 << "km]\n";
00228       }
00229       if ((timeset || circle) && (time < m.MinTime() || time > m.MaxTime()))
00230         std::cerr << "WARNING: Time " << time
00231                   << " outside allowed range ["
00232                   << m.MinTime() << "," << m.MaxTime() << "]\n";
00233       if (circle && (h < m.MinHeight() || h > m.MaxHeight()))
00234         std::cerr << "WARNING: Height " << h/1000
00235                   << "km outside allowed range ["
00236                   << m.MinHeight()/1000 << "km,"
00237                   << m.MaxHeight()/1000 << "km]\n";
00238       const MagneticCircle c(circle ? m.Circle(time, lat, h) :
00239                              MagneticCircle());
00240       std::string s, stra, strb;
00241       while (std::getline(*input, s)) {
00242         try {
00243           std::string eol("\n");
00244           if (!cdelim.empty()) {
00245             std::string::size_type m = s.find(cdelim);
00246             if (m != std::string::npos) {
00247               eol = " " + s.substr(m) + "\n";
00248               s = s.substr(0, m);
00249             }
00250           }
00251           std::istringstream str(s);
00252           if (!(timeset || circle)) {
00253             if (!(str >> stra))
00254               throw GeographicErr("Incomplete input: " + s);
00255             time = Utility::fractionalyear<real>(stra);
00256             if (time < m.MinTime() - tguard || time > m.MaxTime() + tguard)
00257               throw GeographicErr("Time " + Utility::str(time) +
00258                                   " too far outside allowed range [" +
00259                                   Utility::str(m.MinTime()) + "," +
00260                                   Utility::str(m.MaxTime()) +
00261                                   "]");
00262             if (time < m.MinTime() || time > m.MaxTime())
00263               std::cerr << "WARNING: Time " << time
00264                         << " outside allowed range ["
00265                         << m.MinTime() << "," << m.MaxTime() << "]\n";
00266           }
00267           real lon;
00268           if (circle) {
00269             if (!(str >> strb))
00270               throw GeographicErr("Incomplete input: " + s);
00271             DMS::flag ind;
00272             lon = DMS::Decode(strb, ind);
00273             if (ind == DMS::LATITUDE)
00274               throw GeographicErr("Bad hemisphere letter on " + strb);
00275             if (lon < -180 || lon > 360)
00276               throw GeographicErr("Longitude " + strb + "not in [-180d, 360d]");
00277           } else {
00278             if (!(str >> stra >> strb))
00279               throw GeographicErr("Incomplete input: " + s);
00280             DMS::DecodeLatLon(stra, strb, lat, lon);
00281             h = 0;              // h is optional
00282             if (str >> h) {
00283               if (h < m.MinHeight() - hguard || h > m.MaxHeight() + hguard)
00284                 throw GeographicErr("Height " + Utility::str(h/1000) +
00285                                     "km too far outside allowed range [" +
00286                                     Utility::str(m.MinHeight()/1000) + "km," +
00287                                     Utility::str(m.MaxHeight()/1000) + "km]");
00288               if (h < m.MinHeight() || h > m.MaxHeight())
00289                 std::cerr << "WARNING: Height " << h/1000
00290                           << "km outside allowed range ["
00291                           << m.MinHeight()/1000 << "km,"
00292                           << m.MaxHeight()/1000 << "km]\n";
00293             }
00294             else
00295               str.clear();
00296           }
00297           if (str >> stra)
00298             throw GeographicErr("Extra junk in input: " + s);
00299           real bx, by, bz, bxt, byt, bzt;
00300           if (circle)
00301             c(lon, bx, by, bz, bxt, byt, bzt);
00302           else
00303             m(time, lat, lon, h, bx, by, bz, bxt, byt, bzt);
00304           real H, F, D, I, Ht, Ft, Dt, It;
00305           MagneticModel::FieldComponents(bx, by, bz, bxt, byt, bzt,
00306                                          H, F, D, I, Ht, Ft, Dt, It);
00307 
00308           *output << DMS::Encode(D, prec + 1, DMS::NUMBER) << " "
00309                   << DMS::Encode(I, prec + 1, DMS::NUMBER) << " "
00310                   << Utility::str<real>(H, prec) << " "
00311                   << Utility::str<real>(by, prec) << " "
00312                   << Utility::str<real>(bx, prec) << " "
00313                   << Utility::str<real>(-bz, prec) << " "
00314                   << Utility::str<real>(F, prec) << eol;
00315           if (rate)
00316             *output << DMS::Encode(Dt, prec + 1, DMS::NUMBER) << " "
00317                     << DMS::Encode(It, prec + 1, DMS::NUMBER) << " "
00318                     << Utility::str<real>(Ht, prec) << " "
00319                     << Utility::str<real>(byt, prec) << " "
00320                     << Utility::str<real>(bxt, prec) << " "
00321                     << Utility::str<real>(-bzt, prec) << " "
00322                     << Utility::str<real>(Ft, prec) << eol;
00323         }
00324         catch (const std::exception& e) {
00325           *output << "ERROR: " << e.what() << "\n";
00326           retval = 1;
00327         }
00328       }
00329     }
00330     catch (const std::exception& e) {
00331       std::cerr << "Error reading " << model << ": " << e.what() << "\n";
00332       retval = 1;
00333     }
00334     return retval;
00335   }
00336   catch (const std::exception& e) {
00337     std::cerr << "Caught exception: " << e.what() << "\n";
00338     return 1;
00339   }
00340   catch (...) {
00341     std::cerr << "Caught unknown exception\n";
00342     return 1;
00343   }
00344 }
geographiclib-1.21/doc/html/Geographic.tag0000644000175000017500000074031411745620414020347 0ustar frankiefrankie index Geographic library index contents download abstract Accumulator.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ Accumulator_8hpp GeographicLib/Constants.hpp GeographicLib::Accumulator GeographicLib #define GEOGRAPHICLIB_ACCUMULATOR_HPP Accumulator_8hpp.html af2ea0de968b20eb37534fa6baedcba54 AlbersEqualArea.cpp /scratch/geographic-dist/gita/geographiclib/src/ AlbersEqualArea_8cpp GeographicLib/AlbersEqualArea.hpp GeographicLib #define GEOGRAPHICLIB_ALBERSEQUALAREA_CPP AlbersEqualArea_8cpp.html a0cbf05d716ed87a0d1bc3cc16e6adb2a AlbersEqualArea.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ AlbersEqualArea_8hpp GeographicLib/Constants.hpp GeographicLib::AlbersEqualArea GeographicLib #define GEOGRAPHICLIB_ALBERSEQUALAREA_HPP AlbersEqualArea_8hpp.html aa9494d369d907d2b285fcb2f45b4689c AzimuthalEquidistant.cpp /scratch/geographic-dist/gita/geographiclib/src/ AzimuthalEquidistant_8cpp GeographicLib/AzimuthalEquidistant.hpp GeographicLib #define GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_CPP AzimuthalEquidistant_8cpp.html a66c8226c0b34ef5b0138d44829f5c394 AzimuthalEquidistant.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ AzimuthalEquidistant_8hpp GeographicLib/Geodesic.hpp GeographicLib/Constants.hpp GeographicLib::AzimuthalEquidistant GeographicLib #define GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP AzimuthalEquidistant_8hpp.html a70d20e83eaef9177a9dbc4503fae17b7 CartConvert.cpp /scratch/geographic-dist/gita/geographiclib/tools/ CartConvert_8cpp GeographicLib/Geocentric.hpp GeographicLib/LocalCartesian.hpp GeographicLib/DMS.hpp GeographicLib/Utility.hpp int main CartConvert_8cpp.html a0ddf1224851353fc92bfbff6f499fa97 (int argc, char *argv[]) CassiniSoldner.cpp /scratch/geographic-dist/gita/geographiclib/src/ CassiniSoldner_8cpp GeographicLib/CassiniSoldner.hpp GeographicLib #define GEOGRAPHICLIB_CASSINISOLDNER_CPP CassiniSoldner_8cpp.html a91edbe2e2eaf2776b80aecf2107909d4 CassiniSoldner.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ CassiniSoldner_8hpp GeographicLib/Geodesic.hpp GeographicLib/GeodesicLine.hpp GeographicLib/Constants.hpp GeographicLib::CassiniSoldner GeographicLib #define GEOGRAPHICLIB_CASSINISOLDNER_HPP CassiniSoldner_8hpp.html ab674f10f5e4e3b25dc68c65fa408e315 CircularEngine.cpp /scratch/geographic-dist/gita/geographiclib/src/ CircularEngine_8cpp GeographicLib/CircularEngine.hpp GeographicLib #define GEOGRAPHICLIB_CIRCULARENGINE_CPP CircularEngine_8cpp.html af686808d87a6f2cd0b1305f1aeac536d CircularEngine.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ CircularEngine_8hpp GeographicLib/Constants.hpp GeographicLib/SphericalEngine.hpp GeographicLib::CircularEngine GeographicLib #define GEOGRAPHICLIB_CIRCULARENGINE_HPP CircularEngine_8hpp.html abfcea264d0e3f7a45c8ff8de7f2e539f ConicProj.cpp /scratch/geographic-dist/gita/geographiclib/tools/ ConicProj_8cpp GeographicLib/LambertConformalConic.hpp GeographicLib/AlbersEqualArea.hpp GeographicLib/DMS.hpp GeographicLib/Utility.hpp int main ConicProj_8cpp.html a0ddf1224851353fc92bfbff6f499fa97 (int argc, char *argv[]) Constants.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ Constants_8hpp GeographicLib/Math.hpp GeographicLib::Constants GeographicLib::GeographicErr GeographicLib #define GEOGRAPHICLIB_CONSTANTS_HPP Constants_8hpp.html a16d93570265d8037f7dc7d5d026b2aa4 #define STATIC_ASSERT Constants_8hpp.html a8f24445c1bccd69b63e365aa5d5bb129 (cond, reason) #define RCSID_DECL Constants_8hpp.html af90fa899707a2ac513d5e4c76853bbf5 (x) #define GEOGRAPHIC_EXPORT Constants_8hpp.html a59a204dcc2942f86d7b24b4233aad719 DMS.cpp /scratch/geographic-dist/gita/geographiclib/src/ DMS_8cpp GeographicLib/DMS.hpp GeographicLib/Utility.hpp GeographicLib #define GEOGRAPHICLIB_DMS_CPP DMS_8cpp.html a6ef96ce6d2929e11dc6ec87433f4d7d1 DMS.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ DMS_8hpp GeographicLib/Constants.hpp GeographicLib/Utility.hpp GeographicLib::DMS GeographicLib #define GEOGRAPHICLIB_DMS_HPP DMS_8hpp.html a844e4c8afc70c59c842f4553ce40b9c6 EllipticFunction.cpp /scratch/geographic-dist/gita/geographiclib/src/ EllipticFunction_8cpp GeographicLib/EllipticFunction.hpp GeographicLib #define GEOGRAPHICLIB_ELLIPTICFUNCTION_CPP EllipticFunction_8cpp.html a7843c8be162380a81bdd1c48d00a475b EllipticFunction.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ EllipticFunction_8hpp GeographicLib/Constants.hpp GeographicLib::EllipticFunction GeographicLib #define GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP EllipticFunction_8hpp.html a94cb49e5d48fa1a0399e4303f1ad162a Geocentric.cpp /scratch/geographic-dist/gita/geographiclib/src/ Geocentric_8cpp GeographicLib/Geocentric.hpp GeographicLib #define GEOGRAPHICLIB_GEOCENTRIC_CPP Geocentric_8cpp.html a290e33302d7c35b9465d73f33dcb0774 Geocentric.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ Geocentric_8hpp GeographicLib/Constants.hpp GeographicLib::Geocentric GeographicLib #define GEOGRAPHICLIB_GEOCENTRIC_HPP Geocentric_8hpp.html a29517663058dd79a39541248f58db55f GeoConvert.cpp /scratch/geographic-dist/gita/geographiclib/tools/ GeoConvert_8cpp GeographicLib/GeoCoords.hpp GeographicLib/DMS.hpp GeographicLib/Utility.hpp int main GeoConvert_8cpp.html a0ddf1224851353fc92bfbff6f499fa97 (int argc, char *argv[]) GeoCoords.cpp /scratch/geographic-dist/gita/geographiclib/src/ GeoCoords_8cpp GeographicLib/GeoCoords.hpp GeographicLib/MGRS.hpp GeographicLib/DMS.hpp GeographicLib #define GEOGRAPHICLIB_GEOCOORDS_CPP GeoCoords_8cpp.html a8ca6643c26cc3909b0935409c1dbc403 GeoCoords.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ GeoCoords_8hpp GeographicLib/UTMUPS.hpp GeographicLib/Constants.hpp GeographicLib::GeoCoords GeographicLib #define GEOGRAPHICLIB_GEOCOORDS_HPP GeoCoords_8hpp.html a20841ff1ac217be34150ce32c5ad4bb8 Geod.cpp /scratch/geographic-dist/gita/geographiclib/tools/ Geod_8cpp GeographicLib/Geodesic.hpp GeographicLib/GeodesicLine.hpp GeographicLib/DMS.hpp GeographicLib/Utility.hpp GeographicLib::Math::real real Geod_8cpp.html a5caf95d46b184d9ca1d3764b3781b3c9 std::string LatLonString Geod_8cpp.html a8c3a2a4c039b4d0118416afd97a45fcf (real lat, real lon, int prec, bool dms, char dmssep) std::string AzimuthString Geod_8cpp.html adeb84b4732b410c9fdccf799037ef245 (real azi, int prec, bool dms, char dmssep) std::string DistanceStrings Geod_8cpp.html a600021136749afe8d757335563b5b544 (real s12, real a12, bool full, bool arcmode, int prec, bool dms) real ReadDistance Geod_8cpp.html a01ac56deedd203bd66c8c7328654b7e9 (const std::string &s, bool arcmode) int main Geod_8cpp.html a0ddf1224851353fc92bfbff6f499fa97 (int argc, char *argv[]) Geodesic.cpp /scratch/geographic-dist/gita/geographiclib/src/ Geodesic_8cpp GeographicLib/Geodesic.hpp GeographicLib/GeodesicLine.hpp GeographicLib #define GEOGRAPHICLIB_GEODESIC_CPP Geodesic_8cpp.html a61dcde881d6a80b561fc2b4c4b327883 Geodesic.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ Geodesic_8hpp GeographicLib/Constants.hpp GeographicLib::Geodesic GeographicLib #define GEOGRAPHICLIB_GEODESIC_HPP Geodesic_8hpp.html ab538cb707d6ff36056dd372c7e9e6d7e #define GEOD_ORD Geodesic_8hpp.html a1927ca941a173c95631417cbd8cc8e0c GeodesicLine.cpp /scratch/geographic-dist/gita/geographiclib/src/ GeodesicLine_8cpp GeographicLib/GeodesicLine.hpp GeographicLib #define GEOGRAPHICLIB_GEODESICLINE_CPP GeodesicLine_8cpp.html a8c325bf3ebfa8126888b62b16495d64e GeodesicLine.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ GeodesicLine_8hpp GeographicLib/Constants.hpp GeographicLib/Geodesic.hpp GeographicLib::GeodesicLine GeographicLib #define GEOGRAPHICLIB_GEODESICLINE_HPP GeodesicLine_8hpp.html a45305d595b59bfb061a5a0c6e1044485 GeodesicProj.cpp /scratch/geographic-dist/gita/geographiclib/tools/ GeodesicProj_8cpp GeographicLib/Geodesic.hpp GeographicLib/AzimuthalEquidistant.hpp GeographicLib/CassiniSoldner.hpp GeographicLib/Gnomonic.hpp GeographicLib/DMS.hpp GeographicLib/Utility.hpp int main GeodesicProj_8cpp.html a0ddf1224851353fc92bfbff6f499fa97 (int argc, char *argv[]) Geographic.doc /scratch/geographic-dist/gita/geographiclib/doc/ Geographic_8doc Geoid.cpp /scratch/geographic-dist/gita/geographiclib/src/ Geoid_8cpp GeographicLib/Geoid.hpp GeographicLib/Utility.hpp GeographicLib #define GEOGRAPHICLIB_GEOID_CPP Geoid_8cpp.html ad2cadd66a2a8fe0322579f4a1922a907 #define GEOGRAPHICLIB_DATA Geoid_8cpp.html a45687ef771d809c1c369daea074cc109 #define GEOID_DEFAULT_NAME Geoid_8cpp.html a2999d90c0556a04490ea239ddcb052b8 Geoid.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ Geoid_8hpp GeographicLib/Constants.hpp GeographicLib::Geoid GeographicLib #define GEOGRAPHICLIB_GEOID_HPP Geoid_8hpp.html a81966978f2fe7fad1effabc667a99820 #define PGM_PIXEL_WIDTH Geoid_8hpp.html aa34d236045b829973cbc0d958d3ed139 GeoidEval.cpp /scratch/geographic-dist/gita/geographiclib/tools/ GeoidEval_8cpp GeographicLib/Geoid.hpp GeographicLib/DMS.hpp GeographicLib/Utility.hpp GeographicLib/GeoCoords.hpp int main GeoidEval_8cpp.html a0ddf1224851353fc92bfbff6f499fa97 (int argc, char *argv[]) Gnomonic.cpp /scratch/geographic-dist/gita/geographiclib/src/ Gnomonic_8cpp GeographicLib/Gnomonic.hpp GeographicLib #define GEOGRAPHICLIB_GNOMONIC_CPP Gnomonic_8cpp.html ad62c02d3264b4069476f2f1aa21f223e Gnomonic.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ Gnomonic_8hpp GeographicLib/Geodesic.hpp GeographicLib/GeodesicLine.hpp GeographicLib/Constants.hpp GeographicLib::Gnomonic GeographicLib #define GEOGRAPHICLIB_GNOMONIC_HPP Gnomonic_8hpp.html af85f3f443620d568666f526ee193308a Gravity.cpp /scratch/geographic-dist/gita/geographiclib/tools/ Gravity_8cpp GeographicLib/GravityModel.hpp GeographicLib/GravityCircle.hpp GeographicLib/DMS.hpp GeographicLib/Utility.hpp int main Gravity_8cpp.html a0ddf1224851353fc92bfbff6f499fa97 (int argc, char *argv[]) GravityCircle.cpp /scratch/geographic-dist/gita/geographiclib/src/ GravityCircle_8cpp GeographicLib/GravityCircle.hpp GeographicLib/Geocentric.hpp GeographicLib #define GEOGRAPHICLIB_GRAVITYCIRCLE_CPP GravityCircle_8cpp.html a57d7b0412922810faed5fb35173f561c #define GRAVITY_DEFAULT_PATH GravityCircle_8cpp.html a21f239249a382b864294a231061d97d4 GravityCircle.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ GravityCircle_8hpp GeographicLib/Constants.hpp GeographicLib/CircularEngine.hpp GeographicLib/GravityModel.hpp GeographicLib::GravityCircle GeographicLib #define GEOGRAPHICLIB_GRAVITYCIRCLE_HPP GravityCircle_8hpp.html a07d4fadabf913f2115556a6de80f6115 GravityModel.cpp /scratch/geographic-dist/gita/geographiclib/src/ GravityModel_8cpp GeographicLib/GravityModel.hpp GeographicLib/SphericalEngine.hpp GeographicLib/GravityCircle.hpp GeographicLib/Utility.hpp GeographicLib #define GEOGRAPHICLIB_GRAVITYMODEL_CPP GravityModel_8cpp.html a65e1bf85112eafa00622f95531afc180 #define GEOGRAPHICLIB_DATA GravityModel_8cpp.html a45687ef771d809c1c369daea074cc109 #define GRAVITY_DEFAULT_NAME GravityModel_8cpp.html a05d4f5b688275acf184933e85a0063bd GravityModel.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ GravityModel_8hpp GeographicLib/Constants.hpp GeographicLib/NormalGravity.hpp GeographicLib/SphericalHarmonic.hpp GeographicLib/SphericalHarmonic1.hpp GeographicLib::GravityModel GeographicLib #define GEOGRAPHICLIB_GRAVITYMODEL_HPP GravityModel_8hpp.html ace85f3a4d35d4657064e289e2bf57dab LambertConformalConic.cpp /scratch/geographic-dist/gita/geographiclib/src/ LambertConformalConic_8cpp GeographicLib/LambertConformalConic.hpp GeographicLib #define GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_CPP LambertConformalConic_8cpp.html adf8d4ab2a5f0e2571915d27d31758930 LambertConformalConic.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ LambertConformalConic_8hpp GeographicLib/Constants.hpp GeographicLib::LambertConformalConic GeographicLib #define GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP LambertConformalConic_8hpp.html aac2fbd995d5b75016781c58b97093c67 LocalCartesian.cpp /scratch/geographic-dist/gita/geographiclib/src/ LocalCartesian_8cpp GeographicLib/LocalCartesian.hpp GeographicLib #define GEOGRAPHICLIB_LOCALCARTESIAN_CPP LocalCartesian_8cpp.html a0917de4aed4abb985b1e2830077aea45 LocalCartesian.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ LocalCartesian_8hpp GeographicLib/Geocentric.hpp GeographicLib/Constants.hpp GeographicLib::LocalCartesian GeographicLib #define GEOGRAPHICLIB_LOCALCARTESIAN_HPP LocalCartesian_8hpp.html a628d4dcde137e8249cb7fdbcaab30acd MagneticCircle.cpp /scratch/geographic-dist/gita/geographiclib/src/ MagneticCircle_8cpp GeographicLib/MagneticCircle.hpp GeographicLib/Geocentric.hpp GeographicLib #define GEOGRAPHICLIB_MAGNETICCIRCLE_CPP MagneticCircle_8cpp.html a0ca864788d9c9fdd4987afdc16db17ac #define MAGNETIC_DEFAULT_PATH MagneticCircle_8cpp.html adda468b8dc758dd6d082ccf33c5e1b75 MagneticCircle.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ MagneticCircle_8hpp GeographicLib/Constants.hpp GeographicLib/CircularEngine.hpp GeographicLib::MagneticCircle GeographicLib #define GEOGRAPHICLIB_MAGNETICCIRCLE_HPP MagneticCircle_8hpp.html a5bc784ff412658d1c422828506b424da MagneticField.cpp /scratch/geographic-dist/gita/geographiclib/tools/ MagneticField_8cpp GeographicLib/MagneticModel.hpp GeographicLib/MagneticCircle.hpp GeographicLib/DMS.hpp GeographicLib/Utility.hpp int main MagneticField_8cpp.html a0ddf1224851353fc92bfbff6f499fa97 (int argc, char *argv[]) MagneticModel.cpp /scratch/geographic-dist/gita/geographiclib/src/ MagneticModel_8cpp GeographicLib/MagneticModel.hpp GeographicLib/SphericalEngine.hpp GeographicLib/MagneticCircle.hpp GeographicLib/Utility.hpp GeographicLib #define GEOGRAPHICLIB_MAGNETICMODEL_CPP MagneticModel_8cpp.html ac744ec56ccbc33cff2c75c204b4c7ae1 #define GEOGRAPHICLIB_DATA MagneticModel_8cpp.html a45687ef771d809c1c369daea074cc109 #define MAGNETIC_DEFAULT_NAME MagneticModel_8cpp.html a302055ff69e445c8103c09913de840ff MagneticModel.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ MagneticModel_8hpp GeographicLib/Constants.hpp GeographicLib/Geocentric.hpp GeographicLib/SphericalHarmonic.hpp GeographicLib::MagneticModel GeographicLib #define GEOGRAPHICLIB_MAGNETICMODEL_HPP MagneticModel_8hpp.html a8f9f091785b789fbe080c650bc0b8654 Math.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ Math_8hpp GeographicLib/Constants.hpp GeographicLib::Math GeographicLib #define GEOGRAPHICLIB_MATH_HPP Math_8hpp.html afb2818ef5e2f2bed96dcaa151b3edca4 #define GEOGRAPHICLIB_CPLUSPLUS11_MATH Math_8hpp.html a2769cdfa2277e2728e4e157ec3f6318b #define WORDS_BIGENDIAN Math_8hpp.html a82e69009d3cd108c8aad8afe44fb1132 #define GEOGRAPHICLIB_PREC Math_8hpp.html a8df061fdb3d6e90d150d4fdd749f96b1 MGRS.cpp /scratch/geographic-dist/gita/geographiclib/src/ MGRS_8cpp GeographicLib/MGRS.hpp GeographicLib/Utility.hpp GeographicLib #define GEOGRAPHICLIB_MGRS_CPP MGRS_8cpp.html a7882927f72a62a7131868e387edd4dac MGRS.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ MGRS_8hpp GeographicLib/Constants.hpp GeographicLib/UTMUPS.hpp GeographicLib::MGRS GeographicLib #define GEOGRAPHICLIB_MGRS_HPP MGRS_8hpp.html a1c5e778121820c6ec16b6180ffab51ac NormalGravity.cpp /scratch/geographic-dist/gita/geographiclib/src/ NormalGravity_8cpp GeographicLib/NormalGravity.hpp GeographicLib #define GEOGRAPHICLIB_NORMALGRAVITY_CPP NormalGravity_8cpp.html ae09694799ad8f72c9b216b9729848655 NormalGravity.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ NormalGravity_8hpp GeographicLib/Constants.hpp GeographicLib/Geocentric.hpp GeographicLib::NormalGravity GeographicLib #define GEOGRAPHICLIB_NORMALGRAVITY_HPP NormalGravity_8hpp.html a3f83059dc418514a79fa4e6c94869b58 OSGB.cpp /scratch/geographic-dist/gita/geographiclib/src/ OSGB_8cpp GeographicLib/OSGB.hpp GeographicLib/Utility.hpp GeographicLib #define GEOGRAPHICLIB_OSGB_CPP OSGB_8cpp.html af7fa9aa83a3be95cccc572fc3b399b58 OSGB.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ OSGB_8hpp GeographicLib/Constants.hpp GeographicLib/TransverseMercator.hpp GeographicLib::OSGB GeographicLib #define GEOGRAPHICLIB_OSGB_HPP OSGB_8hpp.html a786c5942146679103feb716bea66a0a7 Planimeter.cpp /scratch/geographic-dist/gita/geographiclib/tools/ Planimeter_8cpp GeographicLib/PolygonArea.hpp GeographicLib/DMS.hpp GeographicLib/Utility.hpp GeographicLib/GeoCoords.hpp int main Planimeter_8cpp.html a0ddf1224851353fc92bfbff6f499fa97 (int argc, char *argv[]) PolarStereographic.cpp /scratch/geographic-dist/gita/geographiclib/src/ PolarStereographic_8cpp GeographicLib/PolarStereographic.hpp GeographicLib #define GEOGRAPHICLIB_POLARSTEREOGRAPHIC_CPP PolarStereographic_8cpp.html a2887f1d8fd2633373698a2d1468befc2 PolarStereographic.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ PolarStereographic_8hpp GeographicLib/Constants.hpp GeographicLib::PolarStereographic GeographicLib #define GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP PolarStereographic_8hpp.html a7450566a6ed1475dc10f7c0dc85f5dd9 PolygonArea.cpp /scratch/geographic-dist/gita/geographiclib/src/ PolygonArea_8cpp GeographicLib/PolygonArea.hpp GeographicLib #define GEOGRAPHICLIB_POLYGONAREA_CPP PolygonArea_8cpp.html adda27aeacbbca888326b0f4cd9577254 PolygonArea.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ PolygonArea_8hpp GeographicLib/Geodesic.hpp GeographicLib/Constants.hpp GeographicLib/Accumulator.hpp GeographicLib::PolygonArea GeographicLib #define GEOGRAPHICLIB_POLYGONAREA_HPP PolygonArea_8hpp.html a284051319ec399ec9363ace180fc1203 SphericalEngine.cpp /scratch/geographic-dist/gita/geographiclib/src/ SphericalEngine_8cpp GeographicLib/SphericalEngine.hpp GeographicLib/CircularEngine.hpp GeographicLib/Utility.hpp GeographicLib #define GEOGRAPHICLIB_SPHERICALENGINE_CPP SphericalEngine_8cpp.html acbb0476075cd231855709ab48c95fa7e SphericalEngine.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ SphericalEngine_8hpp GeographicLib/Constants.hpp GeographicLib::SphericalEngine GeographicLib::SphericalEngine::coeff GeographicLib #define GEOGRAPHICLIB_SPHERICALENGINE_HPP SphericalEngine_8hpp.html a46e29e0e930e205c8f9a059ae458b44e SphericalHarmonic.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ SphericalHarmonic_8hpp GeographicLib/Constants.hpp GeographicLib/SphericalEngine.hpp GeographicLib/CircularEngine.hpp GeographicLib/Geocentric.hpp GeographicLib::SphericalHarmonic GeographicLib #define GEOGRAPHICLIB_SPHERICALHARMONIC_HPP SphericalHarmonic_8hpp.html ab6742c760b0220c0a0d6423bed5b8bf8 SphericalHarmonic1.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ SphericalHarmonic1_8hpp GeographicLib/Constants.hpp GeographicLib/SphericalEngine.hpp GeographicLib/CircularEngine.hpp GeographicLib::SphericalHarmonic1 GeographicLib #define GEOGRAPHICLIB_SPHERICALHARMONIC1_HPP SphericalHarmonic1_8hpp.html a16f04a6cf043288bc2d78f51d9c42186 SphericalHarmonic2.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ SphericalHarmonic2_8hpp GeographicLib/Constants.hpp GeographicLib/SphericalEngine.hpp GeographicLib/CircularEngine.hpp GeographicLib::SphericalHarmonic2 GeographicLib #define GEOGRAPHICLIB_SPHERICALHARMONIC2_HPP SphericalHarmonic2_8hpp.html a15f930b306cf77dee059d32d2bb417ad TransverseMercator.cpp /scratch/geographic-dist/gita/geographiclib/src/ TransverseMercator_8cpp GeographicLib/TransverseMercator.hpp GeographicLib #define GEOGRAPHICLIB_TRANSVERSEMERCATOR_CPP TransverseMercator_8cpp.html ab09ba83d5531a4ca91dc8ce82ae98084 TransverseMercator.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ TransverseMercator_8hpp GeographicLib/Constants.hpp GeographicLib::TransverseMercator GeographicLib #define GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP TransverseMercator_8hpp.html abbbe2faaff284db3183ddf3afcbf5623 #define TM_TX_MAXPOW TransverseMercator_8hpp.html a823820984cba9dabe0517925bf18c77b TransverseMercatorExact.cpp /scratch/geographic-dist/gita/geographiclib/src/ TransverseMercatorExact_8cpp GeographicLib/TransverseMercatorExact.hpp GeographicLib #define GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_CPP TransverseMercatorExact_8cpp.html a019dc2a5f6ac9aa9ba03ad8dd974e438 TransverseMercatorExact.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ TransverseMercatorExact_8hpp GeographicLib/Constants.hpp GeographicLib/EllipticFunction.hpp GeographicLib::TransverseMercatorExact GeographicLib #define GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP TransverseMercatorExact_8hpp.html a33c80ffd2f74ea9ed9dd4c11bf9e1198 TransverseMercatorProj.cpp /scratch/geographic-dist/gita/geographiclib/tools/ TransverseMercatorProj_8cpp GeographicLib/EllipticFunction.hpp GeographicLib/TransverseMercatorExact.hpp GeographicLib/TransverseMercator.hpp GeographicLib/DMS.hpp GeographicLib/Utility.hpp int main TransverseMercatorProj_8cpp.html a0ddf1224851353fc92bfbff6f499fa97 (int argc, char *argv[]) Utility.cpp /scratch/geographic-dist/gita/geographiclib/src/ Utility_8cpp GeographicLib/Utility.hpp GeographicLib #define GEOGRAPHICLIB_UTILITY_CPP Utility_8cpp.html a572751ca8465c95b9e157dc20175f6bc Utility.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ Utility_8hpp GeographicLib/Constants.hpp GeographicLib::Utility GeographicLib #define GEOGRAPHICLIB_UTILITY_HPP Utility_8hpp.html aba45651243cd7449a073dd2c8b11a88a UTMUPS.cpp /scratch/geographic-dist/gita/geographiclib/src/ UTMUPS_8cpp GeographicLib/UTMUPS.hpp GeographicLib/MGRS.hpp GeographicLib/PolarStereographic.hpp GeographicLib/TransverseMercator.hpp GeographicLib/Utility.hpp GeographicLib #define GEOGRAPHICLIB_UTMUPS_CPP UTMUPS_8cpp.html af7026e1ac5bb37428765d957f2f14a6b UTMUPS.hpp /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ UTMUPS_8hpp GeographicLib/Constants.hpp GeographicLib::UTMUPS GeographicLib #define GEOGRAPHICLIB_UTMUPS_HPP UTMUPS_8hpp.html aab4dce5d203c0d98ae740800332ed9d9 intro Introduction intro install Installing %GeographicLib install maintainer windowsbin qt windows gnu autoconf cmake start Getting started start utilities Utility programs utilities organization Code organization organization other Other interfaces (Javascript, Python, Matlab, Octave) other javascript python matlab geoid Geoid height geoid geoidinterp geoidformat geoidcache geoidinst testgeoid gravity Gravity models gravity gravityatmos gravityformat gravityinst gravityparallel gravitygeoid gravitynga magnetic Magnetic models magnetic magneticformat magneticinst geodesic Geodesics on the ellipsoid geodesic testgeod geodseries transversemercator Transverse Mercator projection transversemercator tmseries testmerc geocentric Geocentric coordinates geocentric old Old versions old GeographicLib namespaceGeographicLib.html GeographicLib::Accumulator GeographicLib::AlbersEqualArea GeographicLib::AzimuthalEquidistant GeographicLib::CassiniSoldner GeographicLib::CircularEngine GeographicLib::Constants GeographicLib::GeographicErr GeographicLib::DMS GeographicLib::EllipticFunction GeographicLib::Geocentric GeographicLib::GeoCoords GeographicLib::Geodesic GeographicLib::GeodesicLine GeographicLib::Geoid GeographicLib::Gnomonic GeographicLib::GravityCircle GeographicLib::GravityModel GeographicLib::LambertConformalConic GeographicLib::LocalCartesian GeographicLib::MagneticCircle GeographicLib::MagneticModel GeographicLib::Math GeographicLib::MGRS GeographicLib::NormalGravity GeographicLib::OSGB GeographicLib::PolarStereographic GeographicLib::PolygonArea GeographicLib::SphericalEngine GeographicLib::SphericalHarmonic GeographicLib::SphericalHarmonic1 GeographicLib::SphericalHarmonic2 GeographicLib::TransverseMercator GeographicLib::TransverseMercatorExact GeographicLib::Utility GeographicLib::UTMUPS GeographicLib::Accumulator classGeographicLib_1_1Accumulator.html Accumulator classGeographicLib_1_1Accumulator.html a6d30e4a792644ffc78546dda4b5d0022 (T y=T(0)) Accumulator & operator= classGeographicLib_1_1Accumulator.html a9cd31c9155208a2de0fdd9810f2a9dd8 (T y) T operator() classGeographicLib_1_1Accumulator.html af74ec2f9a77fcc82819111e6bb87b375 () const T operator() classGeographicLib_1_1Accumulator.html a1a2b7ac3fd3b067a1c9930cb02a102b2 (T y) const Accumulator & operator+= classGeographicLib_1_1Accumulator.html adc56d12f08b8a61b19dd78ce532285d4 (T y) Accumulator & operator-= classGeographicLib_1_1Accumulator.html abf3e43f38791c48d1fa09e4fb569827b (T y) Accumulator & operator*= classGeographicLib_1_1Accumulator.html a2b0bc40e9722e1ffac89ecfeb601fb23 (int n) bool operator== classGeographicLib_1_1Accumulator.html a6ea5d769a36e01327f3633b39cd38290 (T y) const bool operator!= classGeographicLib_1_1Accumulator.html a4102ce7aac36753c2b0390c4fc951a42 (T y) const bool operator< classGeographicLib_1_1Accumulator.html a9a7299c02ec8805d951309fdae60e57f (T y) const bool operator<= classGeographicLib_1_1Accumulator.html afb83bdb43b78e20f76e2a7e5e2440386 (T y) const bool operator> classGeographicLib_1_1Accumulator.html af0e4a35c09b0b179ebf1e2f6912ddeb3 (T y) const bool operator>= classGeographicLib_1_1Accumulator.html aeafc5d10683648d37fe18ec75725196b (T y) const GeographicLib::AlbersEqualArea classGeographicLib_1_1AlbersEqualArea.html AlbersEqualArea classGeographicLib_1_1AlbersEqualArea.html a08edd228ba175a5ae71d783c4a712e50 (real a, real f, real stdlat, real k0) AlbersEqualArea classGeographicLib_1_1AlbersEqualArea.html a3851897cd1944503f81b46b7ce372d2a (real a, real f, real stdlat1, real stdlat2, real k1) AlbersEqualArea classGeographicLib_1_1AlbersEqualArea.html a58535d87e148d0cc474f3139c5188371 (real a, real f, real sinlat1, real coslat1, real sinlat2, real coslat2, real k1) void SetScale classGeographicLib_1_1AlbersEqualArea.html a0c00022edeb6b67dcd4e00f087b412c4 (real lat, real k=real(1)) void Forward classGeographicLib_1_1AlbersEqualArea.html aac57f3a9c0c08fb897a1e37034d127c1 (real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const void Reverse classGeographicLib_1_1AlbersEqualArea.html a577a9f43be8c1e238a4d56158acf8625 (real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const void Forward classGeographicLib_1_1AlbersEqualArea.html a68a13780a73bcf9c8e50a3ce4eae3086 (real lon0, real lat, real lon, real &x, real &y) const void Reverse classGeographicLib_1_1AlbersEqualArea.html a871246cba03145512f3f12ceb3e3e3a8 (real lon0, real x, real y, real &lat, real &lon) const Math::real MajorRadius classGeographicLib_1_1AlbersEqualArea.html a55d5ca45e7c80a96b3faf0094714ac59 () const Math::real Flattening classGeographicLib_1_1AlbersEqualArea.html a565c63954715204781ae458db0d6b1f7 () const Math::real OriginLatitude classGeographicLib_1_1AlbersEqualArea.html ad780e943e9a9ba168b350d809d0bfe08 () const Math::real CentralScale classGeographicLib_1_1AlbersEqualArea.html af407e835eaf76895ee25ec9e7a9c090c () const static const AlbersEqualArea CylindricalEqualArea classGeographicLib_1_1AlbersEqualArea.html ae643f7f82f5864f95da4cb14571ccf55 static const AlbersEqualArea AzimuthalEqualAreaNorth classGeographicLib_1_1AlbersEqualArea.html ae65fcb68843b36d206751527ebd08f44 static const AlbersEqualArea AzimuthalEqualAreaSouth classGeographicLib_1_1AlbersEqualArea.html aff0ff4e2f162107bd136310b44444cc1 GeographicLib::AzimuthalEquidistant classGeographicLib_1_1AzimuthalEquidistant.html AzimuthalEquidistant classGeographicLib_1_1AzimuthalEquidistant.html a125571cdeed68d10192611cc12e221ce (const Geodesic &earth=Geodesic::WGS84) void Forward classGeographicLib_1_1AzimuthalEquidistant.html a8b4951b7c732f97aedeb8e869c9349d2 (real lat0, real lon0, real lat, real lon, real &x, real &y, real &azi, real &rk) const void Reverse classGeographicLib_1_1AzimuthalEquidistant.html a26d1b6fe3af8750babaeb60efdfec062 (real lat0, real lon0, real x, real y, real &lat, real &lon, real &azi, real &rk) const void Forward classGeographicLib_1_1AzimuthalEquidistant.html a950431c3d269fb82e9410f332c401786 (real lat0, real lon0, real lat, real lon, real &x, real &y) const void Reverse classGeographicLib_1_1AzimuthalEquidistant.html a6b86b19f2e1c773e028e386a0f5e00e0 (real lat0, real lon0, real x, real y, real &lat, real &lon) const Math::real MajorRadius classGeographicLib_1_1AzimuthalEquidistant.html a42c4103265af804395b8b5260a4c25e0 () const Math::real Flattening classGeographicLib_1_1AzimuthalEquidistant.html a3f300fcc10aeee9dc88ff93fb991f191 () const GeographicLib::CassiniSoldner classGeographicLib_1_1CassiniSoldner.html CassiniSoldner classGeographicLib_1_1CassiniSoldner.html a948f9d934615c4120eb23740635200bc (const Geodesic &earth=Geodesic::WGS84) CassiniSoldner classGeographicLib_1_1CassiniSoldner.html a1b19cedb287ec9bbe59ec18a0ad2a5e4 (real lat0, real lon0, const Geodesic &earth=Geodesic::WGS84) void Reset classGeographicLib_1_1CassiniSoldner.html af9bdc7088bca547dcc191691b2737759 (real lat0, real lon0) void Forward classGeographicLib_1_1CassiniSoldner.html a37656c7551b10ad75a40758d0bba570d (real lat, real lon, real &x, real &y, real &azi, real &rk) const void Reverse classGeographicLib_1_1CassiniSoldner.html aea917b790f577026184a0bb262102db4 (real x, real y, real &lat, real &lon, real &azi, real &rk) const void Forward classGeographicLib_1_1CassiniSoldner.html a87bf8d3b416bbfd8b7a2c5269245e693 (real lat, real lon, real &x, real &y) const void Reverse classGeographicLib_1_1CassiniSoldner.html a27a675e995d2c1fdd0ab4c0ab397e065 (real x, real y, real &lat, real &lon) const bool Init classGeographicLib_1_1CassiniSoldner.html a3f71bb8b662438a7954be174315ce974 () const Math::real LatitudeOrigin classGeographicLib_1_1CassiniSoldner.html a2aa51120af199603f57d54b8c9a0bdde () const Math::real LongitudeOrigin classGeographicLib_1_1CassiniSoldner.html aeb5c42b5cb6202a2371ba84bf76e0161 () const Math::real MajorRadius classGeographicLib_1_1CassiniSoldner.html a0019eeb70b5493de687c5cc36ae7f43c () const Math::real Flattening classGeographicLib_1_1CassiniSoldner.html a8d618d5abe71a49fc5ec4f2801d22555 () const GeographicLib::CircularEngine classGeographicLib_1_1CircularEngine.html CircularEngine classGeographicLib_1_1CircularEngine.html a91dd2b9cc408e35f8cb6482cdf3aadbf () Math::real operator() classGeographicLib_1_1CircularEngine.html a8e39d83fcbed23df36ef4fefe2a86420 (real coslon, real sinlon) const Math::real operator() classGeographicLib_1_1CircularEngine.html a48d2327412e0c674285ff6bb85440054 (real lon) const Math::real operator() classGeographicLib_1_1CircularEngine.html aa15c408a0ff4cf17575e62edfeae77a6 (real coslon, real sinlon, real &gradx, real &grady, real &gradz) const Math::real operator() classGeographicLib_1_1CircularEngine.html a88a0726718baa7b457c77b5681fabb0a (real lon, real &gradx, real &grady, real &gradz) const friend class SphericalEngine classGeographicLib_1_1CircularEngine.html ab89064f7f3c32a745c72d8c3188f7485 friend class GravityCircle classGeographicLib_1_1CircularEngine.html a243c90a7f9bf3f7aa96877a4b0667a89 friend class MagneticCircle classGeographicLib_1_1CircularEngine.html a7294f6a1cc932f8fd1562a15602e9e86 GeographicLib::Constants classGeographicLib_1_1Constants.html static Math::real degree classGeographicLib_1_1Constants.html a26ff02acd8141a815428cddf0ff3ff66 () static Math::real arcminute classGeographicLib_1_1Constants.html a8f8e6d3bd08abb72b686a0f4398b587b () static Math::real arcsecond classGeographicLib_1_1Constants.html a04858f922295d2a04bb021eecac07179 () static T WGS84_a classGeographicLib_1_1Constants.html ae12127984ac6713823746d917b4abfa7 () static Math::real WGS84_a classGeographicLib_1_1Constants.html a53f39f52837f47490fbdf7332a37dd8b () static T WGS84_f classGeographicLib_1_1Constants.html acc5244425bb484594be51b27d56cd335 () static Math::real WGS84_f classGeographicLib_1_1Constants.html acd335c7f28440e0774666cedffed84f0 () static T WGS84_GM classGeographicLib_1_1Constants.html af7806106d7bd289bb63d5290e79c87a6 () static T WGS84_omega classGeographicLib_1_1Constants.html a98c114d5a6ca42d3e4ece8595a0c2180 () static Math::real WGS84_r classGeographicLib_1_1Constants.html a199810de7ff3351be6473d20ef045789 () static T GRS80_a classGeographicLib_1_1Constants.html a9b955c3556dcfcebce6a2926bfeaf464 () static T GRS80_GM classGeographicLib_1_1Constants.html a7541474ca70cbec7fccb08d3e3fbfe31 () static T GRS80_omega classGeographicLib_1_1Constants.html a9caea97ab2be0959c7972155141bfd1b () static T GRS80_J2 classGeographicLib_1_1Constants.html a59c7a1d298eb72256119894b67470974 () static T UTM_k0 classGeographicLib_1_1Constants.html ab5cc487ab160c0a213fdf8e12cde198a () static Math::real UTM_k0 classGeographicLib_1_1Constants.html aebbe37ebfb407a851f72caa95e5dc94f () static T UPS_k0 classGeographicLib_1_1Constants.html a3fe287ab1a0847f5392c1aaf9c5e635a () static Math::real UPS_k0 classGeographicLib_1_1Constants.html a49d415263ee320d1a63a857f784439a3 () static T meter classGeographicLib_1_1Constants.html ac1b17e7cf67ef42b9b91f3677c2eaa75 () static Math::real meter classGeographicLib_1_1Constants.html afeffc10d6b8171b39a50949cac149063 () static Math::real kilometer classGeographicLib_1_1Constants.html a4ec5a9d91ab0ccbd3bd921cda4bfc836 () static Math::real nauticalmile classGeographicLib_1_1Constants.html afedc242aa3ee9b3bf9c72d6d81fc6740 () static T square_meter classGeographicLib_1_1Constants.html ab92200b36f9d306a2710738c6d9bc705 () static Math::real square_meter classGeographicLib_1_1Constants.html a702b928c9a29dbcc7324b9d835b38d94 () static Math::real hectare classGeographicLib_1_1Constants.html a4cc4ae77e3136d7784cd7c69d6927adc () static Math::real square_kilometer classGeographicLib_1_1Constants.html a1956824e4f2b22705d57566229a7c311 () static Math::real square_nauticalmile classGeographicLib_1_1Constants.html a5acf6b2c23d1c9ddf140a6b4e588e88a () static Math::real foot classGeographicLib_1_1Constants.html ac69f40e7e56c71bc72011c7591f7bef9 () static Math::real yard classGeographicLib_1_1Constants.html a00057328caa45bc216d18243786920c2 () static Math::real fathom classGeographicLib_1_1Constants.html a51cf3e97984ac301b1f27b667b360be0 () static Math::real chain classGeographicLib_1_1Constants.html ac4f3792bce075999b0c9b9485e4079d0 () static Math::real furlong classGeographicLib_1_1Constants.html a824d39311cf43f916d4ac19e46da3713 () static Math::real mile classGeographicLib_1_1Constants.html a49cb7b828f7c85c36761d47b8db6518c () static Math::real acre classGeographicLib_1_1Constants.html ae5aa419ea6c6ce121c912c8afea0a0b7 () static Math::real square_mile classGeographicLib_1_1Constants.html ab7f473c27ad50da450b4192155cc92f9 () static Math::real surveyfoot classGeographicLib_1_1Constants.html a7faf6e7435791c0a8061296a79c0be08 () GeographicLib::GeographicErr classGeographicLib_1_1GeographicErr.html GeographicErr classGeographicLib_1_1GeographicErr.html ae0f338af58f073657b012c8a9a64b006 (const std::string &msg) GeographicLib::DMS classGeographicLib_1_1DMS.html flag classGeographicLib_1_1DMS.html a7a1101fd2577636863753baae3e54869 NONE classGeographicLib_1_1DMS.html a7a1101fd2577636863753baae3e54869adc80eee37727cca42f9805cfefb83fc1 LATITUDE classGeographicLib_1_1DMS.html a7a1101fd2577636863753baae3e54869a6b5a0451ce4c199bd82f5d87d50b523b LONGITUDE classGeographicLib_1_1DMS.html a7a1101fd2577636863753baae3e54869a321624c1b510f7f1e392e7509a85914f AZIMUTH classGeographicLib_1_1DMS.html a7a1101fd2577636863753baae3e54869a92264580521b3a1c1df2a7421b435e24 NUMBER classGeographicLib_1_1DMS.html a7a1101fd2577636863753baae3e54869a5a65ec03b2682ad76873829167882518 component classGeographicLib_1_1DMS.html ab9fa04b3a9156f36f18852eed9b7ce09 DEGREE classGeographicLib_1_1DMS.html ab9fa04b3a9156f36f18852eed9b7ce09a8ee59944227e74901b71f27410d70781 MINUTE classGeographicLib_1_1DMS.html ab9fa04b3a9156f36f18852eed9b7ce09a9884bea675fd214061e534e76a1c15d6 SECOND classGeographicLib_1_1DMS.html ab9fa04b3a9156f36f18852eed9b7ce09a10c28c85ddfa71db5f1d46d362333075 static Math::real Decode classGeographicLib_1_1DMS.html ae802c666ad53884ce062281409bd78b4 (const std::string &dms, flag &ind) static Math::real Decode classGeographicLib_1_1DMS.html a4987f8eb6c1ba5402eb25d6225ab58e1 (real d, real m=0, real s=0) static void DecodeLatLon classGeographicLib_1_1DMS.html a2d38adcfecb7a41865092e870e19730f (const std::string &dmsa, const std::string &dmsb, real &lat, real &lon, bool swaplatlong=false) static Math::real DecodeAngle classGeographicLib_1_1DMS.html a868248d72f6b0bf2dae18a15d741ac43 (const std::string &angstr) static Math::real DecodeAzimuth classGeographicLib_1_1DMS.html a0512cc1275e089138e1550efbee421d9 (const std::string &azistr) static std::string Encode classGeographicLib_1_1DMS.html a0777e26ef4507f8123549723bf3cb56f (real angle, component trailing, unsigned prec, flag ind, char dmssep) static std::string Encode classGeographicLib_1_1DMS.html a3e36baa6114d46f82a8900d002784369 (real angle, component trailing, unsigned prec, flag ind=NONE) static std::string Encode classGeographicLib_1_1DMS.html aeb9d338b12e885092a611bda7e52f9f4 (real angle, unsigned prec, flag ind=NONE, char dmssep=char(0)) static void Encode classGeographicLib_1_1DMS.html a1ae785976e5d7c6346cfb68863884b55 (real ang, real &d, real &m) static void Encode classGeographicLib_1_1DMS.html af27df7ef6ac42bf0e6341749b4b96eec (real ang, real &d, real &m, real &s) GeographicLib::EllipticFunction classGeographicLib_1_1EllipticFunction.html EllipticFunction classGeographicLib_1_1EllipticFunction.html ada122111b55eb0ab9c7b9fafb0a4b1e6 (real m) Math::real m classGeographicLib_1_1EllipticFunction.html aba29c348874db7880ab7b1065f03ff7c () const Math::real m1 classGeographicLib_1_1EllipticFunction.html ad1fbe801f6731285462d35d874a149ba () const Math::real K classGeographicLib_1_1EllipticFunction.html a6c6c8029d93946b32184ee964525938c () const Math::real E classGeographicLib_1_1EllipticFunction.html a184174d29953891896b41c597c34eb9a () const Math::real KE classGeographicLib_1_1EllipticFunction.html a12bcdf2c3fc7bcb165318822171328f7 () const void sncndn classGeographicLib_1_1EllipticFunction.html a0b8d63970c4276503d03d4133ee6c321 (real x, real &sn, real &cn, real &dn) const Math::real E classGeographicLib_1_1EllipticFunction.html a8be312b5da54b01f2976416aa82e7d08 (real phi) const Math::real E classGeographicLib_1_1EllipticFunction.html af1b3b2265bca5d2b52c17ca44dabffa8 (real sn, real cn, real dn) const GeographicLib::Geocentric classGeographicLib_1_1Geocentric.html Geocentric classGeographicLib_1_1Geocentric.html a6527d3ab1df78de8277122581dbcdaff (real a, real f) Geocentric classGeographicLib_1_1Geocentric.html adc92d7214526b4cfcd0b9a0171fc8448 () void Forward classGeographicLib_1_1Geocentric.html a65320594cad8c03d28beaa409f3d6fae (real lat, real lon, real h, real &X, real &Y, real &Z) const void Forward classGeographicLib_1_1Geocentric.html a54e09e4673ddbf99feeba81036c81345 (real lat, real lon, real h, real &X, real &Y, real &Z, std::vector< real > &M) const void Reverse classGeographicLib_1_1Geocentric.html a1907735ce8f5f915a14a5f7a8b3adfea (real X, real Y, real Z, real &lat, real &lon, real &h) const void Reverse classGeographicLib_1_1Geocentric.html aeddd854d52064bcb1f068052057edf2c (real X, real Y, real Z, real &lat, real &lon, real &h, std::vector< real > &M) const bool Init classGeographicLib_1_1Geocentric.html a7d2e34d1be6009caf4576c6cc884a589 () const Math::real MajorRadius classGeographicLib_1_1Geocentric.html ae20c62c298f1724412fec581285cf269 () const Math::real Flattening classGeographicLib_1_1Geocentric.html a30ba434524b5836c9852d454e61d795f () const static const Geocentric WGS84 classGeographicLib_1_1Geocentric.html a4762989f3d1d30bca597f644e8b2b52e friend class LocalCartesian classGeographicLib_1_1Geocentric.html a8904c4eadcf94e3803743e8cd9ffbc1c friend class MagneticCircle classGeographicLib_1_1Geocentric.html a7294f6a1cc932f8fd1562a15602e9e86 friend class MagneticModel classGeographicLib_1_1Geocentric.html af6619ebe4c078705fc49a0d9f950b431 friend class GravityCircle classGeographicLib_1_1Geocentric.html a243c90a7f9bf3f7aa96877a4b0667a89 friend class GravityModel classGeographicLib_1_1Geocentric.html ada1db1d9f480d8044753ed869c995519 friend class NormalGravity classGeographicLib_1_1Geocentric.html ae7298549755c5982fe1be124d6631561 friend class SphericalHarmonic classGeographicLib_1_1Geocentric.html ae0383f6b1ce413d48e258750c3177f21 friend class SphericalHarmonic1 classGeographicLib_1_1Geocentric.html accac7c5b7843a1e4fb2baf0c83cc24f0 friend class SphericalHarmonic2 classGeographicLib_1_1Geocentric.html a3eabc426b6edd718324c791ef3536360 GeographicLib::GeoCoords classGeographicLib_1_1GeoCoords.html GeoCoords classGeographicLib_1_1GeoCoords.html a8b3f4a919ba4478c4fec0e7b01e84c57 () GeoCoords classGeographicLib_1_1GeoCoords.html acdfe641aaea6b68aee25cfee822f782a (const std::string &s, bool centerp=true, bool swaplatlong=false) GeoCoords classGeographicLib_1_1GeoCoords.html a7bde6a5cba74adf66d831788e6be8e65 (real latitude, real longitude, int zone=UTMUPS::STANDARD) GeoCoords classGeographicLib_1_1GeoCoords.html aaab765054416e1243f2d7b36edc8e0d4 (int zone, bool northp, real easting, real northing) void Reset classGeographicLib_1_1GeoCoords.html a4a1e0a65a8a344dfe519fcbf25078e37 (const std::string &s, bool centerp=true, bool swaplatlong=false) void Reset classGeographicLib_1_1GeoCoords.html a0cbbebaa7bb77f91f3f8dbbadfd6532a (real latitude, real longitude, int zone=UTMUPS::STANDARD) void Reset classGeographicLib_1_1GeoCoords.html ab072761684d992f508b5a3b9440653fb (int zone, bool northp, real easting, real northing) Math::real Latitude classGeographicLib_1_1GeoCoords.html a1bc1bb3a2377fa6b70be046dcf5d3e97 () const Math::real Longitude classGeographicLib_1_1GeoCoords.html a7db5459efae411dfebec758a8244a95a () const Math::real Easting classGeographicLib_1_1GeoCoords.html a9a84801f0b383860b24cc1344e4015fb () const Math::real Northing classGeographicLib_1_1GeoCoords.html ac0202def9c16ce856f62485b5c249083 () const Math::real Convergence classGeographicLib_1_1GeoCoords.html ad92c8fa1b34bd11dbd908dfffbb836a8 () const Math::real Scale classGeographicLib_1_1GeoCoords.html aafd68e75d223b821abcbf20179c7a9e0 () const bool Northp classGeographicLib_1_1GeoCoords.html a5bcf16f97750a6be77f72d50e304a007 () const char Hemisphere classGeographicLib_1_1GeoCoords.html a0764b9f389a6ce851f9c7c8317ecebb3 () const int Zone classGeographicLib_1_1GeoCoords.html a3ce32259b53a9ea9a5346d9e418ad6a5 () const void SetAltZone classGeographicLib_1_1GeoCoords.html a7782c2d78462bde2ba6277b2b60af8f6 (int zone=UTMUPS::STANDARD) const int AltZone classGeographicLib_1_1GeoCoords.html a590600b600395c7914e4854faee08f8e () const Math::real AltEasting classGeographicLib_1_1GeoCoords.html af4a5b63a1931973338f71ef2ec4e27fa () const Math::real AltNorthing classGeographicLib_1_1GeoCoords.html a2f5a9665712214ad34b061d35ce89659 () const Math::real AltConvergence classGeographicLib_1_1GeoCoords.html a2b62e667ce462d8102fdfa6ece6ff50e () const Math::real AltScale classGeographicLib_1_1GeoCoords.html a299131cd5383ad0adc5af92c84dc6afe () const std::string GeoRepresentation classGeographicLib_1_1GeoCoords.html a79af2d72afdfeede78f2ba65b809d6b3 (int prec=0, bool swaplatlong=false) const std::string DMSRepresentation classGeographicLib_1_1GeoCoords.html af6e9f9087a407b01dc24401df8610257 (int prec, bool swaplatlong, char dmssep) const std::string DMSRepresentation classGeographicLib_1_1GeoCoords.html ab37746606876eb77335268054589390a (int prec=0, bool swaplatlong=false) const std::string MGRSRepresentation classGeographicLib_1_1GeoCoords.html a36594aaa4f293b0ddf00b1c78bb04595 (int prec=0) const std::string UTMUPSRepresentation classGeographicLib_1_1GeoCoords.html a056efc42fe4c653aad40be5d5b865ea3 (int prec=0) const std::string AltMGRSRepresentation classGeographicLib_1_1GeoCoords.html ad602893cd4a81ccc511daff76b411413 (int prec=0) const std::string AltUTMUPSRepresentation classGeographicLib_1_1GeoCoords.html a020732ccba257d7f5248692afd318b93 (int prec=0) const Math::real MajorRadius classGeographicLib_1_1GeoCoords.html a897e6bbfb71f78b0646045bf47e09696 () const Math::real Flattening classGeographicLib_1_1GeoCoords.html a4d892f5e55df8cbb597d1a693da4783c () const GeographicLib::Geodesic classGeographicLib_1_1Geodesic.html mask classGeographicLib_1_1Geodesic.html aab966190e69651b86661fc2628d20828 NONE classGeographicLib_1_1Geodesic.html aab966190e69651b86661fc2628d20828ab10adfebcb73de5356c4787246f056af LATITUDE classGeographicLib_1_1Geodesic.html aab966190e69651b86661fc2628d20828a7c1f4742e41ae5e75c8133ee7fb8fd90 LONGITUDE classGeographicLib_1_1Geodesic.html aab966190e69651b86661fc2628d20828aa1e019a4815f6c23ca30d4b3efcf6c6b AZIMUTH classGeographicLib_1_1Geodesic.html aab966190e69651b86661fc2628d20828aa413d0b81ccb4b5302285b1a01f16c08 DISTANCE classGeographicLib_1_1Geodesic.html aab966190e69651b86661fc2628d20828a0fe3400fb8dcc92274fbac2839cc4e0d DISTANCE_IN classGeographicLib_1_1Geodesic.html aab966190e69651b86661fc2628d20828ae20140cdf788fa0497df59630d3211ef REDUCEDLENGTH classGeographicLib_1_1Geodesic.html aab966190e69651b86661fc2628d20828a7a27709e1377a8c34704cf1cec64db6c GEODESICSCALE classGeographicLib_1_1Geodesic.html aab966190e69651b86661fc2628d20828afb114302395314a68dfef3c14693ea2e AREA classGeographicLib_1_1Geodesic.html aab966190e69651b86661fc2628d20828a9aea7d24f8e437d6ea38defbe4ec9b14 ALL classGeographicLib_1_1Geodesic.html aab966190e69651b86661fc2628d20828a30e0c9456c5df9e6ff23880014bd11e0 Geodesic classGeographicLib_1_1Geodesic.html a455300c36e6caa70968115416e1573a4 (real a, real f) Math::real Direct classGeographicLib_1_1Geodesic.html a6e31d7655895a61a49258de00fd14603 (real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21, real &S12) const Math::real Direct classGeographicLib_1_1Geodesic.html ac8b9e451fc4093253cfe3f8051d72a14 (real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2) const Math::real Direct classGeographicLib_1_1Geodesic.html ac8f0b5f4db73c5d8d11797698f937402 (real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2) const Math::real Direct classGeographicLib_1_1Geodesic.html a63f7681d1239902dc3f528ded0f90352 (real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &m12) const Math::real Direct classGeographicLib_1_1Geodesic.html a7fb2003b8f1d68976fac43d158b4b8b4 (real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &M12, real &M21) const Math::real Direct classGeographicLib_1_1Geodesic.html a65cf95dc7f5c0bfd427e963281e044f0 (real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21) const void ArcDirect classGeographicLib_1_1Geodesic.html abfb6553227e1534b451900240b39d058 (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const void ArcDirect classGeographicLib_1_1Geodesic.html aa1bed6c11200c0323cffd0e7027e4df2 (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2) const void ArcDirect classGeographicLib_1_1Geodesic.html a6f8eabd951b2fe23ffacb6209b2d43bc (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2) const void ArcDirect classGeographicLib_1_1Geodesic.html a223802b76bae1665f360b2e343d7afd7 (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12) const void ArcDirect classGeographicLib_1_1Geodesic.html a63ffe80d449adad813dc98805adcca81 (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12) const void ArcDirect classGeographicLib_1_1Geodesic.html a55c17605d76f6c46ac5b11f36e8e8641 (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &M12, real &M21) const void ArcDirect classGeographicLib_1_1Geodesic.html adc8a4d02e631e8966d5842056a49be9c (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21) const Math::real GenDirect classGeographicLib_1_1Geodesic.html acaef3032846a71fc730e1ea26ea32d20 (real lat1, real lon1, real azi1, bool arcmode, real s12_a12, unsigned outmask, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const Math::real Inverse classGeographicLib_1_1Geodesic.html ad7e59a242125a35a95c96cdb20573081 (real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &m12, real &M12, real &M21, real &S12) const Math::real Inverse classGeographicLib_1_1Geodesic.html a7c35218473b1784b1a80b8631f2d345d (real lat1, real lon1, real lat2, real lon2, real &s12) const Math::real Inverse classGeographicLib_1_1Geodesic.html a599e587407713f7019906881d6116873 (real lat1, real lon1, real lat2, real lon2, real &azi1, real &azi2) const Math::real Inverse classGeographicLib_1_1Geodesic.html a3e07eef498c82ac25b482cadf129d8ae (real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2) const Math::real Inverse classGeographicLib_1_1Geodesic.html aa6da95e73bec6443a03bf3928f401d19 (real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &m12) const Math::real Inverse classGeographicLib_1_1Geodesic.html ac668b5d0f82b28440dac5a44719fd61a (real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &M12, real &M21) const Math::real Inverse classGeographicLib_1_1Geodesic.html ad3f98a5f2adf39ff26cf3d6fe32258a8 (real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &m12, real &M12, real &M21) const Math::real GenInverse classGeographicLib_1_1Geodesic.html a84a3b9b457dd87b1059045b9d50303fd (real lat1, real lon1, real lat2, real lon2, unsigned outmask, real &s12, real &azi1, real &azi2, real &m12, real &M12, real &M21, real &S12) const GeodesicLine Line classGeographicLib_1_1Geodesic.html a3ac241c18897bb9bec4b839d7e1a7c59 (real lat1, real lon1, real azi1, unsigned caps=ALL) const Math::real MajorRadius classGeographicLib_1_1Geodesic.html acd276bb113cfdf3fe59aa43fb3d7289b () const Math::real Flattening classGeographicLib_1_1Geodesic.html a7abba09bec76f8f97f1e3bc81a7456e2 () const Math::real EllipsoidArea classGeographicLib_1_1Geodesic.html a0dde7d12d4bafedef63d371c5fe40f50 () const static const Geodesic WGS84 classGeographicLib_1_1Geodesic.html ae918bb7e1555fba38483449cbbac0ca1 friend class GeodesicLine classGeographicLib_1_1Geodesic.html ac4a8bd684285e00b12427c052697a106 GeographicLib::GeodesicLine classGeographicLib_1_1GeodesicLine.html mask classGeographicLib_1_1GeodesicLine.html adeec76cf92a8c30770e1199bdadacbcc NONE classGeographicLib_1_1GeodesicLine.html adeec76cf92a8c30770e1199bdadacbcca0f2ec05e56540d908a326a872b9aa68f LATITUDE classGeographicLib_1_1GeodesicLine.html adeec76cf92a8c30770e1199bdadacbcca34e259b158b7fa5441e91d32eae20c23 LONGITUDE classGeographicLib_1_1GeodesicLine.html adeec76cf92a8c30770e1199bdadacbccac41b1e2e1d73c8d323f92b94e57a0cc9 AZIMUTH classGeographicLib_1_1GeodesicLine.html adeec76cf92a8c30770e1199bdadacbcca654b16d956cdd16a70605a6b54a1228e DISTANCE classGeographicLib_1_1GeodesicLine.html adeec76cf92a8c30770e1199bdadacbcca6d8b294c13e0495120b9bfd6a9281184 DISTANCE_IN classGeographicLib_1_1GeodesicLine.html adeec76cf92a8c30770e1199bdadacbcca7929baa71a65e8399073f67382e4d0bc REDUCEDLENGTH classGeographicLib_1_1GeodesicLine.html adeec76cf92a8c30770e1199bdadacbccab6649103de9393f5f18a5d2e44624411 GEODESICSCALE classGeographicLib_1_1GeodesicLine.html adeec76cf92a8c30770e1199bdadacbcca74f896572150d24be4667cf66ed696a6 AREA classGeographicLib_1_1GeodesicLine.html adeec76cf92a8c30770e1199bdadacbcca71c623894b3e6bb0864f3da89d1a1915 ALL classGeographicLib_1_1GeodesicLine.html adeec76cf92a8c30770e1199bdadacbccabf2df1a904dc1c546a122ac0ebe1acd6 GeodesicLine classGeographicLib_1_1GeodesicLine.html a5669be85b4a574258f4a136f12d3f1bb (const Geodesic &g, real lat1, real lon1, real azi1, unsigned caps=ALL) GeodesicLine classGeographicLib_1_1GeodesicLine.html ae5ad84103d70f252c66bf61afbda3fa0 () Math::real Position classGeographicLib_1_1GeodesicLine.html ac9843cbfff45e8163b78e184a3126d82 (real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21, real &S12) const Math::real Position classGeographicLib_1_1GeodesicLine.html a50feb9c64d66b6518c640584d25e9507 (real s12, real &lat2, real &lon2) const Math::real Position classGeographicLib_1_1GeodesicLine.html ac736a0cc3300e443d42bbd2dc901962c (real s12, real &lat2, real &lon2, real &azi2) const Math::real Position classGeographicLib_1_1GeodesicLine.html a10b743a14701f620c0f41f1c6e1cee76 (real s12, real &lat2, real &lon2, real &azi2, real &m12) const Math::real Position classGeographicLib_1_1GeodesicLine.html ada48245beb736fe9ff3d8c491e9a691f (real s12, real &lat2, real &lon2, real &azi2, real &M12, real &M21) const Math::real Position classGeographicLib_1_1GeodesicLine.html aa42e5028aa78ef3ce8fbcb01b25eb458 (real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21) const void ArcPosition classGeographicLib_1_1GeodesicLine.html a9270eecb58eaac3115a5f08879990482 (real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const void ArcPosition classGeographicLib_1_1GeodesicLine.html afa377ee7344df5759cb7ea1022ff8288 (real a12, real &lat2, real &lon2) const void ArcPosition classGeographicLib_1_1GeodesicLine.html a2d147b25bcef6a7258fabc581a2d64a1 (real a12, real &lat2, real &lon2, real &azi2) const void ArcPosition classGeographicLib_1_1GeodesicLine.html afdedfa0bc105dbe5de4c292115c7b7ae (real a12, real &lat2, real &lon2, real &azi2, real &s12) const void ArcPosition classGeographicLib_1_1GeodesicLine.html ad6b2013f9dcde3f4bf867632f6a2d1ff (real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12) const void ArcPosition classGeographicLib_1_1GeodesicLine.html a2e0249a548d2dd9c882cb4a8de17d8eb (real a12, real &lat2, real &lon2, real &azi2, real &s12, real &M12, real &M21) const void ArcPosition classGeographicLib_1_1GeodesicLine.html af286d2071bdc59e68046dd2557115f21 (real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21) const Math::real GenPosition classGeographicLib_1_1GeodesicLine.html ad9522110fe6a5a0c7f912a6b1a23094d (bool arcmode, real s12_a12, unsigned outmask, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const bool Init classGeographicLib_1_1GeodesicLine.html af7e248d7632f56cf7abc6eac4927a587 () const Math::real Latitude classGeographicLib_1_1GeodesicLine.html a00a291e94d0c688a168a58623a360659 () const Math::real Longitude classGeographicLib_1_1GeodesicLine.html ac567ccf20c683319370f4c747f23966a () const Math::real Azimuth classGeographicLib_1_1GeodesicLine.html a40707b9e989c95418b2559b271cc2699 () const Math::real EquatorialAzimuth classGeographicLib_1_1GeodesicLine.html ad117912c4fc4ef29bf4050c9be3267f2 () const Math::real EquatorialArc classGeographicLib_1_1GeodesicLine.html a308c7fb4f7c562a8c604453bf2ee2ca2 () const Math::real MajorRadius classGeographicLib_1_1GeodesicLine.html af8953029b9985a3929fe406f7530143b () const Math::real Flattening classGeographicLib_1_1GeodesicLine.html a42e1f97e3ed564f98b305450b0d04590 () const unsigned Capabilities classGeographicLib_1_1GeodesicLine.html a21d07549d1171ad05c7318533c4c8970 () const bool Capabilities classGeographicLib_1_1GeodesicLine.html a4e12366c2ce02e7a96ee778eedb55bf9 (unsigned testcaps) const friend class Geodesic classGeographicLib_1_1GeodesicLine.html a088c26ef9558197029bbeb317f3104c0 GeographicLib::Geoid classGeographicLib_1_1Geoid.html convertflag classGeographicLib_1_1Geoid.html a58ddbd0fd48c25b361f45bdb70dadb96 ELLIPSOIDTOGEOID classGeographicLib_1_1Geoid.html a58ddbd0fd48c25b361f45bdb70dadb96a4a1db06e9dcfa1ebb345c616151ab70d NONE classGeographicLib_1_1Geoid.html a58ddbd0fd48c25b361f45bdb70dadb96a677322ba74ea5494e67478c3dc1780d5 GEOIDTOELLIPSOID classGeographicLib_1_1Geoid.html a58ddbd0fd48c25b361f45bdb70dadb96a96385bcbc41f3d933588f6d6a9868473 Geoid classGeographicLib_1_1Geoid.html ac3556c755dad0d43c3be0913df08b395 (const std::string &name, const std::string &path="", bool cubic=true, bool threadsafe=false) void CacheArea classGeographicLib_1_1Geoid.html a52b5dc2d976796046aaeb8765e4a9c0f (real south, real west, real north, real east) const void CacheAll classGeographicLib_1_1Geoid.html a482c6482d5ab4c5d661210327848170e () const void CacheClear classGeographicLib_1_1Geoid.html ad948f48545c9c40f1705f2892887cdab () const Math::real operator() classGeographicLib_1_1Geoid.html accb63bfbbadae10af79b3a3028a3045a (real lat, real lon) const Math::real operator() classGeographicLib_1_1Geoid.html a3bb5740c3a38a77caeb5eabd54c77cbc (real lat, real lon, real &gradn, real &grade) const Math::real ConvertHeight classGeographicLib_1_1Geoid.html adf98d0f0d881893a4f5ff711a3be0e04 (real lat, real lon, real h, convertflag d) const const std::string & Description classGeographicLib_1_1Geoid.html a37d76bcfe0ddf9b84042d701c312e941 () const const std::string & DateTime classGeographicLib_1_1Geoid.html a9cd7304b5df37001f4ad3c91cdbc56f4 () const const std::string & GeoidFile classGeographicLib_1_1Geoid.html a07e5f704f2684ce5acf824b7e0b17d30 () const const std::string & GeoidName classGeographicLib_1_1Geoid.html aa244668a189e35ce5ff248fb8fa2e57b () const const std::string & GeoidDirectory classGeographicLib_1_1Geoid.html a83b17b17045c49984bcdd032e637155e () const const std::string Interpolation classGeographicLib_1_1Geoid.html a0ddfefaef196023486fc7642af45cf96 () const Math::real MaxError classGeographicLib_1_1Geoid.html aff538da14578a02c551b411a899e567a () const Math::real RMSError classGeographicLib_1_1Geoid.html a207f98316d20a5b9d47846e559c5e2a2 () const Math::real Offset classGeographicLib_1_1Geoid.html ac798950a643e4286aa8d3bb8cd9b0815 () const Math::real Scale classGeographicLib_1_1Geoid.html ab2346300c12ff7e70d35e08479ecede1 () const bool ThreadSafe classGeographicLib_1_1Geoid.html a286e947c13592f21e45cbdd404b283c7 () const bool Cache classGeographicLib_1_1Geoid.html ade5715c0d1428a409383b1acd2cbe9be () const Math::real CacheWest classGeographicLib_1_1Geoid.html aa0d2e119f089ee4182987ddd3faaf62a () const Math::real CacheEast classGeographicLib_1_1Geoid.html acb34cfbcfb8be2794b16a3d18209dbbe () const Math::real CacheNorth classGeographicLib_1_1Geoid.html a26742332938bb8f22be23c979ffb02a1 () const Math::real CacheSouth classGeographicLib_1_1Geoid.html aa3db8f9639eb231539376e4617a3d59e () const Math::real MajorRadius classGeographicLib_1_1Geoid.html aada99465d9ddfc1b34ccf2ef3d86dbd7 () const Math::real Flattening classGeographicLib_1_1Geoid.html abd2076cab3455b816e9477cdb410b187 () const static std::string DefaultGeoidPath classGeographicLib_1_1Geoid.html a2daf81f5c648cf190a83981f441ab08f () static std::string DefaultGeoidName classGeographicLib_1_1Geoid.html a048865342b2b12ed2272e547209381fd () GeographicLib::Gnomonic classGeographicLib_1_1Gnomonic.html Gnomonic classGeographicLib_1_1Gnomonic.html a2ac973ebbd7aaf18c451b152cd92db99 (const Geodesic &earth=Geodesic::WGS84) void Forward classGeographicLib_1_1Gnomonic.html ab851ea19db5671f8d4a4151820bc6853 (real lat0, real lon0, real lat, real lon, real &x, real &y, real &azi, real &rk) const void Reverse classGeographicLib_1_1Gnomonic.html afccbed660a482ef73d33ad16406ee626 (real lat0, real lon0, real x, real y, real &lat, real &lon, real &azi, real &rk) const void Forward classGeographicLib_1_1Gnomonic.html a2c08cf2bad190ee9ab88f7d877223208 (real lat0, real lon0, real lat, real lon, real &x, real &y) const void Reverse classGeographicLib_1_1Gnomonic.html a8700d59a1e244f8dd211e344587dfed3 (real lat0, real lon0, real x, real y, real &lat, real &lon) const Math::real MajorRadius classGeographicLib_1_1Gnomonic.html a8598fe6d8c3896fa3fd58d24023f78ee () const Math::real Flattening classGeographicLib_1_1Gnomonic.html a06b559fa72aa1e51da966c43d22b983d () const GeographicLib::GravityCircle classGeographicLib_1_1GravityCircle.html GravityCircle classGeographicLib_1_1GravityCircle.html a4a000e07f0856a130ab11f1b26c933ed () Math::real Gravity classGeographicLib_1_1GravityCircle.html a5d8053ee66ae22217ae0b61e96194b64 (real lon, real &gx, real &gy, real &gz) const Math::real Disturbance classGeographicLib_1_1GravityCircle.html a2c3bde01c9d822b0cdd935314193a466 (real lon, real &deltax, real &deltay, real &deltaz) const Math::real GeoidHeight classGeographicLib_1_1GravityCircle.html a5d5a577c99cf4649d9286f1b4afacab5 (real lon) const void SphericalAnomaly classGeographicLib_1_1GravityCircle.html ac94672db5e450f4394e6df69eda99e69 (real lon, real &Dg01, real &xi, real &eta) const Math::real W classGeographicLib_1_1GravityCircle.html a04ae0659ec2eb766ae360d3bcbe332c4 (real lon, real &gX, real &gY, real &gZ) const Math::real V classGeographicLib_1_1GravityCircle.html aba5f3ec3cb7b620e13dafa6fa4e48ae0 (real lon, real &GX, real &GY, real &GZ) const Math::real T classGeographicLib_1_1GravityCircle.html afae12e4bbf17809f1dd6c32b41dfde03 (real lon, real &deltaX, real &deltaY, real &deltaZ) const Math::real T classGeographicLib_1_1GravityCircle.html a408d52806d43fe61b53af3ffb306bec5 (real lon) const bool Init classGeographicLib_1_1GravityCircle.html aee7b6c92dc9264345048a8ad7c230e4c () const Math::real MajorRadius classGeographicLib_1_1GravityCircle.html a19c5d003a9981cb3ece5b44ee836553a () const Math::real Flattening classGeographicLib_1_1GravityCircle.html ad9bfc60d802b662ffc1a41566882b743 () const Math::real Latitude classGeographicLib_1_1GravityCircle.html a9628e97c53a2532959c5c8af75e1c14b () const Math::real Height classGeographicLib_1_1GravityCircle.html a026b2b79ff3ae70b4fee5d9c4d1ffb70 () const unsigned Capabilities classGeographicLib_1_1GravityCircle.html a08ecc2b31ca7d0ddc2d25950a6bc247f () const bool Capabilities classGeographicLib_1_1GravityCircle.html a2fa608c25be9b8caa087102c4c311768 (unsigned testcaps) const friend class GravityModel classGeographicLib_1_1GravityCircle.html ada1db1d9f480d8044753ed869c995519 GeographicLib::GravityModel classGeographicLib_1_1GravityModel.html mask classGeographicLib_1_1GravityModel.html af8691d0f13d6d42278cd1e615903d365 NONE classGeographicLib_1_1GravityModel.html af8691d0f13d6d42278cd1e615903d365add4ee1aa94e38a8283826704105dc2e1 GRAVITY classGeographicLib_1_1GravityModel.html af8691d0f13d6d42278cd1e615903d365ae6a4573c13b932c98ab95e7f9dbd0952 DISTURBANCE classGeographicLib_1_1GravityModel.html af8691d0f13d6d42278cd1e615903d365a83daf366a2c7ab93495f0e6b4144d885 DISTURBING_POTENTIAL classGeographicLib_1_1GravityModel.html af8691d0f13d6d42278cd1e615903d365abe1f6d891a721a4f544cd8a341abcb28 SPHERICAL_ANOMALY classGeographicLib_1_1GravityModel.html af8691d0f13d6d42278cd1e615903d365ada02eebe918ebb3764a62b9323dceac9 GEOID_HEIGHT classGeographicLib_1_1GravityModel.html af8691d0f13d6d42278cd1e615903d365a0ac768bffe3f104069c3fd5af1ddaa69 ALL classGeographicLib_1_1GravityModel.html af8691d0f13d6d42278cd1e615903d365a8e0e6b9a6d629d05f22f41996fe98068 GravityModel classGeographicLib_1_1GravityModel.html ac351170c1104f41754d5c0b8371d3e15 (const std::string &name, const std::string &path="") Math::real Gravity classGeographicLib_1_1GravityModel.html a2dc8bf4cfa3c1914f4c7e93a5a3b3eac (real lat, real lon, real h, real &gx, real &gy, real &gz) const Math::real Disturbance classGeographicLib_1_1GravityModel.html a75cf57146334d9ce0856222a6814ae6f (real lat, real lon, real h, real &deltax, real &deltay, real &deltaz) const Math::real GeoidHeight classGeographicLib_1_1GravityModel.html a7e75bdba6b9c8e64cc64403335a6fba4 (real lat, real lon) const void SphericalAnomaly classGeographicLib_1_1GravityModel.html aaf89eb4a9b7266f0aa2ef2c341fc264e (real lat, real lon, real h, real &Dg01, real &xi, real &eta) const Math::real W classGeographicLib_1_1GravityModel.html ab6767f3833caa34095a7ef83c43a46f0 (real X, real Y, real Z, real &gX, real &gY, real &gZ) const Math::real V classGeographicLib_1_1GravityModel.html a7aec9ecfa959b257dd0a965331598368 (real X, real Y, real Z, real &GX, real &GY, real &GZ) const Math::real T classGeographicLib_1_1GravityModel.html a257022f1f125d88b0a6efdccfc5e7a41 (real X, real Y, real Z, real &deltaX, real &deltaY, real &deltaZ) const Math::real T classGeographicLib_1_1GravityModel.html a690657dedac8ccea22052eda2829fea3 (real X, real Y, real Z) const Math::real U classGeographicLib_1_1GravityModel.html af368d4f9015e076e5cc57ad87b8a185f (real X, real Y, real Z, real &gammaX, real &gammaY, real &gammaZ) const Math::real Phi classGeographicLib_1_1GravityModel.html a80477ccafa1049964ee0cef40ae2eea6 (real X, real Y, real &fX, real &fY) const GravityCircle Circle classGeographicLib_1_1GravityModel.html aadafafc09b9b707d47606da1e413d54f (real lat, real h, unsigned caps=ALL) const const NormalGravity & ReferenceEllipsoid classGeographicLib_1_1GravityModel.html a0467e44598b65fb403109ba0d0fbf182 () const const std::string & Description classGeographicLib_1_1GravityModel.html af2c1c74254e3193adb155987f6dd0a59 () const const std::string & DateTime classGeographicLib_1_1GravityModel.html acbed448c2423cd45e800d03fab059500 () const const std::string & GravityFile classGeographicLib_1_1GravityModel.html a26a87d363713ba3d1aa1b16da2fc2f27 () const const std::string & GravityModelName classGeographicLib_1_1GravityModel.html a9ca1191e449bf7c04595ebd8a299af78 () const const std::string & GravityModelDirectory classGeographicLib_1_1GravityModel.html a17f2da4cd5abbb5f38f1b90d75975898 () const Math::real MajorRadius classGeographicLib_1_1GravityModel.html a07f361e231e1725a4f8e3c37a06cf304 () const Math::real MassConstant classGeographicLib_1_1GravityModel.html aa63d1c6e71abfa9455df695f4a3e6bdd () const Math::real ReferenceMassConstant classGeographicLib_1_1GravityModel.html a4e6b9d48f26544a45c5509a87eb334e7 () const Math::real AngularVelocity classGeographicLib_1_1GravityModel.html aeb3d751ba7719e57e0266b65ee7d63d8 () const Math::real Flattening classGeographicLib_1_1GravityModel.html aa2316f6d328435417627d49046c45308 () const static std::string DefaultGravityPath classGeographicLib_1_1GravityModel.html a0fdf62e41828ae7ae183d9e876f37954 () static std::string DefaultGravityName classGeographicLib_1_1GravityModel.html ad4a776d68b60e85275c0e580d3c7caba () friend class GravityCircle classGeographicLib_1_1GravityModel.html a243c90a7f9bf3f7aa96877a4b0667a89 GeographicLib::LambertConformalConic classGeographicLib_1_1LambertConformalConic.html LambertConformalConic classGeographicLib_1_1LambertConformalConic.html a21dc9fa160a5b96a1c11ab30af0eb129 (real a, real f, real stdlat, real k0) LambertConformalConic classGeographicLib_1_1LambertConformalConic.html a6273d61ce32ad6016471a7bd0e155ca4 (real a, real f, real stdlat1, real stdlat2, real k1) LambertConformalConic classGeographicLib_1_1LambertConformalConic.html a4d772372388f32029359b156dc43e4cd (real a, real f, real sinlat1, real coslat1, real sinlat2, real coslat2, real k1) void SetScale classGeographicLib_1_1LambertConformalConic.html aac6267f7f970b35043b17e12e4163ff2 (real lat, real k=real(1)) void Forward classGeographicLib_1_1LambertConformalConic.html a2bafb6c1a81d4b6cf04f172b9e96278c (real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const void Reverse classGeographicLib_1_1LambertConformalConic.html a085d37693f5e95fd650b7f59f61ab744 (real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const void Forward classGeographicLib_1_1LambertConformalConic.html a14a3757d85e81488afe476f7ceb8a720 (real lon0, real lat, real lon, real &x, real &y) const void Reverse classGeographicLib_1_1LambertConformalConic.html a1bffe1259895569e6834a4b1df9b22ab (real lon0, real x, real y, real &lat, real &lon) const Math::real MajorRadius classGeographicLib_1_1LambertConformalConic.html a21f9bc21f3f40c56d2f5d12fb4b7f75a () const Math::real Flattening classGeographicLib_1_1LambertConformalConic.html abd47e48c75ed958f5aa91bcaa80ddc8c () const Math::real OriginLatitude classGeographicLib_1_1LambertConformalConic.html a7c589335b43b2274d3a68c0f68f29d77 () const Math::real CentralScale classGeographicLib_1_1LambertConformalConic.html a2298a4e48e550cfd7346cf5f2dd175ad () const static const LambertConformalConic Mercator classGeographicLib_1_1LambertConformalConic.html a7fbb6973b77593245db52c9759740f9a GeographicLib::LocalCartesian classGeographicLib_1_1LocalCartesian.html LocalCartesian classGeographicLib_1_1LocalCartesian.html ad277a6798293d5d66168c3c1438d10a2 (real lat0, real lon0, real h0=0, const Geocentric &earth=Geocentric::WGS84) LocalCartesian classGeographicLib_1_1LocalCartesian.html a3474a0434b2ff8b258111fe6d8468f0d (const Geocentric &earth=Geocentric::WGS84) void Reset classGeographicLib_1_1LocalCartesian.html a85b9c15b843cf6a84be08e0cc4de9122 (real lat0, real lon0, real h0=0) void Forward classGeographicLib_1_1LocalCartesian.html a6426e95f904f224eabedb8fcd17fe537 (real lat, real lon, real h, real &x, real &y, real &z) const void Forward classGeographicLib_1_1LocalCartesian.html a774332be14e894536f13b3cc7a8323c7 (real lat, real lon, real h, real &x, real &y, real &z, std::vector< real > &M) const void Reverse classGeographicLib_1_1LocalCartesian.html ac34878de3ae995e7d54f0347a1f34118 (real x, real y, real z, real &lat, real &lon, real &h) const void Reverse classGeographicLib_1_1LocalCartesian.html a7baa88b38b320d763f6cba3ece4f518d (real x, real y, real z, real &lat, real &lon, real &h, std::vector< real > &M) const Math::real LatitudeOrigin classGeographicLib_1_1LocalCartesian.html af4905164de5157c7ae2678f7716cbad7 () const Math::real LongitudeOrigin classGeographicLib_1_1LocalCartesian.html a45656227b4fff45249f1844bc6d233ad () const Math::real HeightOrigin classGeographicLib_1_1LocalCartesian.html ac8e00f262d70da122f45afa15b9381e2 () const Math::real MajorRadius classGeographicLib_1_1LocalCartesian.html a795356c736f1170fe5ef075ebbf34354 () const Math::real Flattening classGeographicLib_1_1LocalCartesian.html a99907eda4b863acbe8e7d159a6482abb () const GeographicLib::MagneticCircle classGeographicLib_1_1MagneticCircle.html MagneticCircle classGeographicLib_1_1MagneticCircle.html a49170460b1833722ad9bc45b92c86e5a () void operator() classGeographicLib_1_1MagneticCircle.html a8669d47d20b03e9185d358440d3da9b1 (real lon, real &Bx, real &By, real &Bz) const void operator() classGeographicLib_1_1MagneticCircle.html ac715ae0394bd7f8c23288f80c406e5bc (real lon, real &Bx, real &By, real &Bz, real &Bxt, real &Byt, real &Bzt) const bool Init classGeographicLib_1_1MagneticCircle.html a8ec84cd0b1d97b51464ec80d9e2dcf57 () const Math::real MajorRadius classGeographicLib_1_1MagneticCircle.html a78721d381d21f676152394dd576f2e77 () const Math::real Flattening classGeographicLib_1_1MagneticCircle.html a4c3fc40a49332ddcd042e5cb41c3cb2a () const Math::real Latitude classGeographicLib_1_1MagneticCircle.html aaf14e89275bffd8253acdbe4840b65d0 () const Math::real Height classGeographicLib_1_1MagneticCircle.html aadd95eac0650f195e4d7acdc9819716b () const Math::real Time classGeographicLib_1_1MagneticCircle.html a44783c9e44f16bbd48cc5061b30ce8e9 () const friend class MagneticModel classGeographicLib_1_1MagneticCircle.html af6619ebe4c078705fc49a0d9f950b431 GeographicLib::MagneticModel classGeographicLib_1_1MagneticModel.html MagneticModel classGeographicLib_1_1MagneticModel.html a84a020586d58c4da61ec6ffbc7b4fa37 (const std::string &name, const std::string &path="", const Geocentric &earth=Geocentric::WGS84) const std::string & Description classGeographicLib_1_1MagneticModel.html a204e8d3c4ebf6f8c13eb9e1817921ea2 () const const std::string & DateTime classGeographicLib_1_1MagneticModel.html a230648296f87ff6fc12a3e65ff01bc3b () const const std::string & MagneticFile classGeographicLib_1_1MagneticModel.html aa072d202531c0cacdd7bca128d670705 () const const std::string & MagneticModelName classGeographicLib_1_1MagneticModel.html ad500f0d76997b4026b75805fad71dbee () const const std::string & MagneticModelDirectory classGeographicLib_1_1MagneticModel.html a2476aee96f07071de17c24dbbf80f521 () const Math::real MinHeight classGeographicLib_1_1MagneticModel.html a8a170290542bf8e694cda4b4d329c881 () const Math::real MaxHeight classGeographicLib_1_1MagneticModel.html a41e16617bc2cdd89ab7b7a02b4bd4dcf () const Math::real MinTime classGeographicLib_1_1MagneticModel.html a1e8624990112edc3c6503c9c9acb9309 () const Math::real MaxTime classGeographicLib_1_1MagneticModel.html a5d538204401200c87b37cdc37509311a () const Math::real MajorRadius classGeographicLib_1_1MagneticModel.html a0b55df676607204a2d44687ffafe8d9e () const Math::real Flattening classGeographicLib_1_1MagneticModel.html a38ad95b421f5fbce40abff5733421370 () const static std::string DefaultMagneticPath classGeographicLib_1_1MagneticModel.html a469db97d257876c1abafa3da3c5f0f7e () static std::string DefaultMagneticName classGeographicLib_1_1MagneticModel.html ab2ac8cc598c0d9a6b448c9a45e9642d9 () void operator() classGeographicLib_1_1MagneticModel.html a550eb1739712fbbae1a167c2559d6dbc (real t, real lat, real lon, real h, real &Bx, real &By, real &Bz) const void operator() classGeographicLib_1_1MagneticModel.html a11fed1ca7a45947f6f43f6ba7897250f (real t, real lat, real lon, real h, real &Bx, real &By, real &Bz, real &Bxt, real &Byt, real &Bzt) const MagneticCircle Circle classGeographicLib_1_1MagneticModel.html ae4275d73128fc2c6c62f53677ce70bd5 (real t, real lat, real h) const static void FieldComponents classGeographicLib_1_1MagneticModel.html af553c42337b9a9a1d51b81fea7083ea2 (real Bx, real By, real Bz, real &H, real &F, real &D, real &I) static void FieldComponents classGeographicLib_1_1MagneticModel.html a54aa849393ab2a7e37aa1f086e64cffb (real Bx, real By, real Bz, real Bxt, real Byt, real Bzt, real &H, real &F, real &D, real &I, real &Ht, real &Ft, real &Dt, real &It) GeographicLib::Math classGeographicLib_1_1Math.html double extended classGeographicLib_1_1Math.html a436f350a6a9539e176dda19d0e4811f8 double real classGeographicLib_1_1Math.html aeee4778d7cf2f9fb9648efe4911da59d static T pi classGeographicLib_1_1Math.html aca1580c771e7019bfe826512fba9b2f1 () static real pi classGeographicLib_1_1Math.html abb031de2a30d6fbac4c634b344e46df4 () static T degree classGeographicLib_1_1Math.html a0f3b4ea16cc2cb21557555fca3b1c201 () static real degree classGeographicLib_1_1Math.html a5bb8bea024e11eb402ecbcf9bae28bb5 () static T sq classGeographicLib_1_1Math.html a6a092f38e231c80a1f144814c90f1895 (T x) static T hypot classGeographicLib_1_1Math.html a62b6fca06c571481aafba3f1716a8bb2 (T x, T y) static T expm1 classGeographicLib_1_1Math.html a2fd4e8930d9dd953352d25fc184d843e (T x) static T log1p classGeographicLib_1_1Math.html a90eddd5a6d0c9dcc4a9f18dd647ac520 (T x) static T asinh classGeographicLib_1_1Math.html aba75669f9d52fc672a8faaf69261bd8a (T x) static T atanh classGeographicLib_1_1Math.html a372ac604592d9de9cf608cfdfc463447 (T x) static T cbrt classGeographicLib_1_1Math.html a04b87b033b845f4812a5700661c64a2a (T x) static bool isfinite classGeographicLib_1_1Math.html af61f7360e67c35131d80083e7b53dda8 (T x) static T NaN classGeographicLib_1_1Math.html ad1dc13a367125d3f8d291eaa98339186 () static real NaN classGeographicLib_1_1Math.html a28304be9b5cb17eeb7413b059604a154 () static bool isnan classGeographicLib_1_1Math.html a554d35e9f54bf304447833a21ee2047c (T x) static T infinity classGeographicLib_1_1Math.html a82ccc01be301f14061c681ee93a5120b () static real infinity classGeographicLib_1_1Math.html a1606218c36b8d7c60a5ad5847a94ab9c () static T swab classGeographicLib_1_1Math.html aec7f95c2bb99422f1f047cb628a232f8 (T x) static const bool bigendian classGeographicLib_1_1Math.html ab14e512a1867b98ecb38e9175426596c GeographicLib::MGRS classGeographicLib_1_1MGRS.html static void Forward classGeographicLib_1_1MGRS.html a91de10ebde478dbb85b3c7d057ff97b9 (int zone, bool northp, real x, real y, int prec, std::string &mgrs) static void Forward classGeographicLib_1_1MGRS.html a37f9dd9b12dbc74381116d842be47ccd (int zone, bool northp, real x, real y, real lat, int prec, std::string &mgrs) static void Reverse classGeographicLib_1_1MGRS.html a066b79e78cd85bf4b50df50808bed7e3 (const std::string &mgrs, int &zone, bool &northp, real &x, real &y, int &prec, bool centerp=true) static Math::real MajorRadius classGeographicLib_1_1MGRS.html a8942a1dfafa3ea845ccc5fafb6ca4dc2 () static Math::real Flattening classGeographicLib_1_1MGRS.html a8eee27799bda8238d6d0525dffdddd4e () friend class UTMUPS classGeographicLib_1_1MGRS.html a6a0cfac496024eaf645c7a2f98a02a75 GeographicLib::NormalGravity classGeographicLib_1_1NormalGravity.html NormalGravity classGeographicLib_1_1NormalGravity.html af625bbc7df2d36ba5c43c8f20f61c134 (real a, real GM, real omega, real f, real J2) NormalGravity classGeographicLib_1_1NormalGravity.html a55f749c3bb3e9d19626105041bf1b6fb () Math::real SurfaceGravity classGeographicLib_1_1NormalGravity.html a019541fea3712f8ca73aec8a0b29c71c (real lat) const Math::real Gravity classGeographicLib_1_1NormalGravity.html acfca8d6e44778501b54cd0b38dbbddde (real lat, real h, real &gammay, real &gammaz) const Math::real U classGeographicLib_1_1NormalGravity.html a258290ade5fd46c42fdc4199683cf563 (real X, real Y, real Z, real &gammaX, real &gammaY, real &gammaZ) const Math::real V0 classGeographicLib_1_1NormalGravity.html aa656e36306bc396ac6d32dcdfc2069a2 (real X, real Y, real Z, real &GammaX, real &GammaY, real &GammaZ) const Math::real Phi classGeographicLib_1_1NormalGravity.html af0f50fd88d8b647a1b7bb209a4cfae0f (real X, real Y, real &fX, real &fY) const bool Init classGeographicLib_1_1NormalGravity.html a1d96cafc362959215eaa553a712b6908 () const Math::real MajorRadius classGeographicLib_1_1NormalGravity.html a9155d22c5a64a7ef346ce7f590a6264f () const Math::real MassConstant classGeographicLib_1_1NormalGravity.html a3c6693dc7efe04cdbed408b2510c69da () const Math::real DynamicalFormFactor classGeographicLib_1_1NormalGravity.html aa52b03157eb0b199d331d6fca28a259a (int n=2) const Math::real AngularVelocity classGeographicLib_1_1NormalGravity.html aefd6dfb7e6f806b63d099316dcc97f55 () const Math::real Flattening classGeographicLib_1_1NormalGravity.html aba396954f43e623e755bdff7db7d850b () const Math::real EquatorialGravity classGeographicLib_1_1NormalGravity.html a3610ec908c7b168b39f00946e2fc3fad () const Math::real PolarGravity classGeographicLib_1_1NormalGravity.html a3079310d3a7af97ccb50b91be01d5a50 () const Math::real GravityFlattening classGeographicLib_1_1NormalGravity.html a7e9329f7b3120b7777a0c5be3ca424a7 () const Math::real SurfacePotential classGeographicLib_1_1NormalGravity.html a5bc3756dd7dbc82c07ef4afd1a182372 () const const Geocentric & Earth classGeographicLib_1_1NormalGravity.html ab15ded1ab7ec9a30e8053fc330ed76ac () const static const NormalGravity WGS84 classGeographicLib_1_1NormalGravity.html a70c328a95e05964180106d89c2583b78 static const NormalGravity GRS80 classGeographicLib_1_1NormalGravity.html a78cf6878967ad52adadbe06b5f7c4146 friend class GravityModel classGeographicLib_1_1NormalGravity.html ada1db1d9f480d8044753ed869c995519 GeographicLib::OSGB classGeographicLib_1_1OSGB.html static void Forward classGeographicLib_1_1OSGB.html a92618eea9870908e11446875d80aab6b (real lat, real lon, real &x, real &y, real &gamma, real &k) static void Reverse classGeographicLib_1_1OSGB.html ae006380e574858a81011752dd1d4af60 (real x, real y, real &lat, real &lon, real &gamma, real &k) static void Forward classGeographicLib_1_1OSGB.html a0f705bee98c6669ca7a95394712fd758 (real lat, real lon, real &x, real &y) static void Reverse classGeographicLib_1_1OSGB.html ab804929a4126ed390a40d35e837b4001 (real x, real y, real &lat, real &lon) static void GridReference classGeographicLib_1_1OSGB.html a0a79e8f2babae1eb0305a0e728fea8c8 (real x, real y, int prec, std::string &gridref) static void GridReference classGeographicLib_1_1OSGB.html a3693cfef49442747750e8393c81014aa (const std::string &gridref, real &x, real &y, int &prec, bool centerp=true) static Math::real MajorRadius classGeographicLib_1_1OSGB.html a9bb3b0ff55a462ac2ebcd0cfd446d811 () static Math::real Flattening classGeographicLib_1_1OSGB.html aae688ebd8c126f22517eaa0a01d659f8 () static Math::real CentralScale classGeographicLib_1_1OSGB.html a65210bfdcac362f393a8f81f28259ad0 () static Math::real OriginLatitude classGeographicLib_1_1OSGB.html ad6bcef7e2dcc2992831e101bf0b05fa8 () static Math::real OriginLongitude classGeographicLib_1_1OSGB.html a4eb3b20734af47c9661d40581555c345 () static Math::real FalseNorthing classGeographicLib_1_1OSGB.html a74072d4e62fcd4ca679b222716b6a6a1 () static Math::real FalseEasting classGeographicLib_1_1OSGB.html ab27e19f7688f6b472d217b31aeae079c () GeographicLib::PolarStereographic classGeographicLib_1_1PolarStereographic.html PolarStereographic classGeographicLib_1_1PolarStereographic.html a170d21f9c7a2e922c57fc83a44ea3dfa (real a, real f, real k0) void SetScale classGeographicLib_1_1PolarStereographic.html a3f957214eb1d1248277a680e4c4ceed5 (real lat, real k=real(1)) void Forward classGeographicLib_1_1PolarStereographic.html a30ef1a1f906ee389e2a5f7e5fd7d8fa4 (bool northp, real lat, real lon, real &x, real &y, real &gamma, real &k) const void Reverse classGeographicLib_1_1PolarStereographic.html a01302b8dba43c57e3c3849f94123a157 (bool northp, real x, real y, real &lat, real &lon, real &gamma, real &k) const void Forward classGeographicLib_1_1PolarStereographic.html ac2fe4c9524ec35f8d05336555f96e1b1 (bool northp, real lat, real lon, real &x, real &y) const void Reverse classGeographicLib_1_1PolarStereographic.html a16572cc552eeb24ebf84319cdcd6652e (bool northp, real x, real y, real &lat, real &lon) const Math::real MajorRadius classGeographicLib_1_1PolarStereographic.html ab1746576356a2409f34d9527064adfdd () const Math::real Flattening classGeographicLib_1_1PolarStereographic.html a3b08d03e475dae2c2a81c76420946942 () const Math::real CentralScale classGeographicLib_1_1PolarStereographic.html ad6f7bd8a35208d91706ac8c258387e6f () const static const PolarStereographic UPS classGeographicLib_1_1PolarStereographic.html a2db6bcb1b59a6ddc6087ee04c64c9825 GeographicLib::PolygonArea classGeographicLib_1_1PolygonArea.html PolygonArea classGeographicLib_1_1PolygonArea.html a060a1dc499bd079c62f62ed5cad929e5 (const Geodesic &earth, bool polyline=false) void Clear classGeographicLib_1_1PolygonArea.html a66198bec67036ad09aa58ec43166fe60 () void AddPoint classGeographicLib_1_1PolygonArea.html acfec56f0e136a534192e1e71589299f1 (real lat, real lon) unsigned Compute classGeographicLib_1_1PolygonArea.html a60e1c288358818c849356c9921191215 (bool reverse, bool sign, real &perimeter, real &area) const unsigned TestCompute classGeographicLib_1_1PolygonArea.html ac46ac5567223b3db2ee11e6c4f72c257 (real lat, real lon, bool reverse, bool sign, real &perimeter, real &area) const Math::real MajorRadius classGeographicLib_1_1PolygonArea.html afcdd74fcb4a0f57aa193e5fd08239369 () const Math::real Flattening classGeographicLib_1_1PolygonArea.html aba3543baed0f014b64890d174b8c62a0 () const GeographicLib::SphericalEngine classGeographicLib_1_1SphericalEngine.html GeographicLib::SphericalEngine::coeff normalization classGeographicLib_1_1SphericalEngine.html a5332d09191e018cbddc568c1fc71949f FULL classGeographicLib_1_1SphericalEngine.html a5332d09191e018cbddc568c1fc71949fac720ca87adfc478dbfc13a37f0cf8ba9 SCHMIDT classGeographicLib_1_1SphericalEngine.html a5332d09191e018cbddc568c1fc71949fa2e3db3efd68d118e3f357a97eb77a131 static Math::real Value classGeographicLib_1_1SphericalEngine.html a1157f59596dd15bf0a21b6a7fb99630b (const coeff c[], const real f[], real x, real y, real z, real a, real &gradx, real &grady, real &gradz) static CircularEngine Circle classGeographicLib_1_1SphericalEngine.html af6a5fa63535d47cf528b733bb6a97901 (const coeff c[], const real f[], real p, real z, real a) static void RootTable classGeographicLib_1_1SphericalEngine.html a7fac63262c0a8bb18aee8c962a08d429 (int N) static void ClearRootTable classGeographicLib_1_1SphericalEngine.html ab3fb8f933adb257df6b7537268d55a75 () friend class CircularEngine classGeographicLib_1_1SphericalEngine.html a0c689dbf7b6bf2fb4cffb109085b1d3b GeographicLib::SphericalEngine::coeff classGeographicLib_1_1SphericalEngine_1_1coeff.html coeff classGeographicLib_1_1SphericalEngine_1_1coeff.html a98ee0fd797434667a8cb5093d7644af4 () coeff classGeographicLib_1_1SphericalEngine_1_1coeff.html a45a4378903a4f3ee817c47b72d086183 (const std::vector< real > &C, const std::vector< real > &S, int N, int nmx, int mmx) coeff classGeographicLib_1_1SphericalEngine_1_1coeff.html a2f453e210345b33a364bf5a3bee84b7b (const std::vector< real > &C, const std::vector< real > &S, int N) int N classGeographicLib_1_1SphericalEngine_1_1coeff.html a38ab91101bb639963e094327a22fed59 () const int nmx classGeographicLib_1_1SphericalEngine_1_1coeff.html a96467118f9c16c16259d4fbbed3917ff () const int mmx classGeographicLib_1_1SphericalEngine_1_1coeff.html a2a1ff83503433c64bd4399689a3e40f6 () const int index classGeographicLib_1_1SphericalEngine_1_1coeff.html a356d705a99ee15089d1faabd0c01084c (int n, int m) const Math::real Cv classGeographicLib_1_1SphericalEngine_1_1coeff.html ab591ddf74f5653c16b58ed2f5bde5ffe (int k) const Math::real Sv classGeographicLib_1_1SphericalEngine_1_1coeff.html ac93aaebb09086ab14330aafc0f105a17 (int k) const Math::real Cv classGeographicLib_1_1SphericalEngine_1_1coeff.html ad30081b2dfdee79652aacbc24bacb635 (int k, int n, int m, real f) const Math::real Sv classGeographicLib_1_1SphericalEngine_1_1coeff.html a4fc7e6c7faf3f5940ee8f3ab28216897 (int k, int n, int m, real f) const static int Csize classGeographicLib_1_1SphericalEngine_1_1coeff.html a8a126c9790a7a1609046fbae7934e587 (int N, int M) static int Ssize classGeographicLib_1_1SphericalEngine_1_1coeff.html a98a75827d68247cf5ad1843d9d68b222 (int N, int M) static void readcoeffs classGeographicLib_1_1SphericalEngine_1_1coeff.html a2d545f589894683e7de297c42b7c995a (std::istream &stream, int &N, int &M, std::vector< real > &C, std::vector< real > &S) GeographicLib::SphericalHarmonic classGeographicLib_1_1SphericalHarmonic.html normalization classGeographicLib_1_1SphericalHarmonic.html a889791c67edc32865996842c600104eb FULL classGeographicLib_1_1SphericalHarmonic.html a889791c67edc32865996842c600104ebaee7040963f955b45b5a8ab0ea325c782 SCHMIDT classGeographicLib_1_1SphericalHarmonic.html a889791c67edc32865996842c600104eba014c2f3300abd50ff65ea8d73ef3c69e SphericalHarmonic classGeographicLib_1_1SphericalHarmonic.html adb71d28aa60a813ca3384f9c58ef8fa1 (const std::vector< real > &C, const std::vector< real > &S, int N, real a, unsigned norm=FULL) SphericalHarmonic classGeographicLib_1_1SphericalHarmonic.html a2ed62c0ad8fb1ab36d5a331a3f33c3d7 (const std::vector< real > &C, const std::vector< real > &S, int N, int nmx, int mmx, real a, unsigned norm=FULL) SphericalHarmonic classGeographicLib_1_1SphericalHarmonic.html a6d97388f273d1511a8191d812e9bde3e () Math::real operator() classGeographicLib_1_1SphericalHarmonic.html a42480d85a81238f612a6178410bf97ff (real x, real y, real z) const Math::real operator() classGeographicLib_1_1SphericalHarmonic.html a5046d787c241c5216cfeb0062673cbd7 (real x, real y, real z, real &gradx, real &grady, real &gradz) const CircularEngine Circle classGeographicLib_1_1SphericalHarmonic.html a2b2b2ad35bba090a4956693ba5ef0f32 (real p, real z, bool gradp) const const SphericalEngine::coeff & Coefficients classGeographicLib_1_1SphericalHarmonic.html ac8886de1d1400ecf6482f6441c76a8a0 () const GeographicLib::SphericalHarmonic1 classGeographicLib_1_1SphericalHarmonic1.html normalization classGeographicLib_1_1SphericalHarmonic1.html ac4aaa81e0f753894ecef173c4d667916 FULL classGeographicLib_1_1SphericalHarmonic1.html ac4aaa81e0f753894ecef173c4d667916aafd320d946e992459e0013da6b769638 SCHMIDT classGeographicLib_1_1SphericalHarmonic1.html ac4aaa81e0f753894ecef173c4d667916aa1959e3e2bdf7c01f596692757858231 SphericalHarmonic1 classGeographicLib_1_1SphericalHarmonic1.html aeb3299ea40b0bedae55fd0a6f0c1fa40 (const std::vector< real > &C, const std::vector< real > &S, int N, const std::vector< real > &C1, const std::vector< real > &S1, int N1, real a, unsigned norm=FULL) SphericalHarmonic1 classGeographicLib_1_1SphericalHarmonic1.html aca472a143f7e000e232f4c261550b626 (const std::vector< real > &C, const std::vector< real > &S, int N, int nmx, int mmx, const std::vector< real > &C1, const std::vector< real > &S1, int N1, int nmx1, int mmx1, real a, unsigned norm=FULL) SphericalHarmonic1 classGeographicLib_1_1SphericalHarmonic1.html aa976378e6eae1e85ce04976b631ccb5f () Math::real operator() classGeographicLib_1_1SphericalHarmonic1.html a43098674b6bb823ccbac8908a7831234 (real tau, real x, real y, real z) const Math::real operator() classGeographicLib_1_1SphericalHarmonic1.html ac732f25af07eee71ad0ca288a2e86fbd (real tau, real x, real y, real z, real &gradx, real &grady, real &gradz) const CircularEngine Circle classGeographicLib_1_1SphericalHarmonic1.html a32dd4989c40181939d667298681625f6 (real tau, real p, real z, bool gradp) const const SphericalEngine::coeff & Coefficients classGeographicLib_1_1SphericalHarmonic1.html a67fe3c8ab08be94a300d07c98814aab0 () const const SphericalEngine::coeff & Coefficients1 classGeographicLib_1_1SphericalHarmonic1.html ad200e309790cd6e41bb79529d9076274 () const GeographicLib::SphericalHarmonic2 classGeographicLib_1_1SphericalHarmonic2.html normalization classGeographicLib_1_1SphericalHarmonic2.html adbdc59ce4e6f1e4ce0fc7169c760f8be FULL classGeographicLib_1_1SphericalHarmonic2.html adbdc59ce4e6f1e4ce0fc7169c760f8bea4b8746ff0805a8a819130794c103e946 SCHMIDT classGeographicLib_1_1SphericalHarmonic2.html adbdc59ce4e6f1e4ce0fc7169c760f8bea326a84d3094b558a1c43b4b61f9c2d58 SphericalHarmonic2 classGeographicLib_1_1SphericalHarmonic2.html a897f6b15b82812e874a2b0927cfc3912 (const std::vector< real > &C, const std::vector< real > &S, int N, const std::vector< real > &C1, const std::vector< real > &S1, int N1, const std::vector< real > &C2, const std::vector< real > &S2, int N2, real a, unsigned norm=FULL) SphericalHarmonic2 classGeographicLib_1_1SphericalHarmonic2.html a19300de2d629c014883026bf0042b6f0 (const std::vector< real > &C, const std::vector< real > &S, int N, int nmx, int mmx, const std::vector< real > &C1, const std::vector< real > &S1, int N1, int nmx1, int mmx1, const std::vector< real > &C2, const std::vector< real > &S2, int N2, int nmx2, int mmx2, real a, unsigned norm=FULL) SphericalHarmonic2 classGeographicLib_1_1SphericalHarmonic2.html a2fad42164df6175bc376e2f78e3e0c5a () Math::real operator() classGeographicLib_1_1SphericalHarmonic2.html a48f85ac41417815e6735ff5aa7d74155 (real tau1, real tau2, real x, real y, real z) const Math::real operator() classGeographicLib_1_1SphericalHarmonic2.html a762d48fc2c3dc902859286de4df7672c (real tau1, real tau2, real x, real y, real z, real &gradx, real &grady, real &gradz) const CircularEngine Circle classGeographicLib_1_1SphericalHarmonic2.html a3aa683a43a8e9232a16390b09c6be920 (real tau1, real tau2, real p, real z, bool gradp) const const SphericalEngine::coeff & Coefficients classGeographicLib_1_1SphericalHarmonic2.html a166338f0b4ccf89c48278bb9514046f0 () const const SphericalEngine::coeff & Coefficients1 classGeographicLib_1_1SphericalHarmonic2.html a51751279dc4e0b6e19886723f8e8b493 () const const SphericalEngine::coeff & Coefficients2 classGeographicLib_1_1SphericalHarmonic2.html a676b4c36923744bf5057b24484d9cf60 () const GeographicLib::TransverseMercator classGeographicLib_1_1TransverseMercator.html TransverseMercator classGeographicLib_1_1TransverseMercator.html a9a4074c9d0ea35f0ebfc9c9f73bd3183 (real a, real f, real k0) void Forward classGeographicLib_1_1TransverseMercator.html a07d73a6d94e2434cbb937978d61a5ae7 (real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const void Reverse classGeographicLib_1_1TransverseMercator.html a15611aee4e3707e155278bab02403a07 (real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const void Forward classGeographicLib_1_1TransverseMercator.html af689c212234963734354347d56bf12f6 (real lon0, real lat, real lon, real &x, real &y) const void Reverse classGeographicLib_1_1TransverseMercator.html ac3bd58646dd6c06731a9baadee11f7e5 (real lon0, real x, real y, real &lat, real &lon) const Math::real MajorRadius classGeographicLib_1_1TransverseMercator.html a47e93a8cde548b6e8d7c4c076bac4be6 () const Math::real Flattening classGeographicLib_1_1TransverseMercator.html a6571ba8c59fd7e5e32c9994d37d4cdb5 () const Math::real CentralScale classGeographicLib_1_1TransverseMercator.html a63876dc20e8765501ca62022f9a73432 () const static const TransverseMercator UTM classGeographicLib_1_1TransverseMercator.html aa25b52e35bc54c368e6c8b17e02b0542 GeographicLib::TransverseMercatorExact classGeographicLib_1_1TransverseMercatorExact.html TransverseMercatorExact classGeographicLib_1_1TransverseMercatorExact.html a72ffcc89eee6f30a6d1f4d061518a6f1 (real a, real f, real k0, bool extendp=false) void Forward classGeographicLib_1_1TransverseMercatorExact.html a0dab8d1a275df9e4796d2d858f42f7e3 (real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const void Reverse classGeographicLib_1_1TransverseMercatorExact.html a350070780708de5a622d4f4c4757104c (real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const void Forward classGeographicLib_1_1TransverseMercatorExact.html a39c294a3389af325c41a8de51fd9228a (real lon0, real lat, real lon, real &x, real &y) const void Reverse classGeographicLib_1_1TransverseMercatorExact.html a56ff2f371d59e2ca0da8644571706169 (real lon0, real x, real y, real &lat, real &lon) const Math::real MajorRadius classGeographicLib_1_1TransverseMercatorExact.html a19083f16ecfc51f9020d7242b3ded43e () const Math::real Flattening classGeographicLib_1_1TransverseMercatorExact.html a4045ec4b01c99c4bb589b1b3e7e07ca4 () const Math::real CentralScale classGeographicLib_1_1TransverseMercatorExact.html a355a827f45c194d56a465e0d4f91c3a3 () const static const TransverseMercatorExact UTM classGeographicLib_1_1TransverseMercatorExact.html a68668637e754201897bddb82baaf634b GeographicLib::Utility classGeographicLib_1_1Utility.html static int day classGeographicLib_1_1Utility.html a877a58000a56bc84c354cf42b4b1cd99 (int y, int m=1, int d=1) static int day classGeographicLib_1_1Utility.html a0590e044fe0352adc10a58c46fa1e529 (int y, int m, int d, bool check) static void date classGeographicLib_1_1Utility.html aa6955e745deebb79795b12ab139798e0 (int s, int &y, int &m, int &d) static void date classGeographicLib_1_1Utility.html a3b62cb71f8b7cafd49c1bf3389298525 (const std::string &s, int &y, int &m, int &d) static int dow classGeographicLib_1_1Utility.html a42a6f8679c068dcb06f1da26aa21dfb1 (int y, int m, int d) static int dow classGeographicLib_1_1Utility.html a4687c34e55dc7ccc135e31a72402f008 (int s) static T fractionalyear classGeographicLib_1_1Utility.html a074607cb34326b7109532c8fdd07e38c (const std::string &s) static std::string str classGeographicLib_1_1Utility.html ae87a7ae2bee75f724907af9f753f03b7 (T x, int p=-1) static T num classGeographicLib_1_1Utility.html aa35f1f83c0543558a79b3cf42ddf50c8 (const std::string &s) static T nummatch classGeographicLib_1_1Utility.html ad0d89bfe63814bab5312306fe3ac2b43 (const std::string &s) static T fract classGeographicLib_1_1Utility.html a46b13d9ce2893f7e0fe6e7da093f528f (const std::string &s) static int lookup classGeographicLib_1_1Utility.html a9a47fdaaa00a92e9a42035e62bd98faa (const std::string &s, char c) static void readarray classGeographicLib_1_1Utility.html a23e88040ceb60bd3fe28efc04f9119f8 (std::istream &str, IntT array[], size_t num) static void readarray classGeographicLib_1_1Utility.html a044796b4fc14a952abec27da27fc20be (std::istream &str, std::vector< IntT > &array) static void writearray classGeographicLib_1_1Utility.html a276eb20ace49c5260e1878c7d8aefd31 (std::ostream &str, const IntT array[], size_t num) static void writearray classGeographicLib_1_1Utility.html a0621066e4aa146a2c100802375e70389 (std::ostream &str, std::vector< IntT > &array) static bool ParseLine classGeographicLib_1_1Utility.html a96252f445a912b77517bff04d4d6ea74 (const std::string &line, std::string &key, std::string &val) GeographicLib::UTMUPS classGeographicLib_1_1UTMUPS.html zonespec classGeographicLib_1_1UTMUPS.html a0c459615da18cc899a960bdc8c5b11b7 MINPSEUDOZONE classGeographicLib_1_1UTMUPS.html a0c459615da18cc899a960bdc8c5b11b7a058ac8a834bbc78ce73d9b37a1a5dfb9 INVALID classGeographicLib_1_1UTMUPS.html a0c459615da18cc899a960bdc8c5b11b7aeb6750fb82edce6e5b58178a38ee8bd0 MATCH classGeographicLib_1_1UTMUPS.html a0c459615da18cc899a960bdc8c5b11b7a9059a8e3b4721e27869e99ed1ae3d320 UTM classGeographicLib_1_1UTMUPS.html a0c459615da18cc899a960bdc8c5b11b7aacc8f89ac6144b1e445ca21cbe9a2533 STANDARD classGeographicLib_1_1UTMUPS.html a0c459615da18cc899a960bdc8c5b11b7adf96495ab4bfbf495f1fe31aebb9e406 MAXPSEUDOZONE classGeographicLib_1_1UTMUPS.html a0c459615da18cc899a960bdc8c5b11b7ac22db7e136b6e06fba7c3c06b5888362 MINZONE classGeographicLib_1_1UTMUPS.html a0c459615da18cc899a960bdc8c5b11b7af91adc987ae7295bfb6d3786b23c58e1 UPS classGeographicLib_1_1UTMUPS.html a0c459615da18cc899a960bdc8c5b11b7a40256f9ab9f277957f8ab697bcd2fd42 MINUTMZONE classGeographicLib_1_1UTMUPS.html a0c459615da18cc899a960bdc8c5b11b7a1413e6cc83d4bf1eb4ad1c0f1d745eb6 MAXUTMZONE classGeographicLib_1_1UTMUPS.html a0c459615da18cc899a960bdc8c5b11b7ae8e04ab8df50a062c1fe277a6880bc19 MAXZONE classGeographicLib_1_1UTMUPS.html a0c459615da18cc899a960bdc8c5b11b7a12dabceb6da15aa0fc94b9406aca921a static int StandardZone classGeographicLib_1_1UTMUPS.html a62623c295d1b43318a9fa762c3da94ea (real lat, real lon, int setzone=STANDARD) static void Forward classGeographicLib_1_1UTMUPS.html a921d6c23e728e0b17651902d43fb56e8 (real lat, real lon, int &zone, bool &northp, real &x, real &y, real &gamma, real &k, int setzone=STANDARD, bool mgrslimits=false) static void Reverse classGeographicLib_1_1UTMUPS.html aaf417ae6bed6da324aa03fc96ee0dda4 (int zone, bool northp, real x, real y, real &lat, real &lon, real &gamma, real &k, bool mgrslimits=false) static void Forward classGeographicLib_1_1UTMUPS.html aa21ec1bc26f691e0a6f2ccc44debe6f0 (real lat, real lon, int &zone, bool &northp, real &x, real &y, int setzone=STANDARD, bool mgrslimits=false) static void Reverse classGeographicLib_1_1UTMUPS.html ac8cbfd7b15c96b52b876b54ce68f7b4d (int zone, bool northp, real x, real y, real &lat, real &lon, bool mgrslimits=false) static void DecodeZone classGeographicLib_1_1UTMUPS.html ad74d52d7ebeff195019745f791f30562 (const std::string &zonestr, int &zone, bool &northp) static std::string EncodeZone classGeographicLib_1_1UTMUPS.html a3410e1e221158962f34147255653818f (int zone, bool northp) static Math::real UTMShift classGeographicLib_1_1UTMUPS.html abd70d3f90f5c79a09bdd217b67e6729b () static Math::real MajorRadius classGeographicLib_1_1UTMUPS.html a293aa30508096d49db77a23917ea1092 () static Math::real Flattening classGeographicLib_1_1UTMUPS.html a182de2e29f1181c55a266777039b8a9d () include/GeographicLib/ /scratch/geographic-dist/gita/geographiclib/include/GeographicLib/ dir_b4d36717c8020107727c093197410e9d.html Accumulator.hpp AlbersEqualArea.hpp AzimuthalEquidistant.hpp CassiniSoldner.hpp CircularEngine.hpp Constants.hpp DMS.hpp EllipticFunction.hpp Geocentric.hpp GeoCoords.hpp Geodesic.hpp GeodesicLine.hpp Geoid.hpp Gnomonic.hpp GravityCircle.hpp GravityModel.hpp LambertConformalConic.hpp LocalCartesian.hpp MagneticCircle.hpp MagneticModel.hpp Math.hpp MGRS.hpp NormalGravity.hpp OSGB.hpp PolarStereographic.hpp PolygonArea.hpp SphericalEngine.hpp SphericalHarmonic.hpp SphericalHarmonic1.hpp SphericalHarmonic2.hpp TransverseMercator.hpp TransverseMercatorExact.hpp Utility.hpp UTMUPS.hpp include/ /scratch/geographic-dist/gita/geographiclib/include/ dir_addd23a7fcb542c6c8ac894d486b21be.html include/GeographicLib/ src/ /scratch/geographic-dist/gita/geographiclib/src/ dir_20dd3cf0f425f295158796088ceb05f4.html AlbersEqualArea.cpp AzimuthalEquidistant.cpp CassiniSoldner.cpp CircularEngine.cpp DMS.cpp EllipticFunction.cpp Geocentric.cpp GeoCoords.cpp Geodesic.cpp GeodesicLine.cpp Geoid.cpp Gnomonic.cpp GravityCircle.cpp GravityModel.cpp LambertConformalConic.cpp LocalCartesian.cpp MagneticCircle.cpp MagneticModel.cpp MGRS.cpp NormalGravity.cpp OSGB.cpp PolarStereographic.cpp PolygonArea.cpp SphericalEngine.cpp TransverseMercator.cpp TransverseMercatorExact.cpp Utility.cpp UTMUPS.cpp tools/ /scratch/geographic-dist/gita/geographiclib/tools/ dir_27ad12676aedce3065ab152db424ea04.html CartConvert.cpp ConicProj.cpp GeoConvert.cpp Geod.cpp GeodesicProj.cpp GeoidEval.cpp Gravity.cpp MagneticField.cpp Planimeter.cpp TransverseMercatorProj.cpp geographiclib-1.21/doc/html/GeoConvert_8cpp.html0000644000175000017500000001267511745620414021477 0ustar frankiefrankie GeographicLib: GeoConvert.cpp File Reference
GeoConvert.cpp File Reference

Command line utility for geographic coordinate conversions. More...

#include <iostream>
#include <sstream>
#include <string>
#include <fstream>
#include <GeographicLib/GeoCoords.hpp>
#include <GeographicLib/DMS.hpp>
#include <GeographicLib/Utility.hpp>
#include "GeoConvert.usage"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Detailed Description

Command line utility for geographic coordinate conversions.

Copyright (c) Charles Karney (2008-2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Compile and link with g++ -g -O3 -I../include -I../man -o GeoConvert \ GeoConvert.cpp \ ../src/DMS.cpp \ ../src/GeoCoords.cpp \ ../src/MGRS.cpp \ ../src/PolarStereographic.cpp \ ../src/TransverseMercator.cpp \ ../src/UTMUPS.cpp

See the man page for usage information.

Definition in file GeoConvert.cpp.


Function Documentation

int main ( int  argc,
char *  argv[] 
)
geographiclib-1.21/doc/html/GeodesicLine_8hpp_source.html0000644000175000017500000021463211745620414023340 0ustar frankiefrankie GeographicLib: GeodesicLine.hpp Source File
GeodesicLine.hpp
Go to the documentation of this file.
00001 /**
00002  * \file GeodesicLine.hpp
00003  * \brief Header for GeographicLib::GeodesicLine class
00004  *
00005  * Copyright (c) Charles Karney (2009-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_GEODESICLINE_HPP)
00011 #define GEOGRAPHICLIB_GEODESICLINE_HPP \
00012   "$Id: 4bbc611bc3837d78456bc227e17bea39cb443745 $"
00013 
00014 #include <GeographicLib/Constants.hpp>
00015 #include <GeographicLib/Geodesic.hpp>
00016 
00017 namespace GeographicLib {
00018 
00019   /**
00020    * \brief A geodesic line.
00021    *
00022    * GeodesicLine facilitates the determination of a series of points on a
00023    * single geodesic.  The starting point (\e lat1, \e lon1) and the azimuth \e
00024    * azi1 are specified in the constructor.  GeodesicLine.Position returns the
00025    * location of point 2 a distance \e s12 along the geodesic.  Alternatively
00026    * GeodesicLine.ArcPosition gives the position of point 2 an arc length \e
00027    * a12 along the geodesic.
00028    *
00029    * The default copy constructor and assignment operators work with this
00030    * class.  Similarly, a vector can be used to hold GeodesicLine objects.
00031    *
00032    * The calculations are accurate to better than 15 nm (15 nanometers).  See
00033    * Sec. 9 of
00034    * <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for
00035    * details.
00036    *
00037    * The algorithms are described in
00038    * - C. F. F. Karney,
00039    *   <a href="http://arxiv.org/abs/1102.1215v1">Geodesics
00040    *   on an ellipsoid of revolution</a>,
00041    *   Feb. 2011;
00042    *   preprint
00043    *   <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a>.
00044    * - C. F. F. Karney,
00045    *   <a href="http://arxiv.org/abs/1109.4448">Algorithms for geodesics</a>,
00046    *   Sept. 2011;
00047    *   preprint
00048    *   <a href="http://arxiv.org/abs/1109.4448">arxiv:1109.4448</a>.
00049    * .
00050    * For more information on geodesics see \ref geodesic.
00051    *
00052    * Example of use:
00053    * \include example-GeodesicLine.cpp
00054    *
00055    * <a href="Geod.1.html">Geod</a> is a command-line utility providing access
00056    * to the functionality of Geodesic and GeodesicLine.
00057    **********************************************************************/
00058 
00059   class GEOGRAPHIC_EXPORT GeodesicLine {
00060   private:
00061     typedef Math::real real;
00062     friend class Geodesic;
00063     static const int nC1_ = Geodesic::nC1_;
00064     static const int nC1p_ = Geodesic::nC1p_;
00065     static const int nC2_ = Geodesic::nC2_;
00066     static const int nC3_ = Geodesic::nC3_;
00067     static const int nC4_ = Geodesic::nC4_;
00068 
00069     real _lat1, _lon1, _azi1;
00070     real _a, _f, _b, _c2, _f1, _salp0, _calp0, _k2,
00071       _salp1, _calp1, _ssig1, _csig1, _stau1, _ctau1, _somg1, _comg1,
00072       _A1m1, _A2m1, _A3c, _B11, _B21, _B31, _A4, _B41;
00073     // index zero elements of _C1a, _C1pa, _C2a, _C3a are unused
00074     real _C1a[nC1_ + 1], _C1pa[nC1p_ + 1], _C2a[nC2_ + 1], _C3a[nC3_],
00075       _C4a[nC4_];    // all the elements of _C4a are used
00076     unsigned _caps;
00077 
00078     enum captype {
00079       CAP_NONE = Geodesic::CAP_NONE,
00080       CAP_C1   = Geodesic::CAP_C1,
00081       CAP_C1p  = Geodesic::CAP_C1p,
00082       CAP_C2   = Geodesic::CAP_C2,
00083       CAP_C3   = Geodesic::CAP_C3,
00084       CAP_C4   = Geodesic::CAP_C4,
00085       CAP_ALL  = Geodesic::CAP_ALL,
00086       OUT_ALL  = Geodesic::OUT_ALL,
00087     };
00088   public:
00089 
00090     /**
00091      * Bit masks for what calculations to do.  They signify to the
00092      * GeodesicLine::GeodesicLine constructor and to Geodesic::Line what
00093      * capabilities should be included in the GeodesicLine object.  This is
00094      * merely a duplication of Geodesic::mask.
00095      **********************************************************************/
00096     enum mask {
00097       /**
00098        * No capabilities, no output.
00099        * @hideinitializer
00100        **********************************************************************/
00101       NONE          = Geodesic::NONE,
00102       /**
00103        * Calculate latitude \e lat2.  (It's not necessary to include this as a
00104        * capability to GeodesicLine because this is included by default.)
00105        * @hideinitializer
00106        **********************************************************************/
00107       LATITUDE      = Geodesic::LATITUDE,
00108       /**
00109        * Calculate longitude \e lon2.
00110        * @hideinitializer
00111        **********************************************************************/
00112       LONGITUDE     = Geodesic::LONGITUDE,
00113       /**
00114        * Calculate azimuths \e azi1 and \e azi2.  (It's not necessary to
00115        * include this as a capability to GeodesicLine because this is included
00116        * by default.)
00117        * @hideinitializer
00118        **********************************************************************/
00119       AZIMUTH       = Geodesic::AZIMUTH,
00120       /**
00121        * Calculate distance \e s12.
00122        * @hideinitializer
00123        **********************************************************************/
00124       DISTANCE      = Geodesic::DISTANCE,
00125       /**
00126        * Allow distance \e s12 to be used as input in the direct geodesic
00127        * problem.
00128        * @hideinitializer
00129        **********************************************************************/
00130       DISTANCE_IN   = Geodesic::DISTANCE_IN,
00131       /**
00132        * Calculate reduced length \e m12.
00133        * @hideinitializer
00134        **********************************************************************/
00135       REDUCEDLENGTH = Geodesic::REDUCEDLENGTH,
00136       /**
00137        * Calculate geodesic scales \e M12 and \e M21.
00138        * @hideinitializer
00139        **********************************************************************/
00140       GEODESICSCALE = Geodesic::GEODESICSCALE,
00141       /**
00142        * Calculate area \e S12.
00143        * @hideinitializer
00144        **********************************************************************/
00145       AREA          = Geodesic::AREA,
00146       /**
00147        * All capabilities.  Calculate everything.
00148        * @hideinitializer
00149        **********************************************************************/
00150       ALL           = Geodesic::ALL,
00151     };
00152 
00153     /** \name Constructors
00154      **********************************************************************/
00155     ///@{
00156 
00157     /**
00158      * Constructor for a geodesic line staring at latitude \e lat1, longitude
00159      * \e lon1, and azimuth \e azi1 (all in degrees).
00160      *
00161      * @param[in] g A Geodesic object used to compute the necessary information
00162      *   about the GeodesicLine.
00163      *
00164      * @param[in] lat1 latitude of point 1 (degrees).
00165      * @param[in] lon1 longitude of point 1 (degrees).
00166      * @param[in] azi1 azimuth at point 1 (degrees).
00167      * @param[in] caps bitor'ed combination of GeodesicLine::mask values
00168      *   specifying the capabilities the GeodesicLine object should possess,
00169      *   i.e., which quantities can be returned in calls to
00170      *   GeodesicLib::Position.
00171      *
00172      * \e lat1 should be in the range [-90, 90]; \e lon1 and \e azi1 should be
00173      * in the range [-180, 360].
00174      *
00175      * The GeodesicLine::mask values are
00176      * - \e caps |= GeodesicLine::LATITUDE for the latitude \e lat2; this is
00177      *   added automatically
00178      * - \e caps |= GeodesicLine::LONGITUDE for the latitude \e lon2
00179      * - \e caps |= GeodesicLine::AZIMUTH for the latitude \e azi2; this is
00180      *   added automatically
00181      * - \e caps |= GeodesicLine::DISTANCE for the distance \e s12
00182      * - \e caps |= GeodesicLine::REDUCEDLENGTH for the reduced length \e m12
00183      * - \e caps |= GeodesicLine::GEODESICSCALE for the geodesic scales \e M12
00184      *   and \e M21
00185      * - \e caps |= GeodesicLine::AREA for the area \e S12
00186      * - \e caps |= GeodesicLine::DISTANCE_IN permits the length of the
00187      *   geodesic to be given in terms of \e s12; without this capability the
00188      *   length can only be specified in terms of arc length.
00189      * .
00190      * The default value of \e caps is GeodesicLine::ALL which turns on all the
00191      * capabilities.
00192      *
00193      * If the point is at a pole, the azimuth is defined by keeping the \e lon1
00194      * fixed and writing \e lat1 = 90 - \e eps or -90 + \e eps and taking the
00195      * limit \e eps -> 0 from above.
00196      **********************************************************************/
00197     GeodesicLine(const Geodesic& g, real lat1, real lon1, real azi1,
00198                  unsigned caps = ALL)
00199       throw();
00200 
00201     /**
00202      * A default constructor.  If GeodesicLine::Position is called on the
00203      * resulting object, it returns immediately (without doing any
00204      * calculations).  The object can be set with a call to Geodesic::Line.
00205      * Use Init() to test whether object is still in this uninitialized state.
00206      **********************************************************************/
00207     GeodesicLine() throw() : _caps(0U) {}
00208     ///@}
00209 
00210     /** \name Position in terms of distance
00211      **********************************************************************/
00212     ///@{
00213 
00214     /**
00215      * Compute the position of point 2 which is a distance \e s12 (meters)
00216      * from point 1.
00217      *
00218      * @param[in] s12 distance between point 1 and point 2 (meters); it can be
00219      *   signed.
00220      * @param[out] lat2 latitude of point 2 (degrees).
00221      * @param[out] lon2 longitude of point 2 (degrees); requires that the
00222      *   GeodesicLine object was constructed with \e caps |=
00223      *   GeodesicLine::LONGITUDE.
00224      * @param[out] azi2 (forward) azimuth at point 2 (degrees).
00225      * @param[out] m12 reduced length of geodesic (meters); requires that the
00226      *   GeodesicLine object was constructed with \e caps |=
00227      *   GeodesicLine::REDUCEDLENGTH.
00228      * @param[out] M12 geodesic scale of point 2 relative to point 1
00229      *   (dimensionless); requires that the GeodesicLine object was constructed
00230      *   with \e caps |= GeodesicLine::GEODESICSCALE.
00231      * @param[out] M21 geodesic scale of point 1 relative to point 2
00232      *   (dimensionless); requires that the GeodesicLine object was constructed
00233      *   with \e caps |= GeodesicLine::GEODESICSCALE.
00234      * @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires
00235      *   that the GeodesicLine object was constructed with \e caps |=
00236      *   GeodesicLine::AREA.
00237      * @return \e a12 arc length of between point 1 and point 2 (degrees).
00238      *
00239      * The values of \e lon2 and \e azi2 returned are in the range [-180, 180).
00240      *
00241      * The GeodesicLine object \e must have been constructed with \e caps |=
00242      * GeodesicLine::DISTANCE_IN; otherwise Math::NaN() is returned and no
00243      * parameters are set.  Requesting a value which the GeodesicLine object is
00244      * not capable of computing is not an error; the corresponding argument
00245      * will not be altered.
00246      *
00247      * The following functions are overloaded versions of
00248      * GeodesicLine::Position which omit some of the output parameters.  Note,
00249      * however, that the arc length is always computed and returned as the
00250      * function value.
00251      **********************************************************************/
00252     Math::real Position(real s12,
00253                         real& lat2, real& lon2, real& azi2,
00254                         real& m12, real& M12, real& M21,
00255                         real& S12) const throw() {
00256       real t;
00257       return GenPosition(false, s12,
00258                          LATITUDE | LONGITUDE | AZIMUTH |
00259                          REDUCEDLENGTH | GEODESICSCALE | AREA,
00260                          lat2, lon2, azi2, t, m12, M12, M21, S12);
00261     }
00262 
00263     /**
00264      * See the documentation for GeodesicLine::Position.
00265      **********************************************************************/
00266     Math::real Position(real s12, real& lat2, real& lon2) const throw() {
00267       real t;
00268       return GenPosition(false, s12,
00269                          LATITUDE | LONGITUDE,
00270                          lat2, lon2, t, t, t, t, t, t);
00271     }
00272 
00273     /**
00274      * See the documentation for GeodesicLine::Position.
00275      **********************************************************************/
00276     Math::real Position(real s12, real& lat2, real& lon2,
00277                         real& azi2) const throw() {
00278       real t;
00279       return GenPosition(false, s12,
00280                          LATITUDE | LONGITUDE | AZIMUTH,
00281                          lat2, lon2, azi2, t, t, t, t, t);
00282     }
00283 
00284     /**
00285      * See the documentation for GeodesicLine::Position.
00286      **********************************************************************/
00287     Math::real Position(real s12, real& lat2, real& lon2,
00288                         real& azi2, real& m12) const throw() {
00289       real t;
00290       return GenPosition(false, s12,
00291                          LATITUDE | LONGITUDE |
00292                          AZIMUTH | REDUCEDLENGTH,
00293                          lat2, lon2, azi2, t, m12, t, t, t);
00294     }
00295 
00296     /**
00297      * See the documentation for GeodesicLine::Position.
00298      **********************************************************************/
00299     Math::real Position(real s12, real& lat2, real& lon2,
00300                         real& azi2, real& M12, real& M21)
00301       const throw() {
00302       real t;
00303       return GenPosition(false, s12,
00304                          LATITUDE | LONGITUDE |
00305                          AZIMUTH | GEODESICSCALE,
00306                          lat2, lon2, azi2, t, t, M12, M21, t);
00307     }
00308 
00309     /**
00310      * See the documentation for GeodesicLine::Position.
00311      **********************************************************************/
00312     Math::real Position(real s12,
00313                         real& lat2, real& lon2, real& azi2,
00314                         real& m12, real& M12, real& M21)
00315       const throw() {
00316       real t;
00317       return GenPosition(false, s12,
00318                          LATITUDE | LONGITUDE | AZIMUTH |
00319                          REDUCEDLENGTH | GEODESICSCALE,
00320                          lat2, lon2, azi2, t, m12, M12, M21, t);
00321     }
00322 
00323     ///@}
00324 
00325     /** \name Position in terms of arc length
00326      **********************************************************************/
00327     ///@{
00328 
00329     /**
00330      * Compute the position of point 2 which is an arc length \e a12 (degrees)
00331      * from point 1.
00332      *
00333      * @param[in] a12 arc length between point 1 and point 2 (degrees); it can
00334      *   be signed.
00335      * @param[out] lat2 latitude of point 2 (degrees).
00336      * @param[out] lon2 longitude of point 2 (degrees); requires that the
00337      *   GeodesicLine object was constructed with \e caps |=
00338      *   GeodesicLine::LONGITUDE.
00339      * @param[out] azi2 (forward) azimuth at point 2 (degrees).
00340      * @param[out] s12 distance between point 1 and point 2 (meters); requires
00341      *   that the GeodesicLine object was constructed with \e caps |=
00342      *   GeodesicLine::DISTANCE.
00343      * @param[out] m12 reduced length of geodesic (meters); requires that the
00344      *   GeodesicLine object was constructed with \e caps |=
00345      *   GeodesicLine::REDUCEDLENGTH.
00346      * @param[out] M12 geodesic scale of point 2 relative to point 1
00347      *   (dimensionless); requires that the GeodesicLine object was constructed
00348      *   with \e caps |= GeodesicLine::GEODESICSCALE.
00349      * @param[out] M21 geodesic scale of point 1 relative to point 2
00350      *   (dimensionless); requires that the GeodesicLine object was constructed
00351      *   with \e caps |= GeodesicLine::GEODESICSCALE.
00352      * @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires
00353      *   that the GeodesicLine object was constructed with \e caps |=
00354      *   GeodesicLine::AREA.
00355      *
00356      * The values of \e lon2 and \e azi2 returned are in the range [-180, 180).
00357      *
00358      * Requesting a value which the GeodesicLine object is not capable of
00359      * computing is not an error; the corresponding argument will not be
00360      * altered.
00361      *
00362      * The following functions are overloaded versions of
00363      * GeodesicLine::ArcPosition which omit some of the output parameters.
00364      **********************************************************************/
00365     void ArcPosition(real a12, real& lat2, real& lon2, real& azi2,
00366                      real& s12, real& m12, real& M12, real& M21,
00367                      real& S12) const throw() {
00368       GenPosition(true, a12,
00369                   LATITUDE | LONGITUDE | AZIMUTH | DISTANCE |
00370                   REDUCEDLENGTH | GEODESICSCALE | AREA,
00371                   lat2, lon2, azi2, s12, m12, M12, M21, S12);
00372     }
00373 
00374     /**
00375      * See the documentation for GeodesicLine::ArcPosition.
00376      **********************************************************************/
00377     void ArcPosition(real a12, real& lat2, real& lon2)
00378       const throw() {
00379       real t;
00380       GenPosition(true, a12,
00381                   LATITUDE | LONGITUDE,
00382                   lat2, lon2, t, t, t, t, t, t);
00383     }
00384 
00385     /**
00386      * See the documentation for GeodesicLine::ArcPosition.
00387      **********************************************************************/
00388     void ArcPosition(real a12,
00389                      real& lat2, real& lon2, real& azi2)
00390       const throw() {
00391       real t;
00392       GenPosition(true, a12,
00393                   LATITUDE | LONGITUDE | AZIMUTH,
00394                   lat2, lon2, azi2, t, t, t, t, t);
00395     }
00396 
00397     /**
00398      * See the documentation for GeodesicLine::ArcPosition.
00399      **********************************************************************/
00400     void ArcPosition(real a12, real& lat2, real& lon2, real& azi2,
00401                      real& s12) const throw() {
00402       real t;
00403       GenPosition(true, a12,
00404                   LATITUDE | LONGITUDE | AZIMUTH | DISTANCE,
00405                   lat2, lon2, azi2, s12, t, t, t, t);
00406     }
00407 
00408     /**
00409      * See the documentation for GeodesicLine::ArcPosition.
00410      **********************************************************************/
00411     void ArcPosition(real a12, real& lat2, real& lon2, real& azi2,
00412                      real& s12, real& m12) const throw() {
00413       real t;
00414       GenPosition(true, a12,
00415                   LATITUDE | LONGITUDE | AZIMUTH |
00416                   DISTANCE | REDUCEDLENGTH,
00417                   lat2, lon2, azi2, s12, m12, t, t, t);
00418     }
00419 
00420     /**
00421      * See the documentation for GeodesicLine::ArcPosition.
00422      **********************************************************************/
00423     void ArcPosition(real a12, real& lat2, real& lon2, real& azi2,
00424                      real& s12, real& M12, real& M21)
00425       const throw() {
00426       real t;
00427       GenPosition(true, a12,
00428                   LATITUDE | LONGITUDE | AZIMUTH |
00429                   DISTANCE | GEODESICSCALE,
00430                   lat2, lon2, azi2, s12, t, M12, M21, t);
00431     }
00432 
00433     /**
00434      * See the documentation for GeodesicLine::ArcPosition.
00435      **********************************************************************/
00436     void ArcPosition(real a12, real& lat2, real& lon2, real& azi2,
00437                      real& s12, real& m12, real& M12, real& M21)
00438       const throw() {
00439       real t;
00440       GenPosition(true, a12,
00441                   LATITUDE | LONGITUDE | AZIMUTH |
00442                   DISTANCE | REDUCEDLENGTH | GEODESICSCALE,
00443                   lat2, lon2, azi2, s12, m12, M12, M21, t);
00444     }
00445     ///@}
00446 
00447     /** \name The general position function.
00448      **********************************************************************/
00449     ///@{
00450 
00451     /**
00452      * The general position function.  GeodesicLine::Position and
00453      * GeodesicLine::ArcPosition are defined in terms of this function.
00454      *
00455      * @param[in] arcmode boolean flag determining the meaning of the second
00456      *   parameter; if arcmode is false, then the GeodesicLine object must have
00457      *   been constructed with \e caps |= GeodesicLine::DISTANCE_IN.
00458      * @param[in] s12_a12 if \e arcmode is false, this is the distance between
00459      *   point 1 and point 2 (meters); otherwise it is the arc length between
00460      *   point 1 and point 2 (degrees); it can be signed.
00461      * @param[in] outmask a bitor'ed combination of GeodesicLine::mask values
00462      *   specifying which of the following parameters should be set.
00463      * @param[out] lat2 latitude of point 2 (degrees).
00464      * @param[out] lon2 longitude of point 2 (degrees); requires that the
00465      *   GeodesicLine object was constructed with \e caps |=
00466      *   GeodesicLine::LONGITUDE.
00467      * @param[out] azi2 (forward) azimuth at point 2 (degrees).
00468      * @param[out] s12 distance between point 1 and point 2 (meters); requires
00469      *   that the GeodesicLine object was constructed with \e caps |=
00470      *   GeodesicLine::DISTANCE.
00471      * @param[out] m12 reduced length of geodesic (meters); requires that the
00472      *   GeodesicLine object was constructed with \e caps |=
00473      *   GeodesicLine::REDUCEDLENGTH.
00474      * @param[out] M12 geodesic scale of point 2 relative to point 1
00475      *   (dimensionless); requires that the GeodesicLine object was constructed
00476      *   with \e caps |= GeodesicLine::GEODESICSCALE.
00477      * @param[out] M21 geodesic scale of point 1 relative to point 2
00478      *   (dimensionless); requires that the GeodesicLine object was constructed
00479      *   with \e caps |= GeodesicLine::GEODESICSCALE.
00480      * @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires
00481      *   that the GeodesicLine object was constructed with \e caps |=
00482      *   GeodesicLine::AREA.
00483      * @return \e a12 arc length of between point 1 and point 2 (degrees).
00484      *
00485      * The GeodesicLine::mask values possible for \e outmask are
00486      * - \e outmask |= GeodesicLine::LATITUDE for the latitude \e lat2.
00487      * - \e outmask |= GeodesicLine::LONGITUDE for the latitude \e lon2.
00488      * - \e outmask |= GeodesicLine::AZIMUTH for the latitude \e azi2.
00489      * - \e outmask |= GeodesicLine::DISTANCE for the distance \e s12.
00490      * - \e outmask |= GeodesicLine::REDUCEDLENGTH for the reduced length \e
00491      *   m12.
00492      * - \e outmask |= GeodesicLine::GEODESICSCALE for the geodesic scales \e
00493      *   M12 and \e M21.
00494      * - \e outmask |= GeodesicLine::AREA for the area \e S12.
00495      * .
00496      * Requesting a value which the GeodesicLine object is not capable of
00497      * computing is not an error; the corresponding argument will not be
00498      * altered.  Note, however, that the arc length is always computed and
00499      * returned as the function value.
00500      **********************************************************************/
00501     Math::real GenPosition(bool arcmode, real s12_a12, unsigned outmask,
00502                            real& lat2, real& lon2, real& azi2,
00503                            real& s12, real& m12, real& M12, real& M21,
00504                            real& S12) const throw();
00505 
00506     ///@}
00507 
00508     /** \name Inspector functions
00509      **********************************************************************/
00510     ///@{
00511 
00512     /**
00513      * @return true if the object has been initialized.
00514      **********************************************************************/
00515     bool Init() const throw() { return _caps != 0U; }
00516 
00517     /**
00518      * @return \e lat1 the latitude of point 1 (degrees).
00519      **********************************************************************/
00520     Math::real Latitude() const throw()
00521     { return Init() ? _lat1 : Math::NaN<real>(); }
00522 
00523     /**
00524      * @return \e lon1 the longitude of point 1 (degrees).
00525      **********************************************************************/
00526     Math::real Longitude() const throw()
00527     { return Init() ? _lon1 : Math::NaN<real>(); }
00528 
00529     /**
00530      * @return \e azi1 the azimuth (degrees) of the geodesic line at point 1.
00531      **********************************************************************/
00532     Math::real Azimuth() const throw()
00533     { return Init() ? _azi1 : Math::NaN<real>(); }
00534 
00535     /**
00536      * @return \e azi0 the azimuth (degrees) of the geodesic line as it crosses
00537      * the equator in a northward direction.
00538      **********************************************************************/
00539     Math::real EquatorialAzimuth() const throw() {
00540       return Init() ?
00541         atan2(_salp0, _calp0) / Math::degree<real>() : Math::NaN<real>();
00542     }
00543 
00544     /**
00545      * @return \e a1 the arc length (degrees) between the northward equatorial
00546      * crossing and point 1.
00547      **********************************************************************/
00548     Math::real EquatorialArc() const throw() {
00549       return Init() ?
00550         atan2(_ssig1, _csig1) / Math::degree<real>() : Math::NaN<real>();
00551     }
00552 
00553     /**
00554      * @return \e a the equatorial radius of the ellipsoid (meters).  This is
00555      *   the value inherited from the Geodesic object used in the constructor.
00556      **********************************************************************/
00557     Math::real MajorRadius() const throw()
00558     { return Init() ? _a : Math::NaN<real>(); }
00559 
00560     /**
00561      * @return \e f the flattening of the ellipsoid.  This is the value
00562      *   inherited from the Geodesic object used in the constructor.
00563      **********************************************************************/
00564     Math::real Flattening() const throw()
00565     { return Init() ? _f : Math::NaN<real>(); }
00566 
00567     /// \cond SKIP
00568     /**
00569      * <b>DEPRECATED</b>
00570      * @return \e r the inverse flattening of the ellipsoid.
00571      **********************************************************************/
00572     Math::real InverseFlattening() const throw()
00573     { return Init() ? 1/_f : Math::NaN<real>(); }
00574     /// \endcond
00575 
00576     /**
00577      * @return \e caps the computational capabilities that this object was
00578      *   constructed with.  LATITUDE and AZIMUTH are always included.
00579      **********************************************************************/
00580     unsigned Capabilities() const throw() { return _caps; }
00581 
00582     /**
00583      * @param[in] testcaps a set of bitor'ed GeodesicLine::mask values.
00584      * @return true if the GeodesicLine object has all these capabilities.
00585      **********************************************************************/
00586     bool Capabilities(unsigned testcaps) const throw() {
00587       testcaps &= OUT_ALL;
00588       return (_caps & testcaps) == testcaps;
00589     }
00590     ///@}
00591 
00592   };
00593 
00594 } // namespace GeographicLib
00595 
00596 #endif  // GEOGRAPHICLIB_GEODESICLINE_HPP
geographiclib-1.21/doc/html/functions_func_0x77.html0000644000175000017500000001247711745620415022303 0ustar frankiefrankie GeographicLib: Class Members - Functions geographiclib-1.21/doc/html/CassiniSoldner_8hpp_source.html0000644000175000017500000007700711745620415023732 0ustar frankiefrankie GeographicLib: CassiniSoldner.hpp Source File
CassiniSoldner.hpp
Go to the documentation of this file.
00001 /**
00002  * \file CassiniSoldner.hpp
00003  * \brief Header for GeographicLib::CassiniSoldner class
00004  *
00005  * Copyright (c) Charles Karney (2009-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_CASSINISOLDNER_HPP)
00011 #define GEOGRAPHICLIB_CASSINISOLDNER_HPP \
00012   "$Id: d794ea8a1e64fd9cbb8dcee34755b6dc4fee623a $"
00013 
00014 #include <GeographicLib/Geodesic.hpp>
00015 #include <GeographicLib/GeodesicLine.hpp>
00016 #include <GeographicLib/Constants.hpp>
00017 
00018 namespace GeographicLib {
00019 
00020   /**
00021    * \brief Cassini-Soldner Projection.
00022    *
00023    * Cassini-Soldner projection centered at an arbitrary position, \e lat0, \e
00024    * lon0, on the ellipsoid.  This projection is a transverse cylindrical
00025    * equidistant projection.  The projection from (\e lat, \e lon) to easting
00026    * and northing (\e x, \e y) is defined by geodesics as follows.  Go north
00027    * along a geodesic a distance \e y from the central point; then turn
00028    * clockwise 90<sup>o</sup> and go a distance \e x along a geodesic.
00029    * (Although the initial heading is north, this changes to south if the pole
00030    * is crossed.)  This procedure uniquely defines the reverse projection.  The
00031    * forward projection is constructed as follows.  Find the point (\e lat1, \e
00032    * lon1) on the meridian closest to (\e lat, \e lon).  Here we consider the
00033    * full meridian so that \e lon1 may be either \e lon0 or \e lon0 +
00034    * 180<sup>o</sup>.  \e x is the geodesic distance from (\e lat1, \e lon1) to
00035    * (\e lat, \e lon), appropriately signed according to which side of the
00036    * central meridian (\e lat, \e lon) lies.  \e y is the shortest distance
00037    * along the meridian from (\e lat0, \e lon0) to (\e lat1, \e lon1), again,
00038    * appropriately signed according to the initial heading.  [Note that, in the
00039    * case of prolate ellipsoids, the shortest meridional path from (\e lat0, \e
00040    * lon0) to (\e lat1, \e lon1) may not be the shortest path.]  This procedure
00041    * uniquely defines the forward projection except for a small class of points
00042    * for which there may be two equally short routes for either leg of the
00043    * path.
00044    *
00045    * Because of the properties of geodesics, the (\e x, \e y) grid is
00046    * orthogonal.  The scale in the easting direction is unity.  The scale, \e
00047    * k, in the northing direction is unity on the central meridian and
00048    * increases away from the central meridian.  The projection routines return
00049    * \e azi, the true bearing of the easting direction, and \e rk = 1/\e k, the
00050    * reciprocal of the scale in the northing direction.
00051    *
00052    * The conversions all take place using a Geodesic object (by default
00053    * Geodesic::WGS84).  For more information on geodesics see \ref geodesic.
00054    * The determination of (\e lat1, \e lon1) in the forward projection is by
00055    * solving the inverse geodesic problem for (\e lat, \e lon) and its twin
00056    * obtained by reflection in the meridional plane.  The scale is found by
00057    * determining where two neighboring geodesics intersecting the central
00058    * meridian at \e lat1 and \e lat1 + \e dlat1 intersect and taking the ratio
00059    * of the reduced lengths for the two geodesics between that point and,
00060    * respectively, (\e lat1, \e lon1) and (\e lat, \e lon).
00061    *
00062    * Example of use:
00063    * \include example-CassiniSoldner.cpp
00064    *
00065    * <a href="GeodesicProj.1.html">GeodesicProj</a> is a command-line utility
00066    * providing access to the functionality of AzimuthalEquidistant, Gnomonic,
00067    * and CassiniSoldner.
00068    **********************************************************************/
00069 
00070   class GEOGRAPHIC_EXPORT CassiniSoldner {
00071   private:
00072     typedef Math::real real;
00073     Geodesic _earth;
00074     GeodesicLine _meridian;
00075     real _sbet0, _cbet0;
00076     static const real eps1_;
00077     static const real tiny_;
00078     static const unsigned maxit_ = 10;
00079 
00080     // The following private helper functions are copied from Geodesic.
00081     static inline real AngNormalize(real x) throw() {
00082       // Place angle in [-180, 180).  Assumes x is in [-540, 540).
00083       return x >= 180 ? x - 360 : (x < -180 ? x + 360 : x);
00084     }
00085     static inline real AngRound(real x) throw() {
00086       // The makes the smallest gap in x = 1/16 - nextafter(1/16, 0) = 1/2^57
00087       // for reals = 0.7 pm on the earth if x is an angle in degrees.  (This
00088       // is about 1000 times more resolution than we get with angles around 90
00089       // degrees.)  We use this to avoid having to deal with near singular
00090       // cases when x is non-zero but tiny (e.g., 1.0e-200).
00091       const real z = real(0.0625); // 1/16
00092       volatile real y = std::abs(x);
00093       // The compiler mustn't "simplify" z - (z - y) to y
00094       y = y < z ? z - (z - y) : y;
00095       return x < 0 ? -y : y;
00096     }
00097     static inline void SinCosNorm(real& sinx, real& cosx) throw() {
00098       real r = Math::hypot(sinx, cosx);
00099       sinx /= r;
00100       cosx /= r;
00101     }
00102   public:
00103 
00104     /**
00105      * Constructor for CassiniSoldner.
00106      *
00107      * @param[in] earth the Geodesic object to use for geodesic calculations.
00108      *   By default this uses the WGS84 ellipsoid.
00109      *
00110      * This constructor makes an "uninitialized" object.  Call Reset to set the
00111      * central latitude and longitude, prior to calling Forward and Reverse.
00112      **********************************************************************/
00113     explicit CassiniSoldner(const Geodesic& earth = Geodesic::WGS84) throw()
00114       : _earth(earth) {}
00115 
00116     /**
00117      * Constructor for CassiniSoldner specifying a center point.
00118      *
00119      * @param[in] lat0 latitude of center point of projection (degrees).
00120      * @param[in] lon0 longitude of center point of projection (degrees).
00121      * @param[in] earth the Geodesic object to use for geodesic calculations.
00122      *   By default this uses the WGS84 ellipsoid.
00123      *
00124      * \e lat0 should be in the range [-90, 90] and \e lon0 should be in the
00125      * range [-180, 360].
00126      **********************************************************************/
00127     CassiniSoldner(real lat0, real lon0,
00128                    const Geodesic& earth = Geodesic::WGS84) throw()
00129       : _earth(earth) {
00130       Reset(lat0, lon0);
00131     }
00132 
00133     /**
00134      * Set the central point of the projection
00135      *
00136      * @param[in] lat0 latitude of center point of projection (degrees).
00137      * @param[in] lon0 longitude of center point of projection (degrees).
00138      *
00139      * \e lat0 should be in the range [-90, 90] and \e lon0 should be in the
00140      * range [-180, 360].
00141      **********************************************************************/
00142     void Reset(real lat0, real lon0) throw();
00143 
00144     /**
00145      * Forward projection, from geographic to Cassini-Soldner.
00146      *
00147      * @param[in] lat latitude of point (degrees).
00148      * @param[in] lon longitude of point (degrees).
00149      * @param[out] x easting of point (meters).
00150      * @param[out] y northing of point (meters).
00151      * @param[out] azi azimuth of easting direction at point (degrees).
00152      * @param[out] rk reciprocal of azimuthal northing scale at point.
00153      *
00154      * \e lat should be in the range [-90, 90] and \e lon should be in the
00155      * range [-180, 360].  A call to Forward followed by a call to Reverse will
00156      * return the original (\e lat, \e lon) (to within roundoff).  The routine
00157      * does nothing if the origin has not been set.
00158      **********************************************************************/
00159     void Forward(real lat, real lon,
00160                  real& x, real& y, real& azi, real& rk) const throw();
00161 
00162     /**
00163      * Reverse projection, from Cassini-Soldner to geographic.
00164      *
00165      * @param[in] x easting of point (meters).
00166      * @param[in] y northing of point (meters).
00167      * @param[out] lat latitude of point (degrees).
00168      * @param[out] lon longitude of point (degrees).
00169      * @param[out] azi azimuth of easting direction at point (degrees).
00170      * @param[out] rk reciprocal of azimuthal northing scale at point.
00171      *
00172      * A call to Reverse followed by a call to Forward will return the original
00173      * (\e x, \e y) (to within roundoff), provided that \e x and \e y are
00174      * sufficiently small not to "wrap around" the earth.  The routine does
00175      * nothing if the origin has not been set.
00176      **********************************************************************/
00177     void Reverse(real x, real y,
00178                  real& lat, real& lon, real& azi, real& rk) const throw();
00179 
00180     /**
00181      * CassiniSoldner::Forward without returning the azimuth and scale.
00182      **********************************************************************/
00183     void Forward(real lat, real lon,
00184                  real& x, real& y) const throw() {
00185       real azi, rk;
00186       Forward(lat, lon, x, y, azi, rk);
00187     }
00188 
00189     /**
00190      * CassiniSoldner::Reverse without returning the azimuth and scale.
00191      **********************************************************************/
00192     void Reverse(real x, real y,
00193                  real& lat, real& lon) const throw() {
00194       real azi, rk;
00195       Reverse(x, y, lat, lon, azi, rk);
00196     }
00197 
00198     /** \name Inspector functions
00199      **********************************************************************/
00200     ///@{
00201     /**
00202      * @return true if the object has been initialized.
00203      **********************************************************************/
00204     bool Init() const throw() { return _meridian.Init(); }
00205 
00206     /**
00207      * @return \e lat0 the latitude of origin (degrees).
00208      **********************************************************************/
00209     Math::real LatitudeOrigin() const throw()
00210     { return _meridian.Latitude(); }
00211 
00212     /**
00213      * @return \e lon0 the longitude of origin (degrees).
00214      **********************************************************************/
00215     Math::real LongitudeOrigin() const throw()
00216     { return _meridian.Longitude(); }
00217 
00218     /**
00219      * @return \e a the equatorial radius of the ellipsoid (meters).  This is
00220      *   the value inherited from the Geodesic object used in the constructor.
00221      **********************************************************************/
00222     Math::real MajorRadius() const throw() { return _earth.MajorRadius(); }
00223 
00224     /**
00225      * @return \e f the flattening of the ellipsoid.  This is the value
00226      *   inherited from the Geodesic object used in the constructor.
00227      **********************************************************************/
00228     Math::real Flattening() const throw() { return _earth.Flattening(); }
00229     ///@}
00230 
00231     /// \cond SKIP
00232     /**
00233      * <b>DEPRECATED</b>
00234      * @return \e r the inverse flattening of the ellipsoid.
00235      **********************************************************************/
00236     Math::real InverseFlattening() const throw()
00237     { return _earth.InverseFlattening(); }
00238     /// \endcond
00239   };
00240 
00241 } // namespace GeographicLib
00242 
00243 #endif  // GEOGRAPHICLIB_CASSINISOLDNER_HPP
geographiclib-1.21/doc/html/classGeographicLib_1_1LambertConformalConic-members.html0000644000175000017500000001532211745620414030423 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::LambertConformalConic Member List
This is the complete list of members for GeographicLib::LambertConformalConic, including all inherited members.
CentralScale() const GeographicLib::LambertConformalConic [inline]
Flattening() const GeographicLib::LambertConformalConic [inline]
Forward(real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const GeographicLib::LambertConformalConic
Forward(real lon0, real lat, real lon, real &x, real &y) const GeographicLib::LambertConformalConic [inline]
LambertConformalConic(real a, real f, real stdlat, real k0)GeographicLib::LambertConformalConic
LambertConformalConic(real a, real f, real stdlat1, real stdlat2, real k1)GeographicLib::LambertConformalConic
LambertConformalConic(real a, real f, real sinlat1, real coslat1, real sinlat2, real coslat2, real k1)GeographicLib::LambertConformalConic
MajorRadius() const GeographicLib::LambertConformalConic [inline]
MercatorGeographicLib::LambertConformalConic [static]
OriginLatitude() const GeographicLib::LambertConformalConic [inline]
Reverse(real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const GeographicLib::LambertConformalConic
Reverse(real lon0, real x, real y, real &lat, real &lon) const GeographicLib::LambertConformalConic [inline]
SetScale(real lat, real k=real(1))GeographicLib::LambertConformalConic
geographiclib-1.21/doc/html/LocalCartesian_8cpp.html0000644000175000017500000001137511745620415022305 0ustar frankiefrankie GeographicLib: LocalCartesian.cpp File Reference
LocalCartesian.cpp File Reference

Implementation for GeographicLib::LocalCartesian class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_LOCALCARTESIAN_CPP   "$Id: 4d15764c089e07855bf6db300271e18f4fa89624 $"

Detailed Description

Implementation for GeographicLib::LocalCartesian class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file LocalCartesian.cpp.


Define Documentation

#define GEOGRAPHICLIB_LOCALCARTESIAN_CPP   "$Id: 4d15764c089e07855bf6db300271e18f4fa89624 $"

Definition at line 12 of file LocalCartesian.cpp.

geographiclib-1.21/doc/html/geoid.html0000644000175000017500000007167011745620414017561 0ustar frankiefrankie GeographicLib: Geoid height
Geoid height
Back to Other interfaces (Javascript, Python, Matlab, Octave). Forward to Gravity models. Up to Contents.

The gravitational equipotential surface approximately coinciding with mean sea level is called the geoid. The GeographicLib::Geoid class and the GeoidEval utility evaluate the height of the geoid above the WGS84 ellipsoid. This can be used to convert heights above mean sea level to heights above the WGS84 ellipsoid. Because the normal to the ellipsoid differs from the normal to the geoid (the direction of a plumb line) there is a slight ambiguity in the measurement of heights; however for heights up to 10 km this ambiguity is only 1 mm.

The geoid is usually approximated by an "earth gravity model" (EGM). The models published by the NGA are:

GeographicLib::Geoid offers a uniform way to handle all 3 geoids at a variety of grid resolutions. (In contrast, the software tools that NGA offers are different for each geoid, and the interpolation programs are different for each grid resolution. In addition these tools are written in Fortran with is nowadays difficult to integrate with other software.)

Unlike other components of GeographicLib, there is a appreciable error in the results obtained (at best, the RMS error is 1 mm). However the class provides methods to report the maximum and RMS errors in the results. The class also returns the gradient of the geoid. This can be used to estimate the direction of a plumb line relative to the WGS84 ellipsoid.

The GeographicLib::GravityModel class calculates geoid heights using the underlying gravity model. This is slower then GeographicLib::Geoid but considerably more accurate. This class also can accurately compute all the components of the acceleration due to gravity (and hence the direction of plumb line).

Go to

Installing the geoid datasets

The geoid heights are computed using interpolation into a rectangular grid. The grids are read from data files which have been are computed using the NGA synthesis programs in the case of the EGM84 and EGM96 models and using the NGA binary gridded data files in the case of EGM2008. These data files are available for download:

Available geoid data files
name geoid grid size
(MB)
Download Links (size, MB)
tar file Windows
installer
zip file
egm84-30 EGM84
30'
0.6
link (0.5)
link (0.8)
link (0.5)
egm84-15 EGM84
15'
2.1
link (1.5)
link (1.9)
link (2.0)
egm96-15 EGM96
15'
2.1
link (1.5)
link (1.9)
link (2.0)
egm96-5 EGM96
5'
19
link (11)
link (11)
link (17)
egm2008-5 EGM2008
5'
19
link (11)
link (11)
link (17)
egm2008-2_5 EGM2008
2.5'
75
link (35)
link (33)
link (65)
egm2008-1 EGM2008
1'
470
link (170)
link (130)
link (390)

The "size" column is the size of the uncompressed data and it also gives the memory requirements for caching the entire dataset using the GeographicLib::Geoid::CacheAll method. At a minimum you should install egm96-5 and either egm2008-1 or egm2008-2_5. Many applications use the EGM96 geoid, however the use of EGM2008 is growing. (EGM84 is rarely used now.)

For Linux and Unix systems, GeographicLib provides a shell script geographiclib-get-geoids (typically installed in /usr/local/sbin) which automates the process of downloading and installing the geoid data. For example

   geographiclib-get-geoids best # to install egm84-15, egm96-5, egm2008-1
   geographiclib-get-geoids -h   # for help

This script should be run as a user with write access to the installation directory, which is typically /usr/local/share/GeographicLib (this can be overridden with the -p flag), and the data will then be placed in the "geoids" subdirectory.

Windows users should download and run the Windows installers. These will prompt for an installation directory with the default being one of

   C:/Documents and Settings/All Users/Application Data/GeographicLib
   C:/ProgramData/GeographicLib

(which you probably should not change) and the data is installed in the "geoids" sub-directory. (The second directory name is an alternate name that Windows 7 for the "Application Data" directory.)

Otherwise download either the tar.bz2 file or the zip file (they have the same contents). If possible use the tar.bz2 files, since these are compressed about 2 times better than the zip file. To unpack these, run, for example

   mkdir -p /usr/local/share/GeographicLib
   tar xofjC egm96-5.tar.bz2 /usr/local/share/GeographicLib
   tar xofjC egm2008-2_5.tar.bz2 /usr/local/share/GeographicLib
   etc.

and, again, the data will be placed in the "geoids" subdirectory.

However you install the geoid data, all the datasets should be installed in the same directory. GeographicLib::Geoid and GeoidEval uses a compile time default to locate the datasets. This is

  • /usr/local/share/GeographicLib/geoids, for non-Windows systems
  • C:/Documents and Settings/All Users/Application Data/GeographicLib/geoids, for Windows systems

consistent with the examples above. This may be overridden at run-time by defining the GEOID_PATH or the GEOGRAPHIC_DATA environment variables; see GeographicLib::Geoid::DefaultGeoidPath() for details. Finally, the path may be set using the optional second argument to the GeographicLib::Geoid constructor or with the "-d" flag to GeoidEval. Supplying the "-h" flag to GeoidEval reports the default geoid path for that utility. The "-v" flag causes GeoidEval to report the full path name of the data file it uses.

The format of the geoid data files

The gridded data used by the GeographicLib::Geoid class is stored in 16-bit PGM files. Thus the data for egm96-5 might be stored in the file

  • /usr/local/share/GeographicLib/geoids/egm96-5.pgm

PGM simple graphic format with the following properties

  • it is well documented here;
  • there are no separate "little-endian" and "big-endian" versions;
  • it uses 1 or 2 bytes per pixel;
  • pixels can be randomly accessed;
  • comments can be added to the file header;
  • it is sufficiently simple that it can be easily read without using the libnetpbm library (and thus we avoid adding a software dependency to GeographicLib).

The major drawback of this format is that since there are only 65535 possible pixel values, the height must be quantized to 3 mm. However, the resulting quantization error (up to 1.5 mm) is typically smaller than the linear interpolation errors. The comments in the header for egm96-5 are

   # Geoid file in PGM format for the GeographicLib::Geoid class
   # Description WGS84 EGM96, 5-minute grid
   # URL http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html
   # DateTime 2009-08-29 18:45:03
   # MaxBilinearError 0.140
   # RMSBilinearError 0.005
   # MaxCubicError 0.003
   # RMSCubicError 0.001
   # Offset -108
   # Scale 0.003
   # Origin 90N 0E
   # AREA_OR_POINT Point
   # Vertical_Datum WGS84

Of these lines, the Scale and Offset lines are required and define the conversion from pixel value to height (in meters) using height = offset + scale pixel. The Geoid constructor also reads the Description, DateTime, and error lines (if present) and stores the resulting data so that it can be returned by GeographicLib::Geoid::Description, GeographicLib::Geoid::DateTime, GeographicLib::Geoid::MaxError, and GeographicLib::Geoid::RMSError methods. The other lines serve as additional documentation but are not used by this class. Accompanying egm96-5.pgm (and similarly with the other geoid data files) are two files egm96-5.wld and egm96-5.pgm.aux.xml. The first is an ESRI "world" file and the second supplies complete projection metadata for use by GDAL. Neither of these files is read by GeographicLib::Geoid.

You can use gdal_translate to convert the data files to a standard GeoTiff, e.g., with

   gdal_translate -ot Float32 -scale 0 65000 -108 87 egm96-5.pgm egm96-5.tif

The arguments to -scale here are specific to the Offset and Scale parameters used in the pgm file (note 65000 * 0.003 - 108 = 87). You can check these by running GeoidEval with the "-v" option.

Here is a sample script which uses GDAL to create a 1-degree squared grid of geoid heights at 3" resolution (matching DTED1) by bilinear interpolation.

   #! /bin/sh
   lat=37
   lon=067
   res=3                           # resolution in seconds
   TEMP=`mktemp junkXXXXXXXXXX`    # temporary file for GDAL
   gdalwarp -q -te `echo $lon $lat $res | awk '{
       lon = $1; lat = $2; res = $3;
       printf "%.14f %.14f %.14f %.14f",
           lon  -0.5*res/3600, lat  -0.5*res/3600,
           lon+1+0.5*res/3600, lat+1+0.5*res/3600;
   }'` -ts $((3600/res+1)) $((3600/res+1)) -r bilinear egm96-5.tif $TEMP
   gdal_translate -quiet \
       -mo AREA_OR_POINT=Point \
       -mo Description="WGS84 EGM96, $res-second grid" \
       -mo Vertical_Datum=WGS84 \
       -mo Tie_Point_Location=pixel_corner \
       $TEMP e$lon-n$lat.tif
   rm -f $TEMP

Because the pgm files are uncompressed, they can take up a lot of disk space. Some compressed formats compress in tiles and so might be compatible with the requirement that the data can be randomly accessed. In particular gdal_translate can be used to convert the pgm files to compressed tiff files with

gdal_translate -co COMPRESS=LZW -co PREDICTOR=2 \
   -co TILED=YES -co BLOCKXSIZE=256 -co BLOCKYSIZE=256 \
   egmyy-g.pgm egmyy-g.tif

The resulting files sizes are

                  pgm      tif
    egm84-30      0.6 MB   0.5 MB
    egm84-15      2.1 MB   1.4 MB
    egm96-15      2.1 MB   1.5 MB
    egm96-5        19 MB   8.5 MB
    egm2008-5      19 MB   9.8 MB
    egm2008-2_5    75 MB    28 MB
    egm2008-1     470 MB    97 MB

Currently, there are no plans for GeographicLib to support this compressed format.

Interpolating the geoid data

GeographicLib::Geoid evaluates the geoid height using bilinear or cubic interpolation. The gradient of the geoid height is obtained by differentiating the interpolated height and referencing the result to distance on the WGS84 ellipsoid.

WARNING: Although GeographicLib::Geoid computes the gradient of the geoid height, this is subject to large quantization errors as a result of the way that the geoid data is stored. This is particularly acute for fine grids, at high latitudes, and for the easterly gradient. If you need to compute the direction of the acceleration due to gravity accurately, you should use GeographicLib::GravityModel::Gravity.

The bilinear interpolation is based on the values at the 4 corners of the enclosing cell. The interpolated height is a continuous function of position; however the gradient has discontinuities are cell boundaries. The quantization of the data files exacerbates the errors in the gradients.

The cubic interpolation is a least-squares fit to the values on a 12-point stencil with weights as follows:

   . 1 1 .
   1 2 2 1
   1 2 2 1
   . 1 1 .

The cubic is constrained to be independent of longitude when evaluating the height at one of the poles. Cubic interpolation is considerably more accurate than bilinear interpolation; however, in this implementation there are small discontinuities in the heights are cell boundaries. The over-constrained cubic fit slightly reduces the quantization errors on average.

The algorithm for the least squares fit is taken from, F. H. Lesh, Multi-dimensional least-squares polynomial curve fitting, CACM 2, 29-30 (1959). This algorithm is not part of GeographicLib::Geoid; instead it is implemented as Maxima code which is used to precompute the matrices to convert the function values on the stencil into the coefficients from the cubic polynomial. This code is included as a comment in Geoid.cpp.

The interpolation methods are quick and give good accuracy. Here is a summary of the combined quantization and interpolation errors for the heights.

Interpolation and quantization errors for geoid heights
name geoid grid
bilinear error
cubic error
max
rms
max
rms
egm84-30 EGM84
30'
1.546 m
70 mm
0.274 m
14 mm
egm84-15 EGM84
15'
0.413 m
18 mm
0.021 m
1.2 mm
egm96-15 EGM96
15'
1.152 m
40 mm
0.169 m
7.0 mm
egm96-5 EGM96
5'
0.140 m
4.6 mm
0.0032 m
0.7 mm
egm2008-5 EGM2008
5'
0.478 m
12 mm
0.294 m
4.5 mm
egm2008-2_5EGM2008
2.5'
0.135 m
3.2 mm
0.031 m
0.8 mm
egm2008-1 EGM2008
1'
0.025 m
0.8 mm
0.0022 m
0.7 mm

The errors are with respect to the specific NGA earth gravity model (not to any "real" geoid). The RMS values are obtained using 5 million uniformly distributed random points. The maximum values are obtained by evaluating the errors using a different grid with points at the centers of the original grid. (The RMS difference between EGM96 and EGM2008 is about 0.5 m. The RMS difference between EGM84 and EGM96 is about 1.5 m.)

The errors in the table above include the quantization errors that arise because the height data that GeographicLib::Geoid uses are quantized to 3 mm. If, instead, GeographicLib::Geoid were to use data files without such quantization artifacts, the overall error would be reduced but only modestly as shown in the following table, where only the changed rows are included and where the changed entries are given in bold:

Interpolation (only!) errors for geoid heights
name geoid grid
bilinear error
cubic error
max
rms
max
rms
egm96-5 EGM96
5'
0.140 m
4.6 mm
0.0026 m
0.1 mm
egm2008-2_5EGM2008
2.5'
0.135 m
3.2 mm
0.031 m
0.4 mm
egm2008-1 EGM2008
1'
0.025 m
0.6 mm
0.0010 m
0.011 mm

Caching the geoid data

A simple way of calling Geoid is as follows

   #include <GeographicLib/Geoid.hpp>
   #include <iostream>
   ...
   GeographicLib::Geoid g("egm96-5");
   double lat, lon;
   while (std::cin >> lat >> lon)
      std::cout << g(lat, lon) << "\n";
   ...

The first call to g(lat, lon) causes the data for the stencil points (4 points for bilinear interpolation and 12 for cubic interpolation) to be read and the interpolated value returned. A simple 0th-order caching scheme is provided by default, so that, if the second and subsequent points falls within the same grid cell, the data values are not reread from the file. This is adequate for most interactive use and also minimizes disk accesses for the case when a continuous track is being followed.

If a large quantity of geoid calculations are needed, the calculation can be sped up by preloading the data for a rectangular block with GeographicLib::Geoid::CacheArea or the entire dataset with GeographicLib::Geoid::CacheAll. If the requested points lie within the cached area, the cached data values are used; otherwise the data is read from disk as before. Caching all the data is a reasonable choice for the 5' grids and coarser. Caching all the data for the 1' grid will require 0.5 GB of RAM and should only be used on systems with sufficient memory.

The use of caching does not affect the values returned. Because of the caching and the random file access, this class is not normally thread safe; i.e., a single instantiation cannot be safely used by multiple threads. If multiple threads need to calculate geoid heights, there are two alternatives:

  • they should all construct thread-local instantiations.
  • GeographicLib::Geoid should be constructed with threadsafe = true. This causes all the data to be read at the time of construction (and if this fails, an exception is thrown), the data file to be closed and the single-cell caching to be turned off. The resulting object may then be shared safely between threads.

Test data for geoids

A test set for the geoid models is available at

This is about 11 MB (compressed). This test set consists of a set of 500000 geographic coordinates together with the corresponding geoid heights according to various earth gravity models.

Each line of the test set gives 6 space delimited numbers

  • latitude (degrees, exact)
  • longitude (degrees, exact)
  • EGM84 height (meters, accurate to 1 um)
  • EGM96 height (meters, accurate to 1 um)
  • EGM2008 height (meters, accurate to 1 um)

The latitude and longitude are all multiples of 10-6 deg and should be regarded as exact. The geoid heights are computed using the harmonic NGA synthesis programs, where the programs were compiled (with gfortran) and run under Linux. In the case of the EGM2008 program, a SAVE statement needed to be added to subroutine latf, in order for the program to compile correctly with a stack-based compiler. Similarly the EGM96 code requires a SAVE statement in subroutine legfdn.

Back to Other interfaces (Javascript, Python, Matlab, Octave). Forward to Gravity models. Up to Contents.
geographiclib-1.21/doc/html/GravityCircle_8cpp_source.html0000644000175000017500000004126111745620414023544 0ustar frankiefrankie GeographicLib: GravityCircle.cpp Source File
GravityCircle.cpp
Go to the documentation of this file.
00001 /**
00002  * \file GravityCircle.cpp
00003  * \brief Implementation for GeographicLib::GravityCircle class
00004  *
00005  * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under
00006  * the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/GravityCircle.hpp>
00011 #include <fstream>
00012 #include <sstream>
00013 #include <GeographicLib/Geocentric.hpp>
00014 
00015 #define GEOGRAPHICLIB_GRAVITYCIRCLE_CPP \
00016   "$Id: 94c2bce8fa9f379b5e3d0e176c89b4989762ef3a $"
00017 
00018 RCSID_DECL(GEOGRAPHICLIB_GRAVITYCIRCLE_CPP)
00019 RCSID_DECL(GEOGRAPHICLIB_GRAVITYCIRCLE_HPP)
00020 
00021 #define GRAVITY_DEFAULT_PATH "/home/ckarney/geographiclib/gravity"
00022 
00023 namespace GeographicLib {
00024 
00025   using namespace std;
00026 
00027   Math::real GravityCircle::Gravity(real lon, real& gx, real& gy, real& gz)
00028     const throw() {
00029     real clam, slam, M[Geocentric::dim2_];
00030     CircularEngine::cossin(lon, clam, slam);
00031     real Wres = W(clam, slam, gx, gy, gz);
00032     Geocentric::Rotation(_sphi, _cphi, slam, clam, M);
00033     Geocentric::Unrotate(M, gx, gy, gz, gx, gy, gz);
00034     return Wres;
00035   }
00036 
00037   Math::real GravityCircle::Disturbance(real lon, real& deltax, real& deltay,
00038                                         real& deltaz) const throw() {
00039     real clam, slam, M[Geocentric::dim2_];
00040     CircularEngine::cossin(lon, clam, slam);
00041     real Tres = InternalT(clam, slam, deltax, deltay, deltaz, true, true);
00042     Geocentric::Rotation(_sphi, _cphi, slam, clam, M);
00043     Geocentric::Unrotate(M, deltax, deltay, deltaz, deltax, deltay, deltaz);
00044     return Tres;
00045   }
00046 
00047   Math::real GravityCircle::GeoidHeight(real lon) const throw() {
00048     if ((_caps & GEOID_HEIGHT) != GEOID_HEIGHT)
00049       return Math::NaN<real>();
00050     real clam, slam, dummy;
00051     CircularEngine::cossin(lon, clam, slam);
00052     real T = InternalT(clam, slam, dummy, dummy, dummy, false, false);
00053     real correction = _corrmult * _correction(clam, slam);
00054     return T/_gamma0 + correction;
00055   }
00056 
00057   void GravityCircle::SphericalAnomaly(real lon,
00058                                        real& Dg01, real& xi, real& eta)
00059     const throw() {
00060     if ((_caps & SPHERICAL_ANOMALY) != SPHERICAL_ANOMALY) {
00061       Dg01 = xi = eta = Math::NaN<real>();
00062       return;
00063     }
00064     real clam, slam;
00065     CircularEngine::cossin(lon, clam, slam);
00066     real
00067       deltax, deltay, deltaz,
00068       T = InternalT(clam, slam, deltax, deltay, deltaz, true, false);
00069     // Rotate cartesian into spherical coordinates
00070     real MC[Geocentric::dim2_];
00071     Geocentric::Rotation(_spsi, _cpsi, slam, clam, MC);
00072     Geocentric::Unrotate(MC, deltax, deltay, deltaz, deltax, deltay, deltaz);
00073     // H+M, Eq 2-151c
00074     Dg01 = - deltaz - 2 * T * _invR;
00075     xi  = -(deltay/_gamma) / Math::degree<real>();
00076     eta = -(deltax/_gamma) / Math::degree<real>();
00077   }
00078 
00079   Math::real GravityCircle::W(real clam, real slam,
00080                               real& gX, real& gY, real& gZ) const throw() {
00081     real Wres = V(clam, slam, gX, gY, gZ) + _frot * _P / 2;
00082     gX += _frot * clam;
00083     gY += _frot * slam;
00084     return Wres;
00085   }
00086 
00087   Math::real GravityCircle::V(real clam, real slam,
00088                               real& GX, real& GY, real& GZ)
00089     const throw() {
00090     if ((_caps & GRAVITY) != GRAVITY) {
00091       GX = GY = GZ = Math::NaN<real>();
00092       return Math::NaN<real>();
00093     }
00094     real
00095       Vres = _gravitational(clam, slam, GX, GY, GZ),
00096       f = _GMmodel / _amodel;
00097     Vres *= f;
00098     GX *= f;
00099     GY *= f;
00100     GZ *= f;
00101     return Vres;
00102   }
00103 
00104   Math::real GravityCircle::InternalT(real clam, real slam,
00105                                       real& deltaX, real& deltaY, real& deltaZ,
00106                                       bool gradp, bool correct) const throw() {
00107     if (gradp) {
00108       if ((_caps & DISTURBANCE) != DISTURBANCE) {
00109         deltaX = deltaY = deltaZ = Math::NaN<real>();
00110         return Math::NaN<real>();
00111       }
00112     } else {
00113       if ((_caps & DISTURBING_POTENTIAL) != DISTURBING_POTENTIAL)
00114         return Math::NaN<real>();
00115     }
00116     if (_dzonal0 == 0)
00117       correct = false;
00118     real T = (gradp
00119               ? _disturbing(clam, slam, deltaX, deltaY, deltaZ)
00120               : _disturbing(clam, slam));
00121     T = (T / _amodel - (correct ? _dzonal0 : 0) * _invR) * _GMmodel;
00122     if (gradp) {
00123       real f = _GMmodel / _amodel;
00124       deltaX *= f;
00125       deltaY *= f;
00126       deltaZ *= f;
00127       if (correct) {
00128         real r3 = _GMmodel * _dzonal0 * _invR * _invR * _invR;
00129         deltaX += _P * clam * r3;
00130         deltaY += _P * slam * r3;
00131         deltaZ += _Z * r3;
00132       }
00133     }
00134     return T;
00135   }
00136 
00137 } // namespace GeographicLib
geographiclib-1.21/doc/html/functions_func_0x79.html0000644000175000017500000001053311745620414022273 0ustar frankiefrankie GeographicLib: Class Members - Functions
 

- y -

geographiclib-1.21/doc/html/Utility_8hpp_source.html0000644000175000017500000016632511745620415022457 0ustar frankiefrankie GeographicLib: Utility.hpp Source File
Utility.hpp
Go to the documentation of this file.
00001 /**
00002  * \file Utility.hpp
00003  * \brief Header for GeographicLib::Utility class
00004  *
00005  * Copyright (c) Charles Karney (2011, 2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_UTILITY_HPP)
00011 #define GEOGRAPHICLIB_UTILITY_HPP \
00012   "$Id: 92c92fcb8ea92116fed01909c2611934b708e4cd $"
00013 
00014 #include <GeographicLib/Constants.hpp>
00015 #include <iomanip>
00016 #include <vector>
00017 #include <string>
00018 #include <sstream>
00019 #include <algorithm>
00020 #include <cctype>
00021 
00022 namespace GeographicLib {
00023 
00024   /**
00025    * \brief Some utility routines for %GeographicLib
00026    *
00027    * Example of use:
00028    * \include example-Utility.cpp
00029    **********************************************************************/
00030   class GEOGRAPHIC_EXPORT Utility {
00031   private:
00032     static bool gregorian(int y, int m, int d) {
00033       // The original cut over to the Gregorian calendar in Pope Gregory XIII's
00034       // time had 1582-10-04 followed by 1582-10-15. Here we implement the
00035       // switch over used by the English-speaking world where 1752-09-02 was
00036       // followed by 1752-09-14. We also assume that the year always begins
00037       // with January 1, whereas in reality it often was reckoned to begin in
00038       // March.
00039       return 100 * (100 * y + m) + d >= 17520914; // or 15821004
00040     }
00041     static bool gregorian(int s) {
00042       return s >= 639799;       // 1752-09-14
00043     }
00044   public:
00045 
00046     /**
00047      * Convert a date to the day numbering sequentially starting with
00048      * 0001-01-01 as day 1.
00049      *
00050      * @param[in] y the year (must be positive).
00051      * @param[in] m the month, Jan = 1, etc. (must be positive).  Default = 1.
00052      * @param[in] d the day of the month (must be positive).  Default = 1.
00053      * @return the sequential day number.
00054      **********************************************************************/
00055     static int day(int y, int m = 1, int d = 1) throw() {
00056       // Convert from date to sequential day and vice versa
00057       //
00058       // Here is some code to convert a date to sequential day and vice
00059       // versa. The sequential day is numbered so that January 1, 1 AD is day 1
00060       // (a Saturday). So this is offset from the "Julian" day which starts the
00061       // numbering with 4713 BC.
00062       //
00063       // This is inspired by a talk by John Conway at the John von Neumann
00064       // National Supercomputer Center when he described his Doomsday algorithm
00065       // for figuring the day of the week. The code avoids explicitly doing ifs
00066       // (except for the decision of whether to use the Julian or Gregorian
00067       // calendar). Instead the equivalent result is achieved using integer
00068       // arithmetic. I got this idea from the routine for the day of the week
00069       // in MACLisp (I believe that that routine was written by Guy Steele).
00070       //
00071       // There are three issues to take care of
00072       //
00073       // 1. the rules for leap years,
00074       // 2. the inconvenient placement of leap days at the end of February,
00075       // 3. the irregular pattern of month lengths.
00076       //
00077       // We deal with these as follows:
00078       //
00079       // 1. Leap years are given by simple rules which are straightforward to
00080       // accommodate.
00081       //
00082       // 2. We simplify the calculations by moving January and February to the
00083       // previous year. Here we internally number the months March–December,
00084       // January, February as 0–9, 10, 11.
00085       //
00086       // 3. The pattern of month lengths from March through January is regular
00087       // with a 5-month period—31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31. The
00088       // 5-month period is 153 days long. Since February is now at the end of
00089       // the year, we don't need to include its length in this part of the
00090       // calculation.
00091       bool greg = gregorian(y, m, d);
00092       y += (m + 9) / 12 - 1; // Move Jan and Feb to previous year,
00093       m = (m + 9) % 12;      // making March month 0.
00094       return
00095         (1461 * y) / 4 // Julian years converted to days.  Julian year is 365 +
00096                        // 1/4 = 1461/4 days.
00097         // Gregorian leap year corrections.  The 2 offset with respect to the
00098         // Julian calendar synchronizes the vernal equinox with that at the time
00099         // of the Council of Nicea (325 AD).
00100         + (greg ? (y / 100) / 4 - (y / 100) + 2 : 0)
00101         + (153 * m + 2) / 5     // The zero-based start of the m'th month
00102         + d - 1                 // The zero-based day
00103         - 305; // The number of days between March 1 and December 31.
00104                // This makes 0001-01-01 day 1
00105     }
00106 
00107     /**
00108      * Convert a date to the day numbering sequentially starting with
00109      * 0001-01-01 as day 1.
00110      *
00111      * @param[in] y the year (must be positive).
00112      * @param[in] m the month, Jan = 1, etc. (must be positive).  Default = 1.
00113      * @param[in] d the day of the month (must be positive).  Default = 1.
00114      * @param[in] check whether to check the date.
00115      * @return the sequential day number.
00116      *
00117      * If \e check is true and the date is invalid an exception is thrown.
00118      **********************************************************************/
00119     static int day(int y, int m, int d, bool check) {
00120       int s = day(y, m, d);
00121       if (!check)
00122         return s;
00123       int y1, m1, d1;
00124       date(s, y1, m1, d1);
00125       if (!(s > 0 && y == y1 && m == m1 && d == d1))
00126         throw GeographicErr("Invalid date " +
00127                             str(y) + "-" + str(m) + "-" + str(d)
00128                             + (s > 0 ? "; use " +
00129                                str(y1) + "-" + str(m1) + "-" + str(d1) :
00130                                " before 0001-01-01"));
00131       return s;
00132     }
00133 
00134     /**
00135      * Given a day (counting from 0001-01-01 as day 1), return the date.
00136      *
00137      * @param[in] s the sequential day number (must be positive)
00138      * @param[out] y the year.
00139      * @param[out] m the month, Jan = 1, etc.
00140      * @param[out] d the day of the month.
00141      **********************************************************************/
00142     static void date(int s, int& y, int& m, int& d) throw() {
00143       int c = 0;
00144       bool greg = gregorian(s);
00145       s += 305;                 // s = 0 on March 1, 1BC
00146       if (greg) {
00147         s -= 2;                 // The 2 day Gregorian offset
00148         // Determine century with the Gregorian rules for leap years.  The
00149         // Gregorian year is 365 + 1/4 - 1/100 + 1/400 = 146097/400 days.
00150         c = (4 * s + 3) / 146097;
00151         s -= (c * 146097) / 4;  // s = 0 at beginning of century
00152       }
00153       y = (4 * s + 3) / 1461;   // Determine the year using Julian rules.
00154       s -= (1461 * y) / 4;      // s = 0 at start of year, i.e., March 1
00155       y += c * 100;             // Assemble full year
00156       m = (5 * s + 2) / 153;    // Determine the month
00157       s -= (153 * m + 2) / 5;   // s = 0 at beginning of month
00158       d = s + 1;                // Determine day of month
00159       y += (m + 2) / 12;        // Move Jan and Feb back to original year
00160       m = (m + 2) % 12 + 1;     // Renumber the months so January = 1
00161     }
00162 
00163     /**
00164      * Given a date as a string in the format yyyy, yyyy-mm, or yyyy-mm-dd,
00165      * return the numeric values for the year, month, and day.  No checking is
00166      * done on these values.
00167      *
00168      * @param[in] s the date in string format.
00169      * @param[out] y the year.
00170      * @param[out] m the month, Jan = 1, etc.
00171      * @param[out] d the day of the month.
00172      **********************************************************************/
00173     static void date(const std::string& s, int& y, int& m, int& d) {
00174       int y1, m1 = 1, d1 = 1;
00175       const char* digits = "0123456789";
00176       std::string::size_type p1 = s.find_first_not_of(digits);
00177       if (p1 == std::string::npos)
00178         y1 = num<int>(s);
00179       else if (s[p1] != '-')
00180         throw GeographicErr("Delimiter not hyphen in date " + s);
00181       else if (p1 == 0)
00182         throw GeographicErr("Empty year field in date " + s);
00183       else {
00184         y1 = num<int>(s.substr(0, p1));
00185         if (++p1 == s.size())
00186           throw GeographicErr("Empty month field in date " + s);
00187         std::string::size_type p2 = s.find_first_not_of(digits, p1);
00188         if (p2 == std::string::npos)
00189           m1 = num<int>(s.substr(p1));
00190         else if (s[p2] != '-')
00191           throw GeographicErr("Delimiter not hyphen in date " + s);
00192         else if (p2 == p1)
00193           throw GeographicErr("Empty month field in date " + s);
00194         else {
00195           m1 = num<int>(s.substr(p1, p2 - p1));
00196           if (++p2 == s.size())
00197             throw GeographicErr("Empty day field in date " + s);
00198           d1 = num<int>(s.substr(p2));
00199         }
00200       }
00201       y = y1; m = m1; d = d1;
00202     }
00203 
00204     /**
00205      * Given the date, return the day of the week.
00206      *
00207      * @param[in] y the year (must be positive).
00208      * @param[in] m the month, Jan = 1, etc. (must be positive).
00209      * @param[in] d the day of the month (must be positive).
00210      * @return the day of the week with Sunday, Monday - Saturday = 0, 1 - 6.
00211      **********************************************************************/
00212     static int dow(int y, int m, int d) throw() { return dow(day(y, m, d)); }
00213 
00214     /**
00215      * Given the sequential day, return the day of the week.
00216      *
00217      * @param[in] s the sequential day (must be positive).
00218      * @return the day of the week with Sunday, Monday - Saturday = 0, 1 - 6.
00219      **********************************************************************/
00220     static int dow(int s) throw() {
00221       return (s + 5) % 7;  // The 5 offset makes day 1 (0001-01-01) a Saturday.
00222     }
00223 
00224     /**
00225      * Convert a string representing a date to a fractional year.
00226      *
00227      * @tparam T the type of the argument.
00228      * @param[in] s the string to be converted.
00229      * @return the fractional year.
00230      *
00231      * The string is first read as an ordinary number (e.g., 2010 or 2012.5);
00232      * if this is successful, the value is returned.  Otherwise the string
00233      * should be of the form yyyy-mm or yyyy-mm-dd and this is converted to a
00234      * number with 2010-01-01 giving 2010.0 and 2012-07-03 giving 2012.5.
00235      **********************************************************************/
00236     template<typename T> static T fractionalyear(const std::string& s) {
00237       try {
00238         return num<T>(s);
00239       }
00240       catch (const std::exception&) {
00241       }
00242       int y, m, d;
00243       date(s, y, m, d);
00244       int t = day(y, m, d, true);
00245       return T(y) + T(t - day(y)) / T(day(y + 1) - day(y));
00246     }
00247 
00248     /**
00249      * Convert a object of type T to a string.
00250      *
00251      * @tparam T the type of the argument.
00252      * @param[in] x the value to be converted.
00253      * @param[in] p the precision used (default -1).
00254      * @return the string representation.
00255      *
00256      * If \e p >= 0, then the number fixed format is used with p bits of
00257      * precision.  With p < 0, there is no manipulation of the format.
00258      **********************************************************************/
00259     template<typename T> static std::string str(T x, int p = -1) {
00260       if (!std::numeric_limits<T>::is_integer && !Math::isfinite<T>(x))
00261         return x < 0 ? std::string("-inf") :
00262           (x > 0 ? std::string("inf") : std::string("nan"));
00263       std::ostringstream s;
00264       if (p >= 0) s << std::fixed << std::setprecision(p);
00265       s << x; return s.str();
00266     }
00267 
00268     /**
00269      * Convert a string to an object of type T.
00270      *
00271      * @tparam T the type of the return value.
00272      * @param[in] s the string to be converted.
00273      * @return object of type T
00274      **********************************************************************/
00275     template<typename T> static T num(const std::string& s) {
00276       T x;
00277       std::string errmsg;
00278       do {                     // Executed once (provides the ability to break)
00279         std::istringstream is(s);
00280         if (!(is >> x)) {
00281           errmsg = "Cannot decode " + s;
00282           break;
00283         }
00284         int pos = int(is.tellg()); // Returns -1 at end of string?
00285         if (!(pos < 0 || pos == int(s.size()))) {
00286           errmsg = "Extra text " + s.substr(pos) + " at end of " + s;
00287           break;
00288         }
00289         return x;
00290       } while (false);
00291       x = std::numeric_limits<T>::is_integer ? 0 : nummatch<T>(s);
00292       if (x == 0)
00293         throw GeographicErr(errmsg);
00294       return x;
00295     }
00296 
00297     /**
00298      * Match "nan" and "inf" (and variants thereof) in a string.
00299      *
00300      * @tparam T the type of the return value.
00301      * @param[in] s the string to be matched.
00302      * @return appropriate special value (+/-inf, nan) or 0 is none is found.
00303      **********************************************************************/
00304     template<typename T> static T nummatch(const std::string& s) {
00305       if (s.length() < 3)
00306         return 0;
00307       std::string t;
00308       t.resize(s.length());
00309       std::transform(s.begin(), s.end(), t.begin(), (int(*)(int))std::toupper);
00310       for (size_t i = s.length(); i--;)
00311         t[i] = std::toupper(s[i]);
00312       int sign = t[0] == '-' ? -1 : 1;
00313       std::string::size_type p0 = t[0] == '-' || t[0] == '+' ? 1 : 0;
00314       std::string::size_type p1 = t.find_last_not_of('0');
00315       if (p1 == std::string::npos || p1 + 1 < p0 + 3)
00316         return 0;
00317       // Strip off sign and trailing 0s
00318       t = t.substr(p0, p1 + 1 - p0);  // Length at least 3
00319       if (t == "NAN" || t == "1.#QNAN" || t == "1.#SNAN" || t == "1.#IND" ||
00320           t == "1.#R")
00321         return Math::NaN<T>();
00322       else if (t == "INF" || t == "1.#INF")
00323         return sign * Math::infinity<T>();
00324       return 0;
00325     }
00326 
00327     /**
00328      * Read a simple fraction, e.g., 3/4, from a string to an object of type T.
00329      *
00330      * @tparam T the type of the return value.
00331      * @param[in] s the string to be converted.
00332      * @return object of type T
00333      **********************************************************************/
00334     template<typename T> static T fract(const std::string& s) {
00335       std::string::size_type delim = s.find('/');
00336       return
00337         !(delim != std::string::npos && delim >= 1 && delim + 2 <= s.size()) ?
00338         num<T>(s) :
00339         // delim in [1, size() - 2]
00340         num<T>(s.substr(0, delim)) / num<T>(s.substr(delim + 1));
00341     }
00342 
00343     /**
00344      * Lookup up a character in a string.
00345      *
00346      * @param[in] s the string to be searched.
00347      * @param[in] c the character to look for.
00348      * @return the index of the first occurrence character in the string or -1
00349      *   is the character is not present.
00350      *
00351      * \e c is converted to upper case before search \e s.  Therefore, it is
00352      * intended that \e s should not contain any lower case letters.
00353      **********************************************************************/
00354     static int lookup(const std::string& s, char c) throw() {
00355       std::string::size_type r = s.find(toupper(c));
00356       return r == std::string::npos ? -1 : int(r);
00357     }
00358 
00359     /**
00360      * Read data of type ExtT from a binary stream to an array of type IntT.
00361      * The data in the file is in (bigendp ? big : little)-endian format.
00362      *
00363      * @tparam ExtT the type of the objects in the binary stream (external).
00364      * @tparam IntT the type of the objects in the array (internal).
00365      * @tparam bigendp true if the external storage format is big-endian.
00366      * @param[in] str the input stream containing the data of type ExtT
00367      *   (external).
00368      * @param[out] array the output array of type IntT (internal).
00369      * @param[in] num the size of the array.
00370      **********************************************************************/
00371     template<typename ExtT, typename IntT, bool bigendp>
00372       static inline void readarray(std::istream& str,
00373                                    IntT array[], size_t num) {
00374       if (sizeof(IntT) == sizeof(ExtT) &&
00375           std::numeric_limits<IntT>::is_integer ==
00376           std::numeric_limits<ExtT>::is_integer) {
00377         // Data is compatible (aside from the issue of endian-ness).
00378         str.read(reinterpret_cast<char *>(array), num * sizeof(ExtT));
00379         if (!str.good())
00380           throw GeographicErr("Failure reading data");
00381         if (bigendp != Math::bigendian) { // endian mismatch -> swap bytes
00382           for (size_t i = num; i--;)
00383             array[i] = Math::swab<IntT>(array[i]);
00384         }
00385       } else {
00386         const int bufsize = 1024; // read this many values at a time
00387         ExtT buffer[bufsize];     // temporary buffer
00388         int k = int(num);         // data values left to read
00389         int i = 0;                // index into output array
00390         while (k) {
00391           int n = (std::min)(k, bufsize);
00392           str.read(reinterpret_cast<char *>(buffer), n * sizeof(ExtT));
00393           if (!str.good())
00394             throw GeographicErr("Failure reading data");
00395           for (int j = 0; j < n; ++j)
00396             // fix endian-ness and cast to IntT
00397             array[i++] = IntT(bigendp == Math::bigendian ? buffer[j] :
00398                               Math::swab<ExtT>(buffer[j]));
00399           k -= n;
00400         }
00401       }
00402       return;
00403     }
00404 
00405     /**
00406      * Read data of type ExtT from a binary stream to a vector array of type
00407      * IntT.  The data in the file is in (bigendp ? big : little)-endian
00408      * format.
00409      *
00410      * @tparam ExtT the type of the objects in the binary stream (external).
00411      * @tparam IntT the type of the objects in the array (internal).
00412      * @tparam bigendp true if the external storage format is big-endian.
00413      * @param[in] str the input stream containing the data of type ExtT
00414      *   (external).
00415      * @param[out] array the output vector of type IntT (internal).
00416      **********************************************************************/
00417     template<typename ExtT, typename IntT, bool bigendp>
00418       static inline void readarray(std::istream& str,
00419                                    std::vector<IntT>& array) {
00420       readarray<ExtT, IntT, bigendp>(str, &array[0], array.size());
00421     }
00422 
00423     /**
00424      * Write data in an array of type IntT as type ExtT to a binary stream.
00425      * The data in the file is in (bigendp ? big : little)-endian format.
00426      *
00427      * @tparam ExtT the type of the objects in the binary stream (external).
00428      * @tparam IntT the type of the objects in the array (internal).
00429      * @tparam bigendp true if the external storage format is big-endian.
00430      * @param[out] str the output stream for the data of type ExtT (external).
00431      * @param[in] array the input array of type IntT (internal).
00432      * @param[in] num the size of the array.
00433      **********************************************************************/
00434     template<typename ExtT, typename IntT, bool bigendp>
00435       static inline void writearray(std::ostream& str,
00436                                    const IntT array[], size_t num) {
00437       if (sizeof(IntT) == sizeof(ExtT) &&
00438           std::numeric_limits<IntT>::is_integer ==
00439           std::numeric_limits<ExtT>::is_integer &&
00440           bigendp == Math::bigendian) {
00441         // Data is compatible (including endian-ness).
00442         str.write(reinterpret_cast<const char *>(array), num * sizeof(ExtT));
00443         if (!str.good())
00444           throw GeographicErr("Failure writing data");
00445       } else {
00446         const int bufsize = 1024; // write this many values at a time
00447         ExtT buffer[bufsize];     // temporary buffer
00448         int k = int(num);         // data values left to write
00449         int i = 0;                // index into output array
00450         while (k) {
00451           int n = (std::min)(k, bufsize);
00452           for (int j = 0; j < n; ++j)
00453             // cast to ExtT and fix endian-ness
00454             buffer[j] = bigendp == Math::bigendian ? ExtT(array[i++]) :
00455               Math::swab<ExtT>(ExtT(array[i++]));
00456           str.write(reinterpret_cast<const char *>(buffer), n * sizeof(ExtT));
00457           if (!str.good())
00458             throw GeographicErr("Failure writing data");
00459           k -= n;
00460         }
00461       }
00462       return;
00463     }
00464 
00465     /**
00466      * Write data in an array of type IntT as type ExtT to a binary stream.
00467      * The data in the file is in (bigendp ? big : little)-endian format.
00468      *
00469      * @tparam ExtT the type of the objects in the binary stream (external).
00470      * @tparam IntT the type of the objects in the array (internal).
00471      * @tparam bigendp true if the external storage format is big-endian.
00472      * @param[out] str the output stream for the data of type ExtT (external).
00473      * @param[in] array the input vector of type IntT (internal).
00474      **********************************************************************/
00475     template<typename ExtT, typename IntT, bool bigendp>
00476       static inline void writearray(std::ostream& str,
00477                                    std::vector<IntT>& array) {
00478       writearray<ExtT, IntT, bigendp>(str, &array[0], array.size());
00479     }
00480 
00481     /**
00482      * Parse a KEY VALUE line.
00483      *
00484      * @param[in] line the input line.
00485      * @param[out] key the key.
00486      * @param[out] val the value.
00487      * @return whether a key was found.
00488      *
00489      * A # character and everything after it are discarded.  If the results is
00490      * just white space, the routine returns false (and \e key and \e val are
00491      * not set).  Otherwise the first token is taken to be the key and the rest
00492      * of the line (trimmed of leading and trailing white space) is the value.
00493      **********************************************************************/
00494     static bool ParseLine(const std::string& line,
00495                           std::string& key, std::string& val);
00496 
00497   };
00498 
00499 } // namespace GeographicLib
00500 
00501 #endif  // GEOGRAPHICLIB_UTILITY_HPP
geographiclib-1.21/doc/html/classGeographicLib_1_1TransverseMercator.html0000644000175000017500000007301411745620414026423 0ustar frankiefrankie GeographicLib: GeographicLib::TransverseMercator Class Reference
GeographicLib::TransverseMercator Class Reference

Transverse Mercator Projection. More...

#include <GeographicLib/TransverseMercator.hpp>

List of all members.

Public Member Functions

 TransverseMercator (real a, real f, real k0)
void Forward (real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const throw ()
void Reverse (real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const throw ()
void Forward (real lon0, real lat, real lon, real &x, real &y) const throw ()
void Reverse (real lon0, real x, real y, real &lat, real &lon) const throw ()
Inspector functions
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()
Math::real CentralScale () const throw ()

Static Public Attributes

static const TransverseMercator UTM

Detailed Description

Transverse Mercator Projection.

This uses Krüger's method which evaluates the projection and its inverse in terms of a series. See

Krüger's method has been extended from 4th to 6th order. The maximum error is 5 nm (5 nanometers), ground distance, for all positions within 35 degrees of the central meridian. The error in the convergence is 2e-15" and the relative error in the scale is 6e-12%%. See Sec. 4 of arXiv:1002.1417 for details. The speed penalty in going to 6th order is only about 1%. TransverseMercatorExact is an alternative implementation of the projection using exact formulas which yield accurate (to 8 nm) results over the entire ellipsoid.

The ellipsoid parameters and the central scale are set in the constructor. The central meridian (which is a trivial shift of the longitude) is specified as the lon0 argument of the TransverseMercator::Forward and TransverseMercator::Reverse functions. The latitude of origin is taken to be the equator. There is no provision in this class for specifying a false easting or false northing or a different latitude of origin. However these are can be simply included by the calling function. For example, the UTMUPS class applies the false easting and false northing for the UTM projections. A more complicated example is the British National Grid (EPSG:7405) which requires the use of a latitude of origin. This is implemented by the GeographicLib::OSGB class.

See TransverseMercator.cpp for more information on the implementation.

See Transverse Mercator projection for a discussion of this projection.

Example of use:

// Example of using the GeographicLib::TransverseMercator class
// $Id: c01651412c934220e2293c344258773ac3d7131c $

#include <iostream>
#include <exception>
#include <string>
#include <iomanip>
#include <GeographicLib/TransverseMercator.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    TransverseMercator proj(Constants::WGS84_a(), Constants::WGS84_f(),
                            Constants::UTM_k0());
    // Alternatively: const TransverseMercator& proj = TransverseMercator::UTM;
    double lon0 = -75;          // Central meridian for UTM zone 18
    {
      // Sample forward calculation
      double lat = 40.3, lon = -74.7; // Princeton, NJ
      double x, y;
      proj.Forward(lon0, lat, lon, x, y);
      cout << x << " " << y << "\n";
    }
    {
      // Sample reverse calculation
      double x = 25e3, y = 4461e3;
      double lat, lon;
      proj.Reverse(lon0, x, y, lat, lon);
      cout << lat << " " << lon << "\n";
    }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

TransverseMercatorProj is a command-line utility providing access to the functionality of TransverseMercator and TransverseMercatorExact.


Constructor & Destructor Documentation

GeographicLib::TransverseMercator::TransverseMercator ( real  a,
real  f,
real  k0 
)

Constructor for a ellipsoid with

Parameters:
[in]aequatorial radius (meters).
[in]fflattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid. If f > 1, set flattening to 1/f.
[in]k0central scale factor.

An exception is thrown if either of the axes of the ellipsoid or k0 is not positive.

Definition at line 60 of file TransverseMercator.cpp.

References GeographicLib::Math::isfinite(), GeographicLib::Math::sq(), and STATIC_ASSERT.


Member Function Documentation

void GeographicLib::TransverseMercator::Forward ( real  lon0,
real  lat,
real  lon,
real &  x,
real &  y,
real &  gamma,
real &  k 
) const throw ()

Forward projection, from geographic to transverse Mercator.

Parameters:
[in]lon0central meridian of the projection (degrees).
[in]latlatitude of point (degrees).
[in]lonlongitude of point (degrees).
[out]xeasting of point (meters).
[out]ynorthing of point (meters).
[out]gammameridian convergence at point (degrees).
[out]kscale of projection at point.

No false easting or northing is added. lat should be in the range [-90, 90]; lon and lon0 should be in the range [-180, 360].

Definition at line 217 of file TransverseMercator.cpp.

References GeographicLib::Math::hypot(), GeographicLib::Math::asinh(), and GeographicLib::Math::sq().

Referenced by GeographicLib::UTMUPS::Forward().

void GeographicLib::TransverseMercator::Reverse ( real  lon0,
real  x,
real  y,
real &  lat,
real &  lon,
real &  gamma,
real &  k 
) const throw ()

Reverse projection, from transverse Mercator to geographic.

Parameters:
[in]lon0central meridian of the projection (degrees).
[in]xeasting of point (meters).
[in]ynorthing of point (meters).
[out]latlatitude of point (degrees).
[out]lonlongitude of point (degrees).
[out]gammameridian convergence at point (degrees).
[out]kscale of projection at point.

No false easting or northing is added. lon0 should be in the range [-180, 360]. The value of lon returned is in the range [-180, 180).

Definition at line 387 of file TransverseMercator.cpp.

References GeographicLib::Math::hypot(), and GeographicLib::Math::sq().

Referenced by GeographicLib::UTMUPS::Reverse().

void GeographicLib::TransverseMercator::Forward ( real  lon0,
real  lat,
real  lon,
real &  x,
real &  y 
) const throw () [inline]

TransverseMercator::Forward without returning the convergence and scale.

Definition at line 153 of file TransverseMercator.hpp.

void GeographicLib::TransverseMercator::Reverse ( real  lon0,
real  x,
real  y,
real &  lat,
real &  lon 
) const throw () [inline]

TransverseMercator::Reverse without returning the convergence and scale.

Definition at line 162 of file TransverseMercator.hpp.

Math::real GeographicLib::TransverseMercator::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value used in the constructor.

Definition at line 175 of file TransverseMercator.hpp.

Math::real GeographicLib::TransverseMercator::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid. This is the value used in the constructor.

Definition at line 181 of file TransverseMercator.hpp.

Math::real GeographicLib::TransverseMercator::CentralScale ( ) const throw () [inline]
Returns:
k0 central scale for the projection. This is the value of k0 used in the constructor and is the scale on the central meridian.

Definition at line 195 of file TransverseMercator.hpp.


Member Data Documentation

A global instantiation of TransverseMercator with the WGS84 ellipsoid and the UTM scale factor. However, unlike UTM, no false easting or northing is added.

Definition at line 203 of file TransverseMercator.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/classGeographicLib_1_1MagneticCircle-members.html0000644000175000017500000001254711745620414027077 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::MagneticCircle Member List
This is the complete list of members for GeographicLib::MagneticCircle, including all inherited members.
Flattening() const GeographicLib::MagneticCircle [inline]
Height() const GeographicLib::MagneticCircle [inline]
Init() const GeographicLib::MagneticCircle [inline]
Latitude() const GeographicLib::MagneticCircle [inline]
MagneticCircle()GeographicLib::MagneticCircle [inline]
MagneticModel classGeographicLib::MagneticCircle [friend]
MajorRadius() const GeographicLib::MagneticCircle [inline]
operator()(real lon, real &Bx, real &By, real &Bz) const GeographicLib::MagneticCircle [inline]
operator()(real lon, real &Bx, real &By, real &Bz, real &Bxt, real &Byt, real &Bzt) const GeographicLib::MagneticCircle [inline]
Time() const GeographicLib::MagneticCircle [inline]
geographiclib-1.21/doc/html/classGeographicLib_1_1SphericalHarmonic.html0000644000175000017500000010524411745620414026166 0ustar frankiefrankie GeographicLib: GeographicLib::SphericalHarmonic Class Reference
GeographicLib::SphericalHarmonic Class Reference

Spherical Harmonic series. More...

#include <GeographicLib/SphericalHarmonic.hpp>

List of all members.

Public Types

enum  normalization { FULL, SCHMIDT }

Public Member Functions

 SphericalHarmonic (const std::vector< real > &C, const std::vector< real > &S, int N, real a, unsigned norm=FULL)
 SphericalHarmonic (const std::vector< real > &C, const std::vector< real > &S, int N, int nmx, int mmx, real a, unsigned norm=FULL)
 SphericalHarmonic ()
Math::real operator() (real x, real y, real z) const throw ()
Math::real operator() (real x, real y, real z, real &gradx, real &grady, real &gradz) const throw ()
CircularEngine Circle (real p, real z, bool gradp) const
const SphericalEngine::coeffCoefficients () const throw ()

Detailed Description

Spherical Harmonic series.

This class evaluates the spherical harmonic sum

 V(x, y, z) = sum(n = 0..N)[ q^(n+1) * sum(m = 0..n)[
   (C[n,m] * cos(m*lambda) + S[n,m] * sin(m*lambda)) *
   P[n,m](cos(theta)) ] ]

where

  • p2 = x2 + y2,
  • r2 = p2 + z2,
  • q = a/r,
  • theta = atan2(p, z) = the spherical colatitude,
  • lambda = atan2(y, x) = the longitude.
  • Pnm(t) is the associated Legendre polynomial of degree n and order m.

Two normalizations are supported for Pnm

Clenshaw summation is used for the sums over both n and m. This allows the computation to be carried out without the need for any temporary arrays. See SphericalEngine.cpp for more information on the implementation.

References:

  • C. W. Clenshaw, A note on the summation of Chebyshev series, Math. Tables Aids Comput. 9(51), 118-120 (1955).
  • R. E. Deakin, Derivatives of the earth's potentials, Geomatics Research Australasia 68, 31-60, (June 1998).
  • W. A. Heiskanen and H. Moritz, Physical Geodesy, (Freeman, San Francisco, 1967). (See Sec. 1-14, for a definition of Pbar.)
  • S. A. Holmes and W. E. Featherstone, A unified approach to the Clenshaw summation and the recursive computation of very high degree and order normalised associated Legendre functions, J. Geod. 76(5), 279-299 (2002).
  • C. C. Tscherning and K. Poder, Some geodetic applications of Clenshaw summation, Boll. Geod. Sci. Aff. 41(4), 349-375 (1982).

Example of use:

// Example of using the GeographicLib::SphericalHarmonic class
// $Id: b7e4a45d66787db49d40aa7bc991ab686cc32d44 $

#include <iostream>
#include <exception>
#include <vector>
#include <GeographicLib/SphericalHarmonic.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    int N = 3;                  // The maxium degree
    double ca[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients
    vector<double> C(ca, ca + (N + 1) * (N + 2) / 2);
    double sa[] = {6, 5, 4, 3, 2, 1}; // sine coefficients
    vector<double> S(sa, sa + N * (N + 1) / 2);
    double a = 1;
    SphericalHarmonic h(C, S, N, a);
    double x = 2, y = 3, z = 1;
    double v, vx, vy, vz;
    v = h(x, y, z, vx, vy, vz);
    cout << v << " " << vx << " " << vy << " " << vz << "\n";
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Member Enumeration Documentation

Supported normalizations for the associated Legendre polynomials.

Enumerator:
FULL 

Fully normalized associated Legendre polynomials.

These are defined by Pnmfull(z) = (-1)m sqrt(k (2n + 1) (n - m)! / (n + m)!) Pnm(z), where Pnm(z) is Ferrers function (also known as the Legendre function on the cut or the associated Legendre polynomial) http://dlmf.nist.gov/14.7.E10 and k = 1 for m = 0 and k = 2 otherwise.

The mean squared value of Pnmfull(cos theta) cos(m lambda) and Pnmfull(cos theta) sin(m lambda) over the sphere is 1.

SCHMIDT 

Schmidt semi-normalized associated Legendre polynomials.

These are defined by Pnmschmidt(z) = (-1)m sqrt(k (n - m)! / (n + m)!) Pnm(z), where Pnm(z) is Ferrers function (also known as the Legendre function on the cut or the associated Legendre polynomial) http://dlmf.nist.gov/14.7.E10 and k = 1 for m = 0 and k = 2 otherwise.

The mean squared value of Pnmschmidt(cos theta) cos(m lambda) and Pnmschmidt(cos theta) sin(m lambda) over the sphere is 1/(2n + 1).

Definition at line 71 of file SphericalHarmonic.hpp.


Constructor & Destructor Documentation

GeographicLib::SphericalHarmonic::SphericalHarmonic ( const std::vector< real > &  C,
const std::vector< real > &  S,
int  N,
real  a,
unsigned  norm = FULL 
) [inline]

Constructor with a full set of coefficients specified.

Parameters:
[in]Cthe coefficients Cnm.
[in]Sthe coefficients Snm.
[in]Nthe maximum degree and order of the sum
[in]athe reference radius appearing in the definition of the sum.
[in]normthe normalization for the associated Legendre polynomials, either SphericalHarmonic::full (the default) or SphericalHarmonic::schmidt.

The coefficients Cnm and Snm are stored in the one-dimensional vectors C and S which must contain (N + 1)(N + 2)/2 and N (N + 1)/2 elements, respectively, stored in "column-major" order. Thus for N = 3, the order would be: C00, C10, C20, C30, C11, C21, C31, C22, C32, C33. In general the (n,m) element is at index m*N - m*(m - 1)/2 + n. The layout of S is the same except that the first column is omitted (since the m = 0 terms never contribute to the sum) and the 0th element is S11

The class stores pointers to the first elements of C and S. These arrays should not be altered or destroyed during the lifetime of a SphericalHarmonic object.

Definition at line 159 of file SphericalHarmonic.hpp.

GeographicLib::SphericalHarmonic::SphericalHarmonic ( const std::vector< real > &  C,
const std::vector< real > &  S,
int  N,
int  nmx,
int  mmx,
real  a,
unsigned  norm = FULL 
) [inline]

Constructor with a subset of coefficients specified.

Parameters:
[in]Cthe coefficients Cnm.
[in]Sthe coefficients Snm.
[in]Nthe degree used to determine the layout of C and S.
[in]nmxthe maximum degree used in the sum. The sum over n is from 0 thru nmx.
[in]mmxthe maximum order used in the sum. The sum over m is from 0 thru min(n, mmx).
[in]athe reference radius appearing in the definition of the sum.
[in]normthe normalization for the associated Legendre polynomials, either SphericalHarmonic::FULL (the default) or SphericalHarmonic::SCHMIDT.

The class stores pointers to the first elements of C and S. These arrays should not be altered or destroyed during the lifetime of a SphericalHarmonic object.

Definition at line 186 of file SphericalHarmonic.hpp.

GeographicLib::SphericalHarmonic::SphericalHarmonic ( ) [inline]

A default constructor so that the object can be created when the constructor for another object is initialized. This default object can then be reset with the default copy assignment operator.

Definition at line 199 of file SphericalHarmonic.hpp.


Member Function Documentation

Math::real GeographicLib::SphericalHarmonic::operator() ( real  x,
real  y,
real  z 
) const throw () [inline]

Compute the spherical harmonic sum.

Parameters:
[in]xcartesian coordinate.
[in]ycartesian coordinate.
[in]zcartesian coordinate.
Returns:
V the spherical harmonic sum.

This routine requires constant memory and thus never throws an exception.

Definition at line 212 of file SphericalHarmonic.hpp.

Math::real GeographicLib::SphericalHarmonic::operator() ( real  x,
real  y,
real  z,
real &  gradx,
real &  grady,
real &  gradz 
) const throw () [inline]

Compute a spherical harmonic sum and its gradient.

Parameters:
[in]xcartesian coordinate.
[in]ycartesian coordinate.
[in]zcartesian coordinate.
[out]gradxx component of the gradient
[out]gradyy component of the gradient
[out]gradzz component of the gradient
Returns:
V the spherical harmonic sum.

This is the same as the previous function, except that the components of the gradients of the sum in the x, y, and z directions are computed. This routine requires constant memory and thus never throws an exception.

Definition at line 245 of file SphericalHarmonic.hpp.

CircularEngine GeographicLib::SphericalHarmonic::Circle ( real  p,
real  z,
bool  gradp 
) const [inline]

Create a CircularEngine to allow the efficient evaluation of several points on a circle of latitude.

Parameters:
[in]pthe radius of the circle.
[in]zthe height of the circle above the equatorial plane.
[in]gradpif true the returned object will be able to compute the gradient of the sum.
Returns:
the CircularEngine object.

SphericalHarmonic::operator()() exchanges the order of the sums in the definition, i.e., sum(n = 0..N)[sum(m = 0..n)[...]] becomes sum(m = 0..N)[sum(n = m..N)[...]]. SphericalHarmonic::Circle performs the inner sum over degree n (which entails about N2 operations). Calling CircularEngine::operator()() on the returned object performs the outer sum over the order m (about N operations). This routine may throw a bad_alloc exception in the CircularEngine constructor.

Here's an example of computing the spherical sum at a sequence of longitudes without using a CircularEngine object

  SphericalHarmonic h(...);     // Create the SphericalHarmonic object
  double r = 2, lat = 33, lon0 = 44, dlon = 0.01;
  double
    phi = lat * Math::degree<double>(),
    z = r * sin(phi), p = r * cos(phi);
  for (int i = 0; i <= 100; ++i) {
    real
      lon = lon0 + i * dlon,
      lam = lon * Math::degree<double>();
    std::cout << lon << " " << h(p * cos(lam), p * sin(lam), z) << "\n";
  }

Here is the same calculation done using a CircularEngine object. This will be about N/2 times faster.

  SphericalHarmonic h(...);     // Create the SphericalHarmonic object
  double r = 2, lat = 33, lon0 = 44, dlon = 0.01;
  double
    phi = lat * Math::degree<double>(),
    z = r * sin(phi), p = r * cos(phi);
  CircularEngine c(h(p, z, false)); // Create the CircularEngine object
  for (int i = 0; i <= 100; ++i) {
    real
      lon = lon0 + i * dlon;
    std::cout << lon << " " << c(lon) << "\n";
  }

Definition at line 312 of file SphericalHarmonic.hpp.

Referenced by GeographicLib::GravityModel::Circle().

const SphericalEngine::coeff& GeographicLib::SphericalHarmonic::Coefficients ( ) const throw () [inline]
Returns:
the zeroth SphericalEngine::coeff object.

Definition at line 336 of file SphericalHarmonic.hpp.

Referenced by GeographicLib::GravityModel::GravityModel().


The documentation for this class was generated from the following file:
geographiclib-1.21/doc/html/Geocentric_8hpp.html0000644000175000017500000001253111745620414021502 0ustar frankiefrankie GeographicLib: Geocentric.hpp File Reference
Geocentric.hpp File Reference

Header for GeographicLib::Geocentric class. More...

#include <vector>
#include <algorithm>
#include <GeographicLib/Constants.hpp>

Go to the source code of this file.

Classes

class  GeographicLib::Geocentric
 Geocentric coordinates More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_GEOCENTRIC_HPP   "$Id: e9f709c85e61f60509c492429061cba04350eea8 $"

Detailed Description

Header for GeographicLib::Geocentric class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file Geocentric.hpp.


Define Documentation

#define GEOGRAPHICLIB_GEOCENTRIC_HPP   "$Id: e9f709c85e61f60509c492429061cba04350eea8 $"

Definition at line 11 of file Geocentric.hpp.

geographiclib-1.21/doc/html/gravity.html0000644000175000017500000011024411745620414020146 0ustar frankiefrankie GeographicLib: Gravity models
Gravity models
Back to Geoid height. Forward to Magnetic models. Up to Contents.

GeographicLib can compute the earth's gravitational field with an earth gravity model using the GeographicLib::GravityModel and GeographicLib::GravityCircle classes and with the Gravity utility. These models expand the gravitational potential of the earth as sum of spherical harmonics. The models also specify a reference ellipsoid, relative to which geoid heights and gravity disturbances are measured.

The supported models are

See

  • W. A. Heiskanen and H. Moritz, Physical Geodesy (Freeman, San Francisco, 1967).

for more information.

Acknowledgment: I would like to thank Mathieu Peyréga for sharing EGM_Geoid_CalculatorClass from his Geo library with me. His implementation was the first I could easily understand and he and I together worked through some of the issues with overflow and underflow the occur while performing high-degree spherical harmonic sums.

Go to

Installing the gravity models

These gravity models are available for download:

Available gravity models
name max
degree
size
(kB)
Download Links (size, kB)
tar file Windows
installer
zip file
egm84
180
27
link (26)
link (55)
link (26)
egm96
360
2100
link (2100)
link (2300)
link (2100)
egm2008
2190
76000
link (75000)
link (72000)
link (73000)
wgs84
20
1
link (1)
link (30)
link (1)

The "size" column is the size of the uncompressed data.

For Linux and Unix systems, GeographicLib provides a shell script geographiclib-get-gravity (typically installed in /usr/local/sbin) which automates the process of downloading and installing the gravity models. For example

   geographiclib-get-gravity all  # to install egm84, egm96, egm2008, wgs84
   geographiclib-get-gravity -h   # for help

This script should be run as a user with write access to the installation directory, which is typically /usr/local/share/GeographicLib (this can be overridden with the -p flag), and the data will then be placed in the "gravity" subdirectory.

Windows users should download and run the Windows installers. These will prompt for an installation directory with the default being one of

   C:/Documents and Settings/All Users/Application Data/GeographicLib
   C:/ProgramData/GeographicLib

(which you probably should not change) and the data is installed in the "gravity" sub-directory. (The second directory name is an alternate name that Windows 7 for the "Application Data" directory.)

Otherwise download either the tar.bz2 file or the zip file (they have the same contents). To unpack these, run, for example

   mkdir -p /usr/local/share/GeographicLib
   tar xofjC egm96.tar.bz2 /usr/local/share/GeographicLib
   tar xofjC egm2008.tar.bz2 /usr/local/share/GeographicLib
   etc.

and, again, the data will be placed in the "gravity" subdirectory.

However you install the gravity models, all the datasets should be installed in the same directory. GeographicLib::GravityModel and Gravity uses a compile time default to locate the datasets. This is

  • /usr/local/share/GeographicLib/gravity, for non-Windows systems
  • C:/Documents and Settings/All Users/Application Data/GeographicLib/gravity, for Windows systems

consistent with the examples above. This may be overridden at run-time by defining the GRAVITY_PATH or the GEOGRAPHIC_DATA environment variables; see GeographicLib::GravityModel::DefaultGravityPath() for details. Finally, the path may be set using the optional second argument to the GeographicLib::GravityModel constructor or with the "-d" flag to Gravity. Supplying the "-h" flag to Gravity reports the default path for gravity models for that utility. The "-v" flag causes Gravity to report the full path name of the data file it uses.

The format of the gravity model files

The constructor for GeographicLib::GravityModel reads a file called NAME.egm which specifies various properties for the gravity model. It then opens a binary file NAME.egm.cof to obtain the coefficients of the spherical harmonic sum.

The first line of the .egm file must consist of "EGMF-v" where EGMF stands for "Earth Gravity Model Format" and v is the version number of the format (currently "1").

The rest of the File is read a line at a time. A # character and everything after it are discarded. If the result is just white space it is discarded. The remaining lines are of the form "KEY WHITESPACE VALUE". In general, the KEY and the VALUE are case-sensitive.

GeographicLib::GravityModel only pays attention to the following keywords

  • keywords that affect the field calculation, namely:
    • ModelRadius (required), the normalizing radius for the model in meters.
    • ReferenceRadius (required), the major radius a for the reference ellipsoid meters.
    • ModelMass (required), the mass constant GM for the model in meters3/seconds2.
    • ReferenceMass (required), the mass constant GM for the reference ellipsoid in meters3/seconds2.
    • AngularVelocity (required), the angular velocity omega for the model and the reference ellipsoid in rad seconds-1.
    • Flattening, the flattening of the reference ellipsoid; this can be given a fraction, e.g., 1/298.257223563. One of Flattening and DynamicalFormFactor is required.
    • DynamicalFormFactor, the dynamical form factor J2 for the reference ellipsoid. One of Flattening and DynamicalFormFactor is required.
    • HeightOffset (default 0), the constant height offset (meters) added to obtain the geoid height.
    • CorrectionMultiplier (default 1), the multiplier for the "zeta-to-N" correction terms for the geoid height to convert them to meters.
    • Normalization (default full), the normalization used for the associated Legendre functions (full or schmidt).
    • ID (required), 8 printable characters which serve as a signature for the .egm.cof file (they must appear as the first 8 bytes of this file).
    The parameters ModelRadius, ModelMass, and AngularVelocity apply to the gravity model, while ReferenceRadius, ReferenceMass, AngularVelocity, and either Flattening or DynamicalFormFactor characterize the reference ellipsoid. AngularVelocity (because it can be measured precisely) is the same for the gravity model and the reference ellipsoid. ModelRadius is merely a scaling parameter for the gravity model and there's no requirement that it be close to the major radius of the earth (although that's typically how it is chosen). ModelMass and ReferenceMass need not be the same and, indeed, they are slightly difference for egm2008. As a result the disturbing potential T has a 1/r dependence at large distances.
  • keywords that store data that the user can query:
    • Name, the name of the model.
    • Description, a more descriptive name of the model.
    • ReleaseDate, when the model was created.
  • keywords that are examined to verify that their values are valid:
    • ByteOrder (default little), the order of bytes in the .egm.cof file. Only little endian is supported at present.

Other keywords are ignored.

The coefficient file NAME.egm.cof is a binary file in little endian order. The first 8 bytes of this file must match the ID given in NAME.egm. This is followed by 2 sets of spherical harmonic coefficients. The first of these gives the gravity potential and the second gives the zeta-to-N corrections to the geoid height. The format for each set of coefficients is:

  • N, the maximum degree of the sum stored as a 4-byte signed integer. This must satisfy N >= -1.
  • M, the maximum order of the sum stored as a 4-byte signed integer. This must satisfy N >= M >= -1.
  • Cnm, the coefficients of the cosine coefficients of the sum in column (i.e., m) major order. There are (M + 1) (2N - M + 2) / 2 elements which are stored as IEEE doubles (8 bytes). For example for N = M = 3, there are 10 coefficients arranged as C00, C10, C20, C30, C11, C21, C31, C22, C32, C33.
  • Snm, the coefficients of the sine coefficients of the sum in column (i.e., m) major order starting at m = 1. There are M (2N - M + 1) / 2 elements which are stored as IEEE doubles (8 bytes). For example for N = M = 3, there are 6 coefficients arranged as S11, S21, S31, S22, S32, S33.

Although the coefficient file is in little endian order, GeographicLib can read it on big endian machines. It can only be read on machines which store doubles in IEEE format.

As an illustration, here is egm2008.egm:

EGMF-1
# An Earth Gravity Model (Format 1) file.  For documentation on the
# format of this file see
# http://geographiclib.sf.net/html/gravity.html#gravityformat
Name            egm2008
Publisher       National Geospatial Intelligence Agency
Description     Earth Gravity Model 2008
URL             http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008
ReleaseDate     2008-06-01
ConversionDate  2011-11-19
DataVersion     1
ModelRadius     6378136.3
ModelMass       3986004.415e8
AngularVelocity 7292115e-11
ReferenceRadius 6378137
ReferenceMass   3986004.418e8
Flattening      1/298.257223563
HeightOffset    -0.41

# Gravitational and correction coefficients taken from
# EGM2008_to2190_TideFree and Zeta-to-N_to2160_egm2008 from
# the egm2008 distribution.
ID              EGM2008A

Comments on the NGA harmonic synthesis code

GeographicLib::GravityModel attempts to reproduce the results of NGA's harmonic synthesis code for EGM2008, hsynth_WGS84.f. Listed here are issues that I encountered using the NGA code:

  1. A compiler which allocates local variables on the stack produces an executable with just returns NaNs. The problem here is a missing SAVE statement in subroutine latf.
  2. Because the model and references masses for egm2008 differ (by about 1 part in 109), there should be a 1/r contribution to the disturbing potential T. However, this term is set to zero in hsynth_WGS84 (effectively altering the normal potential). This shifts the surface W = U0 outward by about 5 mm. Note too that the reference ellipsoid is no longer a level surface of the effective normal potential.
  3. Subroutine radgrav computes the ellipsoidal coordinate beta incorrectly. This leads to small errors in the deflection of the vertical, xi and eta, when the height above the ellipsoid, h, is non-zero (about 1e-7 arcsec at h = 400 km).
  4. There are several expressions which will return inaccurate results due to cancellation. For example, subroutine grs computes the flattening using f = 1 - sqrt(1 - e2). Much better is to use f = e2/(1 + sqrt(1 - e2)). The expressions for q and q' in grs and radgrav suffer from similar problems. The resulting errors are tiny (about 50 pm in the geoid height); however, given that's there's essentially no cost to using more accurate expressions, it's preferable to do so.
  5. hsynth_WGS84 returns an "undefined" value for xi and eta at the poles. Better would be to return the value obtained by taking the limit lat -> +/- 90o.

Issues 1–4 have been reported to the authors of hsynth_WGS84. Issue 1 is peculiar to Fortran and is not encountered in C++ code and GeographicLib::GravityModel corrects issues 3–5. On issue 2, GeographicLib::GravityModel neglects the 1/r term in T in GeographicLib::GravityModel::GeoidHeight and GeographicLib::GravityModel::SphericalAnomaly in order to produce results which match NGA's for these quantities. On the other hand, GeographicLib::GravityModel::Disturbance and GeographicLib::GravityModel::T do include this term.

Details of the geoid height and anomaly calculations

Ideally, the geoid represents a surface of constant gravitational potential which approximates mean sea level. In reality some approximations are taken in determining this surface. The steps taking by GeographicLib::GravityModel in computing the geoid height are described here (in the context of EGM2008). This mimics NGA's code hsynth_WGS84 closely because most users of EGM2008 use the gridded data generated by this code (e.g., GeographicLib::Geoid) and it is desirable to use a consistent definition of the geoid height.

  • The model potential is band limited; the minimum wavelength that is represented is 360o/2160 = 10' (i.e., about 10NM or 18.5km). The maximum degree for the spherical harmonic sum is 2190; however the model was derived using ellipsoidal harmonics of degree and order 2160 and the degree was increased to 2190 in order to capture the ellipsoidal harmonics faithfully with spherical harmonics.
  • The 1/r term is omitted from the T (this is issue 2 in Comments on the NGA harmonic synthesis code). This moves the equipotential surface by about 5mm.
  • The surface W = U0 is determined by Bruns' formula, which is roughly equivalent to a single iteration of Newton's method. The RMS error in this approximation is about 1.5mm with a maximum error of about 10 mm.
  • The model potential is only valid above the earth's surface. A correction therefore needs to be included where the geoid lies beneath the terrain. This is NGA's "zeta-to-N" correction, which is represented by a spherical harmonic sum of degree and order 2160 (and so it misses short wavelength terrain variations). In addition, it entails estimating the isostatic equilibrium of the earth's crust. The correction lies in the range [-5.05 m, 0.05 m], however for 99.9% of the earth's surface the correction is less than 10 mm in magnitude.
  • The resulting surface lies above the observed mean sea level, so -0.41m is added to the geoid height. (Better would be to change the potential used to define the geoid; but this would only change the result by about 2mm.)

A useful discussion of the problems with defining a geoid is given by Dru A. Smith in There is no such thing as "The" EGM96 geoid: Subtle points on the use of a global geopotential model, IGeS Bulletin No. 8, International Geoid Service, Milan, Italy, pp. 17–28 (1998).

GeographicLib::GravityModel::GeoidHeight reproduces the results of the several NGA codes for harmonic synthesis with the following maximum discrepancies:

  • egm84 = 1.1mm. This is probably due to inconsistent parameters for the reference ellipsoid in the NGA code. (In particular, the value of mass constant excludes the atmosphere; however, it's not clear whether the other parameters have been correspondingly adjusted.) Note that geoid heights predicted by egm84 differ from those of more recent gravity models by about 1 meter.
  • egm96 = 23nm.
  • egm2008 = 78pm. After addressing some of the issues alluded to in issue 4 in Comments on the NGA harmonic synthesis code, the maximum discrepancy becomes 23pm.

The formula for the gravity anomaly vector involves computing gravity and normal gravity at two different points (with the displacement between the points unknown ab initio). Since the gravity anomaly is already a small quantity it is sometimes acceptable to employ approximations that change the quantities by O(f). The NGA code uses the spherical approximation described by Heiskanen and Moritz, Sec. 2-14 and GeographicLib::GravityModel::SphericalAnomaly uses the same approximation for compatibility. In this approximation, the gravity disturbance delta = grad T is calculated. Here, T once again excludes the 1/r term (this is issue 2 in Comments on the NGA harmonic synthesis code and is consistent with the computation of the geoid height). Note that delta compares the gravity and the normal gravity at the same point; the gravity anomaly vector is then found by estimating the gradient of the normal gravity in the limit that the earth is spherically symmetric. delta is expressed in spherical coordinates as deltax, deltay, deltaz where, for example, deltaz is the radial component of delta (not the component perpendicular to the ellipsoid) and deltay is similarly slightly different from the usual northerly component. The components of the anomaly are then given by

  • gravity anomaly, Dg01 = deltaz - 2T/R, where R distance to the center of the earth;
  • northerly component of the deflection of the vertical, xi = - deltay/gamma, where gamma is the magnitude of the normal gravity;
  • easterly component of the deflection of the vertical, eta = - deltax/gamma.

GeographicLib::NormalGravity computes the normal gravity accurately and avoids issue 3 of Comments on the NGA harmonic synthesis code. Thus while GeographicLib::GravityModel::SphericalAnomaly reproduces the results for xi and eta at h = 0, there is a slight discrepancy if h is non-zero.

The effect of the mass of the atmosphere

All of the supported models use WGS84 for the reference ellipsoid. This has (see TR8350.2, table 3.1)

  • a = 6378137 m
  • f = 1/298.257223563
  • omega = 7292115e-11 rad s-1
  • GM = 3986004.418e8 m3/s2.

The value of GM includes the mass of the atmosphere and so strictly only applies above the earth's atmosphere. Near the surface of the earth, the value of g will be less (in absolute value) than the value predicted by these models by about delta g = (4 pi G/g) A = 8.552e-11 A m2/kg, where G is the gravitational constant, g is the earth's gravity, and A is the pressure of the atmosphere. At sea level we have A = 101.3 kPa, and delta g = 8.7e-6 m s-2, approximately. (In other words the effect is about 1 part in a million; by way of comparison, buoyancy effects are about 100 times larger.)

Geoid heights on a multi-processor system

The egm2008 model includes many terms (over 2 million spherical harmonics). For that reason computations using this model may be slow; for example it takes about 78 ms to compute the geoid height at a single point. There are two ways to speed up this computation:

  • Use a GeographicLib::GravityCircle to compute the geoid height at several points on a circle of latitude. This reduces the cost per point to about 92 us (a reduction by a factor of over 800).
  • Compute the values on several circles of latitude in parallel. One of the simplest ways of doing this is with OpenMP; on an 8-processor system, this can speed up the computation by another factor of 8.

Both of these techniques are illustrated by the following code, which computes a table of geoid heights on a regular grid and writes on the result in a .gtx file. On an 8-processor Intel 2.66 GHz machine using OpenMP (-DHAVE_OPENMP=1), it takes about 40 minutes of elapsed time to compute the geoid height for EGM2008 on a 1' gride. (Without these optimizations, the computation would have taken about 200 days!)

// Write out a gtx file of geoid heights.  For egm2008 at 1' resolution this
// takes about 40 mins on a 8-processor Intel 2.66 GHz machine using OpenMP
// (-DHAVE_OPENMP=1).
//
// For the format of gtx files, see
// http://vdatum.noaa.gov/dev/gtx_info.html#dev_gtx_binary
//
// data is binary big-endian:
//   south latitude edge (degrees double)
//   west longitude edge (degrees double)
//   delta latitude (degrees double)
//   delta longitude (degrees double)
//   nlat = number of latitude rows (integer)
//   nlong = number of longitude columns (integer)
//   nlat * nlong geoid heights (meters float)

#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>

#if HAVE_OPENMP
#include <omp.h>
#endif

#include <GeographicLib/GravityModel.hpp>
#include <GeographicLib/GravityCircle.hpp>
#include <GeographicLib/Utility.hpp>

using namespace std;
using namespace GeographicLib;

int main(int argc, char* argv[]) {
  // Hardwired for 3 args:
  // 1 = the gravity model (e.g., egm2008)
  // 2 = intervals per degree
  // 3 = output GTX file
  if (argc != 4) {
    cerr << "Usage: " << argv[0]
         << " gravity-model intervals-per-degree output.gtx\n";
    return 1;
  }
  try {
    string model(argv[1]);
    // Number of intervals per degree
    int ndeg = Utility::num<int>(string(argv[2]));
    string filename(argv[3]);
    GravityModel g(model);
    int
      nlat = 180 * ndeg + 1,
      nlon = 360 * ndeg;
    double
      delta = 1 / double(ndeg), // Grid spacing
      latorg = -90,
      lonorg = -180;
    // Write results as floats in binary mode
    ofstream file(filename.c_str(), ios::binary);

    // Write header
    {
      double transform[] = {latorg, lonorg, delta, delta};
      unsigned sizes[] = {nlat, nlon};
      Utility::writearray<double, double, true>(file, transform, 4);
      Utility::writearray<unsigned, unsigned, true>(file, sizes, 2);
    }

    // Compute and store results for nbatch latitudes at a time
    const int nbatch = 64;
    vector< vector<float> > N(nbatch, vector<float>(nlon));

    for (int ilat0 = 0; ilat0 < nlat; ilat0 += nbatch) { // Loop over batches
      int nlat0 = min(nlat, ilat0 + nbatch);

#if HAVE_OPENMP
#pragma omp parallel for
#endif
      for (int ilat = ilat0; ilat < nlat0; ++ilat) { // Loop over latitudes
        double
          lat = latorg + (ilat / ndeg) + delta * (ilat - ndeg * (ilat / ndeg)),
          h = 0;
        GravityCircle c(g.Circle(lat, h, GravityModel::GEOID_HEIGHT));
        for (int ilon = 0; ilon < nlon; ++ilon) { // Loop over longitudes
          double lon = lonorg
            + (ilon / ndeg) + delta * (ilon - ndeg * (ilon / ndeg));
          N[ilat - ilat0][ilon] = float(c.GeoidHeight(lon));
        } // longitude loop
      }   // latitude loop -- end of parallel section

      for (int ilat = ilat0; ilat < nlat0; ++ilat) // write out data
        Utility::writearray<float, float, true>(file, N[ilat - ilat0]);
    } // batch loop
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  catch (...) {
    cerr << "Caught unknown exception\n";
    return 1;
  }
  return 0;
}

This example is built if cmake is invoked with -D GEOGRAPHICLIB_EXAMPLES=ON. cmake will add in support for OpenMP, if it is available.

Back to Geoid height. Forward to Magnetic models. Up to Contents.
geographiclib-1.21/doc/html/tmseries30.html0000644000175000017500000025411611745620414020466 0ustar frankiefrankie Krueger's series for the transverse Mercator projection

Krueger's series for the transverse Mercator projection

This extends Krueger's series for the transverse Mercator projection given in here to 30th order in the flattening. See
Louis Krueger, Konforme Abbildung des Erdellipsoids in der Ebene, Royal Prussian Geodetic Institute, New Series 52, 172 pp. (1912), DOI: 10.2312/GFZ.b103-krueger28
and
Charles F. F. Karney, Transverse Mercator with an accuracy of a few nanometers, J. Geodesy 85(8), 475–485 (Aug. 2011); preprint arXiv:1002.1417; resource page tm.html.

Krueger, p. 12, Eq. (5)
A = a/(n + 1) * (1 + 1/4 * n^2
                   + 1/64 * n^4
                   + 1/256 * n^6
                   + 25/16384 * n^8
                   + 49/65536 * n^10
                   + 441/1048576 * n^12
                   + 1089/4194304 * n^14
                   + 184041/1073741824 * n^16
                   + 511225/4294967296 * n^18
                   + 5909761/68719476736 * n^20
                   + 17631601/274877906944 * n^22
                   + 863948449/17592186044416 * n^24
                   + 2704312009/70368744177664 * n^26
                   + 34493775625/1125899906842624 * n^28
                   + 111759833025/4503599627370496 * n^30);

Krueger's gamma[j], p. 21, Eq. (41)
alpha[1]
   = 1/2 * n
   - 2/3 * n^2
   + 5/16 * n^3
   + 41/180 * n^4
   - 127/288 * n^5
   + 7891/37800 * n^6
   + 72161/387072 * n^7
   - 18975107/50803200 * n^8
   + 60193001/290304000 * n^9
   + 134592031/1026432000 * n^10
   - 1043934033787/3218890752000 * n^11
   + 1107802529272207/5178390497280000 * n^12
   + 142419537515471/2027901173760000 * n^13
   - 20550145413484373/80782891757568000 * n^14
   + 2101511170951245259/11421139410616320000 * n^15
   + 6871484604164555073473/152001089131039948800000 * n^16
   - 316612189636291463036929/1590165240140110233600000 * n^17
   + 311760891443585845069947023/2276285401141473705984000000 * n^18
   + 347174131720182892842402053/5544999731500337332224000000 * n^19
   - 10268774819324130983842267351303/53283288669919616509673472000000 * n^20
   + 464746136644252720151415143064067/3701786370752310199619420160000000 * n^21
   + 2064362591952186950153454576839857/30080838421836438047733841920000000 * n^22
   - 371073254699693809696179501698840034443/1863568101909611009933206974627840000000 * n^23
   + 5346008647175289889016543194428866601311819/37129264970421612359156732460741427200000000 * n^24
   + 6137137281591956159684411551066421423706607/167888850301036855884882616344222105600000000 * n^25
   - 5694433253276142746311340663687118018405227/34071560796386891341343825081621544960000000 * n^26
   + 1499618325109985269858805780437308686284756403/11441314242737326475117926447161802752000000000 * n^27
   + 28163788993539415131077859632876464031084037436421/1310187798864261519640035449688674889891840000000000 * n^28
   - 1382954166683887199687110280755185774160434238372379/10481502390914092157120283597509399119134720000000000 * n^29
   + 115342138314917862218900682540434301181025997372394740949/1236751772737919661464211462733624662313402368000000000000 * n^30;
alpha[2]
   = 13/48 * n^2
   - 3/5 * n^3
   + 557/1440 * n^4
   + 281/630 * n^5
   - 1983433/1935360 * n^6
   + 13769/28800 * n^7
   + 148003883/174182400 * n^8
   - 705286231/465696000 * n^9
   + 1703267974087/3218890752000 * n^10
   + 490493610499/373621248000 * n^11
   - 1975809888712343/976396861440000 * n^12
   + 1116592309932851/2013818526720000 * n^13
   + 802251814098377521231/445424437014036480000 * n^14
   - 25718419234005720100069/10254041727093964800000 * n^15
   + 10411677743818269012186343/20672148121821433036800000 * n^16
   + 58069234404819345427642159/24548175894662951731200000 * n^17
   - 1619780216513490679161882727/538657116774318483701760000 * n^18
   + 15210374203334956573188013/39416197422363181056000000 * n^19
   + 1350424643880191120787483875017417/444214364490277223954330419200000 * n^20
   - 363512649110052773321859331443938611/101105040251172472327105413120000000 * n^21
   + 110501360211107135866854552436284378043/372713620381922201986641394925568000000 * n^22
   + 435725651868235317320938241439343987241/116473006369350688120825435914240000000 * n^23
   - 236785644303962703650496588593815148631118759/55962950100345618628294205448074035200000000 * n^24
   + 29951219608236318375984513968969852637391/119180356695180484115811733824602112000000 * n^25
   + 62685650245065205952020811520018086774286032497/14257637748641899145916185264924708044800000000 * n^26
   - 4483003054643316539810052609365683886313161406697/933182192923263190626805875846634536960000000000 * n^27
   + 1345853871818243074858148169703931833087859724988709/10481502390914092157120283597509399119134720000000000 * n^28
   + 645835710031983279557286116276652061340439304187459/126360334379353222116394530036641089380679680000000 * n^29
   - 6417447834385545863906095749619028053009319834823545892863/1194396760656532610281735373146342851007532236800000000000 * n^30;
alpha[3]
   = 61/240 * n^3
   - 103/140 * n^4
   + 15061/26880 * n^5
   + 167603/181440 * n^6
   - 67102379/29030400 * n^7
   + 79682431/79833600 * n^8
   + 6304945039/2128896000 * n^9
   - 6601904925257/1307674368000 * n^10
   + 35472608886503/41845579776000 * n^11
   + 7660808256523559/1098446469120000 * n^12
   - 388334559174821269/43261891706880000 * n^13
   - 121304505560337904991/236631732163706880000 * n^14
   + 171473290780515481554677/12620359048731033600000 * n^15
   - 132727036454031241642633/9465269286548275200000 * n^16
   - 30639039363651602964664613/7934763925547620761600000 * n^17
   + 41628755176036445034328803761/1767468664415732524646400000 * n^18
   - 62731007539014996251923219444381/3110744849371689243377664000000 * n^19
   - 4253576948330492615223590251863457/425705432636515672956233318400000 * n^20
   + 21109173608034038907290057857778161/560369142096606397967892480000000 * n^21
   - 228353389351527744252835451931600005809/8319500454953620580058959708160000000 * n^22
   - 36528815353507244513448437301156996025493/1863568101909611009933206974627840000000 * n^23
   + 179949541301186621467483604212502389572317467/3179713073883273785698534400458752000000000 * n^24
   - 6667459517369124611809567288843679508075480287/186543167001152062094314018160246784000000000 * n^25
   - 236468538717455606379697014767782772375800752929/7057680450680141777849792338335891456000000000 * n^26
   + 2724615431989937919395302944576209366322330213709/33653452487089882156338604087632199680000000000 * n^27
   - 326200170759406656773108233662108528251650506200184011/7290019291116532045176607502113909002731520000000000 * n^28
   - 36898523581280468039266697831389451828857036025105495411081/698722104984071577014815193290610567839406358528000000000 * n^29
   + 48301814797856398208935403861888385264392898018206796432963809/432334302458894288277916900848565288850632684339200000000000 * n^30;
alpha[4]
   = 49561/161280 * n^4
   - 179/168 * n^5
   + 6601661/7257600 * n^6
   + 97445/49896 * n^7
   - 40176129013/7664025600 * n^8
   + 138471097/66528000 * n^9
   + 48087451385201/5230697472000 * n^10
   - 634613396309/40864824000 * n^11
   + 152161926556090753/1124809184378880000 * n^12
   + 797541596189032241/27161585418240000 * n^13
   - 670034891213941619/19612057573785600 * n^14
   - 797738204370016183711/62444484876533760000 * n^15
   + 1262572420740885661534720343/17264651178664053964800000 * n^16
   - 1504688538793152003510638173/24548175894662951731200000 * n^17
   - 4908380662744446707535585282187/97210776542865288855552000000 * n^18
   + 21617826231307521472044305870999/139740491280368852729856000000 * n^19
   - 9011412074161616811750466480987610329/96159344783777657891290349568000000 * n^20
   - 5712764954291035029425456603013754181/42570543263651567295623331840000000 * n^21
   + 13285505291912233404719867451738427771511/45538318279746133701375358402560000000 * n^22
   - 179649231017237416866042466928297549711/1455912579616883601510317948928000000 * n^23
   - 29884145110494866094058551866948880229303499503/101750818364264761142353100814680064000000000 * n^24
   + 2382017529810135366707938471482990925184741/4716709930568539119450511386869760000000 * n^25
   - 188545346993373372341522235835513997267194575937/1391079045351448234474741678280697446400000000 * n^26
   - 77189939882994048469559094011678147843496599936029/135603037409161682387957728833964081152000000000 * n^27
   + 5055292347375802605991447871089890508241922361424571717527/6177914279257927294560700205929359574176890880000000000 * n^28
   - 896129405773425784164009625079521008114002654837731749413/8398102223366244916043451842435223171146711040000000000 * n^29
   - 4583499403987764386036616357058392174411208549700462493009598039/4522881933416124861984361424261913791052772697702400000000000 * n^30;
alpha[5]
   = 34729/80640 * n^5
   - 3418889/1995840 * n^6
   + 14644087/9123840 * n^7
   + 2605413599/622702080 * n^8
   - 31015475399/2583060480 * n^9
   + 5820486440369/1307674368000 * n^10
   + 98568244458947/3678732288000 * n^11
   - 1367520624030470251/29877743960064000 * n^12
   - 11234223222165655787/1912175613444096000 * n^13
   + 2982454477844692970369/27248502491578368000 * n^14
   - 869190895988598534264203/7266267331087564800000 * n^15
   - 2458295530839889742624897/30213139562662094438400 * n^16
   + 20076007526718092337920372531/60426279125324188876800000 * n^17
   - 92612134608258706595931646307/396778679766797097369600000 * n^18
   - 3111621093870597339292256540131/8985511024872697343508480000 * n^19
   + 618939899724538734690312503581728709/751244881123262952275705856000000 * n^20
   - 349880405493459820104679463829848683211/1041726235157591293822312120320000000 * n^21
   - 207806888296724735724043450497658236815707/199230142473889334943517193011200000000 * n^22
   + 1022460523953867701806308301182024494003729/579578596287678065290231834214400000000 * n^23
   - 383432658756943317231248322200166817451364947/1418641217578691381311653809435443200000000 * n^24
   - 763997490849414433043000164958612268471750563033/295077373256367807312823992362572185600000000 * n^25
   + 69453259794643484263302719504607020126095692449473/20581646784631654560069473467289409945600000000 * n^26
   + 3526475778372639978202920400355285382983253400925713433/11591583469104547848231127456777395681361920000000000 * n^27
   - 3386844879506808385587873157467763778147265832357828657961/599864444526160351145960845888230226510479360000000000 * n^28
   + 8975715445112376764326365404354369942872021811244023950781587/1522855869837079078109212600761587135034603601920000000000 * n^29
   + 1141689688674260410162806230731137824563608969465073820136479347/565360241677015607748045178032739223881596587212800000000000 * n^30;
alpha[6]
   = 212378941/319334400 * n^6
   - 30705481/10378368 * n^7
   + 175214326799/58118860800 * n^8
   + 870492877/96096000 * n^9
   - 1328004581729009/47823519744000 * n^10
   + 3512873113922087/355687428096000 * n^11
   + 986615629722639449/13133074268160000 * n^12
   - 186591382609938512501/1419192838103040000 * n^13
   - 11945326540608489526613/373693748455931904000 * n^14
   + 4125626927677466366821/10899400996631347200 * n^15
   - 4011823062707782237989439819/10071046520887364812800000 * n^16
   - 5594107510292126787316683247/14477129373775586918400000 * n^17
   + 14982221707493385549304025695646893/11007251005469054245797888000000 * n^18
   - 7291595279883773582199320279582809/8943391441943606574710784000000 * n^19
   - 8513492703227656510956084303336491/4584255567495120990240768000000 * n^20
   + 157105326583313971040653100185655846951/40692431060843409914934067200000000 * n^21
   - 342420444562433578699362565080425434441037/375021444656732865776032363315200000000 * n^22
   - 6663996141625951282430738551524458085888493/1050486205771416493338545199513600000000 * n^23
   + 1065943196304789336567113254479304136821982769941/116477910495934660781377891722067968000000000 * n^24
   + 282615555043864261481140961100818513817314366357/285856205342106313334298242601241804800000000 * n^25
   - 2234022131193996792575080782842298020429068641824778623/126453637844776885617066844983026134705766400000000 * n^26
   + 1670315644839955612203042568472364219380574770260571/89166026685419598832547134282903043702784000000 * n^27
   + 10801933283402577517707581324454394034794780353978810731521/1182341513848663880519575000591294359498915840000000000 * n^28
   - 16737951977035205802462496054004751707736362520790525486549/392219059882489460364666706926919763487621120000000000 * n^29
   + 608596584899951573523771478197765351237552575059720715257651893101/18091527733664499447937445697047655164211090790809600000000000 * n^30;
alpha[7]
   = 1522256789/1383782400 * n^7
   - 16759934899/3113510400 * n^8
   + 1315149374443/221405184000 * n^9
   + 71809987837451/3629463552000 * n^10
   - 52653013293696143/812999835648000 * n^11
   + 101784256296129577/4455864483840000 * n^12
   + 4323558791348929159/21064086650880000 * n^13
   - 4743350772552838010233/12772735542927360000 * n^14
   - 29903451511253057978977829/239786821925889638400000 * n^15
   + 15436840428957043227623443109/12408968034664788787200000 * n^16
   - 510180710084169862809596281619/397086977109273241190400000 * n^17
   - 25997085578966927070281529664931/16379837805757521199104000000 * n^18
   + 35427299825029861083061489601504459/6814012527195128818827264000000 * n^19
   - 41290529970653089580171330206559029/15331528186189039842361344000000 * n^20
   - 5636751993648050664276890397282425312669/651078896973494558638945075200000000 * n^21
   + 141025630513942054689154210633777771281593/8496579605504103990238233231360000000 * n^22
   - 5083353505162393632768455472240415265887349/3625207298348417702501646178713600000000 * n^23
   - 2146307295003485715426155323634480307223656521293/64478843310249544361119904346144768000000000 * n^24
   + 2825817217957521232544774598978333849050291610759191/66026335549695533425786782050452242432000000000 * n^25
   + 1121526321726686366084998741747165637003373989067391/71050078471954976186444471989073608704000000000 * n^26
   - 24751330931089944559270444413306567745123372815680765867/240606738674941774627508140128468530626560000000000 * n^27
   + 283315570304624430111229930361091346970544306955451389315961/3103646473852742686363884376552147693684654080000000000 * n^28
   + 4800340784447363734591990355494651667081994231886256711/55232397096636431665504905041636298326016000000000 * n^29
   - 5883627608079327862661606773104442557734582970571316091093779/21654584826138278971716016135829556194222643609600000000 * n^30;
alpha[8]
   = 1424729850961/743921418240 * n^8
   - 256783708069/25204608000 * n^9
   + 2468749292989891/203249958912000 * n^10
   + 117880637749661/2707556544000 * n^11
   - 5921832934345276446697/38926432130826240000 * n^12
   + 58559280970406047561/1064394628577280000 * n^13
   + 707308930074513293534401/1284572260317265920000 * n^14
   - 174465694566990976559029/168307400643782400000 * n^15
   - 4693110873155601006258565965271/11118435359059650753331200000 * n^16
   + 676391985485095809371733839/171665565696943718400000 * n^17
   - 2198445417091794111397602386175901/542023723754157974224896000000 * n^18
   - 53363941504564359044259819052979/8957723800023644405760000000 * n^19
   + 3980756637943323854029497343795084553/210875756104775565551075328000000 * n^20
   - 57605246865079073769101876100784936151/6705002845252607315528908800000000 * n^21
   - 131556990309544385502695007449463535506251/3577507202317517469573992939520000000 * n^22
   + 16563201841502261061487372612686514822354259/246931844784963022216298653286400000000 * n^23
   + 3716622905750730591889081511594229480962791354087/1091129684472639151636059353184731136000000000 * n^24
   - 2213908725034918327552841712951816333387504312678259/14018459110275430350511715674314768384000000000 * n^25
   + 17011573703835625757730804229750060144161108086423592979/91512501071878009328140479921926808010752000000000 * n^26
   + 682892898514410238829628389193295165408986121549166351/5831466588978968792019684149065332817920000000000 * n^27
   - 155436494065578924089463413379949231968540857163058763243101/289553023799672787066018367491745557428305920000000000 * n^28
   + 165551112077463450636444122527612450331221233114708176183743/410124712616255283555227578330105230951186432000000000 * n^29
   + 1403124695221106030113716236806514839242351489435235474477081785401/2304047825501112882590584116852264779065289280061440000000000 * n^30;
alpha[9]
   = 21091646195357/6080126976000 * n^9
   - 67196182138355857/3379030566912000 * n^10
   + 395018924202597949/15446996877312000 * n^11
   + 91220875613845291081/946128558735360000 * n^12
   - 4988552993547340999703/13876552194785280000 * n^13
   + 2274808037645071351151/16571805601849344000 * n^14
   + 535711648203373741428799361/367673126953030778880000 * n^15
   - 27678709003769097826752781127/9651419582517057945600000 * n^16
   - 5280108162364963042999830777751/4014990546327096105369600000 * n^17
   + 1174431699627195631670489145666649/96789950670385352540160000000 * n^18
   - 1183738252014628519027860764867029/93856921862191857008640000000 * n^19
   - 40137685403486395923628481749776837043/1911061539699528562806620160000000 * n^20
   + 287333201658715623813482736998287053515959/4357220310514925123199093964800000000 * n^21
   - 106257838315599820564882015419176890518173209/3950909516559408355460778452582400000000 * n^22
   - 90892763520143573996692682431035087078662489897/622420206916436023998744174683750400000000 * n^23
   + 201524866709123266853440470935579547318921733655003/778803283904190575028428648573042688000000000 * n^24
   + 10814621264427896099430746759393142670689600538379/246140297135151589144787325968764108800000000 * n^25
   - 530693286808080774017187055905756612819533423821542721/762604175598983411067837332682723400089600000000 * n^26
   + 528646912311960943475639104830106896257711233429178692933/691427785876411626034839181632335882747904000000000 * n^27
   + 1238335239482617295952056865714588188866564716732256454849533/1822776500516690149134344792578245470894161920000000000 * n^28
   - 65933487212841390272205814518074033193900839255445948294377851/25518871007233662087880827096095436592518266880000000000 * n^29
   + 162727413247772587683519571850133568153397325055616238461382829/98282138338670185068189671924151343633347379200000000000 * n^30;
alpha[10]
   = 77911515623232821/12014330904576000 * n^10
   - 268897530802721453/6758061133824000 * n^11
   + 8257746726303249815683/149866763703681024000 * n^12
   + 323404376453879141969/1506527781986304000 * n^13
   - 565045774309646240886321061/661811628515455401984000 * n^14
   + 606966182513981199158868163/1723467782592331776000000 * n^15
   + 75743290339815584481785361977/19854348855463662059520000 * n^16
   - 22241327027192487028642722150343/2823040227886239449088000000 * n^17
   - 1526410847130700516846978043440307/394199071821205799436288000000 * n^18
   + 1980853898587532814589028918136701/54202372375415797422489600000 * n^19
   - 32336501755791644291373778373511296903/833917762777976100133797888000000 * n^20
   - 9178264588912399043908657569412179727459/129878682332656421941511454720000000 * n^21
   + 1806166894952081193938559978698482758385827197/8083379310603065246736937333555200000000 * n^22
   - 361654991248988355171855093660297726396047881/4322362548030805722213501213081600000000 * n^23
   - 105020035995730778911321036642305474913412418767240671/190651043899745852766959333170680850022400000000 * n^24
   + 2294386994267351811538453796616269131419043757692511/2383138048746823159586991664633510625280000000 * n^25
   + 2743769449547669368889674700489658732983220398593193929/10458571551071772494644626276791635201228800000000 * n^26
   - 23157882459582328183252760859500524302121767786137065570859/7994633774196009426027828037623883644272640000000000 * n^27
   + 89430614800491857673988760128056842290692364119137870498038657/29634817943884252747216444369659216688085729280000000000 * n^28
   + 2567130086431563482452599790796650371294900574502194735538864809/746426976961584616070514192560791520331159306240000000000 * n^29
   - 509038828002331582891050965787949294310918940649244811719555481648577/43567449791293770870803772391388279458689106386616320000000000 * n^30;
alpha[11]
   = 12809767642647461/1029799791820800 * n^11
   - 5303630969873795374429/65282870552739840000 * n^12
   + 505329992704194411750631/4178103715375349760000 * n^13
   + 902773043678795981447423/1880146671918907392000 * n^14
   - 52457275102567933937177869/25762220537492275200000 * n^15
   + 67595745292234822704267032563/73325720204837388288000000 * n^16
   + 81338369151994478217697814085661/8212480662941787488256000000 * n^17
   - 19217318226298386878750945280512161/893107272094919389347840000000 * n^18
   - 1873245185945872710662470867765863817/171476596242224522754785280000000 * n^19
   + 476337982883129731566963871315011795997/4406497269224532801843363840000000 * n^20
   - 8440994919935476843536233253371860518791717/71444009058360425160553739059200000000 * n^21
   - 33526203318350561460792162793779755990401717/146245349369463351503464326758400000000 * n^22
   + 710399978033562118273811779126576411439704335403/961922137961764764361695542693068800000000 * n^23
   - 34930525249908548784563565768397098265832106510929/133733897236073129045285727532744704000000000 * n^24
   - 23048480004933480948529688590232835511983254849209969/11554608721196718349512686858829142425600000000 * n^25
   + 3343638043167525209592261539785084441516908110518987/960960215823802999597333847150375731200000000 * n^26
   + 3245082101525034287044377973345367353808255099669736817511/2599324777920413759906374035762203880062976000000000 * n^27
   - 1563650841338021630530049879900135725592709642522865259185153573/135713995811197202921911671374689367332938055680000000000 * n^28
   + 100228142507845651554674218817828912081709008921929406668291104191/8685695731916620987002346967980119509308035563520000000000 * n^29
   + 1348681612012517778664036601950009019623074500848299186242899657141/84859828283817488489232796254889378316274578227200000000000 * n^30;
alpha[12]
   = 2240624428311897034834681/91918281738257694720000 * n^12
   - 1694308924283012695547/10043518546575360000 * n^13
   + 2898270966023179721324929303/10754438963376150282240000 * n^14
   + 5049523426723058614103389/4683336365740032000000 * n^15
   - 293488823111024724225343654073741/60224858194906441580544000000 * n^16
   + 15397766080743841984369762728863/6297551277592380309504000000 * n^17
   + 5863952550107110495571900519504737/229656155681550700118016000000 * n^18
   - 1430933931370883795713846515020911423/24472734089815246481326080000000 * n^19
   - 1870907814706500734631241404968509423277611/62870727971357174141287290372096000000 * n^20
   + 85087672018039782610988182307863449111159229/270147659251925357638343825817600000000 * n^21
   - 17181221423420856035067255437638564537594025459/48096106898088238218084777134653440000000 * n^22
   - 29840743030792811125826874514052113793829046631/41332591865544579718666605350092800000000 * n^23
   + 233752394874908577315877184530185132629657928559209871/97769766102433770649722734959323512832000000000 * n^24
   - 201646398092527015113891771761912798737265288328930229/244933632787867935846440809976221925376000000000 * n^25
   - 1478405663522054837879701822965363491041325865689756503513/211622658728717896571324859819455743524864000000000 * n^26
   + 321386243763712289433592425205485189709512429739435078423/26177282004203385643588361566208718274560000000000 * n^27
   + 2818199590151532790384019625468928958215697625600921714777625549/535252958269371601439920541444153022982568017920000000000 * n^28
   - 11378071070442404926793965546213173776855685042822972281764801951/257713735203578688495924900168357493335389739417600000000 * n^29
   + 26391837116130703226086300212905604518448450453630780847639554556493/613134590884340253673783066835327045013588110475264000000000 * n^30;
alpha[13]
   = 1987049611350093295679/40852569661447864320 * n^13
   - 49990807275475500894703/140691247558557696000 * n^14
   + 620844046443235040902108541/1021314241536196608000000 * n^15
   + 30593679475357306372670316797813/12595102555184760619008000000 * n^16
   - 785749129848932618333134357025453/67173880294318723301376000000 * n^17
   + 275581708051003997988541817255279573/42168403354758578552438784000000 * n^18
   + 642193387846955979009281483738217042761/9813737508016541917658480640000000 * n^19
   - 10379707152495210640484367519099555203413/65622913178605350033605787648000000 * n^20
   - 28662530127283669901885121584468088960326233/364665822910787579541585710284800000000 * n^21
   + 4609055620394562855489493272499773205216196129/5087088229605486734605120658472960000000 * n^22
   - 873057563036453343326459102080494704028393390097/813934116736877877536819305355673600000000 * n^23
   - 19289084079854993646765928794776984023563835229561783/8695868619687619024133993253593677824000000000 * n^24
   + 1182490481385670104330958793922877551368861956689593353/155502591787355069608043173476028121088000000000 * n^25
   - 293417158736416271896554762676460700877470285796817656847/111689736551267778745977009349157197971456000000000 * n^26
   - 39859038349761443605955883817872550236932196068750468867903/1675346048269016681189655140237357969571840000000000 * n^27
   + 26244234609643418748414712844720424679053976070350152552610637/618202691811267155358982746747585090772008960000000000 * n^28
   + 2077245025145718452430941958359096421872386057259172217716184873/101286329026358010734015733227124341272085948006400000000 * n^29
   - 191207856187024789574592797220884621637003872633248259491607835405551/1166134827662716367083406640577189322150843540884684800000000 * n^30;
alpha[14]
   = 10469176753142937388346729/106216681119764447232000 * n^14
   - 2524263545672345614192283257/3332037713011841433600000 * n^15
   + 28798233421533175181823218687239/20791915329193890545664000000 * n^16
   + 13912456133127892258104161571997/2535377787082646618112000000 * n^17
   - 5642793384271167571209335562965961618499/200480637663766499175023247360000000 * n^18
   + 2416612854960792848747357744110015450361/137830438393839468182828482560000000 * n^19
   + 37531174405336506824031127490381559959133931/224939275458746012074376083537920000000 * n^20
   - 2616330145733138560090205392154735810050979/6139719528452849037235086950400000000 * n^21
   - 68829610700469773329308127037458237442895425239/341327210244497174450924224826572800000000 * n^22
   + 63069353283833076130495586379466422512525299809581/24468894384402391193450630367254937600000000 * n^23
   - 714098347019839680389819042844541592537678056730181857/223156316785749807684269748949365030912000000000 * n^24
   - 2661752462851196865891091928419385880894607083642023593/398891916254527781235632176246989992755200000000 * n^25
   + 5961320530838574206567558505826389702787945152445692779/250285123924409588226279012547130975846400000000 * n^26
   - 94590092745211556049112510107228668331259876881195561421/11150842204387935702723354017813583888384000000000 * n^27
   - 17802000569076164486140040573046212865608178116650965279535007359/225025779819301244550669719816120973041011261440000000000 * n^28
   + 6231272989222159551881242282050573601231377672788471696790420989/43196913090312292480708919428987508217694126080000000000 * n^29
   + 422268052780700950950541531621666843181077037988763165839750231840343627/5605286734647678672031164692522288170338508448622182400000000000 * n^30;
alpha[15]
   = 100206984674719544740861653301/495045603076045012992000000 * n^15
   - 36822741875265270244508239254871/22559228132175371242045440000 * n^16
   + 179792631498449481362046446075850677/56496153931013103632252928000000 * n^17
   + 1198746750769645158859022771229488225047/96481306875687627727979937792000000 * n^18
   - 712415136407467601227112286139274196716669/10497166188074813896804217231769600000 * n^19
   + 4324780012493436320334302458159540323213361/91850204145654621597036900777984000000 * n^20
   + 1555975364258875353541471977713778721787643043/3674008165826184863881476031119360000000 * n^21
   - 1749084094448959255650030230541491009564819115959/1529305899025149449590664397953433600000000 * n^22
   - 3736902111701391887100479481424584566863791566838269/7438543892858326922808991631645501030400000000 * n^23
   + 160288079478771431803467565454719360005157928068793941/22073070464677426629639725167817628057600000000 * n^24
   - 205505625990694957725950514798454096070237493947357149/21661039816003447999219783631351699000524800000 * n^25
   - 12495724210779737453458596500764106334450954721020624496477/634054042883350928573315637689830862330265600000000 * n^26
   + 5055693252244555496228110569294083881781629217112771929053811/68689187979029683928775860749731676752445440000000000 * n^27
   - 3183992173345900271685562628167128755396195058359564971811781053/115191768240832779948557118477300021913851002880000000000 * n^28
   - 5698640861911756799224037518645406078168295920245835514736969952989/22116819502239893750122966747641604207459392552960000000000 * n^29
   + 142278670225215087706896520822001994673082990276889571404960221414791/294749152212543199400677229925300609918641519984640000000000 * n^30;
alpha[16]
   = 7712781743942384637654934879373/18338215136419449195724800000 * n^16
   - 2402063456298622602221186822696471/676776843965261137261363200000 * n^17
   + 7668107436276322919714287100049904599403/1041385534531231537381370757120000000 * n^18
   + 361303680860095904135414295125524607/12819051189903224347361280000000 * n^19
   - 7227390188103426658110578949868094476645931431/44088097989914218366577712373432320000000 * n^20
   + 12901408373363616730918554960524450439118853/102117113984051111751513381273600000000 * n^21
   + 497747383538267321534956030212997835594308172021801/464908993303645432675561976977843814400000000 * n^22
   - 252499664598382602456303781455085911751340300461/82547761595107498699496089662259200000000 * n^23
   - 131281534185888595153825331846748525760537617955805958541/108305199080017239996098918156758495002624000000000 * n^24
   + 1426262784250791324747799093000080956187589936714029719/70320626514158153080237367679905483980800000000 * n^25
   - 23170473116883805794188278794166757632616659619691851519/828740273599081251646377980227632916070400000000 * n^26
   - 44044500279817699335584829646278793104954720796019992410409/769175802890176148160771357353766171967488000000000 * n^27
   + 62420418657558519149643437875852556019705678659537976085016650961/277762254345241993722109472497853742008909168640000000000 * n^28
   - 109511822578379305705407097075954475716527637153298910483976431823/1209513566528744189459849744011650230095435530240000000000 * n^29
   - 168398596910687560076596170666837371522448204565539850254693515405079907/204359412200696618251136212748208422876924787189350400000000000 * n^30;
alpha[17]
   = 136336614071421552738346511544707/154416107000986498341273600000 * n^17
   - 27801197719443334715141091692509100501/3573381736136578804739997696000000 * n^18
   + 576392411336288932474450636964598560303/33631828104814859338729390080000000 * n^19
   + 556540535711605007979630683151193569919453/8691707297670641941407583961088000000 * n^20
   - 301243011881263087198414763542811432614781470369/759655217816414105679022838199091200000000 * n^21
   + 989789926631181163755007364622407618669102051/2925597777633984541291825940398080000000 * n^22
   + 2103270728132227977532547099652140536893417990637/779966854656425178023381737616179200000000 * n^23
   - 149750803535199564120198336297627481136417850061461067253/18366093042521305863309053676398844051456000000000 * n^24
   - 827633945205212562322541676028753996760694367358637422131/293857488680340893812944858822381504823296000000000 * n^25
   + 10871559511195696848205970321319912766271482873182818466013/193406204284510078070764728510649051643904000000000 * n^26
   - 1185910777714920025608418139877185236744968114328617926870881/14478603348520962788908637314894422060564480000000000 * n^27
   - 1794514783827843337644294958827668476221297946256830260008605439/10945824131481847868414929810060183077786746880000000000 * n^28
   + 128661408285411985453738219706261617148768669184661116871488103229/189555919076956236027138549181277523417671663616000000000 * n^29
   - 1855414703915628112302305459595288498254055876861869243258846990726549/6247526147877631344159452657828430574942185943203840000000000 * n^30;
alpha[18]
   = 67752028110741493306780180177177973987/36222105548912401300221591552000000 * n^18
   - 5545658735018547601364002065686581343/322869656256540697864175616000000 * n^19
   + 6903145472582253547590916629983711429839564343/172188516038387197287245176658460672000000 * n^20
   + 2594359997714507009889054556821919665165991039/17814495239540271366199495675084800000000 * n^21
   - 2653661574489733699865151526666294107005175728022119/2762887731633092857043339748896900382720000000 * n^22
   + 223899545504288463905906021765274294443981546647858717/247796493430843015616074533729190753075200000000 * n^23
   + 144506895392063363464005464205241390539753389057581011317/21348620972503398268461805982822587957248000000000 * n^24
   - 199508703723852397940714471767792646467211904185547826559/9208240064528857740794868475615606996992000000000 * n^25
   - 123747223374921892225259794899435553979183207374624389411529/19856370306543034681931845460426635968774144000000000 * n^26
   + 74365730590824979951370872254622112553384627249684845833999/480734876806360092600482098346103857479680000000000 * n^27
   - 453806568576657850636481186180714169477831867390896126354437393759/1902140993515290007355661135881569592628719124480000000000 * n^28
   - 129377367350744075863584786744687343612005128384626716428469495967/279376958422558219830362729332605533917343121408000000000 * n^29
   + 9812276168495581890730160638055577559800537496316269869797927437190396177/4833641563655724730627900082998991975493047684412997632000000000 * n^30;
alpha[19]
   = 471824901393496747102665687245792177081/118103493571358059411833618432000000 * n^19
   - 50561675675044750669650971499055765086319/1324934718670261598085912408883200000 * n^20
   + 67251111238362727892454291277989954473027123753/714019364752482795768480796350873600000000 * n^21
   + 240180124848943302649869868199872368699919588928959/724551150382581917006065888097048985600000000 * n^22
   - 485940263706654462038872744309833664639315267073048459/208670731310183592097746975771950107852800000000 * n^23
   + 1699999199365185300098132938338874634674993023922086094213/706611263899109188740995696707766052716544000000000 * n^24
   + 18316002921325135783401359443916180813949011876130693396319/1081422456054288845377523848874494132853145600000000 * n^25
   - 1070798289679403964467272203329695220087675802370874334174677/18654537366936482582762286393085023791716761600000000 * n^26
   - 66905570444410496337928253364613460714163911189816744933/5208993291563945942641955456499557439897600000000 * n^27
   + 639717024183652714810791734101835747576462370463927529907834770743/1512416617024375325397452369319368303913436446720000000000 * n^28
   - 121315610544001063260669429484399550327396846073348792749387872304069/175562790458797122792695361672570558744154047774720000000000 * n^29
   - 2310657553908327208643487025983368468395539176694805984465325989447845451/1788765381287069184854074866241403280404499554264678400000000000 * n^30;
alpha[20]
   = 202399116895368048088234707551711981612353729/23547147492429018432443784842182656000000 * n^20
   - 3365095273417630466576291762515903066833421003/39463570282275703540635396955176960000000 * n^21
   + 2717825461890719651841152458000965236132994648134207/12236863873128050153880223887861271756800000000 * n^22
   + 167575736694631175164505551372730340638238831166089517/221984358698463534822733436465733382963200000000 * n^23
   - 1780457197357285934359849612457829809553519546045920132315603/315054408863816150286651947972102624037883084800000000 * n^24
   + 31433611667605561414091907198192986558131456317053607536179/4922725138497127348228936687064103500591923200000000 * n^25
   + 81043708724580147220822100302291795209006507032171545390245907/1918125371612057150274616271477213034583582310400000000 * n^26
   - 1577108197581107731425828348589622362098940512581130343622369/10399988029071674998896733424633161124413440000000000 * n^27
   - 5514916654831738928837454570878277449201710700255298388849026950313581/235404621606609970647462666379821037767518556059074560000000000 * n^28
   + 2277087194186373183792618936007821692864753094815436081352010122233691/1980567729863305041505094548868686615832487851458560000000000 * n^29
   - 143439353635410339941300281453638717803865413230045426199413290694870693/72062639267329582851264081544843174826791394711961600000000000 * n^30;
alpha[21]
   = 7593597428771861155598510033855442354788700917369/407895462437601671796007462928709058560000000 * n^21
   - 45805642625336613066067381416091711616993807717957/239175066611139162098568012353652129792000000 * n^22
   + 1990618787705329951428358040285346629497792311202946171/3788533055120444327641317315681849735905280000000 * n^23
   + 930144112851858298709480062321695584642393218056377949791/540958806428255752552630405171879505559552000000000 * n^24
   - 752902102022542070422923926458337877174355061465216481203/54858440486545321043175068539316832105922560000000 * n^25
   + 24990276016004332532181513229852654837023995611735929270423877/1479326420770302763580519691998352523776334233600000000 * n^26
   + 1273703517934435922639076948106483178914355724092343511679304023/12119166110998363411723475629310149719087906816000000000 * n^27
   - 387147736345336231749751695652681175080211230836264638568453074861881/968987437728821283747116150252959580864281690767360000000000 * n^28
   - 26472588474688318840378923145456844687860042284441254323438583079847087/823916175623134897266119332329373632186314946206760960000000000 * n^29
   + 489733176366105123100315909250683812497390264686335645655218001765029594209/157573968587924549102145322307992707155632733462043033600000000000 * n^30;
alpha[22]
   = 2439323846938124516749950544509820877337338687175781/60135445319372132184782814534632535490560000000 * n^22
   - 34073601205416895076590748626649694428085903921401/78848923058617306186341102973731471360000000 * n^23
   + 114050797567384263375075461734480044074661222373269471907217/91493073281158730512537813173716671122112512000000000 * n^24
   + 137273833008580661426413574856400098350445610433824603561993/35055769925661361419206064286668615837548544000000000 * n^25
   - 45059179088074031893922072777375249940924991766835661888221084641/1351036625382288628601140188130286029427907231744000000000 * n^26
   + 206898006671113514273360240583654940027344524273411544491451421031/4644188399751617160816419396697858226158431109120000000000 * n^27
   + 2440824507911814657571898799746797396009020312235697337059397039885469/9362683813899260196205901503742882183935397115985920000000000 * n^28
   - 696311481675417712820466561405304148537325788366564328711011454870887/663190103484530930564584689848454154695423962382336000000000 * n^29
   - 6924245472208385163375477930704649011923426449727911613839020300441563381/3208778996699554454443686563362760582078339299590694502400000000000 * n^30;
alpha[23]
   = 7474565215206746325580483864591180104671541156913/84105517929191793265430509838646902784000000 * n^23
   - 16782060552985470049913293468183373087712600299046298630661/17138376408101110027167409206815767742801510400000000 * n^24
   + 6503735528674785551831538506800050725715065676154256817241867/2193712180236942083477428378472418271078593331200000000 * n^25
   + 43999179965065941867057377378097709899255133565469268235339039/4935852405533119687824213851562941109926834995200000000 * n^26
   - 320196265269217417773345496488501328010142269670188589023798556437/3948681924426495750259371081250352887941467996160000000000 * n^27
   + 123832182350468652680214620379816199199842965715033754557125222024173/1057259585265194237131946607004781985746328055971840000000000 * n^28
   + 223366335034930390488779600823060385213901770612295015887755022091478569/346358240132877632084425708454766578530497071136374784000000000 * n^29
   - 5683975145729510214638167363294386038771152028333168572495195332205249204543/2065161006792282881303388286661545724488088786650634649600000000000 * n^30;
alpha[24]
   = 39494178711472476796003427487122912293893944185276935843160849/201821520581798671679923410819462480939230586470400000000 * n^24
   - 76348957557716638341723622087037389639067389665177807014579/34276752816202220054334818413631535485603020800000000 * n^25
   + 4701748482852793217057834734347787548724108110072753226999643/665345672247687928615132123580645541557903032320000000 * n^26
   + 679403733200977595115362734887022205196905112342852746889825923/33505525877837670103112284999324825937176952832000000000 * n^27
   - 1551880057739501281928982393705767292741074023417989103820403149655498881/7867890886969072136238806216750253141927340875196661760000000000 * n^28
   + 40509752985115825377187326802004288703338863504362380792112685460851409119/131940842100618072972160918314487643508961228036012769280000000000 * n^29
   + 930119149078652355869135614976346780332901622265792177140238904719349791424829/584599423461200077168959145762652943547397441144179654656000000000000 * n^30;
alpha[25]
   = 8740098043964194699013511747075939410275887707894105297617/20190228149439643025202422050766554715809382400000000 * n^25
   - 560970870667805373435462259322216583674714967329353232405989/110325175245152335101998949063117245411386982400000000 * n^26
   + 37599914809270379883026138747614917048973558104768871252051312999/2227899902526348973090063625929131283095402577920000000000 * n^27
   + 62112464645162326712991624734748037976412787406014636486771832698244341/1348054580849226799204709254809580010308671550814945280000000000 * n^28
   - 337728148943314333204134420372420356729249456410758236907291010482662683997/703684491203296389184858231010600765381126549525401436160000000000 * n^29
   + 9318731629311992919328873307373838077895502043140333484055412345740103859247/11610794104854390421550160811674912628788588067169123696640000000000 * n^30;
alpha[26]
   = 981053882391585426104317525561993317308039476510023968359/1020137843340108279168122377301889080377737216000000 * n^26
   - 804535427693867223518181752525105894684868959294094526147221449/69088598041109651665505696484929975427905303347200000000 * n^27
   + 1850220524749669257030657681847129002392911081379585567459419325323237/45823979891138552002269970273380595222214183119277260800000000 * n^28
   + 4964057679773584492591452849477564911024827566211763096636472333282359/47482084426673170660246844197746340444070617376882688000000000 * n^29
   - 4451537474316831472817032033079424859226655324781227836739835901181143999400077/3810722167747081984508770727934330298679331468199097008128000000000000 * n^30;
alpha[27]
   = 219796242799180006558858282267295702822729406335181729959735197/102474606956438773279014366383959253494644552499200000000 * n^27
   - 1991862922927036259097631233677478784353889919238496520767270708775317/74463967323100147003688701694243467236098047568825548800000000 * n^28
   + 6916252182087743491582730686935092456222021350509646835638283740939656053/71485408630176141123541153626473728546654125666072526848000000000 * n^29
   + 4178831185325638216557225776185254600956561244767568179257086044280129070299149/17648407039378673440756244433745867195758653862097068018892800000000000 * n^30;
alpha[28]
   = 215719482708468448409738976464239418783926747463596671692384366197697/44929100822557395094481533143462725012487441496072519680000000 * n^28
   - 278069851593691889742988308687280247895937313870882245850732354899927/4512967716551524060829618284499604074915033185989427200000000 * n^29
   + 10456333895529602975165309445620837322364136333954987435106098028819923116751/45038779803274177894987830782750235833811918467990185574400000000000 * n^30;
alpha[29]
   = 27323334865827529185376977771399500293634233810796735936299404584293/2533595911046469648185048861473461936794404595643187200000000 * n^29
   - 52262641147658201267292303345886757439639836488719164781023668387608491790413/367286072424459165080994152236686477795330009828475136901120000000000 * n^30;
alpha[30]
   = 138503251037159093918050273397984791664345186887370360837473296764761046660471/5699690220901306106942517947753261728997763363224497107763200000000000 * n^30;

Krueger, p. 18, Eq. (26*)
beta[1]
   = 1/2 * n
   - 2/3 * n^2
   + 37/96 * n^3
   - 1/360 * n^4
   - 81/512 * n^5
   + 96199/604800 * n^6
   - 5406467/38707200 * n^7
   + 7944359/67737600 * n^8
   - 7378753979/97542144000 * n^9
   + 25123531261/804722688000 * n^10
   - 9280258847/6437781504000 * n^11
   - 1628053924171/99584432640000 * n^12
   + 171201246542931467/6186450514083840000 * n^13
   - 5718183564876629179/180953677536952320000 * n^14
   + 644468750008654952687/23162070724729896960000 * n^15
   - 212771552062192641437497/10336074060910716518400000 * n^16
   + 490410367787088228908921/33923525122989018316800000 * n^17
   - 17113867364186490261786648857/1602504922403597489012736000000 * n^18
   + 395980314414341959891853827859/51280157516915119648407552000000 * n^19
   - 19481411440513215539899023606263/5115195712312283184928653312000000 * n^20
   - 135570116300721989060886034459593007/108032933444035420865693157949440000000 * n^21
   + 11080348232555971953029572642513796537/1863568101909611009933206974627840000000 * n^22
   - 250868515348150853528597220771122960249/29817089630553776158931311594045440000000 * n^23
   + 961059950401200029458005065879527529605493/118813647905349159549301543874372567040000000 * n^24
   - 4018789334131226157542250009395235956239124497/659019700381670004966792563356519838515200000000 * n^25
   + 2391844895236730308938558863293259934461956219/570305509945675965836647410596988321792000000000 * n^26
   - 1573270095968198180509050797007198841027307027401/474494184274802403576090645616694283730944000000000 * n^27
   + 2061253330556904530218418240686914940538061818436749/670816153018501898055698150240601543624622080000000000 * n^28
   - 2710857345655764890042245118743890636519888766789337/1100826507517541576296530297830730738255790080000000000 * n^29
   + 455119247458368582897233478322666951033511063680152518561/460521387375865357577946377396084237894154190848000000000000 * n^30;
beta[2]
   = 1/48 * n^2
   + 1/15 * n^3
   - 437/1440 * n^4
   + 46/105 * n^5
   - 1118711/3870720 * n^6
   + 51841/1209600 * n^7
   + 24749483/348364800 * n^8
   - 115295683/1397088000 * n^9
   + 5487737251099/51502252032000 * n^10
   - 5845886411021/41845579776000 * n^11
   + 6339155669701909/46867049349120000 * n^12
   - 3825933403819459/36248733480960000 * n^13
   + 1576089193435485637/19579096132485120000 * n^14
   - 796020536210393262877/13672055636125286400000 * n^15
   + 2472784862443506933077081/82688592487285732147200000 * n^16
   - 1031884087773262337231/259769057086380441600000 * n^17
   - 3043575175820301204619799099/301647985393618350872985600000 * n^18
   + 1240087853302816440305681741/76309758209695118524416000000 * n^19
   - 162802157643900956474519187209659/7107429831844435583269286707200000 * n^20
   + 12816799444007020333086273455167501/404420161004689889308421652480000000 * n^21
   - 8434093090274924630876141677262180833/219243306107013059992141997015040000000 * n^22
   + 4577121708190925068719017020286339507/116473006369350688120825435914240000000 * n^23
   - 3765607524414111763649498176471170518355049/111925900200691237256588410896148070400000000 * n^24
   + 1131301743028144854789954188008691387730629/46411581213027015448945915575926784000000000 * n^25
   - 460026540064989874633511523684594620842417879/29318721223109392213055526792924758016000000000 * n^26
   + 604271886240145180390884566623502375996747842517/59723660347088844200115576054184610365440000000000 * n^27
   - 935636652514721565914189601103950324131311023910747/134163230603700379611139630048120308724924416000000000 * n^28
   + 13991916555135286064709925920796585055379160510097/3716480422922153591658662648136502628843520000000000 * n^29
   + 551187495544637127580837409130179426064488050021383801799/558977683987257261611852154632488454271525086822400000000000 * n^30;
beta[3]
   = 17/480 * n^3
   - 37/840 * n^4
   - 209/4480 * n^5
   + 5569/90720 * n^6
   + 9261899/58060800 * n^7
   - 6457463/17740800 * n^8
   + 2473691167/9289728000 * n^9
   - 852549456029/20922789888000 * n^10
   - 2673218294321/191294078976000 * n^11
   - 1619588070701683/35150287011840000 * n^12
   + 799518679601909/34085126799360000 * n^13
   + 29003748875152374779/473263464327413760000 * n^14
   - 1018892483578870404121/11218096932205363200000 * n^15
   + 481644368636077473383677/6234457370073130598400000 * n^16
   - 723295134325860384163989341/8379110705378287524249600000 * n^17
   + 18449123896439664237491327/175105254678958021017600000 * n^18
   - 9545551652020360064000248463489/99543835179894055788085248000000 * n^19
   + 1624734283470807394728668252816369/22704289740614169224332443648000000 * n^20
   - 2700625783869782207997557873010304073/43592236301979204910718291804160000000 * n^21
   + 115833584495328576175632817607784109681/1863568101909611009933206974627840000000 * n^22
   - 80331805706465175347621476210358062805003/1550488660788796360264428202890362880000000 * n^23
   + 521874000525184838244754419829212765128887/18500148793502683844064200148123648000000000 * n^24
   - 381143434387098814023111575357004480524467771/143265152256884783688433165947069530112000000000 * n^25
   - 3524924454475074760191004058569251720124879785757/215005177249519839120416073795064597315584000000000 * n^26
   + 38831080481512203835364300143596202089804731885903/1433367848330132260802773825300430648770560000000000 * n^27
   - 8744571180068348778510935237066929988537179992179467/279936740778874830534781728081174105704890368000000000 * n^28
   + 924277626444402405054252433779774364643696474585704740403/27948884199362863080592607731624422713576254341120000000000 * n^29
   - 126306569153879537470902727265265301493989903234598946584327/3458674419671154306223335206788522310805061474713600000000000 * n^30;
beta[4]
   = 4397/161280 * n^4
   - 11/504 * n^5
   - 830251/7257600 * n^6
   + 466511/2494800 * n^7
   + 324154477/7664025600 * n^8
   - 937932223/3891888000 * n^9
   - 89112264211/5230697472000 * n^10
   + 12003335387/32691859200 * n^11
   - 537877266968267441/2249618368757760000 * n^12
   - 63357208977773989/597554879201280000 * n^13
   + 887398150788484759/8825425908203520000 * n^14
   + 2384026112354539199/18578524426076160000 * n^15
   - 367013781018742745596861/2656100181332931379200000 * n^16
   - 116368807092865455691/7292981549216563200000 * n^17
   + 13509292858664313453220237223/388843106171461155422208000000 * n^18
   + 12614093798238667596568634093/279480982560737705459712000000 * n^19
   - 42830094113304502651660706556769109/1538549516540442526260645593088000000 * n^20
   - 1668094745107834360626912832785989/31436708871619618925998768128000000 * n^21
   + 324878397379290831787720619212058141009/5100291647331566974554040141086720000000 * n^22
   - 83347374922531563076841834327924641529/3028298165603117891141461333770240000000 * n^23
   + 61194082538219225945927920756047806920251343/1628013093828236178277649613034881024000000000 * n^24
   - 98047007466353520331537046826194116951241/1156259299593917740254012509257728000000000 * n^25
   + 1493069566723126691789414021618816357112902099/14163713916305654751015551633403464908800000000 * n^26
   - 428919341299773794465717432164006775623731672469/4733778760465280548815978897476564287488000000000 * n^27
   + 17024219401413321980501656137013731587720179574723869633/238879352131306522056347074629268570201506447360000000000 * n^28
   - 1999391624298578429684484594521785906724957573844027707/33592408893464979664173807369740892684586844160000000000 * n^29
   + 11744245649394563850890264467671937396646650052934109768653353/235189860537638492823186794061619517134744180280524800000000000 * n^30;
beta[5]
   = 4583/161280 * n^5
   - 108847/3991680 * n^6
   - 8005831/63866880 * n^7
   + 22894433/124540416 * n^8
   + 112731569449/557941063680 * n^9
   - 5391039814733/10461394944000 * n^10
   + 4863559943251/167382319104000 * n^11
   + 37588208648677/67596705792000 * n^12
   - 940430600213372183/7648702453776384000 * n^13
   - 3291872437542629663/5190190950776832000 * n^14
   + 189272332747364970877559/523171247838304665600000 * n^15
   + 502532269819919668347149/1208525582506483777536000 * n^16
   - 949451228897166389540897/2708180577045341798400000 * n^17
   - 1784576325496520253476120683753/7154713153554885259768627200000 * n^18
   + 524830142025358848902662672939/2071953130441233740385484800000 * n^19
   + 2016209403231616185652826723458583/12019918097972207236411293696000000 * n^20
   - 16096897691007333935470338878197156361/100005718575128764206941963550720000000 * n^21
   - 76250060255013791707276485885487883543/490412658397266055245580782796800000000 * n^22
   + 9252161795915253082728155240170650043693/58289047398075051137760458755276800000000 * n^23
   + 7020751793938461613149395590976276678732551/107300863002315566295572360859117158400000000 * n^24
   - 579414190481675218910106244870862973300742643/8393311950403350963564771338313164390400000000 * n^25
   - 14173007029062232289088502554662276328011078147/150540045053305816210793863075031112744960000000 * n^26
   + 772937441939971334194668845837513587924053359303309/7321000085750240746251238393754144640860160000000000 * n^27
   + 49025366795674025628029223704689793073534968814712031/2399457778104641404583843383552920906041917440000000000 * n^28
   - 669686609255507094686692239475289306509135059892997117053/9137135219022474468655275604569522810207621611520000000000 * n^29
   + 40227222695357598417206145371640258351589316954641039386851/1130720483354031215496090356065478447763193174425600000000000 * n^30;
beta[6]
   = 20648693/638668800 * n^6
   - 16363163/518918400 * n^7
   - 2204645983/12915302400 * n^8
   + 4543317553/18162144000 * n^9
   + 54894890298749/167382319104000 * n^10
   - 132058444054073/177843714048000 * n^11
   - 21678380925301381/85364982743040000 * n^12
   + 12818665941423773/9855505820160000 * n^13
   - 4808615626581842484821/26158562391915233280000 * n^14
   - 17463465220672744627/12110445551812608000 * n^15
   + 165202773463857304705337/353370053364468940800000 * n^16
   + 812997634361998476236143/536189976806503219200000 * n^17
   - 154619327801320908736885805799083/176116016087504867932766208000000 * n^18
   - 161959155482489360388164840926603/143094263071097705195372544000000 * n^19
   + 9349367148014299101273724109539769/10684371642641961987921149952000000 * n^20
   + 131732029936307954433180838298519269/162769724243373639659736268800000000 * n^21
   - 8489365993766826694602346374698947667527/12000686229015451704833035626086400000000 * n^22
   - 235155180584267064004207367582121161331463/369771144431538605655167910228787200000000 * n^23
   + 10739171442634029743650624432194704913120097/17833938449138321267962165239742464000000000 * n^24
   + 1762807308141499286674865995442897164018384597/4035617016594442070601857542605766656000000000 * n^25
   - 558496189945509263731011585527531303192423984003189/1264536378447768856170668449830261347057664000000000 * n^26
   - 97808507187022352611022156010465649331807161947569/289789586727613696205778186419434892034048000000000 * n^27
   + 32615652758302709344528899560237170963687405836157/90059147187314916442820962074212161290240000000000 * n^28
   + 943749252435341852900014209629694019211039392602319/4138675144863930994107684407508081919918080000000000 * n^29
   - 2396490245787484054215780490518037472472963419615505648060407/7617485361542947135973661346125328490194143490867200000000000 * n^30;
beta[7]
   = 219941297/5535129600 * n^7
   - 497323811/12454041600 * n^8
   - 79431132943/332107776000 * n^9
   + 4346429528407/12703122432000 * n^10
   + 947319776978297/1625999671296000 * n^11
   - 139564766909992667/115852476579840000 * n^12
   - 3704835620812833323/5560918875832320000 * n^13
   + 498841790610177443141/204363768686837760000 * n^14
   + 39982484505071686289633/174390415946101555200000 * n^15
   - 356813950170946951528704559/99271744277318310297600000 * n^16
   + 15060663961223625760663/21138232235891097600000 * n^17
   + 38394769836703949013594096271/9359907317575726399488000000 * n^18
   - 175303180605302340156213620047457/109024200435122061101236224000000 * n^19
   - 4999297133725717096793715285507829/1226522254895123187388907520000000 * n^20
   + 130827473840213685129346417144165899127/55558732541738202337189979750400000000 * n^21
   + 36940598630244479002168059481052336008621/10875621895045253107504938536140800000000 * n^22
   - 526486046546475419696035545214440337907/215492198539596346402574633533440000000 * n^23
   - 181704492729012922104603484325333564859103969/66558805997676949017930223841181696000000000 * n^24
   + 16251647159655239438323473490445618080618846399/7202872969057694555540376223685699174400000000 * n^25
   + 341205978466077200076092703065430429896507462203/161292905414256231654421996151819049369600000000 * n^26
   - 897269639413978000885629059505489580735895982361633/465305593801127068287908304050096166666240000000000 * n^27
   - 399121663633099371655729890858867495172854098268708589/248291717908219414909110750124171815494772326400000000 * n^28
   + 40132241906468687661336733055001237954868039321697804833/25223285628771496117750933345947613002643537920000000000 * n^29
   + 1896891499373733290268263706761724164585169669418091941816783/1593777443203777332318298787597055335894786569666560000000000 * n^30;
beta[8]
   = 191773887257/3719607091200 * n^8
   - 17822319343/336825216000 * n^9
   - 497155444501631/1422749712384000 * n^10
   + 4081516004323/8281937664000 * n^11
   + 3016420810780677019/2994340933140480000 * n^12
   - 41961075720314059/21502921789440000 * n^13
   - 14085528104367162867569/8992005822220861440000 * n^14
   + 10746171896356804622543/2308215780257587200000 * n^15
   + 13662158833536453560398591327/11118435359059650753331200000 * n^16
   - 57341614923409542539239823/7238564686887793459200000 * n^17
   + 144453057736406779924709655689/542023723754157974224896000000 * n^18
   + 887382930255915812302412329/81992895194724433920000000 * n^19
   - 2060398135313747799783225762752903/741970252961247360272302080000000 * n^20
   - 10832617062792890567329480261903684747/885060375573344165649815961600000000 * n^21
   + 10495965053853858396700728872356351447/2011024758699196210707274137600000000 * n^22
   + 2827633829976426948425669998692889423/232406442150553432674163438387200000 * n^23
   - 413070973425124733081767504737914466664159819031/59317777392239837516214863018588110848000000000 * n^24
   - 192169586323003861221251799348718483715643402161/17652874435161653033977716034322300928000000000 * n^25
   + 1383590112272607978551162261646356694508727283546677/183025002143756018656280959843853616021504000000000 * n^26
   + 42340030181859331179384696226318556087021301196292587/4618521538471343283279589846059743591792640000000000 * n^27
   - 41375761937244157344578465659087922365834839154673258123/5675239266473586626493960002838212925594796032000000000 * n^28
   - 20325331939679357943380416802660356668728866279500649633/2734164750775035223701517188867368206341242880000000000 * n^29
   + 26392423128042468212590130065257380662845826882235929755361/4017520183960092210271288782654341375876703191040000000000 * n^30;
beta[9]
   = 11025641854267/158083301376000 * n^9
   - 492293158444691/6758061133824000 * n^10
   - 3340781295639871/6360528125952000 * n^11
   + 230755947172792843/315376186245120000 * n^12
   + 2325760279413600365521/1332149010699386880000 * n^13
   - 348782269044368632301/108224036583505920000 * n^14
   - 136098374245460277375071/40852569661447864320000 * n^15
   + 239596529464231037411713/27496921887512985600000 * n^16
   + 35364463403763955482475445281/9177121248747648240844800000 * n^17
   - 184592588983229841779643912853103/10840474475083159484497920000000 * n^18
   - 104873550118556639023307009752009/57815863867110183917322240000000 * n^19
   + 7665339074386065543669975721317792709/290481354034328341546606264320000000 * n^20
   - 138062270900799459529491732714711746071/42901861518916185828421848268800000000 * n^21
   - 17357777314150207521711937000950161082441881/505716418119604269498979641930547200000000 * n^22
   + 4926642534361691999909217208854551999460491/475968393524333430116686721816985600000000 * n^23
   + 10015652615289525910183306384331679276443744239/259601094634730191676142882857680896000000000 * n^24
   - 116738227431164324545575763544019189664534311289453/6778703783102074765047442957179763556352000000000 * n^25
   - 84974069676491141925432663367251874389066142853087/2178869073139952603050963807664924000256000000000 * n^26
   + 3976320059916609695369389466291419325879319135434479/178432977000364290589635917840602808451072000000000 * n^27
   + 1586328506886857290329263116615881138694586692983247121/43790426438839402982206481503381272574033920000000000 * n^28
   - 80406545804397163817501103989422456991161536019523815972843/3266415488925908747248745868300215883842338160640000000000 * n^29
   - 96019711772725383787880372103741416386264796387585150918847311/3025517346617622977139150860513074962408965721292800000000000 * n^30;
beta[10]
   = 7028504530429621/72085985427456000 * n^10
   - 1396721719354981/13516122267648000 * n^11
   - 242069739433316973869/299733527407362048000 * n^12
   + 19998425063839930261/17952789402003456000 * n^13
   + 2005763449529247335066903/661811628515455401984000 * n^14
   - 1210830366517042702115957/224800145555521536000000 * n^15
   - 1753821857771614575775682513/258106535121027606773760000 * n^16
   + 332272605573163585761859289/20456813245552459776000000 * n^17
   + 344973470391758976060874801536373/34689518320266110350393344000000 * n^18
   - 2237438243573786540754649786424759/62874751955482325010087936000000 * n^19
   - 1109701881606701094584605721502811981/126755499942252367220337278976000000 * n^20
   + 627358150977452113555749190570504329703/10130537221947200911437893468160000000 * n^21
   - 9310014587788716960656374062579608860273/311210103458218011999372087341875200000000 * n^22
   - 446788868484797840813986816673961950907461/4958004099211806563715486685593600000000 * n^23
   + 1592669172541355914905142337333376652510632300857/95325521949872926383479666585340425011200000000 * n^24
   + 112875421374453323075239925362172217825744049933/992974186977842983161246526930629427200000000 * n^25
   - 11164164940636962806588613537158861808945650584917881/292840003430009629850049535750165785634406400000000 * n^26
   - 36738853303604438684911490335783868504502367676508134849/287806815871056339337001809354459811193815040000000000 * n^27
   + 216582649507727909201718946529683408391594400595766366243093/3674717425041647340654839101837742869322630430720000000000 * n^28
   + 4070973538524250670523695550641268121153963563101596930691/31101124040066025669604758023366313347131637760000000000 * n^29
   - 2373100737803367912157154987764399515404306692774646531223199381/31685418030031833360584561739191475969955713735720960000000000 * n^30;
beta[11]
   = 20180430688893997/144171970854912000 * n^11
   - 39227670225311092139/261131482210959360000 * n^12
   - 15850794471105785046511/12534311146126049280000 * n^13
   + 250199410574189500301/144626667070685184000 * n^14
   + 137588598842474725924656737/26071367183942182502400000 * n^15
   - 2668119315218475090518868331/293302880819349553152000000 * n^16
   - 147889032611857077276756370409/10949974217255716651008000000 * n^17
   + 107809340048140291312939137043109/3572429088379677557391360000000 * n^18
   + 6793119291340068971080115425271339/288802688407957090955427840000000 * n^19
   - 6754847041326342703335830346240936391/92384494472017791155888455680000000 * n^20
   - 64145623999655583749753779305277081997/2304645453495497585824314163200000000 * n^21
   + 2737268880658025692322671196199068915388587/19450631466138625749960755458867200000000 * n^22
   + 63226986025671434632048293692546868186915331/3847688551847059057446782170772275200000000 * n^23
   - 1090700244153262995408297323217157326170412252281/4814420300498632645630286191178809344000000000 * n^24
   + 55625038880876569156054733788858925319816102829/3136997842858837560953670640406102016000000000 * n^25
   + 6071056974043791221702396204511472430847588724030069/19238423520792536051938623619950522138624000000000 * n^26
   - 1146269064361582904187395791106052397722761459105729423/15595948667522482559438244214573223280377856000000000 * n^27
   - 106019806434003656675170902610826150161372006096027080991357/271427991622394405843823342749378734665876111360000000000 * n^28
   + 261700017996377874094049879699967368736409082839966183897/1848807094916266706471338222217990529865482240000000000 * n^29
   + 5564919878581209713189603625962524384371461254179337341860987383/12686544328430714529140303040105962058283049444966400000000000 * n^30;
beta[12]
   = 170866240186706518133/831839653739888640000 * n^12
   - 213377450872182833497/957482101440184320000 * n^13
   - 6175888888953945958057483/3072696846678900080640000 * n^14
   + 1699533901862334396426791/622363365936119808000000 * n^15
   + 1110507543583378006712775869269/120449716389812883161088000000 * n^16
   - 410039885606415108766607293/26460299485682270208000000 * n^17
   - 1868368333536354056091172181516467/70734095949917615636348928000000 * n^18
   + 38905214964730326413906323913167/694966079629641887907840000000 * n^19
   + 2767874903566891102867927978915243454399/52392273309464311784406075310080000000 * n^20
   - 20032373737511717465214006054179506710383/135073829625962678819171912908800000000 * n^21
   - 100577682847890502637160841018962740658759229/1322642939697426550997331371202969600000000 * n^22
   + 135919298571923883567006460953143491460279/435079914374153470722806372106240000000 * n^23
   + 3510216107422604000609260948095627318487208075137/48884883051216885324861367479661756416000000000 * n^24
   - 101070009063831782999779504525998847565124914603267/183700224590900951884830607482166444032000000000 * n^25
   - 290915990038543653257693921668246116917159442076793/22092475361789230960742705145987138060288000000000 * n^26
   + 87749504586448696585237158790684148758827946213899707/104709128016813542574353446264834873098240000000000 * n^27
   - 24637643848282085933220710334515754322900635607050021800141/214101183307748640575968216577661209193027207168000000000 * n^28
   - 21317214475850887868873427382826252613387447653666787141648689/18832926803338442620856050396918432205278480957440000000000 * n^29
   + 3923499613488828643584115055056306377586308324262330823616543131/12820086900308932576815464124738656395738660491755520000000000 * n^30;
beta[13]
   = 18814610183483742537419/61278854492171796480000 * n^13
   - 46368551984271450700489/137877422607386542080000 * n^14
   - 23268635133649915499415221/7193604657776689152000000 * n^15
   + 445607162860807165073496089/101984636074370531328000000 * n^16
   + 133255376497039560923384901787/8246409857103065776128000000 * n^17
   - 17940677571433980181912441444683151/674694453676137256839020544000000 * n^18
   - 2757949059159666555325445738852023379/53975556294090980547121643520000000 * n^19
   + 24878591848279833324547251174969715273/239776028921827240507405762560000000 * n^20
   + 15564548980094931213936099440270052236488729/135655686122812979589469884225945600000000 * n^21
   - 30311212070549573455862406697198244599608233/101741764592109734692102413169459200000000 * n^22
   - 62329425035966782423701548637355352965648981/325573646694751151014727722142269440000000 * n^23
   + 623169776009883975758448302456707372300199400409/915354591546065160435157184588808192000000000 * n^24
   + 9796262122721002376057350329922999007473366798297439/42296704966160578933387743185479648935936000000000 * n^25
   - 6972722553962255796263966532090565610961098085631862003/5361107354460853379806896448759545502629888000000000 * n^26
   - 204621385793344479983894287397851209945711725896319703509/1286665765070604811153655147702290920631173120000000000 * n^27
   + 16994612718512721017891137595235443147803252876143561437699/7912994455184219588594979158369089161881714688000000000 * n^28
   - 2017139943063547149336991050682980115243753114376812382829593/20257265805271602146803146645424868254417189601280000000000 * n^29
   - 38559351426567355385426086606064720807546966166200767527984103843/12275103449081224916667438321865150759482563588259840000000000 * n^30;
beta[14]
   = 8913139575903156465851797/19119002601557600501760000 * n^14
   - 267685764482874813822622157/519797883229847263641600000 * n^15
   - 1312607511537430955013430449229/249502983950326686547968000000 * n^16
   + 394441446207451421108383701253/55778311315818225598464000000 * n^17
   + 23930383074197527389616417665944303/842355620435993694012702720000000 * n^18
   - 3163985271870363313136985965093069527/68915219196919734091414241280000000 * n^19
   - 11031130611852394131866851413708829814267/112469637729373006037188041768960000000 * n^20
   + 82762604768504677943482108437799827136297/430547831932756038736110472396800000000 * n^21
   + 5150460631556395571372500982024919497071310731/21162287035158824815957301939247513600000000 * n^22
   - 29066497085581091842637088116335089148411714769/48937788768804782386901260734509875200000000 * n^23
   - 18574016067923889310355562046347950371431867757801/40573875779227237760776317990793641984000000000 * n^24
   + 2915644146751542300994700670854893964155460634998359/1994459581272638906178160881234949963776000000000 * n^25
   + 44136416359780678842389174803925334595468092209791307/67329448721643370547025387111579849326592000000000 * n^26
   - 19779807925985904471082228799863307496144797516514281/6575618800968119560003273400983467589632000000000 * n^27
   - 9437414987664054735309211086890504857237214217749919547327367/14401649908435279651242862068231742274624720732160000000000 * n^28
   + 10935173238809263052452436833453551042581316812365555123043/2044824288298806744648942931549704531015106560000000000 * n^29
   + 9844133982291098741335196902427881991238566220082170652715161789559/44842293877181429376249317540178305362708067588977459200000000000 * n^30;
beta[15]
   = 602749854274775522930992007/840077387038136991744000000 * n^15
   - 432388677389347815771203181653/541421475172208909809090560000 * n^16
   - 509985088489059649186381056338807/59064160927877335615537152000000 * n^17
   + 557542563821291613858429695152674917/48240653437843813863989968896000000 * n^18
   + 228594885325983207294554048445139632797/4563985299162962563827920535552000000 * n^19
   - 4879838474674757743673587551351918389761/61233469430436414398024600518656000000 * n^20
   - 2751159808671003044739048717767661132425533/14696032663304739455525904124477440000000 * n^21
   + 128125601507169052141729932672077247523358897/359836682123564576374273975989043200000000 * n^22
   + 30192393359192032330697554623405270813965905808153/59508351142866615382471933053164008243200000000 * n^23
   - 4779918733110943106587948891017151456334707858595371/4061444965500646499853709430878443562598400000000 * n^24
   - 43635999640355928220666371208517025763949804332853/41311582611576823901881341954262617292800000000 * n^25
   + 1093615732500524413310474447806551664943154712853580337/352628986416409072575533830586857805787955200000000 * n^26
   + 12242342315633438381845240050057352332923530458934703251/7112724086411810733447920053364873798615040000000000 * n^27
   - 201490867217252848518061423700123290704826593788569337593504193/29489092669653191666830622330188805609945856737280000000000 * n^28
   - 177101515631733926913192960801449153246340895052913001485847913/83263320479020776471051168932297804075141242552320000000000 * n^29
   + 3188424179872321062468258619737006762022989524905745242529616829657/245231294640835941901363455297850107452309744627220480000000000 * n^30;
beta[16]
   = 258111286167289650792323028754789/231006496073475801518545305600000 * n^16
   - 5263782718468783726282279549/4203582881771808305971200000 * n^17
   - 5480008133286071057255185152124708229/383668354827295829561557647360000000 * n^18
   + 3254656358469551348762078052918542501/170852314259030174101631139840000000 * n^19
   + 3903418284121815685136619157954211820691189/44088097989914218366577712373432320000000 * n^20
   - 1475869269349982196110739285641411486418113/10620179854341315622157391652454400000000 * n^21
   - 165406053235626113240302780087909075941876233947/464908993303645432675561976977843814400000000 * n^22
   + 31141324189381440915034448751509805569920381009/47217319632401489256111763286812262400000000 * n^23
   + 3425331498104147467678431771772144489569980472050747/3281975729697492121093906610810863484928000000000 * n^24
   - 181114801957939134097279485499338367321177700348427827/78055895430715549919063478124695087218688000000000 * n^25
   - 20329880662120223623532772221831681492746536794968375279/8563846812969934619691535885680832426278912000000000 * n^26
   + 15514402521245792750246961997116209460024931536101177881/2381963776692158394304324203418114597060608000000000 * n^27
   + 58528872092571805627208033537162293354868952581483996308205593/13610350462916857692383364152394833358436549263360000000000 * n^28
   - 2739294316618535857897844520835697665418072257962762663947501/179187195041295435475533295409133367421546004480000000000 * n^29
   - 28963918619355858559987610778078259702157647632421717394029814967389/4700266480616022219776132893208793726169270105355059200000000000 * n^30;
beta[17]
   = 5972486266662395092991359700731/3397154354021702963508019200000 * n^17
   - 14169262403755308738265442730293527/7146763472273157609479995392000000 * n^18
   - 1407123059162889531671157095700694121/59145628736053718147420651520000000 * n^19
   + 31616271318862027601140911742786459816003/999546339232123823261872155525120000000 * n^20
   + 33847994330735322699501662950595147934349517/215760061865017024098184001381990400000000 * n^21
   - 86502185255596416338989303038079495440176441813/355518641938081801457782688277174681600000000 * n^22
   - 1381419926651852376155125702746693024900887647/2049837214778129305702530815291817984000000 * n^23
   + 2039800582062773533252062008847436810010590704673393/1669644822047391442119004879672622186496000000000 * n^24
   + 6658940828673534449931395737435432548555706698080023117/3134479879256969534004745160772069384781824000000000 * n^25
   - 1381470469487772782735900360391332279866899387998419366549/303260928318111802414959094304697712977641472000000000 * n^26
   - 1395295684620560872662304928419977863449010608559002595498087/266869616919938386125164002988133987420324495360000000000 * n^27
   + 3800355884806913283793161651067966638660881579408061104605403/280213097765935305431422203137540686791340720128000000000 * n^28
   + 14254272866295825003590094337320088635299910217415520581006075573/1374912266371522565316844943394866303189511800094720000000000 * n^29
   - 702046212944594816164772022402471437675208441448777951843503358652627/20791767020136757113362658445253016953407594818982379520000000000 * n^30;
beta[18]
   = 32561519486094387080527719588034341533/11663517986749793218671352479744000000 * n^18
   - 729907719647457582367271201256463879/230528934567170058275021389824000000 * n^19
   - 2367236104332471655932050118751689811238261/59375350358064550788705233330503680000000 * n^20
   + 277337936278972764824727659347223162007380783/5246368848044609917345751476312473600000000 * n^21
   + 2072215526282883572284838680097819963389051894913/7438543892858326922808991631645501030400000000 * n^22
   - 21187399770302239981520985962108187969123956327017/49559298686168603123214906745838150615040000000 * n^23
   - 117781246505279918774486020036924169110810872979542077/92510690880848059163334492592231214481408000000000 * n^24
   + 15346233021039229146148984542248316965482710596146903/6780613138425795245494403150226037879603200000000 * n^25
   + 23577648358032142021574052998960694124312121496108401309501/5499131500168427350457924910058518528661232025600000000 * n^26
   - 25523104372278110417409133482492688317169934216303321881481/2864130989671055911696835890655478400344391680000000000 * n^27
   - 4904614526502535650801519867527379473641587091534278367071269/432842750524368215007154889587272725078179640770560000000 * n^28
   + 21605254007739675177136169588021592098439361907000904630780859/770695057717401985738931667124429059082325852160000000000 * n^29
   + 587901467817860255311504068569140875259033445501764848866062463918953/24168207818278623653139500414994959877465238422064988160000000000 * n^30;
beta[19]
   = 428624286990709813412232185601376712413/95900036779942744242408898166784000000 * n^19
   - 7696493507391194218978151080255673578313/1510425579284098221817940146126848000000 * n^20
   - 527610184507500637130291508233596994938727387/7854213012277310753453288759859609600000000 * n^21
   + 11361451298084078444421426214576116338438506193/127861967714573279471658686134773350400000000 * n^22
   + 413731746541624122896290630838483865650422207002637/834682925240734368390987903087800431411200000000 * n^23
   - 193620425636569480838170976533462900238070466349524697/256949550508766977723998435166460382806016000000000 * n^24
   - 132662492287173341243380190879466905201764211256445800247/55272703309441429874851218942474144568049664000000000 * n^25
   + 13146789691243844636190690725166722508695370878744595367/3135216364191005476094501914804205679280128000000000 * n^26
   + 37750506608225008520506075562486792560657544757045773087576929/4393516640660880377892173691299384803425131692032000000000 * n^27
   - 708261955363343231843730776055545581965081551994723487001141417/40755647785077903505447137531132451137035761090560000000000 * n^28
   - 41215834581264644962808643579846154211341882270808962207078377401/1700549382091093699207676640514703059208080384327680000000000 * n^29
   + 205978745011375578132532475847110147598943760061270638697653240745727/3577530762574138369708149732482806560808999108529356800000000000 * n^30;
beta[20]
   = 4413022171315891282875633078306076423077823/612225834803154479243538405896749056000000 * n^20
   - 20372356369389063598321199048537111545322489/2467109651840332692314561267713966080000000 * n^21
   - 8350441420653344994230757754481656794198878169653/73421183238768300923281343327167630540800000000 * n^22
   + 3602842136240118426653037995310224523478929843329/23998309048482544305160371509809014374400000000 * n^23
   + 556742892772424708949943649093699359972707482370822028429/630108817727632300573303895944205248075766169600000000 * n^24
   - 19669578953730635368229268600445326314943118813499628227/14768175415491382044686810061192310501775769600000000 * n^25
   - 58913853325627285400915530112249848640529228986228560671583/13043252526961988621867390646045048635168359710720000000 * n^26
   + 6202219939216563039972447651959676151814355411005403328908487/798219881207309199515322083807444382620980346880000000000 * n^27
   + 4029539464888473312146356584746881268371745066400450670075103971919/235404621606609970647462666379821037767518556059074560000000000 * n^28
   - 96689844226844260169337694369507826490314199510140141134776628313/2860820054246996171062914348365880667313593563217920000000000 * n^29
   - 1267431993370297356535644841552515784699654333219083107594851764271651/24717485268694046917983579969881208965589448386202828800000000000 * n^30;
beta[21]
   = 6364309775760426912861320334716314963236880099/543860616583468895728009950571612078080000000 * n^21
   - 163511162729184839208619679935376666925954633509/12142734151027065152696529857954646589440000000 * n^22
   - 293082088716477537348152181351392414509711063444079/1515413222048177731056526926272739894362112000000 * n^23
   + 3584068349124466527596686906788906996841447765124034119/14064928967134649566368390534468867144548352000000000 * n^24
   + 65325328354812776334115933271141213585155594697569614279619/41407150879244408323388541733476344873550348288000000000 * n^25
   - 295262389665020199502850268061912716873799689551659695461801/125108748728002748005666808237574956296512838041600000000 * n^26
   - 198220070520799681801810036957883626038127951175197474869802841/23353633095893846294391137537680658508682396434432000000000 * n^27
   + 9203041943910402313157326557559771543787851843067288847306443759/639119373821137442471502141656207383123249625825280000000000 * n^28
   + 223639420140739590352779061494286234859561093634481454398610059052269/6591329404985079178128954658634989057490519569654087680000000000 * n^29
   - 7514702451752062815378233648033968164404526829002371317311008928464377/114599249882126944801560234405812877931369260699667660800000000000 * n^30;
beta[22]
   = 4597258274619973879852787439286345056927543926539/240541781277488528739131258138530141962240000000 * n^22
   - 90547738027796418205837133798540945489664737617/4100143999048099921689737354634036510720000000 * n^23
   - 120833998747258442540330733531559589117031890572073705423/365972293124634922050151252694866684488450048000000000 * n^24
   + 700385303317244963533430016841479945264946535743006370213/1612565416580422625283478957186756328527233024000000000 * n^25
   + 41927528317378886896874815834318257768184011744864991769792173/14861402879205174914612542069433146323706979549184000000000 * n^26
   - 1883738571943229874285781147684391885621206162239253551981097/449437587072737144595137360970760473499203010560000000000 * n^27
   - 1193194903894549620369066288907357112160028172942643483767868101/74901470511194081569647212029943057471483176927887360000000 * n^28
   + 16593315611956986881113970672924159996956254881446619306408644351/621740722016747747404298146732925770026959964733440000000000 * n^29
   + 11172709187913729666978241526344191734961305583177742422182451010341965837/166856507828376831631071701294863550268073643578716114124800000000000 * n^30;
beta[23]
   = 105692798364122771092494104410403169316822970007103/3367584937884839402347837613939421987471360000000 * n^23
   - 4991587424316475527559827056175081831817518759624141283/137107011264808880217339273654526141942412083200000000 * n^24
   - 1094971199704775675327145588577419573356229203017369297031/1935628394326713603068319157475663180363464704000000000 * n^25
   + 55016459854774144990504572561411573956468991982011620879183/74037786082996795317363207773444116648902524928000000000 * n^26
   + 239397211441168562919535061028225053930721123237942287411752901/47384183093117949003112452975004234655297615953920000000000 * n^27
   - 3785206531097832093379025924494221733602175663051851724063493677/507484600927293233823334371362295353158237466866483200000000 * n^28
   - 2878530207214341630613762260409649820059076958972834659710423583641/96377945080452906319144544961326352286747011098817331200000000 * n^29
   + 4793620231717494054901024202427349307198672366940440795548189424277463/96899050172071924049425843362418567717916189402962329600000000000 * n^30;
beta[24]
   = 674454707484204643577912579775944698106967657841301509703/13020743263341849785801510375449192318660037836800000000 * n^24
   - 14426118473738594318758580084527169080893428452291501/239224795864861496358580131547117377080524800000000 * n^25
   - 8831250255802996377564597692702488675170603573810490306068589/9081968426180940225596553486875811642265376391168000000000 * n^26
   + 8524975532343064334059520385109401209472880856691153037771/6682542557352665505329874016485837860046372864000000000 * n^27
   + 3849014409982539112685345447510980453367887363991057306125975552515257/424866107896329895356895535704513669664076407260619735040000000000 * n^28
   - 7018181262756669326759909066253824968190524410099850934366975116824761/527763368402472291888643673257950574035844912144051077120000000000 * n^29
   - 850361604060552572056063294333220546778996672875303006775383312452755647779/15199585009991202006392937789828976532232333469748671021056000000000000 * n^30;
beta[25]
   = 199227752516955126043105919223151730212773157895262123371/2319787592894237605516361043901867597002650419200000000 * n^25
   - 1168128087731386349278531921296393465205853015166911689601/11643549264334538750764812162661296977263303065600000000 * n^26
   - 27390759516798680521492333486028666245475773964938356987895799/16337932618526559135993799923480296076032952238080000000000 * n^27
   + 16623553892978221252992741635428809183176541795604885967233054812289/7566499905411789131019980978608610380442220962638725120000000000 * n^28
   + 1391206775167565949946814294410548218174156897307634862471204069769203/85538095796791963737570611176977111081466475155984220160000000000 * n^29
   - 309601436775289074939542822961271536740569529708755160589227851116770297/13036681100187385736477373542933235232324028706996910817280000000000 * n^30;
beta[26]
   = 20988866881167764922693397699209941026240719371894993737321/146779287695853579403580662414154531592167699251200000000 * n^26
   - 20776782371826844247557167727961747229906685936639469810900161/123982629575591320352462040782956155904259153461248000000000 * n^27
   - 56519161473334888467049876826142477266800694645666348046158762501/19499565911122788086072327775906636264771992816713728000000000 * n^28
   + 713184336250531653186104175190769152673340166708863511978540935479/187949917522247967196810424949412597591112860450160640000000000 * n^29
   + 222786377756937595153775101581958876025910578503920819534055082789529097879/7621444335494163969017541455868660597358662936398194016256000000000000 * n^30;
beta[27]
   = 1159063206283901297028135487345019691847337244400674181558705769/4849098401178682751562959817288951875366580224262144000000000 * n^27
   - 836866364429699038099446680535614249403163042061868319644600230131/2978558692924005880147548067769738689443921902753021952000000000 * n^28
   - 276258332981610143691601963914139654258026350011955431757944008776431/54988775869366262402723964328056714266657019743132712960000000000 * n^29
   + 231942644768785218497452105692225263551992039422426853153865797716482578787/35296814078757346881512488867491734391517307724194136037785600000000000 * n^30;
beta[28]
   = 4820642953919212694667891843709465549522940845258602976903974801919/12021570220089681390145058868115702097935828940841025536000000000 * n^28
   - 1407966726686721532660580475865160144206500909159825439202238905333/2978558692924005880147548067769738689443921902753021952000000000 * n^29
   - 2269078966250518419628311750199082816400532696920651885729048451938814396007/259963837024498554809869759278034361232762393397239351135436800000000000 * n^30;
beta[29]
   = 2257448691193994841515777396189088185825275740674810644118087064739/3344346602581339935604264497144969756568614066249007104000000000 * n^29
   - 190079826774799091739713735364123004573671877623337777048243884284125889/238239614545595134106590801450823661272646492861713602314240000000000 * n^30;
beta[30]
   = 46619651201884945136956267547124218081125978370322440448000334604980392416839/40900977025187772623419508793077406167287949894498991245308723200000000000 * n^30;
    
geographiclib-1.21/doc/html/classGeographicLib_1_1Geodesic.html0000644000175000017500000034727011745620414024324 0ustar frankiefrankie GeographicLib: GeographicLib::Geodesic Class Reference
GeographicLib::Geodesic Class Reference

Geodesic calculations More...

#include <GeographicLib/Geodesic.hpp>

List of all members.

Public Types

enum  mask {
  NONE, LATITUDE, LONGITUDE, AZIMUTH,
  DISTANCE, DISTANCE_IN, REDUCEDLENGTH, GEODESICSCALE,
  AREA, ALL
}

Public Member Functions

Constructor
 Geodesic (real a, real f)
Direct geodesic problem specified in terms of distance.
Math::real Direct (real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21, real &S12) const throw ()
Math::real Direct (real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2) const throw ()
Math::real Direct (real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2) const throw ()
Math::real Direct (real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &m12) const throw ()
Math::real Direct (real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &M12, real &M21) const throw ()
Math::real Direct (real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21) const throw ()
Direct geodesic problem specified in terms of arc length.
void ArcDirect (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const throw ()
void ArcDirect (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2) const throw ()
void ArcDirect (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2) const throw ()
void ArcDirect (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12) const throw ()
void ArcDirect (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12) const throw ()
void ArcDirect (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &M12, real &M21) const throw ()
void ArcDirect (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21) const throw ()
General version of the direct geodesic solution.
Math::real GenDirect (real lat1, real lon1, real azi1, bool arcmode, real s12_a12, unsigned outmask, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const throw ()
Inverse geodesic problem.
Math::real Inverse (real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &m12, real &M12, real &M21, real &S12) const throw ()
Math::real Inverse (real lat1, real lon1, real lat2, real lon2, real &s12) const throw ()
Math::real Inverse (real lat1, real lon1, real lat2, real lon2, real &azi1, real &azi2) const throw ()
Math::real Inverse (real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2) const throw ()
Math::real Inverse (real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &m12) const throw ()
Math::real Inverse (real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &M12, real &M21) const throw ()
Math::real Inverse (real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &m12, real &M12, real &M21) const throw ()
General version of inverse geodesic solution.
Math::real GenInverse (real lat1, real lon1, real lat2, real lon2, unsigned outmask, real &s12, real &azi1, real &azi2, real &m12, real &M12, real &M21, real &S12) const throw ()
Interface to GeodesicLine.
GeodesicLine Line (real lat1, real lon1, real azi1, unsigned caps=ALL) const throw ()
Inspector functions.
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()
Math::real EllipsoidArea () const throw ()

Static Public Attributes

static const Geodesic WGS84

Friends

class GeodesicLine

Detailed Description

Geodesic calculations

The shortest path between two points on a ellipsoid at (lat1, lon1) and (lat2, lon2) is called the geodesic. Its length is s12 and the geodesic from point 1 to point 2 has azimuths azi1 and azi2 at the two end points. (The azimuth is the heading measured clockwise from north. azi2 is the "forward" azimuth, i.e., the heading that takes you beyond point 2 not back to point 1.)

Given lat1, lon1, azi1, and s12, we can determine lat2, lon2, and azi2. This is the direct geodesic problem and its solution is given by the function Geodesic::Direct. (If s12 is sufficiently large that the geodesic wraps more than halfway around the earth, there will be another geodesic between the points with a smaller s12.)

Given lat1, lon1, lat2, and lon2, we can determine azi1, azi2, and s12. This is the inverse geodesic problem, whose solution is given by Geodesic::Inverse. Usually, the solution to the inverse problem is unique. In cases where there are multiple solutions (all with the same s12, of course), all the solutions can be easily generated once a particular solution is provided.

The standard way of specifying the direct problem is the specify the distance s12 to the second point. However it is sometimes useful instead to specify the the arc length a12 (in degrees) on the auxiliary sphere. This is a mathematical construct used in solving the geodesic problems. The solution of the direct problem in this form is provide by Geodesic::ArcDirect. An arc length in excess of 180o indicates that the geodesic is not a shortest path. In addition, the arc length between an equatorial crossing and the next extremum of latitude for a geodesic is 90o.

This class can also calculate several other quantities related to geodesics. These are:

  • reduced length. If we fix the first point and increase azi1 by dazi1 (radians), the the second point is displaced m12 dazi1 in the direction azi2 + 90o. The quantity m12 is called the "reduced length" and is symmetric under interchange of the two points. On a curved surface the reduced length obeys a symmetry relation, m12 + m21 = 0. On a flat surface, we have m12 = s12. The ratio s12/m12 gives the azimuthal scale for an azimuthal equidistant projection.
  • geodesic scale. Consider a reference geodesic and a second geodesic parallel to this one at point 1 and separated by a small distance dt. The separation of the two geodesics at point 2 is M12 dt where M12 is called the "geodesic scale". M21 is defined similarly (with the geodesics being parallel at point 2). On a flat surface, we have M12 = M21 = 1. The quantity 1/M12 gives the scale of the Cassini-Soldner projection.
  • area. Consider the quadrilateral bounded by the following lines: the geodesic from point 1 to point 2, the meridian from point 2 to the equator, the equator from lon2 to lon1, the meridian from the equator to point 1. The area of this quadrilateral is represented by S12 with a clockwise traversal of the perimeter counting as a positive area and it can be used to compute the area of any simple geodesic polygon.

Overloaded versions of Geodesic::Direct, Geodesic::ArcDirect, and Geodesic::Inverse allow these quantities to be returned. In addition there are general functions Geodesic::GenDirect, and Geodesic::GenInverse which allow an arbitrary set of results to be computed. The quantities m12, M12, M21 which all specify the behavior of nearby geodesics obey addition rules. Let points 1, 2, and 3 all lie on a single geodesic, then

  • m13 = m12 M23 + m23 M21
  • M13 = M12 M23 - (1 - M12 M21) m23 / m12
  • M31 = M32 M21 - (1 - M23 M32) m12 / m23

Additional functionality is provided by the GeodesicLine class, which allows a sequence of points along a geodesic to be computed.

The calculations are accurate to better than 15 nm (15 nanometers). See Sec. 9 of arXiv:1102.1215v1 for details.

The algorithms are described in

For more information on geodesics see Geodesics on the ellipsoid.

Example of use:

// Example of using the GeographicLib::Geodesic class
// $Id: c825b2bc016f758b52995e446ac77aa42e0f3fda $

#include <iostream>
#include <exception>
#include <GeographicLib/Geodesic.hpp>
#include <GeographicLib/Constants.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    Geodesic geod(Constants::WGS84_a(), Constants::WGS84_f());
    // Alternatively: const Geodesic& geod = Geodesic::WGS84;
    {
      // Sample direct calculation, travelling about NE from JFK
      double lat1 = 40.6, lon1 = -73.8, s12 = 5.5e6, azi1 = 51;
      double lat2, lon2;
      geod.Direct(lat1, lon1, azi1, s12, lat2, lon2);
      cout << lat2 << " " << lon2 << "\n";
    }
    {
      // Sample inverse calculation, JFK to LHR
      double
        lat1 = 40.6, lon1 = -73.8, // JFK Airport
        lat2 = 51.6, lon2 = -0.5;  // LHR Airport
      double s12;
      geod.Inverse(lat1, lon1, lat2, lon2, s12);
      cout << s12 << "\n";
    }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Geod is a command-line utility providing access to the functionality of Geodesic and GeodesicLine.


Member Enumeration Documentation

Bit masks for what calculations to do. These masks do double duty. They signify to the GeodesicLine::GeodesicLine constructor and to Geodesic::Line what capabilities should be included in the GeodesicLine object. They also specify which results to return in the general routines Geodesic::GenDirect and Geodesic::GenInverse routines. GeodesicLine::mask is a duplication of this enum.

Enumerator:
NONE 

No capabilities, no output.

LATITUDE 

Calculate latitude lat2. (It's not necessary to include this as a capability to GeodesicLine because this is included by default.)

LONGITUDE 

Calculate longitude lon2.

AZIMUTH 

Calculate azimuths azi1 and azi2. (It's not necessary to include this as a capability to GeodesicLine because this is included by default.)

DISTANCE 

Calculate distance s12.

DISTANCE_IN 

Allow distance s12 to be used as input in the direct geodesic problem.

REDUCEDLENGTH 

Calculate reduced length m12.

GEODESICSCALE 

Calculate geodesic scales M12 and M21.

AREA 

Calculate area S12.

ALL 

All capabilities. Calculate everything.

Definition at line 236 of file Geodesic.hpp.


Constructor & Destructor Documentation

GeographicLib::Geodesic::Geodesic ( real  a,
real  f 
)

Constructor for a ellipsoid with

Parameters:
[in]aequatorial radius (meters).
[in]fflattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid. If f > 1, set flattening to 1/f.

An exception is thrown if either of the axes of the ellipsoid is non-positive.

Definition at line 54 of file Geodesic.cpp.

References GeographicLib::Math::isfinite().


Member Function Documentation

Math::real GeographicLib::Geodesic::Direct ( real  lat1,
real  lon1,
real  azi1,
real  s12,
real &  lat2,
real &  lon2,
real &  azi2,
real &  m12,
real &  M12,
real &  M21,
real &  S12 
) const throw () [inline]

Perform the direct geodesic calculation where the length of the geodesic is specify in terms of distance.

Parameters:
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]azi1azimuth at point 1 (degrees).
[in]s12distance between point 1 and point 2 (meters); it can be signed.
[out]lat2latitude of point 2 (degrees).
[out]lon2longitude of point 2 (degrees).
[out]azi2(forward) azimuth at point 2 (degrees).
[out]m12reduced length of geodesic (meters).
[out]M12geodesic scale of point 2 relative to point 1 (dimensionless).
[out]M21geodesic scale of point 1 relative to point 2 (dimensionless).
[out]S12area under the geodesic (meters2).
Returns:
a12 arc length of between point 1 and point 2 (degrees).

lat1 should be in the range [-90, 90]; lon1 and azi1 should be in the range [-180, 360]. The values of lon2 and azi2 returned are in the range [-180, 180).

If either point is at a pole, the azimuth is defined by keeping the longitude fixed and writing lat = 90 - eps or -90 + eps and taking the limit eps -> 0 from above. An arc length greater that 180 degrees signifies a geodesic which is not a shortest path. (For a prolate ellipsoid, an additional condition is necessary for a shortest path: the longitudinal extent must not exceed of 180 degrees.)

The following functions are overloaded versions of Geodesic::Direct which omit some of the output parameters. Note, however, that the arc length is always computed and returned as the function value.

Definition at line 348 of file Geodesic.hpp.

Referenced by main().

Math::real GeographicLib::Geodesic::Direct ( real  lat1,
real  lon1,
real  azi1,
real  s12,
real &  lat2,
real &  lon2 
) const throw () [inline]

See the documentation for Geodesic::Direct.

Definition at line 362 of file Geodesic.hpp.

Math::real GeographicLib::Geodesic::Direct ( real  lat1,
real  lon1,
real  azi1,
real  s12,
real &  lat2,
real &  lon2,
real &  azi2 
) const throw () [inline]

See the documentation for Geodesic::Direct.

Definition at line 374 of file Geodesic.hpp.

Math::real GeographicLib::Geodesic::Direct ( real  lat1,
real  lon1,
real  azi1,
real  s12,
real &  lat2,
real &  lon2,
real &  azi2,
real &  m12 
) const throw () [inline]

See the documentation for Geodesic::Direct.

Definition at line 386 of file Geodesic.hpp.

Math::real GeographicLib::Geodesic::Direct ( real  lat1,
real  lon1,
real  azi1,
real  s12,
real &  lat2,
real &  lon2,
real &  azi2,
real &  M12,
real &  M21 
) const throw () [inline]

See the documentation for Geodesic::Direct.

Definition at line 398 of file Geodesic.hpp.

Math::real GeographicLib::Geodesic::Direct ( real  lat1,
real  lon1,
real  azi1,
real  s12,
real &  lat2,
real &  lon2,
real &  azi2,
real &  m12,
real &  M12,
real &  M21 
) const throw () [inline]

See the documentation for Geodesic::Direct.

Definition at line 411 of file Geodesic.hpp.

void GeographicLib::Geodesic::ArcDirect ( real  lat1,
real  lon1,
real  azi1,
real  a12,
real &  lat2,
real &  lon2,
real &  azi2,
real &  s12,
real &  m12,
real &  M12,
real &  M21,
real &  S12 
) const throw () [inline]

Perform the direct geodesic calculation where the length of the geodesic is specify in terms of arc length.

Parameters:
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]azi1azimuth at point 1 (degrees).
[in]a12arc length between point 1 and point 2 (degrees); it can be signed.
[out]lat2latitude of point 2 (degrees).
[out]lon2longitude of point 2 (degrees).
[out]azi2(forward) azimuth at point 2 (degrees).
[out]s12distance between point 1 and point 2 (meters).
[out]m12reduced length of geodesic (meters).
[out]M12geodesic scale of point 2 relative to point 1 (dimensionless).
[out]M21geodesic scale of point 1 relative to point 2 (dimensionless).
[out]S12area under the geodesic (meters2).

lat1 should be in the range [-90, 90]; lon1 and azi1 should be in the range [-180, 360]. The values of lon2 and azi2 returned are in the range [-180, 180).

If either point is at a pole, the azimuth is defined by keeping the longitude fixed and writing lat = 90 - eps or -90 + eps and taking the limit eps -> 0 from above. An arc length greater that 180 degrees signifies a geodesic which is not a shortest path. (For a prolate ellipsoid, an additional condition is necessary for a shortest path: the longitudinal extent must not exceed of 180 degrees.)

The following functions are overloaded versions of Geodesic::Direct which omit some of the output parameters.

Definition at line 460 of file Geodesic.hpp.

Referenced by main().

void GeographicLib::Geodesic::ArcDirect ( real  lat1,
real  lon1,
real  azi1,
real  a12,
real &  lat2,
real &  lon2 
) const throw () [inline]

See the documentation for Geodesic::ArcDirect.

Definition at line 473 of file Geodesic.hpp.

void GeographicLib::Geodesic::ArcDirect ( real  lat1,
real  lon1,
real  azi1,
real  a12,
real &  lat2,
real &  lon2,
real &  azi2 
) const throw () [inline]

See the documentation for Geodesic::ArcDirect.

Definition at line 484 of file Geodesic.hpp.

void GeographicLib::Geodesic::ArcDirect ( real  lat1,
real  lon1,
real  azi1,
real  a12,
real &  lat2,
real &  lon2,
real &  azi2,
real &  s12 
) const throw () [inline]

See the documentation for Geodesic::ArcDirect.

Definition at line 495 of file Geodesic.hpp.

void GeographicLib::Geodesic::ArcDirect ( real  lat1,
real  lon1,
real  azi1,
real  a12,
real &  lat2,
real &  lon2,
real &  azi2,
real &  s12,
real &  m12 
) const throw () [inline]

See the documentation for Geodesic::ArcDirect.

Definition at line 507 of file Geodesic.hpp.

void GeographicLib::Geodesic::ArcDirect ( real  lat1,
real  lon1,
real  azi1,
real  a12,
real &  lat2,
real &  lon2,
real &  azi2,
real &  s12,
real &  M12,
real &  M21 
) const throw () [inline]

See the documentation for Geodesic::ArcDirect.

Definition at line 520 of file Geodesic.hpp.

void GeographicLib::Geodesic::ArcDirect ( real  lat1,
real  lon1,
real  azi1,
real  a12,
real &  lat2,
real &  lon2,
real &  azi2,
real &  s12,
real &  m12,
real &  M12,
real &  M21 
) const throw () [inline]

See the documentation for Geodesic::ArcDirect.

Definition at line 533 of file Geodesic.hpp.

Math::real GeographicLib::Geodesic::GenDirect ( real  lat1,
real  lon1,
real  azi1,
bool  arcmode,
real  s12_a12,
unsigned  outmask,
real &  lat2,
real &  lon2,
real &  azi2,
real &  s12,
real &  m12,
real &  M12,
real &  M21,
real &  S12 
) const throw ()

The general direct geodesic calculation. Geodesic::Direct and Geodesic::ArcDirect are defined in terms of this function.

Parameters:
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]azi1azimuth at point 1 (degrees).
[in]arcmodeboolean flag determining the meaning of the second parameter.
[in]s12_a12if arcmode is false, this is the distance between point 1 and point 2 (meters); otherwise it is the arc length between point 1 and point 2 (degrees); it can be signed.
[in]outmaska bitor'ed combination of Geodesic::mask values specifying which of the following parameters should be set.
[out]lat2latitude of point 2 (degrees).
[out]lon2longitude of point 2 (degrees).
[out]azi2(forward) azimuth at point 2 (degrees).
[out]s12distance between point 1 and point 2 (meters).
[out]m12reduced length of geodesic (meters).
[out]M12geodesic scale of point 2 relative to point 1 (dimensionless).
[out]M21geodesic scale of point 1 relative to point 2 (dimensionless).
[out]S12area under the geodesic (meters2).
Returns:
a12 arc length of between point 1 and point 2 (degrees).

The Geodesic::mask values possible for outmask are

The function value a12 is always computed and returned and this equals s12_a12 is arcmode is true. If outmask includes Geodesic::DISTANCE and arcmode is false, then s12 = s12_a12. It is not necessary to include Geodesic::DISTANCE_IN in outmask; this is automatically included is arcmode is false.

Definition at line 110 of file Geodesic.cpp.

Math::real GeographicLib::Geodesic::Inverse ( real  lat1,
real  lon1,
real  lat2,
real  lon2,
real &  s12,
real &  azi1,
real &  azi2,
real &  m12,
real &  M12,
real &  M21,
real &  S12 
) const throw () [inline]

Perform the inverse geodesic calculation.

Parameters:
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]lat2latitude of point 2 (degrees).
[in]lon2longitude of point 2 (degrees).
[out]s12distance between point 1 and point 2 (meters).
[out]azi1azimuth at point 1 (degrees).
[out]azi2(forward) azimuth at point 2 (degrees).
[out]m12reduced length of geodesic (meters).
[out]M12geodesic scale of point 2 relative to point 1 (dimensionless).
[out]M21geodesic scale of point 1 relative to point 2 (dimensionless).
[out]S12area under the geodesic (meters2).
Returns:
a12 arc length of between point 1 and point 2 (degrees).

lat1 and lat2 should be in the range [-90, 90]; lon1 and lon2 should be in the range [-180, 360]. The values of azi1 and azi2 returned are in the range [-180, 180).

If either point is at a pole, the azimuth is defined by keeping the longitude fixed and writing lat = 90 - eps or -90 + eps and taking the limit eps -> 0 from above. If the routine fails to converge, then all the requested outputs are set to Math::NaN(). (Test for such results with Math::isnan.) This is not expected to happen with ellipsoidal models of the earth; please report all cases where this occurs.

The following functions are overloaded versions of Geodesic::Inverse which omit some of the output parameters. Note, however, that the arc length is always computed and returned as the function value.

Definition at line 635 of file Geodesic.hpp.

Referenced by main().

Math::real GeographicLib::Geodesic::Inverse ( real  lat1,
real  lon1,
real  lat2,
real  lon2,
real &  s12 
) const throw () [inline]

See the documentation for Geodesic::Inverse.

Definition at line 647 of file Geodesic.hpp.

Math::real GeographicLib::Geodesic::Inverse ( real  lat1,
real  lon1,
real  lat2,
real  lon2,
real &  azi1,
real &  azi2 
) const throw () [inline]

See the documentation for Geodesic::Inverse.

Definition at line 658 of file Geodesic.hpp.

Math::real GeographicLib::Geodesic::Inverse ( real  lat1,
real  lon1,
real  lat2,
real  lon2,
real &  s12,
real &  azi1,
real &  azi2 
) const throw () [inline]

See the documentation for Geodesic::Inverse.

Definition at line 669 of file Geodesic.hpp.

Math::real GeographicLib::Geodesic::Inverse ( real  lat1,
real  lon1,
real  lat2,
real  lon2,
real &  s12,
real &  azi1,
real &  azi2,
real &  m12 
) const throw () [inline]

See the documentation for Geodesic::Inverse.

Definition at line 681 of file Geodesic.hpp.

Math::real GeographicLib::Geodesic::Inverse ( real  lat1,
real  lon1,
real  lat2,
real  lon2,
real &  s12,
real &  azi1,
real &  azi2,
real &  M12,
real &  M21 
) const throw () [inline]

See the documentation for Geodesic::Inverse.

Definition at line 693 of file Geodesic.hpp.

Math::real GeographicLib::Geodesic::Inverse ( real  lat1,
real  lon1,
real  lat2,
real  lon2,
real &  s12,
real &  azi1,
real &  azi2,
real &  m12,
real &  M12,
real &  M21 
) const throw () [inline]

See the documentation for Geodesic::Inverse.

Definition at line 705 of file Geodesic.hpp.

Math::real GeographicLib::Geodesic::GenInverse ( real  lat1,
real  lon1,
real  lat2,
real  lon2,
unsigned  outmask,
real &  s12,
real &  azi1,
real &  azi2,
real &  m12,
real &  M12,
real &  M21,
real &  S12 
) const throw ()

The general inverse geodesic calculation. Geodesic::Inverse is defined in terms of this function.

Parameters:
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]lat2latitude of point 2 (degrees).
[in]lon2longitude of point 2 (degrees).
[in]outmaska bitor'ed combination of Geodesic::mask values specifying which of the following parameters should be set.
[out]s12distance between point 1 and point 2 (meters).
[out]azi1azimuth at point 1 (degrees).
[out]azi2(forward) azimuth at point 2 (degrees).
[out]m12reduced length of geodesic (meters).
[out]M12geodesic scale of point 2 relative to point 1 (dimensionless).
[out]M21geodesic scale of point 1 relative to point 2 (dimensionless).
[out]S12area under the geodesic (meters2).
Returns:
a12 arc length of between point 1 and point 2 (degrees).

The Geodesic::mask values possible for outmask are

The arc length is always computed and returned as the function value.

Definition at line 123 of file Geodesic.cpp.

References GeographicLib::Math::sq(), and GeographicLib::Math::hypot().

GeodesicLine GeographicLib::Geodesic::Line ( real  lat1,
real  lon1,
real  azi1,
unsigned  caps = ALL 
) const throw ()

Set up to compute several points on a singe geodesic.

Parameters:
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]azi1azimuth at point 1 (degrees).
[in]capsbitor'ed combination of Geodesic::mask values specifying the capabilities the GeodesicLine object should possess, i.e., which quantities can be returned in calls to GeodesicLib::Position.

lat1 should be in the range [-90, 90]; lon1 and azi1 should be in the range [-180, 360].

The Geodesic::mask values are

The default value of caps is Geodesic::ALL which turns on all the capabilities.

If the point is at a pole, the azimuth is defined by keeping the lon1 fixed and writing lat1 = 90 - eps or -90 + eps and taking the limit eps -> 0 from above.

Definition at line 105 of file Geodesic.cpp.

Referenced by main().

Math::real GeographicLib::Geodesic::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value used in the constructor.

Definition at line 811 of file Geodesic.hpp.

Math::real GeographicLib::Geodesic::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid. This is the value used in the constructor.

Definition at line 817 of file Geodesic.hpp.

Math::real GeographicLib::Geodesic::EllipsoidArea ( ) const throw () [inline]
Returns:
total area of ellipsoid in meters2. The area of a polygon encircling a pole can be found by adding Geodesic::EllipsoidArea()/2 to the sum of S12 for each side of the polygon.

Definition at line 833 of file Geodesic.hpp.


Friends And Related Function Documentation

friend class GeodesicLine [friend]

Definition at line 132 of file Geodesic.hpp.


Member Data Documentation

A global instantiation of Geodesic with the parameters for the WGS84 ellipsoid.

Definition at line 841 of file Geodesic.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/classGeographicLib_1_1LocalCartesian-members.html0000644000175000017500000001437011745620414027106 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::LocalCartesian Member List
This is the complete list of members for GeographicLib::LocalCartesian, including all inherited members.
Flattening() const GeographicLib::LocalCartesian [inline]
Forward(real lat, real lon, real h, real &x, real &y, real &z) const GeographicLib::LocalCartesian [inline]
Forward(real lat, real lon, real h, real &x, real &y, real &z, std::vector< real > &M) const GeographicLib::LocalCartesian [inline]
HeightOrigin() const GeographicLib::LocalCartesian [inline]
LatitudeOrigin() const GeographicLib::LocalCartesian [inline]
LocalCartesian(real lat0, real lon0, real h0=0, const Geocentric &earth=Geocentric::WGS84)GeographicLib::LocalCartesian [inline]
LocalCartesian(const Geocentric &earth=Geocentric::WGS84)GeographicLib::LocalCartesian [inline, explicit]
LongitudeOrigin() const GeographicLib::LocalCartesian [inline]
MajorRadius() const GeographicLib::LocalCartesian [inline]
Reset(real lat0, real lon0, real h0=0)GeographicLib::LocalCartesian
Reverse(real x, real y, real z, real &lat, real &lon, real &h) const GeographicLib::LocalCartesian [inline]
Reverse(real x, real y, real z, real &lat, real &lon, real &h, std::vector< real > &M) const GeographicLib::LocalCartesian [inline]
geographiclib-1.21/doc/html/other.html0000644000175000017500000003147211745620414017607 0ustar frankiefrankie GeographicLib: Other interfaces (Javascript, Python, Matlab, Octave)
Other interfaces (Javascript, Python, Matlab, Octave)
Back to Code organization. Forward to Geoid height. Up to Contents.

Interfaces to subsets of GeographicLib are available in other languages

Javascript interface

The directory doc/scripts/GeographicLib contains the classes

translated into Javascript. See Interface.js for a simple Javascript interface to these routines (documented near the top of the file). Examples of using this interface are

  • a geodesic calculator showing the solution of direct and inverse geodesic problem, finding intermediate points on a geodesic line, and computing the area of a geodesic polygon.
  • displaying geodesics in Google Maps which shows the geodesic, the geodesic circle, and various geodesic envelopes.

These examples include a "stripped" version of the Javascript code,

<script type="text/javascript"
        src="http://geographiclib.sf.net/scripts/geographiclib.js">
</script>

which loads faster.

Python interface

A python implementation of the geodesic routines from GeographicLib are provided in the python/geographiclib directory (which is installed as PREFIX/lib/python/site-packages/geographiclib). This contains implementations of the classes

You can also download the python interface independent of the rest of GeographicLib from

and then unpack the .tar.gz or .zip file.

You can "install" these routines, so that they are in python's default path with, for example

  cd geographiclib-1.16
  python setup.py install

(this will require root privileges). Or else you can set the path within python using

>>> import sys
>>> sys.path.append("/usr/local/lib/python/site-packages");

An example of using this interface is

>>> from geographiclib.geodesic import Geodesic
>>> # The geodesic inverse problem
... Geodesic.WGS84.Inverse(-41.32, 174.81, 40.96, -5.50)
>>> # The geodesic direct problem
... Geodesic.WGS84.Direct(40.6, -73.8, 45, 10000e3)
>>> # How to obtain several points along a geodesic
... line = Geodesic.WGS84.Line(40.6, -73.8, 45)
>>> line.Position( 5000e3)
>>> line.Position(10000e3)
>>> # Computing the area of a geodesic polygon
... def p(lat,lon): return {'lat': lat, 'lon': lon}
...
>>> Geodesic.WGS84.Area([p(0, 0), p(0, 90), p(90, 0)])
>>> # Introductory help
... help(Geodesic)

(Note: The initial version of setup.py was provided by Andrew MacIntyre of the Australian Communications and Media Authority.)

Matlab and Octave interfaces

The matlab directory contains interface code so that some GeographicLib classes can be accessed from Matlab or Octave. There are two ways of compiling this code: (1) using cmake and (2) invoking the compiler from Matlab.

  • Using cmake: Before running cmake, configure MATLAB on Windows to use the same compiler that you're going to use for compiling GeographicLib. For example
       mex.bat -setup
    
       Please choose your compiler for building external interface (MEX) files:
       Would you like mex to locate installed compilers [y]/n? y
       Select a compiler:
       [1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2010b\sys\lcc
       [2] Microsoft Visual C++ 2010 in C:\Program Files\Microsoft Visual Studio 10.0
       [0] None
    
       Compiler: 2
       etc. 
    (This will require that mex.bat is in your PATH. With Linux, use mex -setup.) Then configure cmake with, for example
       cmake -G "Visual Studio 10" -D MATLAB_COMPILER=mex .. 
    If you are running a 64-bit version of Matlab, be sure to select a 64-bit generator with cmake, e.g., "Visual Studio 10 Win64". Finally compile GeographicLib with Visual Studio. (The binary installer for 64-bit Windows includes the compiled interface built with Visual Studio 10 and Matlab R2010b 64-bit).
    On Linux systems, you can compile the interface for use with octave instead by using
       cmake -D MATLAB_COMPILER=mkoctfile .. 
  • Invoking the compiler from Matlab or Octave: Start Matlab or Octave and run, e.g.,
       mex -setup
       cd 'C:/pkg-vc10-x64/GeographicLib-1.21/libexec/GeographicLib/matlab'
       help geographiclibinterface
       geographiclibinterface('C:/pkg-vc10/GeographicLib-1.21');
       addpath(pwd);
    
    The first command allows you to select the compiler to use (which should be the same as that used to compile GeographicLib).

To use the interface routines for GeographicLib, run one of (for example)

  addpath /usr/local/libexec/GeographicLib/matlab
  addpath 'C:/pkg-vc10-x64/GeographicLib-1.21/libexec/GeographicLib/matlab'

in Octave or Matlab. The available functions are:

These routines just offer a simple interface to the corresponding C++ class. Use the help function to get documentation, e.g.,

  help geodesicdirect 

Unfortunately, the help function does not work for compiled functions in Octave; in this case, just list the .m file, e.g.,

  type geodesicdirect 

Other useful functions, e.g., to convert from geographic coordinates to MGRS can easily be written with Matlab code.

Note that geoidheight, when compiled with Visual Studio 2008 causes Matlab to crash. (The problem does not occur with Visual Studio 2005 or Visual Studio 2010.)

Back to Code organization. Forward to Geoid height. Up to Contents.
geographiclib-1.21/doc/html/PolygonArea_8hpp_source.html0000644000175000017500000005742311745620414023231 0ustar frankiefrankie GeographicLib: PolygonArea.hpp Source File
PolygonArea.hpp
Go to the documentation of this file.
00001 /**
00002  * \file PolygonArea.hpp
00003  * \brief Header for GeographicLib::PolygonArea class
00004  *
00005  * Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_POLYGONAREA_HPP)
00011 #define GEOGRAPHICLIB_POLYGONAREA_HPP \
00012   "$Id: 7a339f312a9c977b9fccad3c0c8bfa9009d863e2 $"
00013 
00014 #include <GeographicLib/Geodesic.hpp>
00015 #include <GeographicLib/Constants.hpp>
00016 #include <GeographicLib/Accumulator.hpp>
00017 
00018 namespace GeographicLib {
00019 
00020   /**
00021    * \brief Polygon Areas.
00022    *
00023    * This computes the area of a geodesic polygon using the method given
00024    * Section 15 of
00025    * - C. F. F. Karney,
00026    *   <a href="http://arxiv.org/abs/1102.1215v1">Geodesics
00027    *   on an ellipsoid of revolution</a>,
00028    *   Feb. 2011;
00029    *   preprint
00030    *   <a href="http://arxiv.org/abs/1102.1215v1">arxiv:1102.1215v1</a>.
00031    * .
00032    * See also Section 6 of
00033    * - C. F. F. Karney,
00034    *   <a href="http://arxiv.org/abs/1109.4448">Algorithms for geodesics</a>,
00035    *   Sept. 2011;
00036    *   preprint
00037    *   <a href="http://arxiv.org/abs/1109.4448">arxiv:1109.4448</a>.
00038    *
00039    * This class lets you add vertices one at a time to the polygon.  The area
00040    * and perimeter are accumulated in two times the standard floating point
00041    * precision to guard against the loss of accuracy with many-sided polygons.
00042    * At any point you can ask for the perimeter and area so far.  There's an
00043    * option to treat the points as defining a polyline instead of a polygon; in
00044    * that case, only the perimeter is computed.
00045    *
00046    * Example of use:
00047    * \include example-PolygonArea.cpp
00048    *
00049    * <a href="Planimeter.1.html">Planimeter</a> is a command-line utility
00050    * providing access to the functionality of PolygonArea.
00051    **********************************************************************/
00052 
00053   class GEOGRAPHIC_EXPORT PolygonArea {
00054   private:
00055     typedef Math::real real;
00056     Geodesic _earth;
00057     real _area0;                // Full ellipsoid area
00058     bool _polyline;             // Assume polyline (don't close and skip area)
00059     unsigned _mask;
00060     unsigned _num;
00061     int _crossings;
00062     Accumulator<real> _areasum, _perimetersum;
00063     real _lat0, _lon0, _lat1, _lon1;
00064     // Copied from Geodesic class
00065     static inline real AngNormalize(real x) throw() {
00066       // Place angle in [-180, 180).  Assumes x is in [-540, 540).
00067       //
00068       // g++ 4.4.4 holds a temporary in an extended register causing an error
00069       // with the triangle 89,0.1;89,90.1;89,-179.9.  The volatile declaration
00070       // fixes this.  (The bug probably triggered because transit and
00071       // AngNormalize are inline functions.  So don't port this change over to
00072       // Geodesic.hpp.)
00073       volatile real y = x;
00074       return y >= 180 ? y - 360 : (y < -180 ? y + 360 : y);
00075     }
00076     static inline int transit(real lon1, real lon2) {
00077       // Return 1 or -1 if crossing prime meridian in east or west direction.
00078       // Otherwise return zero.
00079       lon1 = AngNormalize(lon1);
00080       lon2 = AngNormalize(lon2);
00081       // treat lon12 = -180 as an eastward geodesic, so convert to 180.
00082       real lon12 = -AngNormalize(lon1 - lon2); // In (-180, 180]
00083       int cross =
00084         lon1 < 0 && lon2 >= 0 && lon12 > 0 ? 1 :
00085         (lon2 < 0 && lon1 >= 0 && lon12 < 0 ? -1 : 0);
00086       return cross;
00087     }
00088   public:
00089 
00090     /**
00091      * Constructor for PolygonArea.
00092      *
00093      * @param[in] earth the Geodesic object to use for geodesic calculations.
00094      *   By default this uses the WGS84 ellipsoid.
00095      * @param[in] polyline if true that treat the points as defining a polyline
00096      *   instead of a polygon (default = false).
00097      **********************************************************************/
00098     PolygonArea(const Geodesic& earth, bool polyline = false) throw()
00099       : _earth(earth)
00100       , _area0(_earth.EllipsoidArea())
00101       , _polyline(polyline)
00102       , _mask(Geodesic::DISTANCE | (_polyline ? 0 : Geodesic::AREA))
00103     {
00104       Clear();
00105     }
00106 
00107     /**
00108      * Clear PolygonArea, allowing a new polygon to be started.
00109      **********************************************************************/
00110     void Clear() throw() {
00111       _num = 0;
00112       _crossings = 0;
00113       _areasum = 0;
00114       _perimetersum = 0;
00115       _lat0 = _lon0 = _lat1 = _lon1 = 0;
00116     }
00117 
00118     /**
00119      * Add a point to the polygon or polyline.
00120      *
00121      * @param[in] lat the latitude of the point (degrees).
00122      * @param[in] lon the latitude of the point (degrees).
00123      *
00124      * \e lat should be in the range [-90, 90] and \e lon should be in the
00125      * range [-180, 360].
00126      **********************************************************************/
00127     void AddPoint(real lat, real lon) throw();
00128 
00129     /**
00130      * Return the results so far.
00131      *
00132      * @param[in] reverse if true then clockwise (instead of counter-clockwise)
00133      *   traversal counts as a positive area.
00134      * @param[in] sign if true then return a signed result for the area if
00135      *   the polygon is traversed in the "wrong" direction instead of returning
00136      *   the area for the rest of the earth.
00137      * @param[out] perimeter the perimeter of the polygon or length of the
00138      *   polyline (meters).
00139      * @param[out] area the area of the polygon (meters^2); only set if
00140      *   polyline is false in the constructor.
00141      * @return the number of points.
00142      **********************************************************************/
00143     unsigned Compute(bool reverse, bool sign,
00144                      real& perimeter, real& area) const throw();
00145 
00146     /**
00147      * Return the results assuming a tentative final test point is added;
00148      * however, the data for the test point is not saved.  This lets you report
00149      * a running result for the perimeter and area as the user moves the mouse
00150      * cursor.  Ordinary floating point arithmetic is used to accumulate the
00151      * data for the test point; thus the area and perimeter returned are less
00152      * accurate than if AddPoint and Compute are used.
00153      *
00154      * @param[in] lat the latitude of the test point (degrees).
00155      * @param[in] lon the longitude of the test point (degrees).
00156      * @param[in] reverse if true then clockwise (instead of counter-clockwise)
00157      *   traversal counts as a positive area.
00158      * @param[in] sign if true then return a signed result for the area if
00159      *   the polygon is traversed in the "wrong" direction instead of returning
00160      *   the area for the rest of the earth.
00161      * @param[out] perimeter the approximate perimeter of the polygon or length
00162      *   of the polyline (meters).
00163      * @param[out] area the approximate area of the polygon (meters^2); only
00164      *   set if polyline is false in the constructor.
00165      * @return the number of points.
00166      *
00167      * \e lat should be in the range [-90, 90] and \e lon should be in the
00168      * range [-180, 360].
00169      **********************************************************************/
00170     unsigned TestCompute(real lat, real lon, bool reverse, bool sign,
00171                          real& perimeter, real& area) const throw();
00172 
00173     /** \name Inspector functions
00174      **********************************************************************/
00175     ///@{
00176     /**
00177      * @return \e a the equatorial radius of the ellipsoid (meters).  This is
00178      *   the value inherited from the Geodesic object used in the constructor.
00179      **********************************************************************/
00180 
00181     Math::real MajorRadius() const throw() { return _earth.MajorRadius(); }
00182 
00183     /**
00184      * @return \e f the flattening of the ellipsoid.  This is the value
00185      *   inherited from the Geodesic object used in the constructor.
00186      **********************************************************************/
00187     Math::real Flattening() const throw() { return _earth.Flattening(); }
00188     ///@}
00189   };
00190 
00191 } // namespace GeographicLib
00192 
00193 #endif  // GEOGRAPHICLIB_POLYGONAREA_HPP
geographiclib-1.21/doc/html/Geocentric_8cpp.html0000644000175000017500000001124511745620414021476 0ustar frankiefrankie GeographicLib: Geocentric.cpp File Reference
Geocentric.cpp File Reference

Implementation for GeographicLib::Geocentric class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_GEOCENTRIC_CPP   "$Id: b5135e8042dbbbcddfd5894c66b729bf5c43cab9 $"

Detailed Description

Implementation for GeographicLib::Geocentric class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file Geocentric.cpp.


Define Documentation

#define GEOGRAPHICLIB_GEOCENTRIC_CPP   "$Id: b5135e8042dbbbcddfd5894c66b729bf5c43cab9 $"

Definition at line 12 of file Geocentric.cpp.

geographiclib-1.21/doc/html/tm.mac0000644000175000017500000003060211745620414016674 0ustar frankiefrankie/* Arbitrary precision Transverse Mercator Projection Written by Charles Karney http://geographiclib.sourceforge.net/ $Id: 688c810de1f36d1e2239f39a973835acfc5a8649 $ Reference: Charles F. F. Karney, Transverse Mercator with an accuracy of a few nanometers, J. Geodesy 85(8), 475-485 (Aug. 2011). DOI 10.1007/s00190-011-0445-3 preprint http://arxiv.org/abs/1002.1417 resource page http://geographiclib.sf.net/tm.html The parameters for the transformation are set by setparams(a,invf,k0)$ sets the major radius, inverse flattening, and central scale factor. The default is setparams(6378137b0, 298.257223563b0, 0.9996b0)$ appropriate for UTM applications. tm(lat,lon); takes lat and lon args (in degrees) and returns [x, y, convergence, scale] [x, y] do not include false eastings/northings but do include the scale factor k0. convergence is in degrees. ll(x,y); takes x and y args (in meters) and returns [lat, lon, convergence, scale]. Example: $ maxima Maxima 5.15.0 http://maxima.sourceforge.net Using Lisp CLISP 2.43 (2007-11-18) Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) load("tm.mac")$ (%i2) tm(10b0,20b0); (%o2) [2.235209504622466691587930831718465965864199221939781808953597771095103\ 6690000464b6, 1.17529734503138466792126931904154130080533935727351398258511134\ 68541970512119385b6, 3.6194756227592979778565787394402350354250845160819430786\ 093514889500602612857052b0, 1.062074627142564335518604915718789933200854739344\ 8664109599248189291146283796933b0] (%i3) ll(%[1],%[2]); (%o3) [1.0b1, 2.0b1, 3.6194756227592979778565787394402350354250845160819430786\ 093514889500602612857053b0, 1.062074627142564335518604915718789933200854739344\ 8664109599248189291146283796933b0] (%i4) float(%o2); (%o4) [2235209.504622467, 1175297.345031385, 3.619475622759298, 1.062074627142564] (%i5) float(%o3); (%o5) [10.0, 20.0, 3.619475622759298, 1.062074627142564] This implements GeographicLib::TransverseMercatorExact (i.e., Lee, 1976) using bfloats. However fewer changes from Lee 1976 have been made since we rely more heavily on the high precision to deal with problem cases. To change the precision, change fpprec below and reload. */ fpprec:80$ load("ellint.mac")$ /* Load elliptic functions */ tol:0.1b0^fpprec$ tol1:0.1b0*sqrt(tol)$ /* For Newton's method */ tol2:sqrt(0.01*tol*tol1)$ /* Also for Newton's method but more conservative */ ahypover:log(10b0^fpprec)+2$ pi:bfloat(%pi)$ degree:pi/180$ ratprint:false$ debugprint:false$ setparams(a1,invf,k1):=(a:bfloat(a1),f:1/bfloat(invf),k0:bfloat(k1), e2:f*(2-f), e:sqrt(e2), kcu:kc(e2), kcv:kc(1-e2), ecu:ec(e2), ecv:ec(1-e2), n:f/(2-f), 'done)$ setparams(6378137b0, 298.257223563b0, 0.9996b0)$ /* WGS 84 */ /* setparams(6378388b0, 297b0, 0.9996b0)$ International */ /* setparams(1/ec(0.01b0), 30*sqrt(11b0)+100, 1b0)$ testing, eps = 0.1*/ /* Interpret x_y(y) as x <- y, i.e., "transform quantity y to quantity x" Let phi = geodetic latitude psi = isometric latitude ( + i * lambda ) sigma = TM coords thom = Thompson coords */ /* sqrt(x^2 + y^2) -- Real only */ hypot(x,y):=sqrt(x^2 + y^2)$ /* log(1 + x) -- Real only */ log1p(x) := block([y : 1b0+x], if y = 1b0 then x else x*log(y)/(y - 1))$ /* Real only */ /* Some versions of Maxima have a buggy atanh atnh(x) := block([y : abs(x)], y : log1p(2 * y/(1 - y))/2, if x < 0 then -y else y)$ */ atnh(x) := atanh(x)$ /* exp(x)-1 -- Real only */ expm1(x) := block([y : exp(bfloat(x)),z], z : y - 1b0, if abs(x) > 1b0 then z else if z = 0b0 then x else x * z/log(y))$ /* Real only */ /* Some versions of Maxima have a buggy sinh */ snh(x) := block([u : expm1(x)], (u / (u + 1)) * (u + 2) /2); /* Real only */ psi_phi(phi):=block([s:sin(phi)], asinh(s/max(cos(phi),0.1b0*tol)) - e * atnh(e * s))$ /* Real only */ phi_psi(psi):=block([q:psi,t,dq], for i do ( t:tanh(q), dq : -(q - e * atnh(e * t) - psi) * (1 - e2 * t^2) / (1 - e2), q : q + dq, if debugprint then print(float(q), float(dq)), if abs(dq) < tol1 then return(false)), atan(snh(q)))$ psi_thom_comb(w):=block([jacr:sncndn(bfloat(realpart(w)),1-e2), jaci:sncndn(bfloat(imagpart(w)),e2),d,d1,d2], d:(1-e2)*(jaci[2]^2 + e2 * (jacr[1] * jaci[1])^2)^2, d1:sqrt(jacr[2]^2 + (1-e2) * (jacr[1] * jaci[1])^2), d2:sqrt(e2 * jacr[2]^2 + (1-e2) * jaci[2]^2), [ (if d1 > 0b0 then asinh(jacr[1]*jaci[3]/ d1) else signnum(snu) * ahypover) - (if d2 > 0b0 then e * asinh(e * jacr[1] / d2) else signnum(snu) * ahypover) + %i * (if d1 > 0b0 and d2 > 0b0 then atan2(jacr[3]*jaci[1],jacr[2]*jaci[2]) - e * atan2(e*jacr[2]*jaci[1],jacr[3]*jaci[2]) else 0), jacr[2]*jacr[3]*jaci[3]*(jaci[2]^2-e2*(jacr[1]*jaci[1])^2)/d -%i * jacr[1]*jaci[1]*jaci[2]*((jacr[3]*jaci[3])^2+e2*jacr[2]^2)/d] )$ psi_thom(w):=block([tt:psi_thom_comb(w)],tt[1])$ inv_diff_psi_thom(w):=block([tt:psi_thom_comb(w)],tt[2])$ w0a(psi):=block([lam:bfloat(imagpart(psi)),psia:bfloat(realpart(psi))], rectform(kcu/(pi/2)*( atan2(snh(psia),cos(lam)) +%i*asinh(sin(lam)/sqrt(cos(lam)^2 + snh(psia)^2)))))$ w0c(psi):=block([m,a,dlam], dlam:bfloat(imagpart(psi))-pi/2*(1-e), psi:bfloat(realpart(psi)), m:sqrt(psi^2+dlam^2)*3/(1-e2)/e, a:if m = 0b0 then 0 else atan2(dlam-psi, psi+dlam) - 0.75b0*pi, m:m^(1/3), a:a/3, m*cos(a)+%i*(m*sin(a)+kcv))$ w0d(psi):=block([psir:-realpart(psi)/e+1b0,lam:(pi/2-imagpart(psi))/e,uu,vv], uu:asinh(sin(lam)/sqrt(cos(lam)^2+snh(psir)^2))*(1+e2/2), vv:atan2(cos(lam), snh(psir)) *(1+e2/2), (-uu+kcu) + %i * (-vv+kcv))$ w0m(psi):=if realpart(psi)<-e/2*pi/2 and imagpart(psi)>pi/2*(1-2*e) and realpart(psi) < imagpart(psi)-(pi/2*(1-e)) then w0d(psi) else if realpart(psi)pi/2*(1-2*e) then w0c(psi) else w0a(psi)$ w0(psi):=w0m(psi)$ thom_psi(psi):=block([w:w0(psi),dw,v,vv], if not(abs(psi-pi/2*(1-e)*%i) < e * tol^0.6b0) then for i do ( if i > 100 then error("too many iterations"), vv:psi_thom_comb(w), v:vv[1], dw:-rectform((v-psi)*vv[2]), w:w+dw, dw:abs(dw), if debugprint then print(float(w),float(dw)), /* error is approx dw^2/2 */ if dw < tol2 then return(false) ), w )$ sigma_thom_comb(w):=block([u:bfloat(realpart(w)),v:bfloat(imagpart(w)), jacr,jaci,phi,iu,iv,den,den1,er,ei,dnr,dni], jacr:sncndn(u,1-e2),jaci:sncndn(v,e2), er:eirx(jacr[1],jacr[2],jacr[3],e2,ecu), ei:eirx(jaci[1],jaci[2],jaci[3],1-e2,ecv), den:e2*jacr[2]^2+(1-e2)*jaci[2]^2, den1:(1-e2)*(jaci[2]^2 + e2 * (jacr[1] * jaci[1])^2)^2, dnr:jacr[3]*jaci[2]*jaci[3], dni:-e2*jacr[1]*jacr[2]*jaci[1], [ er - e2*jacr[1]*jacr[2]*jacr[3]/den + %i*(v - ei + (1-e2)*jaci[1]*jaci[2]*jaci[3]/den), (dnr^2-dni^2)/den1 + %i * 2*dnr*dni/den1])$ sigma_thom(w):=block([tt:sigma_thom_comb(w)],tt[1])$ inv_diff_sigma_thom(w):=block([tt:sigma_thom_comb(w)],tt[2])$ wx0a(sigma):=rectform(sigma*kcu/ecu)$ wx0b(sigma):=block([m,aa], sigma:rectform(sigma-%i*(kcv-ecv)), m:abs(sigma)*3/(1-e2), aa:atan2(imagpart(sigma),realpart(sigma)), if aa<-pi/2 then aa:aa+2*pi, aa:aa-pi, rectform(m^(1/3)*(cos(aa/3b0)+%i*sin(aa/3b0))+%i*kcv))$ wx0c(sigma):=rectform(1/(sigma-(ecu+%i*(kcv-ecv))) + kcu+%i*kcv)$ wx0m(sigma):=block([eta:bfloat(imagpart(sigma)), xi:bfloat(realpart(sigma))], if eta > 1.25b0 * (kcv-ecv) or (xi < -0.25*ecu and xi < eta-(kcv-ecv)) then wx0c(sigma) else if (eta > 0.75b0 * (kcv-ecv) and xi < 0.25b0 * ecu) or eta > kcv-ecv or xi < 0 then wx0b(sigma) else wx0a(sigma))$ wx0(sigma):=wx0m(sigma)$ thom_sigma(sigma):=block([w:wx0(sigma),dw,v,vv], for i do ( if i > 100 then error("too many iterations"), vv:sigma_thom_comb(w), v:vv[1], dw:-rectform((v-sigma)*vv[2]), w:w+dw, dw:abs(dw), if debugprint then print(float(w),float(dw)), /* error is approx dw^2/2 */ if dw < tol2 then return(false) ), w )$ /* Lee/Thompson's method forward */ tm(phi,lam):=block([psi,thom,jacr,jaci,sigma,gam,scale,c], phi:phi*degree, lam:lam*degree, psi:psi_phi(phi), thom:thom_psi(psi+%i*lam), jacr:sncndn(bfloat(realpart(thom)),1-e2), jaci:sncndn(bfloat(imagpart(thom)),e2), sigma:sigma_thom(thom), c:cos(phi), if c > tol1 then ( gam:atan2((1-e2)*jacr[1]*jaci[1]*jaci[2], jacr[2]*jacr[3]*jaci[3]), scale:sqrt(1-e2 + e2 * c^2)/c* sqrt(((1-e2)*jaci[1]^2 + (jacr[2]*jaci[3])^2)/ (e2*jacr[2]^2 + (1-e2)*jaci[2]^2))) else (gam : lam, scale : 1b0), [imagpart(sigma)*k0*a,realpart(sigma)*k0*a,gam/degree,k0*scale])$ /* Lee/Thompson's method reverse */ ll(x,y):=block([sigma,thom,jacr,jaci,psi,lam,phi,gam,scale,c], sigma:y/(a*k0)+%i*x/(a*k0), thom:thom_sigma(sigma), jacr:sncndn(bfloat(realpart(thom)),1-e2), jaci:sncndn(bfloat(imagpart(thom)),e2), psi:psi_thom(thom), lam:bfloat(imagpart(psi)), psi:bfloat(realpart(psi)), phi:phi_psi(psi), c:cos(phi), if c > tol1 then ( gam:atan2((1-e2)*jacr[1]*jaci[1]*jaci[2], jacr[2]*jacr[3]*jaci[3]), scale:sqrt(1-e2 + e2 * c^2)/c* sqrt(((1-e2)*jaci[1]^2 + (jacr[2]*jaci[3])^2)/ (e2*jacr[2]^2 + (1-e2)*jaci[2]^2))) else (gam : lam, scale : 1b0), [phi/degree,lam/degree,gam/degree,k0*scale])$ /* Return lat/lon/x/y for a point specified in Thompson coords */ /* Pick u in [0, kcu] and v in [0, kcv] */ lltm(u,v):=block([jacr,jaci,psi,lam,phi,c,gam,scale,sigma,x,y], u:bfloat(u), v:bfloat(v), jacr:sncndn(u,1-e2), jaci:sncndn(v,e2), psi:psi_thom(u+%i*v), sigma:sigma_thom(u+%i*v), x:imagpart(sigma)*k0*a,y:realpart(sigma)*k0*a, lam:bfloat(imagpart(psi)), psi:bfloat(realpart(psi)), phi:phi_psi(psi), c:cos(phi), if c > tol1 then ( gam:atan2((1-e2)*jacr[1]*jaci[1]*jaci[2], jacr[2]*jacr[3]*jaci[3]), scale:sqrt(1-e2 + e2 * c^2)/c* sqrt(((1-e2)*jaci[1]^2 + (jacr[2]*jaci[3])^2)/ (e2*jacr[2]^2 + (1-e2)*jaci[2]^2))) else (gam : lam, scale : 1b0), [phi/degree,lam/degree,x,y,gam/degree,k0*scale])$ /* Gauss-Krueger series to order n^i forward Uses the array functions a1_a[i](n), zeta_a[i](z,n), zeta_d[i](z,n), zetap_a[i](s,n), zetap_d[i](s,n), defined in tmseries.mac. */ tms(phi,lam,i):=block([psi,xip,etap,z,sigma,sp,gam,k,b1], phi:phi*degree, lam:lam*degree, psi:psi_phi(phi), xip:atan2(snh(psi), cos(lam)), etap:asinh(sin(lam)/hypot(snh(psi),cos(lam))), k:sqrt(1 - e2*sin(phi)^2)/(cos(phi)*hypot(snh(psi),cos(lam))), gam:atan(tan(xip)*tanh(etap)), z:xip+%i*etap, b1:a1_a[i](n), sigma:rectform(b1*zeta_a[i](z,n)), sp:rectform(zeta_d[i](z,n)), gam : gam - atan2(imagpart(sp),realpart(sp)), k : k * b1 * cabs(sp), [imagpart(sigma)*k0*a,realpart(sigma)*k0*a,gam/degree,k*k0])$ /* Gauss-Krueger series to order n^i reverse */ lls(x,y,i):=block([sigma,b1,s,z,zp,xip,etap,s,c,r,gam,k,lam,psi,phi], sigma:y/(a*k0)+%i*x/(a*k0), b1:a1_a[i](n), s:rectform(sigma/b1), z:rectform(zetap_a[i](s,n)), zp:rectform(zetap_d[i](s,n)), gam : atan2(imagpart(zp), realpart(zp)), k : b1 / cabs(zp), xip:realpart(z), etap:imagpart(z), s:snh(etap), c:cos(xip), r:hypot(s, c), lam:atan2(s, c), psi : asinh(sin(xip)/r), phi :phi_psi(psi), k : k * sqrt(1 - e2*sin(phi)^2) * r/cos(phi), gam : gam + atan(tan(xip) * tanh(etap)), [phi/degree,lam/degree,gam/degree,k*k0])$ /* Approx geodesic distance valid for small displacements */ dist(phi0,lam0,phi,lam):=block([dphi,dlam,nn,hlon,hlat], dphi:(phi-phi0)*degree, dlam:(lam-lam0)*degree, phi0:phi0*degree, lam0:lam0*degree, nn : 1/sqrt(1 - e2 * sin(phi0)^2), hlon : cos(phi0) * nn, hlat : (1 - e2) * nn^3, a * hypot(dphi*hlat, dlam*hlon))$ /* Compute truncation errors for all truncation levels */ check(phi,lam):=block([vv,x,y,gam,k,vf,vb,errf,errr,err2,errlist], phi:min(90-0.01b0,phi), lam:min(90-0.01b0,lam), vv:tm(phi,lam), errlist:[], x:vv[1], y:vv[2], gam:vv[3], k:vv[4], for i:1 thru maxpow do ( vf:tms(phi,lam,i), errf:hypot(vf[1]-x,vf[2]-y)/k, errfg:abs(vf[3]-gam), errfk:abs((vf[4]-k)/k), vb:lls(x,y,i), errr:dist(phi,lam,vb[1],vb[2]), errrg:abs(vb[3]-gam), errrk:abs((vb[4]-k)/k), errlist:append(errlist, [max(errf, errr), max(errfg, errrg), max(errfk, errrk)])), errlist)$ /* Max of output of check over a set of points */ checka(lst):=block([errlist:[],errx], for i:1 thru 3*maxpow do errlist:cons(0b0,errlist), for vv in lst do ( errx:check(vv[1],vv[2]), for i:1 thru 3*maxpow do errlist[i]:max(errlist[i],errx[i])), errlist)$ geographiclib-1.21/doc/html/classGeographicLib_1_1TransverseMercatorExact.html0000644000175000017500000010043511745620414027406 0ustar frankiefrankie GeographicLib: GeographicLib::TransverseMercatorExact Class Reference
GeographicLib::TransverseMercatorExact Class Reference

An exact implementation of the Transverse Mercator Projection. More...

#include <GeographicLib/TransverseMercatorExact.hpp>

List of all members.

Public Member Functions

 TransverseMercatorExact (real a, real f, real k0, bool extendp=false)
void Forward (real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const throw ()
void Reverse (real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const throw ()
void Forward (real lon0, real lat, real lon, real &x, real &y) const throw ()
void Reverse (real lon0, real x, real y, real &lat, real &lon) const throw ()
Inspector functions
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()
Math::real CentralScale () const throw ()

Static Public Attributes

static const
TransverseMercatorExact 
UTM

Detailed Description

An exact implementation of the Transverse Mercator Projection.

Implementation of the Transverse Mercator Projection given in

Lee gives the correct results for forward and reverse transformations subject to the branch cut rules (see the description of the extendp argument to the constructor). The maximum error is about 8 nm (8 nanometers), ground distance, for the forward and reverse transformations. The error in the convergence is 2e-15", the relative error in the scale is 7e-12%%. See Sec. 3 of arXiv:1002.1417 for details. The method is "exact" in the sense that the errors are close to the round-off limit and that no changes are needed in the algorithms for them to be used with reals of a higher precision. Thus the errors using long double (with a 64-bit fraction) are about 2000 times smaller than using double (with a 53-bit fraction).

This algorithm is about 4.5 times slower than the 6th-order Krüger method, TransverseMercator, taking about 11 us for a combined forward and reverse projection on a 2.66 GHz Intel machine (g++, version 4.3.0, -O3).

The ellipsoid parameters and the central scale are set in the constructor. The central meridian (which is a trivial shift of the longitude) is specified as the lon0 argument of the TransverseMercatorExact::Forward and TransverseMercatorExact::Reverse functions. The latitude of origin is taken to be the equator. See the documentation on TransverseMercator for how to include a false easting, false northing, or a latitude of origin.

See tm-grid.kmz, for an illustration of the transverse Mercator grid in Google Earth.

See TransverseMercatorExact.cpp for more information on the implementation.

See Transverse Mercator projection for a discussion of this projection.

Example of use:

// Example of using the GeographicLib::TransverseMercatorExact class
// $Id: 047cbdcff7135fed1fecf5f50ff2195eda993fcb $

#include <iostream>
#include <exception>
#include <string>
#include <iomanip>
#include <GeographicLib/TransverseMercatorExact.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    TransverseMercatorExact proj(Constants::WGS84_a(), Constants::WGS84_f(),
                                 Constants::UTM_k0());
    // Alternatively:
    // const TransverseMercatorExact& proj = TransverseMercatorExact::UTM;
    double lon0 = -75;          // Central meridian for UTM zone 18
    {
      // Sample forward calculation
      double lat = 40.3, lon = -74.7; // Princeton, NJ
      double x, y;
      proj.Forward(lon0, lat, lon, x, y);
      cout << x << " " << y << "\n";
    }
    {
      // Sample reverse calculation
      double x = 25e3, y = 4461e3;
      double lat, lon;
      proj.Reverse(lon0, x, y, lat, lon);
      cout << lat << " " << lon << "\n";
    }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

TransverseMercatorProj is a command-line utility providing access to the functionality of TransverseMercator and TransverseMercatorExact.


Constructor & Destructor Documentation

GeographicLib::TransverseMercatorExact::TransverseMercatorExact ( real  a,
real  f,
real  k0,
bool  extendp = false 
)

Constructor for a ellipsoid with

Parameters:
[in]aequatorial radius (meters).
[in]fflattening of ellipsoid. If f > 1, set flattening to 1/f.
[in]k0central scale factor.
[in]extendpuse extended domain.

The transverse Mercator projection has a branch point singularity at lat = 0 and lon - lon0 = 90 (1 - e) or (for TransverseMercatorExact::UTM) x = 18381 km, y = 0m. The extendp argument governs where the branch cut is placed. With extendp = false, the "standard" convention is followed, namely the cut is placed along x > 18381 km, y = 0m. Forward can be called with any lat and lon then produces the transformation shown in Lee, Fig 46. Reverse analytically continues this in the +/- x direction. As a consequence, Reverse may map multiple points to the same geographic location; for example, for TransverseMercatorExact::UTM, x = 22051449.037349 m, y = -7131237.022729 m and x = 29735142.378357 m, y = 4235043.607933 m both map to lat = -2 deg, lon = 88 deg.

With extendp = true, the branch cut is moved to the lower left quadrant. The various symmetries of the transverse Mercator projection can be used to explore the projection on any sheet. In this mode the domains of lat, lon, x, and y are restricted to

  • the union of
    • lat in [0, 90] and lon - lon0 in [0, 90]
    • lat in (-90, 0] and lon - lon0 in [90 (1 - e), 90]
  • the union of
    • x/(k0 a) in [0, inf) and y/(k0 a) in [0, E(e2)]
    • x/(k0 a) in [K(1 - e2) - E(1 - e2), inf) and y/(k0 a) in (-inf, 0]

See Sec. 5 of arXiv:1002.1417 for a full discussion of the treatment of the branch cut.

The method will work for all ellipsoids used in terrestrial geodesy. The method cannot be applied directly to the case of a sphere (f = 0) because some the constants characterizing this method diverge in that limit, and in practice, f should be larger than about numeric_limits< real >::epsilon(). However, TransverseMercator treats the sphere exactly. An exception is thrown if either axis of the ellipsoid or k0 is not positive or if f <= 0.

Definition at line 62 of file TransverseMercatorExact.cpp.

References GeographicLib::Math::isfinite().


Member Function Documentation

void GeographicLib::TransverseMercatorExact::Forward ( real  lon0,
real  lat,
real  lon,
real &  x,
real &  y,
real &  gamma,
real &  k 
) const throw ()

Forward projection, from geographic to transverse Mercator.

Parameters:
[in]lon0central meridian of the projection (degrees).
[in]latlatitude of point (degrees).
[in]lonlongitude of point (degrees).
[out]xeasting of point (meters).
[out]ynorthing of point (meters).
[out]gammameridian convergence at point (degrees).
[out]kscale of projection at point.

No false easting or northing is added. lat should be in the range [-90, 90]; lon and lon0 should be in the range [-180, 360].

Definition at line 378 of file TransverseMercatorExact.cpp.

void GeographicLib::TransverseMercatorExact::Reverse ( real  lon0,
real  x,
real  y,
real &  lat,
real &  lon,
real &  gamma,
real &  k 
) const throw ()

Reverse projection, from transverse Mercator to geographic.

Parameters:
[in]lon0central meridian of the projection (degrees).
[in]xeasting of point (meters).
[in]ynorthing of point (meters).
[out]latlatitude of point (degrees).
[out]lonlongitude of point (degrees).
[out]gammameridian convergence at point (degrees).
[out]kscale of projection at point.

No false easting or northing is added. lon0 should be in the range [-180, 360]. The value of lon returned is in the range [-180, 180).

Definition at line 439 of file TransverseMercatorExact.cpp.

void GeographicLib::TransverseMercatorExact::Forward ( real  lon0,
real  lat,
real  lon,
real &  x,
real &  y 
) const throw () [inline]

TransverseMercatorExact::Forward without returning the convergence and scale.

Definition at line 217 of file TransverseMercatorExact.hpp.

void GeographicLib::TransverseMercatorExact::Reverse ( real  lon0,
real  x,
real  y,
real &  lat,
real &  lon 
) const throw () [inline]

TransverseMercatorExact::Reverse without returning the convergence and scale.

Definition at line 227 of file TransverseMercatorExact.hpp.

Math::real GeographicLib::TransverseMercatorExact::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value used in the constructor.

Definition at line 240 of file TransverseMercatorExact.hpp.

Math::real GeographicLib::TransverseMercatorExact::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid. This is the value used in the constructor.

Definition at line 246 of file TransverseMercatorExact.hpp.

Math::real GeographicLib::TransverseMercatorExact::CentralScale ( ) const throw () [inline]
Returns:
k0 central scale for the projection. This is the value of k0 used in the constructor and is the scale on the central meridian.

Definition at line 260 of file TransverseMercatorExact.hpp.


Member Data Documentation

A global instantiation of TransverseMercatorExact with the WGS84 ellipsoid and the UTM scale factor. However, unlike UTM, no false easting or northing is added.

Definition at line 268 of file TransverseMercatorExact.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/open.png0000644000175000017500000000016611745620415017244 0ustar frankiefrankie‰PNG  IHDR à‘=IDATxí1 “ت¦@@   ]01ÀQXY~Jr?D>„¥¶þ’n¼ áFÍ  }ÈúÂéãÏ\ ÄáÿòIEND®B`‚geographiclib-1.21/doc/html/Math_8hpp.html0000644000175000017500000002021111745620414020303 0ustar frankiefrankie GeographicLib: Math.hpp File Reference
Math.hpp File Reference

Header for GeographicLib::Math class. More...

#include <GeographicLib/Constants.hpp>
#include <cmath>
#include <limits>
#include <algorithm>
#include <vector>

Go to the source code of this file.

Classes

class  GeographicLib::Math
 Mathematical functions needed by GeographicLib. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_MATH_HPP   "$Id: edd244e4c5c74e696096c2b6d598728957a0d36d $"
#define GEOGRAPHICLIB_CPLUSPLUS11_MATH   0
#define WORDS_BIGENDIAN   0
#define GEOGRAPHICLIB_PREC   1

Detailed Description

Header for GeographicLib::Math class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file Math.hpp.


Define Documentation

#define GEOGRAPHICLIB_MATH_HPP   "$Id: edd244e4c5c74e696096c2b6d598728957a0d36d $"

Definition at line 15 of file Math.hpp.

#define GEOGRAPHICLIB_CPLUSPLUS11_MATH   0

Are C++11 math functions available?

Definition at line 24 of file Math.hpp.

#define WORDS_BIGENDIAN   0

Definition at line 29 of file Math.hpp.

#define GEOGRAPHICLIB_PREC   1

The precision of floating point numbers used in GeographicLib. 0 means float; 1 (default) means double; 2 means long double. Nearly all the testing has been carried out with doubles and that's the recommended configuration. In order for long double to be used, HAVE_LONG_DOUBLE needs to be defined. Note that with Microsoft Visual Studio, long double is the same as double.

Definition at line 41 of file Math.hpp.

geographiclib-1.21/doc/html/UTMUPS_8hpp.html0000644000175000017500000001246411745620414020462 0ustar frankiefrankie GeographicLib: UTMUPS.hpp File Reference
UTMUPS.hpp File Reference

Header for GeographicLib::UTMUPS class. More...

#include <sstream>
#include <GeographicLib/Constants.hpp>

Go to the source code of this file.

Classes

class  GeographicLib::UTMUPS
 Convert between Geographic coordinates and UTM/UPS. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_UTMUPS_HPP   "$Id: a529ed8aeaeffb02994254bbc7eb1209aa41b9ca $"

Detailed Description

Header for GeographicLib::UTMUPS class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file UTMUPS.hpp.


Define Documentation

#define GEOGRAPHICLIB_UTMUPS_HPP   "$Id: a529ed8aeaeffb02994254bbc7eb1209aa41b9ca $"

Definition at line 11 of file UTMUPS.hpp.

geographiclib-1.21/doc/html/GeoConvert_8cpp_source.html0000644000175000017500000006236411745620414023057 0ustar frankiefrankie GeographicLib: GeoConvert.cpp Source File
GeoConvert.cpp
Go to the documentation of this file.
00001 /**
00002  * \file GeoConvert.cpp
00003  * \brief Command line utility for geographic coordinate conversions
00004  *
00005  * Copyright (c) Charles Karney (2008-2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  *
00009  * Compile and link with
00010  *   g++ -g -O3 -I../include -I../man -o GeoConvert \
00011  *       GeoConvert.cpp \
00012  *       ../src/DMS.cpp \
00013  *       ../src/GeoCoords.cpp \
00014  *       ../src/MGRS.cpp \
00015  *       ../src/PolarStereographic.cpp \
00016  *       ../src/TransverseMercator.cpp \
00017  *       ../src/UTMUPS.cpp
00018  *
00019  * See the <a href="GeoConvert.1.html">man page</a> for usage
00020  * information.
00021  **********************************************************************/
00022 
00023 #include <iostream>
00024 #include <sstream>
00025 #include <string>
00026 #include <sstream>
00027 #include <fstream>
00028 #include <GeographicLib/GeoCoords.hpp>
00029 #include <GeographicLib/DMS.hpp>
00030 #include <GeographicLib/Utility.hpp>
00031 
00032 #include "GeoConvert.usage"
00033 
00034 int main(int argc, char* argv[]) {
00035   try {
00036     using namespace GeographicLib;
00037     typedef Math::real real;
00038     enum { GEOGRAPHIC, DMS, UTMUPS, MGRS, CONVERGENCE };
00039     int outputmode = GEOGRAPHIC;
00040     int prec = 0;
00041     int zone = UTMUPS::MATCH;
00042     bool centerp = true, swaplatlong = false;
00043     std::string istring, ifile, ofile, cdelim;
00044     char lsep = ';', dmssep = char(0);
00045 
00046     for (int m = 1; m < argc; ++m) {
00047       std::string arg(argv[m]);
00048       if (arg == "-g")
00049         outputmode = GEOGRAPHIC;
00050       else if (arg == "-d") {
00051         outputmode = DMS;
00052         dmssep = '\0';
00053       } else if (arg == "-:") {
00054         outputmode = DMS;
00055         dmssep = ':';
00056       } else if (arg == "-u")
00057         outputmode = UTMUPS;
00058       else if (arg == "-m")
00059         outputmode = MGRS;
00060       else if (arg == "-c")
00061         outputmode = CONVERGENCE;
00062       else if (arg == "-n")
00063         centerp = false;
00064       else if (arg == "-w")
00065         swaplatlong = true;
00066       else if (arg == "-p") {
00067         if (++m == argc) return usage(1, true);
00068         try {
00069           prec = Utility::num<int>(std::string(argv[m]));
00070         }
00071         catch (const std::exception&) {
00072           std::cerr << "Precision " << argv[m] << " is not a number\n";
00073           return 1;
00074         }
00075       } else if (arg == "-z") {
00076         if (++m == argc) return usage(1, true);
00077         std::string zonestr(argv[m]);
00078         try {
00079           bool northp;
00080           UTMUPS::DecodeZone(zonestr, zone, northp);
00081         }
00082         catch (const std::exception&) {
00083           std::istringstream str(zonestr);
00084           char c;
00085           if (!(str >> zone) || (str >> c)) {
00086             std::cerr << "Zone " << zonestr
00087                       << " is not a number or zone+hemisphere\n";
00088             return 1;
00089           }
00090           if (!(zone >= UTMUPS::MINZONE && zone <= UTMUPS::MAXZONE)) {
00091             std::cerr << "Zone " << zone << " not in [0, 60]\n";
00092             return 1;
00093           }
00094         }
00095       } else if (arg == "-s")
00096         zone = UTMUPS::STANDARD;
00097       else if (arg == "-t")
00098         zone = UTMUPS::UTM;
00099       else if (arg == "--input-string") {
00100         if (++m == argc) return usage(1, true);
00101         istring = argv[m];
00102       } else if (arg == "--input-file") {
00103         if (++m == argc) return usage(1, true);
00104         ifile = argv[m];
00105       } else if (arg == "--output-file") {
00106         if (++m == argc) return usage(1, true);
00107         ofile = argv[m];
00108       } else if (arg == "--line-separator") {
00109         if (++m == argc) return usage(1, true);
00110         if (std::string(argv[m]).size() != 1) {
00111           std::cerr << "Line separator must be a single character\n";
00112           return 1;
00113         }
00114         lsep = argv[m][0];
00115       } else if (arg == "--comment-delimiter") {
00116         if (++m == argc) return usage(1, true);
00117         cdelim = argv[m];
00118       } else if (arg == "--version") {
00119         std::cout
00120           << argv[0]
00121           << ": $Id: e39b9974b58d123fd979b1c3c086ae3ccccba72d $\n"
00122           << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n";
00123         return 0;
00124       } else
00125         return usage(!(arg == "-h" || arg == "--help"), arg != "--help");
00126     }
00127 
00128     if (!ifile.empty() && !istring.empty()) {
00129       std::cerr << "Cannot specify --input-string and --input-file together\n";
00130       return 1;
00131     }
00132     if (ifile == "-") ifile.clear();
00133     std::ifstream infile;
00134     std::istringstream instring;
00135     if (!ifile.empty()) {
00136       infile.open(ifile.c_str());
00137       if (!infile.is_open()) {
00138         std::cerr << "Cannot open " << ifile << " for reading\n";
00139         return 1;
00140       }
00141     } else if (!istring.empty()) {
00142       std::string::size_type m = 0;
00143       while (true) {
00144         m = istring.find(lsep, m);
00145         if (m == std::string::npos)
00146           break;
00147         istring[m] = '\n';
00148       }
00149       instring.str(istring);
00150     }
00151     std::istream* input = !ifile.empty() ? &infile :
00152       (!istring.empty() ? &instring : &std::cin);
00153 
00154     std::ofstream outfile;
00155     if (ofile == "-") ofile.clear();
00156     if (!ofile.empty()) {
00157       outfile.open(ofile.c_str());
00158       if (!outfile.is_open()) {
00159         std::cerr << "Cannot open " << ofile << " for writing\n";
00160         return 1;
00161       }
00162     }
00163     std::ostream* output = !ofile.empty() ? &outfile : &std::cout;
00164 
00165     GeoCoords p;
00166     std::string s;
00167     std::string os;
00168     int retval = 0;
00169 
00170     while (std::getline(*input, s)) {
00171       std::string eol("\n");
00172       try {
00173         if (!cdelim.empty()) {
00174           std::string::size_type m = s.find(cdelim);
00175           if (m != std::string::npos) {
00176             eol = " " + s.substr(m) + "\n";
00177             s = s.substr(0, m);
00178           }
00179         }
00180         p.Reset(s, centerp, swaplatlong);
00181         p.SetAltZone(zone);
00182         switch (outputmode) {
00183         case GEOGRAPHIC:
00184           os = p.GeoRepresentation(prec, swaplatlong);
00185           break;
00186         case DMS:
00187           os = p.DMSRepresentation(prec, swaplatlong, dmssep);
00188           break;
00189         case UTMUPS:
00190           os = p.AltUTMUPSRepresentation(prec);
00191           break;
00192         case MGRS:
00193           os = p.AltMGRSRepresentation(prec);
00194           break;
00195         case CONVERGENCE:
00196           {
00197             real
00198               gamma = p.AltConvergence(),
00199               k = p.AltScale();
00200             os =
00201               Utility::str<real>(gamma, std::max(-5,std::min(8,prec))+5)
00202               + " " +
00203               Utility::str<real>(k, std::max(-5,std::min(8,prec))+7);
00204           }
00205         }
00206       }
00207       catch (const std::exception& e) {
00208         // Write error message to cout so output lines match input lines
00209         os = std::string("ERROR: ") + e.what();
00210         retval = 1;
00211       }
00212       *output << os << eol;
00213     }
00214     return retval;
00215   }
00216   catch (const std::exception& e) {
00217     std::cerr << "Caught exception: " << e.what() << "\n";
00218     return 1;
00219   }
00220   catch (...) {
00221     std::cerr << "Caught unknown exception\n";
00222     return 1;
00223   }
00224 }
geographiclib-1.21/doc/html/classGeographicLib_1_1GeodesicLine.html0000644000175000017500000025515311745620414025132 0ustar frankiefrankie GeographicLib: GeographicLib::GeodesicLine Class Reference
GeographicLib::GeodesicLine Class Reference

A geodesic line. More...

#include <GeographicLib/GeodesicLine.hpp>

List of all members.

Public Types

enum  mask {
  NONE, LATITUDE, LONGITUDE, AZIMUTH,
  DISTANCE, DISTANCE_IN, REDUCEDLENGTH, GEODESICSCALE,
  AREA, ALL
}

Public Member Functions

Constructors
 GeodesicLine (const Geodesic &g, real lat1, real lon1, real azi1, unsigned caps=ALL) throw ()
 GeodesicLine () throw ()
Position in terms of distance
Math::real Position (real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21, real &S12) const throw ()
Math::real Position (real s12, real &lat2, real &lon2) const throw ()
Math::real Position (real s12, real &lat2, real &lon2, real &azi2) const throw ()
Math::real Position (real s12, real &lat2, real &lon2, real &azi2, real &m12) const throw ()
Math::real Position (real s12, real &lat2, real &lon2, real &azi2, real &M12, real &M21) const throw ()
Math::real Position (real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21) const throw ()
Position in terms of arc length
void ArcPosition (real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const throw ()
void ArcPosition (real a12, real &lat2, real &lon2) const throw ()
void ArcPosition (real a12, real &lat2, real &lon2, real &azi2) const throw ()
void ArcPosition (real a12, real &lat2, real &lon2, real &azi2, real &s12) const throw ()
void ArcPosition (real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12) const throw ()
void ArcPosition (real a12, real &lat2, real &lon2, real &azi2, real &s12, real &M12, real &M21) const throw ()
void ArcPosition (real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21) const throw ()
The general position function.
Math::real GenPosition (bool arcmode, real s12_a12, unsigned outmask, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const throw ()
Inspector functions
bool Init () const throw ()
Math::real Latitude () const throw ()
Math::real Longitude () const throw ()
Math::real Azimuth () const throw ()
Math::real EquatorialAzimuth () const throw ()
Math::real EquatorialArc () const throw ()
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()
unsigned Capabilities () const throw ()
bool Capabilities (unsigned testcaps) const throw ()

Friends

class Geodesic

Detailed Description

A geodesic line.

GeodesicLine facilitates the determination of a series of points on a single geodesic. The starting point (lat1, lon1) and the azimuth azi1 are specified in the constructor. GeodesicLine.Position returns the location of point 2 a distance s12 along the geodesic. Alternatively GeodesicLine.ArcPosition gives the position of point 2 an arc length a12 along the geodesic.

The default copy constructor and assignment operators work with this class. Similarly, a vector can be used to hold GeodesicLine objects.

The calculations are accurate to better than 15 nm (15 nanometers). See Sec. 9 of arXiv:1102.1215v1 for details.

The algorithms are described in

For more information on geodesics see Geodesics on the ellipsoid.

Example of use:

// Example of using the GeographicLib::GeodesicLine class
// $Id: df5c5ffe6534d46e343544430de8c13fc8119bfb $

#include <iostream>
#include <exception>
#include <cmath>
#include <iomanip>
#include <GeographicLib/Geodesic.hpp>
#include <GeographicLib/GeodesicLine.hpp>
#include <GeographicLib/Constants.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    // Print waypoints between JFK and SIN
    Geodesic geod(Constants::WGS84_a(), Constants::WGS84_f());
    // Alternatively: const Geodesic& geod = Geodesic::WGS84;
    double
      lat1 = 40.640, lon1 = -73.779, // JFK
      lat2 =  1.359, lon2 = 103.989; // SIN
    double s12, azi1, azi2,
      a12 = geod.Inverse(lat1, lon1, lat2, lon2, s12, azi1, azi2);
    const GeographicLib::GeodesicLine line(geod, lat1, lon1, azi1);
    // Alternatively
    // const GeographicLib::GeodesicLine line = geod.Line(lat1, lon1, azi1);
    double ds = 500e3;          // Nominal distance between points = 500 km
    int num = int(ceil(s12 / ds)); // The number of intervals
    cout << fixed << setprecision(3);
    {
      // Use intervals of equal length
      double ds = s12 / num;
      for (int i = 0; i <= num; ++i) {
        double lat, lon;
       line.Position(i * ds, lat, lon);
       cout << i << " " << lat << " " << lon << "\n";
      }
    }
    {
      // Slightly faster, use intervals of equal arc length
      double da = a12 / num;
      for (int i = 0; i <= num; ++i) {
        double lat, lon;
       line.ArcPosition(i * da, lat, lon);
       cout << i << " " << lat << " " << lon << "\n";
      }
    }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Geod is a command-line utility providing access to the functionality of Geodesic and GeodesicLine.


Member Enumeration Documentation

Bit masks for what calculations to do. They signify to the GeodesicLine::GeodesicLine constructor and to Geodesic::Line what capabilities should be included in the GeodesicLine object. This is merely a duplication of Geodesic::mask.

Enumerator:
NONE 

No capabilities, no output.

LATITUDE 

Calculate latitude lat2. (It's not necessary to include this as a capability to GeodesicLine because this is included by default.)

LONGITUDE 

Calculate longitude lon2.

AZIMUTH 

Calculate azimuths azi1 and azi2. (It's not necessary to include this as a capability to GeodesicLine because this is included by default.)

DISTANCE 

Calculate distance s12.

DISTANCE_IN 

Allow distance s12 to be used as input in the direct geodesic problem.

REDUCEDLENGTH 

Calculate reduced length m12.

GEODESICSCALE 

Calculate geodesic scales M12 and M21.

AREA 

Calculate area S12.

ALL 

All capabilities. Calculate everything.

Definition at line 96 of file GeodesicLine.hpp.


Constructor & Destructor Documentation

GeographicLib::GeodesicLine::GeodesicLine ( const Geodesic g,
real  lat1,
real  lon1,
real  azi1,
unsigned  caps = ALL 
) throw ()

Constructor for a geodesic line staring at latitude lat1, longitude lon1, and azimuth azi1 (all in degrees).

Parameters:
[in]gA Geodesic object used to compute the necessary information about the GeodesicLine.
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]azi1azimuth at point 1 (degrees).
[in]capsbitor'ed combination of GeodesicLine::mask values specifying the capabilities the GeodesicLine object should possess, i.e., which quantities can be returned in calls to GeodesicLib::Position.

lat1 should be in the range [-90, 90]; lon1 and azi1 should be in the range [-180, 360].

The GeodesicLine::mask values are

The default value of caps is GeodesicLine::ALL which turns on all the capabilities.

If the point is at a pole, the azimuth is defined by keeping the lon1 fixed and writing lat1 = 90 - eps or -90 + eps and taking the limit eps -> 0 from above.

Definition at line 41 of file GeodesicLine.cpp.

GeographicLib::GeodesicLine::GeodesicLine ( ) throw () [inline]

A default constructor. If GeodesicLine::Position is called on the resulting object, it returns immediately (without doing any calculations). The object can be set with a call to Geodesic::Line. Use Init() to test whether object is still in this uninitialized state.

Definition at line 207 of file GeodesicLine.hpp.


Member Function Documentation

Math::real GeographicLib::GeodesicLine::Position ( real  s12,
real &  lat2,
real &  lon2,
real &  azi2,
real &  m12,
real &  M12,
real &  M21,
real &  S12 
) const throw () [inline]

Compute the position of point 2 which is a distance s12 (meters) from point 1.

Parameters:
[in]s12distance between point 1 and point 2 (meters); it can be signed.
[out]lat2latitude of point 2 (degrees).
[out]lon2longitude of point 2 (degrees); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::LONGITUDE.
[out]azi2(forward) azimuth at point 2 (degrees).
[out]m12reduced length of geodesic (meters); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::REDUCEDLENGTH.
[out]M12geodesic scale of point 2 relative to point 1 (dimensionless); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::GEODESICSCALE.
[out]M21geodesic scale of point 1 relative to point 2 (dimensionless); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::GEODESICSCALE.
[out]S12area under the geodesic (meters2); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::AREA.
Returns:
a12 arc length of between point 1 and point 2 (degrees).

The values of lon2 and azi2 returned are in the range [-180, 180).

The GeodesicLine object must have been constructed with caps |= GeodesicLine::DISTANCE_IN; otherwise Math::NaN() is returned and no parameters are set. Requesting a value which the GeodesicLine object is not capable of computing is not an error; the corresponding argument will not be altered.

The following functions are overloaded versions of GeodesicLine::Position which omit some of the output parameters. Note, however, that the arc length is always computed and returned as the function value.

Definition at line 252 of file GeodesicLine.hpp.

Referenced by GeographicLib::Gnomonic::Reverse().

Math::real GeographicLib::GeodesicLine::Position ( real  s12,
real &  lat2,
real &  lon2 
) const throw () [inline]

See the documentation for GeodesicLine::Position.

Definition at line 266 of file GeodesicLine.hpp.

Math::real GeographicLib::GeodesicLine::Position ( real  s12,
real &  lat2,
real &  lon2,
real &  azi2 
) const throw () [inline]

See the documentation for GeodesicLine::Position.

Definition at line 276 of file GeodesicLine.hpp.

Math::real GeographicLib::GeodesicLine::Position ( real  s12,
real &  lat2,
real &  lon2,
real &  azi2,
real &  m12 
) const throw () [inline]

See the documentation for GeodesicLine::Position.

Definition at line 287 of file GeodesicLine.hpp.

Math::real GeographicLib::GeodesicLine::Position ( real  s12,
real &  lat2,
real &  lon2,
real &  azi2,
real &  M12,
real &  M21 
) const throw () [inline]

See the documentation for GeodesicLine::Position.

Definition at line 299 of file GeodesicLine.hpp.

Math::real GeographicLib::GeodesicLine::Position ( real  s12,
real &  lat2,
real &  lon2,
real &  azi2,
real &  m12,
real &  M12,
real &  M21 
) const throw () [inline]

See the documentation for GeodesicLine::Position.

Definition at line 312 of file GeodesicLine.hpp.

void GeographicLib::GeodesicLine::ArcPosition ( real  a12,
real &  lat2,
real &  lon2,
real &  azi2,
real &  s12,
real &  m12,
real &  M12,
real &  M21,
real &  S12 
) const throw () [inline]

Compute the position of point 2 which is an arc length a12 (degrees) from point 1.

Parameters:
[in]a12arc length between point 1 and point 2 (degrees); it can be signed.
[out]lat2latitude of point 2 (degrees).
[out]lon2longitude of point 2 (degrees); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::LONGITUDE.
[out]azi2(forward) azimuth at point 2 (degrees).
[out]s12distance between point 1 and point 2 (meters); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::DISTANCE.
[out]m12reduced length of geodesic (meters); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::REDUCEDLENGTH.
[out]M12geodesic scale of point 2 relative to point 1 (dimensionless); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::GEODESICSCALE.
[out]M21geodesic scale of point 1 relative to point 2 (dimensionless); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::GEODESICSCALE.
[out]S12area under the geodesic (meters2); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::AREA.

The values of lon2 and azi2 returned are in the range [-180, 180).

Requesting a value which the GeodesicLine object is not capable of computing is not an error; the corresponding argument will not be altered.

The following functions are overloaded versions of GeodesicLine::ArcPosition which omit some of the output parameters.

Definition at line 365 of file GeodesicLine.hpp.

void GeographicLib::GeodesicLine::ArcPosition ( real  a12,
real &  lat2,
real &  lon2 
) const throw () [inline]

See the documentation for GeodesicLine::ArcPosition.

Definition at line 377 of file GeodesicLine.hpp.

void GeographicLib::GeodesicLine::ArcPosition ( real  a12,
real &  lat2,
real &  lon2,
real &  azi2 
) const throw () [inline]

See the documentation for GeodesicLine::ArcPosition.

Definition at line 388 of file GeodesicLine.hpp.

void GeographicLib::GeodesicLine::ArcPosition ( real  a12,
real &  lat2,
real &  lon2,
real &  azi2,
real &  s12 
) const throw () [inline]

See the documentation for GeodesicLine::ArcPosition.

Definition at line 400 of file GeodesicLine.hpp.

void GeographicLib::GeodesicLine::ArcPosition ( real  a12,
real &  lat2,
real &  lon2,
real &  azi2,
real &  s12,
real &  m12 
) const throw () [inline]

See the documentation for GeodesicLine::ArcPosition.

Definition at line 411 of file GeodesicLine.hpp.

void GeographicLib::GeodesicLine::ArcPosition ( real  a12,
real &  lat2,
real &  lon2,
real &  azi2,
real &  s12,
real &  M12,
real &  M21 
) const throw () [inline]

See the documentation for GeodesicLine::ArcPosition.

Definition at line 423 of file GeodesicLine.hpp.

void GeographicLib::GeodesicLine::ArcPosition ( real  a12,
real &  lat2,
real &  lon2,
real &  azi2,
real &  s12,
real &  m12,
real &  M12,
real &  M21 
) const throw () [inline]

See the documentation for GeodesicLine::ArcPosition.

Definition at line 436 of file GeodesicLine.hpp.

Math::real GeographicLib::GeodesicLine::GenPosition ( bool  arcmode,
real  s12_a12,
unsigned  outmask,
real &  lat2,
real &  lon2,
real &  azi2,
real &  s12,
real &  m12,
real &  M12,
real &  M21,
real &  S12 
) const throw ()

The general position function. GeodesicLine::Position and GeodesicLine::ArcPosition are defined in terms of this function.

Parameters:
[in]arcmodeboolean flag determining the meaning of the second parameter; if arcmode is false, then the GeodesicLine object must have been constructed with caps |= GeodesicLine::DISTANCE_IN.
[in]s12_a12if arcmode is false, this is the distance between point 1 and point 2 (meters); otherwise it is the arc length between point 1 and point 2 (degrees); it can be signed.
[in]outmaska bitor'ed combination of GeodesicLine::mask values specifying which of the following parameters should be set.
[out]lat2latitude of point 2 (degrees).
[out]lon2longitude of point 2 (degrees); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::LONGITUDE.
[out]azi2(forward) azimuth at point 2 (degrees).
[out]s12distance between point 1 and point 2 (meters); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::DISTANCE.
[out]m12reduced length of geodesic (meters); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::REDUCEDLENGTH.
[out]M12geodesic scale of point 2 relative to point 1 (dimensionless); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::GEODESICSCALE.
[out]M21geodesic scale of point 1 relative to point 2 (dimensionless); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::GEODESICSCALE.
[out]S12area under the geodesic (meters2); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::AREA.
Returns:
a12 arc length of between point 1 and point 2 (degrees).

The GeodesicLine::mask values possible for outmask are

Requesting a value which the GeodesicLine object is not capable of computing is not an error; the corresponding argument will not be altered. Note, however, that the arc length is always computed and returned as the function value.

Definition at line 129 of file GeodesicLine.cpp.

Referenced by GeographicLib::CassiniSoldner::Forward().

bool GeographicLib::GeodesicLine::Init ( ) const throw () [inline]
Returns:
true if the object has been initialized.

Definition at line 515 of file GeodesicLine.hpp.

Math::real GeographicLib::GeodesicLine::Latitude ( ) const throw () [inline]
Returns:
lat1 the latitude of point 1 (degrees).

Definition at line 520 of file GeodesicLine.hpp.

Math::real GeographicLib::GeodesicLine::Longitude ( ) const throw () [inline]
Returns:
lon1 the longitude of point 1 (degrees).

Definition at line 526 of file GeodesicLine.hpp.

Math::real GeographicLib::GeodesicLine::Azimuth ( ) const throw () [inline]
Returns:
azi1 the azimuth (degrees) of the geodesic line at point 1.

Definition at line 532 of file GeodesicLine.hpp.

Math::real GeographicLib::GeodesicLine::EquatorialAzimuth ( ) const throw () [inline]
Returns:
azi0 the azimuth (degrees) of the geodesic line as it crosses the equator in a northward direction.

Definition at line 539 of file GeodesicLine.hpp.

Math::real GeographicLib::GeodesicLine::EquatorialArc ( ) const throw () [inline]
Returns:
a1 the arc length (degrees) between the northward equatorial crossing and point 1.

Definition at line 548 of file GeodesicLine.hpp.

Math::real GeographicLib::GeodesicLine::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value inherited from the Geodesic object used in the constructor.

Definition at line 557 of file GeodesicLine.hpp.

Math::real GeographicLib::GeodesicLine::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid. This is the value inherited from the Geodesic object used in the constructor.

Definition at line 564 of file GeodesicLine.hpp.

unsigned GeographicLib::GeodesicLine::Capabilities ( ) const throw () [inline]
Returns:
caps the computational capabilities that this object was constructed with. LATITUDE and AZIMUTH are always included.

Definition at line 580 of file GeodesicLine.hpp.

bool GeographicLib::GeodesicLine::Capabilities ( unsigned  testcaps) const throw () [inline]
Parameters:
[in]testcapsa set of bitor'ed GeodesicLine::mask values.
Returns:
true if the GeodesicLine object has all these capabilities.

Definition at line 586 of file GeodesicLine.hpp.


Friends And Related Function Documentation

friend class Geodesic [friend]

Definition at line 62 of file GeodesicLine.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/utilities.html0000644000175000017500000001574111745620414020502 0ustar frankiefrankie GeographicLib: Utility programs
Utility programs
Back to Getting started. Forward to Code organization. Up to Contents.

Various utility programs are provided with GeographicLib. These should be installed in a directory included in your PATH (e.g., /usr/local/bin). These programs are wrapper programs that invoke the underlying functionality provided by the library.

The utilities are

The documentation for these utilities is in the form of man pages. This documentation can be accessed by clicking on the utility name in the list above, running the man command on Unix-like systems, or by invoking the utility with the --help option. A brief summary of usage is given by invoking the utility with the -h option. The version of the utility is given by the --version option.

The utilities all accept data on standard input, transform it in some way, and print the results on standard output. This makes the utilities easy to use within scripts to transform tabular data; however they can also be used interactively, often with the input supplied via a pipe, e.g.,

  • echo 38SMB4488 | GeoConvert -d

Online versions of three of these utilities are provided:

Back to Getting started. Forward to Code organization. Up to Contents.
geographiclib-1.21/doc/html/UTMUPS_8cpp.html0000644000175000017500000001224011745620415020446 0ustar frankiefrankie GeographicLib: UTMUPS.cpp File Reference
UTMUPS.cpp File Reference

Implementation for GeographicLib::UTMUPS class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_UTMUPS_CPP   "$Id: 5672b003ee47cd660377c111e3fca2b81da86323 $"

Detailed Description

Implementation for GeographicLib::UTMUPS class.

Copyright (c) Charles Karney (2008-2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file UTMUPS.cpp.


Define Documentation

#define GEOGRAPHICLIB_UTMUPS_CPP   "$Id: 5672b003ee47cd660377c111e3fca2b81da86323 $"

Definition at line 17 of file UTMUPS.cpp.

geographiclib-1.21/doc/html/globals_type.html0000644000175000017500000000440011745620414021141 0ustar frankiefrankie GeographicLib: File Members
 
geographiclib-1.21/doc/html/classGeographicLib_1_1SphericalEngine_1_1coeff-members.html0000644000175000017500000001627711745620414030735 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::SphericalEngine::coeff Member List
This is the complete list of members for GeographicLib::SphericalEngine::coeff, including all inherited members.
coeff()GeographicLib::SphericalEngine::coeff [inline]
coeff(const std::vector< real > &C, const std::vector< real > &S, int N, int nmx, int mmx)GeographicLib::SphericalEngine::coeff [inline]
coeff(const std::vector< real > &C, const std::vector< real > &S, int N)GeographicLib::SphericalEngine::coeff [inline]
Csize(int N, int M)GeographicLib::SphericalEngine::coeff [inline, static]
Cv(int k) const GeographicLib::SphericalEngine::coeff [inline]
Cv(int k, int n, int m, real f) const GeographicLib::SphericalEngine::coeff [inline]
index(int n, int m) const GeographicLib::SphericalEngine::coeff [inline]
mmx() const GeographicLib::SphericalEngine::coeff [inline]
N() const GeographicLib::SphericalEngine::coeff [inline]
nmx() const GeographicLib::SphericalEngine::coeff [inline]
readcoeffs(std::istream &stream, int &N, int &M, std::vector< real > &C, std::vector< real > &S)GeographicLib::SphericalEngine::coeff [static]
Ssize(int N, int M)GeographicLib::SphericalEngine::coeff [inline, static]
Sv(int k) const GeographicLib::SphericalEngine::coeff [inline]
Sv(int k, int n, int m, real f) const GeographicLib::SphericalEngine::coeff [inline]
geographiclib-1.21/doc/html/EllipticFunction_8hpp_source.html0000644000175000017500000004775211745620414024270 0ustar frankiefrankie GeographicLib: EllipticFunction.hpp Source File
EllipticFunction.hpp
Go to the documentation of this file.
00001 /**
00002  * \file EllipticFunction.hpp
00003  * \brief Header for GeographicLib::EllipticFunction class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP)
00011 #define GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP \
00012   "$Id: 30ac447643e48afcaf5ab4671fbf2b235008dabe $"
00013 
00014 #include <GeographicLib/Constants.hpp>
00015 
00016 namespace GeographicLib {
00017 
00018   /**
00019    * \brief Elliptic functions needed for TransverseMercatorExact
00020    *
00021    * This provides the subset of elliptic functions needed for
00022    * TransverseMercatorExact.  For a given ellipsoid, only parameters
00023    * <i>e</i><sup>2</sup> and 1 - <i>e</i><sup>2</sup> are needed.  This class
00024    * taken the parameter as a constructor parameters and caches the values of
00025    * the required complete integrals.  A method is provided for Jacobi elliptic
00026    * functions and for the incomplete elliptic integral of the second kind in
00027    * terms of the amplitude.
00028    *
00029    * The computation of the elliptic integrals uses the algorithms given in
00030    * - B. C. Carlson,
00031    *   <a href="http://dx.doi.org/10.1007/BF02198293"> Computation of elliptic
00032    *   integrals</a>, Numerical Algorithms 10, 13&ndash;26 (1995).
00033    * .
00034    * The computation of the Jacobi elliptic functions uses the algorithm given
00035    * in
00036    * - R. Bulirsch,
00037    *   <a href="http://dx.doi.org/10.1007/BF01397975"> Numerical Calculation of
00038    *   Elliptic Integrals and Elliptic Functions</a>, Numericshe Mathematik 7,
00039    *   78&ndash;90 (1965).
00040    * .
00041    * The notation follows Abramowitz and Stegun, Chapters 16 and 17.
00042    *
00043    * Example of use:
00044    * \include example-EllipticFunction.cpp
00045    **********************************************************************/
00046   class GEOGRAPHIC_EXPORT EllipticFunction {
00047   private:
00048     typedef Math::real real;
00049     static const real tol_;
00050     static const real tolRF_;
00051     static const real tolRD_;
00052     static const real tolRG0_;
00053     static const real tolJAC_;
00054     static const real tolJAC1_;
00055     enum { num_ = 10 }; // Max depth required for sncndn.  Probably 5 is enough.
00056     static real RF(real x, real y, real z) throw();
00057     static real RD(real x, real y, real z) throw();
00058     static real RG0(real x, real y) throw();
00059     real _m, _m1;
00060     mutable bool _init;
00061     mutable real _kc, _ec, _kec;
00062     bool Init() const throw();
00063   public:
00064 
00065     /**
00066      * Constructor.
00067      *
00068      * @param[in] m the parameter which must lie in [0, 1].  (No checking
00069      *   is done.)
00070      **********************************************************************/
00071     explicit EllipticFunction(real m) throw();
00072 
00073     /**
00074      * @return the parameter \e m.
00075      **********************************************************************/
00076     Math::real m() const throw() { return _m; }
00077 
00078     /**
00079      * @return the complementary parameter \e m' = (1 - \e m).
00080      **********************************************************************/
00081     Math::real m1() const throw() { return _m1; }
00082 
00083     /**
00084      * @return the complete integral of first kind, \e K(\e m).
00085      **********************************************************************/
00086     Math::real K() const throw() { _init || Init(); return _kc; }
00087 
00088     /**
00089      * @return the complete integral of second kind, \e E(\e m).
00090      **********************************************************************/
00091     Math::real E() const throw() { _init || Init(); return _ec; }
00092 
00093     /**
00094      * @return the difference \e K(\e m) - \e E(\e m) (which can be computed
00095      *   directly).
00096      **********************************************************************/
00097     Math::real KE() const throw() { _init || Init(); return _kec; }
00098 
00099     /**
00100      * The Jacobi elliptic functions.
00101      *
00102      * @param[in] x the argument.
00103      * @param[out] sn sn(<i>x</i>|<i>m</i>).
00104      * @param[out] cn cn(<i>x</i>|<i>m</i>).
00105      * @param[out] dn dn(<i>x</i>|<i>m</i>).
00106      **********************************************************************/
00107     void sncndn(real x, real& sn, real& cn, real& dn) const throw();
00108 
00109     /**
00110      * The incomplete integral of the second kind.
00111      *
00112      * @param[in] phi
00113      * @return int sqrt(1 -  \e m sin<sup>2</sup>(\e phi)) \e dphi.
00114      **********************************************************************/
00115     Math::real E(real phi) const throw();
00116 
00117     /**
00118      * The incomplete integral of the second kind in terms of Jacobi elliptic
00119      * functions
00120      *
00121      * @param[in] sn
00122      * @param[in] cn
00123      * @param[in] dn
00124      * @return int dn(\e w)<sup>2</sup> \e dw (A+S 17.2.10).
00125      *
00126      * Instead of specifying the amplitude \e phi, we provide \e sn = sin(\e
00127      * phi), \e cn = cos(\e phi), \e dn = sqrt(1 - \e m sin<sup>2</sup>(\e
00128      * phi)).
00129      **********************************************************************/
00130     Math::real E(real sn, real cn, real dn) const throw();
00131   };
00132 
00133 
00134 } // namespace GeographicLib
00135 
00136 #endif  // GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP
geographiclib-1.21/doc/html/classGeographicLib_1_1SphericalHarmonic1-members.html0000644000175000017500000001437511745620414027703 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::SphericalHarmonic1 Member List
This is the complete list of members for GeographicLib::SphericalHarmonic1, including all inherited members.
Circle(real tau, real p, real z, bool gradp) const GeographicLib::SphericalHarmonic1 [inline]
Coefficients() const GeographicLib::SphericalHarmonic1 [inline]
Coefficients1() const GeographicLib::SphericalHarmonic1 [inline]
FULL enum valueGeographicLib::SphericalHarmonic1
normalization enum nameGeographicLib::SphericalHarmonic1
operator()(real tau, real x, real y, real z) const GeographicLib::SphericalHarmonic1 [inline]
operator()(real tau, real x, real y, real z, real &gradx, real &grady, real &gradz) const GeographicLib::SphericalHarmonic1 [inline]
SCHMIDT enum valueGeographicLib::SphericalHarmonic1
SphericalHarmonic1(const std::vector< real > &C, const std::vector< real > &S, int N, const std::vector< real > &C1, const std::vector< real > &S1, int N1, real a, unsigned norm=FULL)GeographicLib::SphericalHarmonic1 [inline]
SphericalHarmonic1(const std::vector< real > &C, const std::vector< real > &S, int N, int nmx, int mmx, const std::vector< real > &C1, const std::vector< real > &S1, int N1, int nmx1, int mmx1, real a, unsigned norm=FULL)GeographicLib::SphericalHarmonic1 [inline]
SphericalHarmonic1()GeographicLib::SphericalHarmonic1 [inline]
geographiclib-1.21/doc/html/CircularEngine_8cpp_source.html0000644000175000017500000002746611745620414023702 0ustar frankiefrankie GeographicLib: CircularEngine.cpp Source File
CircularEngine.cpp
Go to the documentation of this file.
00001 /**
00002  * \file CircularEngine.cpp
00003  * \brief Implementation for GeographicLib::CircularEngine class
00004  *
00005  * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under
00006  * the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/CircularEngine.hpp>
00011 #include <limits>
00012 
00013 #define GEOGRAPHICLIB_CIRCULARENGINE_CPP \
00014   "$Id: bdd0d21aa34063706e4042410f06bb0f7844fea9 $"
00015 
00016 RCSID_DECL(GEOGRAPHICLIB_CIRCULARENGINE_CPP)
00017 RCSID_DECL(GEOGRAPHICLIB_CIRCULARENGINE_HPP)
00018 
00019 namespace GeographicLib {
00020 
00021   using namespace std;
00022 
00023   Math::real CircularEngine::Value(bool gradp, real cl, real sl,
00024                                    real& gradx, real& grady, real& gradz)
00025     const throw() {
00026     gradp = _gradp && gradp;
00027     const vector<real>& root_( SphericalEngine::root_ );
00028 
00029     // Initialize outer sum
00030     real vc  = 0, vc2  = 0, vs  = 0, vs2  = 0;   // v [N + 1], v [N + 2]
00031     // vr, vt, vl and similar w variable accumulate the sums for the
00032     // derivatives wrt r, theta, and lambda, respectively.
00033     real vrc = 0, vrc2 = 0, vrs = 0, vrs2 = 0;   // vr[N + 1], vr[N + 2]
00034     real vtc = 0, vtc2 = 0, vts = 0, vts2 = 0;   // vt[N + 1], vt[N + 2]
00035     real vlc = 0, vlc2 = 0, vls = 0, vls2 = 0;   // vl[N + 1], vl[N + 2]
00036     for (int m = _M; m >= 0; --m) {   // m = M .. 0
00037       // Now Sc[m] = wc, Ss[m] = ws
00038       // Sc'[m] = wtc, Ss'[m] = wtc
00039       if (m) {
00040         real v, A, B;           // alpha[m], beta[m + 1]
00041         switch (_norm) {
00042         case FULL:
00043           v = root_[2] * root_[2 * m + 3] / root_[m + 1];
00044           A = cl * v * _uq;
00045           B = - v * root_[2 * m + 5] / (root_[8] * root_[m + 2]) * _uq2;
00046           break;
00047         case SCHMIDT:
00048           v = root_[2] * root_[2 * m + 1] / root_[m + 1];
00049           A = cl * v * _uq;
00050           B = - v * root_[2 * m + 3] / (root_[8] * root_[m + 2]) * _uq2;
00051           break;
00052         default:
00053           A = B = 0;
00054         }
00055         v = A * vc  + B * vc2  +  _wc[m] ; vc2  = vc ; vc  = v;
00056         v = A * vs  + B * vs2  +  _ws[m] ; vs2  = vs ; vs  = v;
00057         if (gradp) {
00058           v = A * vrc + B * vrc2 +  _wrc[m]; vrc2 = vrc; vrc = v;
00059           v = A * vrs + B * vrs2 +  _wrs[m]; vrs2 = vrs; vrs = v;
00060           v = A * vtc + B * vtc2 +  _wtc[m]; vtc2 = vtc; vtc = v;
00061           v = A * vts + B * vts2 +  _wts[m]; vts2 = vts; vts = v;
00062           v = A * vlc + B * vlc2 + m*_ws[m]; vlc2 = vlc; vlc = v;
00063           v = A * vls + B * vls2 - m*_wc[m]; vls2 = vls; vls = v;
00064         }
00065       } else {
00066         real A, B, qs;
00067         switch (_norm) {
00068         case FULL:
00069           A = root_[3] * _uq;       // F[1]/(q*cl) or F[1]/(q*sl)
00070           B = - root_[15]/2 * _uq2; // beta[1]/q
00071           break;
00072         case SCHMIDT:
00073           A = _uq;
00074           B = - root_[3]/2 * _uq2;
00075           break;
00076         default:
00077           A = B = 0;
00078         }
00079         qs = _q / SphericalEngine::scale_;
00080         vc = qs * (_wc[m] + A * (cl * vc + sl * vs ) + B * vc2);
00081         if (gradp) {
00082           qs /= _r;
00083           // The components of the gradient in circular coordinates are
00084           // r: dV/dr
00085           // theta: 1/r * dV/dtheta
00086           // lambda: 1/(r*u) * dV/dlambda
00087           vrc =    - qs * (_wrc[m] + A * (cl * vrc + sl * vrs) + B * vrc2);
00088           vtc =      qs * (_wtc[m] + A * (cl * vtc + sl * vts) + B * vtc2);
00089           vlc = qs / _u * (          A * (cl * vlc + sl * vls) + B * vlc2);
00090         }
00091       }
00092     }
00093 
00094     if (gradp) {
00095       // Rotate into cartesian (geocentric) coordinates
00096       gradx = cl * (_u * vrc + _t * vtc) - sl * vlc;
00097       grady = sl * (_u * vrc + _t * vtc) + cl * vlc;
00098       gradz =           _t * vrc - _u * vtc                ;
00099     }
00100     return vc;
00101   }
00102 
00103 } // namespace GeographicLib
geographiclib-1.21/doc/html/classGeographicLib_1_1DMS.html0000644000175000017500000012550011745620415023214 0ustar frankiefrankie GeographicLib: GeographicLib::DMS Class Reference
GeographicLib::DMS Class Reference

Convert between degrees and DMS representation. More...

#include <GeographicLib/DMS.hpp>

List of all members.

Public Types

enum  flag {
  NONE, LATITUDE, LONGITUDE, AZIMUTH,
  NUMBER
}
enum  component { DEGREE, MINUTE, SECOND }

Static Public Member Functions

static Math::real Decode (const std::string &dms, flag &ind)
static Math::real Decode (real d, real m=0, real s=0) throw ()
static void DecodeLatLon (const std::string &dmsa, const std::string &dmsb, real &lat, real &lon, bool swaplatlong=false)
static Math::real DecodeAngle (const std::string &angstr)
static Math::real DecodeAzimuth (const std::string &azistr)
static std::string Encode (real angle, component trailing, unsigned prec, flag ind, char dmssep)
static std::string Encode (real angle, component trailing, unsigned prec, flag ind=NONE)
static std::string Encode (real angle, unsigned prec, flag ind=NONE, char dmssep=char(0))
static void Encode (real ang, real &d, real &m) throw ()
static void Encode (real ang, real &d, real &m, real &s) throw ()

Detailed Description

Convert between degrees and DMS representation.

Parse a string representing degree, minutes, and seconds and return the angle in degrees and format an angle in degrees as degree, minutes, and seconds. In addition, handle NANs and infinities on input and output.

Example of use:

// Example of using the GeographicLib::DMS class
// $Id: c12828a51e75bb4a2a28f67768acdb405f63a197 $

#include <iostream>
#include <exception>
#include <GeographicLib/DMS.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    {
      string dms = "30d14'45.6\"S";
      DMS::flag type;
      double ang = DMS::Decode(dms, type);
      cout << type << " " << ang << "\n";
    }
    {
      double ang = -30.245715;
      string dms = DMS::Encode(ang, 6, DMS::LATITUDE);
      cout << dms << "\n";
    }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Member Enumeration Documentation

Indicator for presence of hemisphere indicator (N/S/E/W) on latitudes and longitudes.

Enumerator:
NONE 

No indicator present.

LATITUDE 

Latitude indicator (N/S) present.

LONGITUDE 

Longitude indicator (E/W) present.

AZIMUTH 

Used in Encode to indicate output of an azimuth in [000, 360) with no letter indicator.

NUMBER 

Used in Encode to indicate output of a plain number.

Definition at line 63 of file DMS.hpp.

Indicator for trailing units on an angle.

Enumerator:
DEGREE 

Trailing unit is degrees.

MINUTE 

Trailing unit is arc minutes.

SECOND 

Trailing unit is arc seconds.

Definition at line 95 of file DMS.hpp.


Member Function Documentation

Math::real GeographicLib::DMS::Decode ( const std::string &  dms,
flag ind 
) [static]

Convert a string in DMS to an angle.

Parameters:
[in]dmsstring input.
[out]inda DMS::flag value signaling the presence of a hemisphere indicator.
Returns:
angle (degrees).

Degrees, minutes, and seconds are indicated by the characters d, ' (single quote), " (double quote), and these components may only be given in this order. Any (but not all) components may be omitted and other symbols (e.g., the o symbol for degrees and the unicode prime and double prime symbols for minutes and seconds) may be substituted. The last component indicator may be omitted and is assumed to be the next smallest unit (thus 33d10 is interpreted as 33d10'). The final component may be a decimal fraction but the non-final components must be integers. Instead of using d, ', and " to indicate degrees, minutes, and seconds, : (colon) may be used to separate these components (numbers must appear before and after each colon); thus 50d30'10.3" may be written as 50:30:10.3, 5.5' may be written 0:5.5, and so on. The integer parts of the minutes and seconds components must be less than 60. A single leading sign is permitted. A hemisphere designator (N, E, W, S) may be added to the beginning or end of the string. The result is multiplied by the implied sign of the hemisphere designator (negative for S and W). In addition ind is set to DMS::LATITUDE if N or S is present, to DMS::LONGITUDE if E or W is present, and to DMS::NONE otherwise. Throws an error on a malformed string. No check is performed on the range of the result. Examples of legal and illegal strings are

  • LEGAL (all the entries on each line are equivalent)
    • -20.51125, 20d30'40.5"S, -20d30'40.5, -20d30.675, N-20d30'40.5", -20:30:40.5
    • 4d0'9, 4d9", 4d9'', 4:0:9, 004:00:09, 4.0025, 4.0025d, 4d0.15, 04:.15
  • ILLEGAL (the exception thrown explains the problem)
    • 4d5"4', 4::5, 4:5:, :4:5, 4d4.5'4", -N20.5, 1.8e2d, 4:60, 4d-5'

NOTE: At present, all the string handling in the C++ implementation GeographicLib is with 8-bit characters. The support for unicode symbols for degrees, minutes, and seconds is therefore via the UTF-8 encoding. (The Javascript implementation of this class uses unicode natively, of course.)

Here is the list of Unicode symbols supported for degrees, minutes, seconds:

  • degrees:
    • d, D lower and upper case letters
    • U+00b0 degree symbol
    • U+00ba masculine ordinal indicator
    • U+2070 superscript zero
  • minutes:
    • ' apostrophe
    • U+2032 prime
    • U+00b4 acute accent
  • seconds:
    • " quotation mark
    • U+2033 double prime
    • ' ' any two consecutive symbols for minutes

The codes with a leading zero byte, e.g., U+00b0, are accepted in their UTF-8 coded form 0xc2 0xb0 and as a single byte 0xb0.

Definition at line 31 of file DMS.cpp.

Referenced by main().

static Math::real GeographicLib::DMS::Decode ( real  d,
real  m = 0,
real  s = 0 
) throw () [inline, static]

Convert DMS to an angle.

Parameters:
[in]ddegrees.
[in]marc minutes.
[in]sarc seconds.
Returns:
angle (degrees)

This does not propagate the sign on d to the other components, so -3d20' would need to be represented as - DMS::Decode(3.0, 20.0) or DMS::Decode(-3.0, -20.0).

Definition at line 191 of file DMS.hpp.

void GeographicLib::DMS::DecodeLatLon ( const std::string &  dmsa,
const std::string &  dmsb,
real &  lat,
real &  lon,
bool  swaplatlong = false 
) [static]

Convert a pair of strings to latitude and longitude.

Parameters:
[in]dmsafirst string.
[in]dmsbsecond string.
[out]latlatitude.
[out]lonlongitude.
[in]swaplatlongif true assume longitude is given before latitude in the absence of hemisphere designators (default false).

By default, the lat (resp., lon) is assigned to the results of decoding dmsa (resp., dmsb). However this is overridden if either dmsa or dmsb contain a latitude or longitude hemisphere designator (N, S, E, W). Throws an error if the decoded numbers are out of the ranges [-90o, 90o] for latitude and [-180o, 360o] for longitude and, in which case lat and lon are unchanged. Finally the longitude is reduced to the range [-180o, 180o).

Definition at line 207 of file DMS.cpp.

Referenced by main().

Math::real GeographicLib::DMS::DecodeAngle ( const std::string &  angstr) [static]

Convert a string to an angle in degrees.

Parameters:
[in]angstrinput string.
Returns:
angle (degrees)

No hemisphere designator is allowed and no check is done on the range of the result.

Definition at line 240 of file DMS.cpp.

Referenced by ReadDistance().

Math::real GeographicLib::DMS::DecodeAzimuth ( const std::string &  azistr) [static]

Convert a string to an azimuth in degrees.

Parameters:
[in]azistrinput string.
Returns:
azimuth (degrees)

A hemisphere designator E/W can be used; the result is multiplied by -1 if W is present. Throws an error if the result is out of the range [-180o, 360o]. Finally the azimuth is reduced to the range [-180o, 180o).

Definition at line 249 of file DMS.cpp.

Referenced by main().

string GeographicLib::DMS::Encode ( real  angle,
component  trailing,
unsigned  prec,
flag  ind,
char  dmssep 
) [static]

Convert angle (in degrees) into a DMS string (using d, ', and ").

Parameters:
[in]angleinput angle (degrees)
[in]trailingDMS::component value indicating the trailing units on the string and this is given as a decimal number if necessary.
[in]precthe number of digits after the decimal point for the trailing component.
[in]indDMS::flag value indicated additional formatting.
[in]dmssepif non-null, use as the DMS separator character (instead of d, ', " delimiters).
Returns:
formatted string

The interpretation of ind is as follows:

  • ind == DMS::NONE, signed result no leading zeros on degrees except in the units place, e.g., -8d03'.
  • ind == DMS::LATITUDE, trailing N or S hemisphere designator, no sign, pad degrees to 2 digits, e.g., 08d03'S.
  • ind == DMS::LONGITUDE, trailing E or W hemisphere designator, no sign, pad degrees to 3 digits, e.g., 008d03'W.
  • ind == DMS::AZIMUTH, convert to the range [0, 360o), no sign, pad degrees to 3 digits, , e.g., 351d57'.

The integer parts of the minutes and seconds components are always given with 2 digits.

Definition at line 261 of file DMS.cpp.

Referenced by LatLonString(), AzimuthString(), DistanceStrings(), and main().

string GeographicLib::DMS::Encode ( real  angle,
component  trailing,
unsigned  prec,
flag  ind = NONE 
) [static]

Convert angle (in degrees) into a DMS string (using d, ', and ").

Parameters:
[in]angleinput angle (degrees)
[in]trailingDMS::component value indicating the trailing units on the string and this is given as a decimal number if necessary.
[in]precthe number of digits after the decimal point for the trailing component.
[in]indDMS::flag value indicated additional formatting.
Returns:
formatted string

COMPATIBILITY NOTE: This function calls Encode(real, component, unsigned, flag, char) with a 5th argument of char(0). At some point, Encode(real, component, unsigned, flag) and will be withdrawn and the interface to Encode(real, component, unsigned, flag, char) changed so that its 4th and 5th arguments have default values. This will preserve source-level compatibility.

Definition at line 338 of file DMS.cpp.

static std::string GeographicLib::DMS::Encode ( real  angle,
unsigned  prec,
flag  ind = NONE,
char  dmssep = char(0) 
) [inline, static]

Convert angle into a DMS string (using d, ', and ") selecting the trailing component based on the precision.

Parameters:
[in]angleinput angle (degrees)
[in]precthe precision relative to 1 degree.
[in]indDMS::flag value indicated additional formatting.
[in]dmssepif non-null, use as the DMS separator character (instead of d, ', " delimiters).
Returns:
formatted string

prec indicates the precision relative to 1 degree, e.g., prec = 3 gives a result accurate to 0.1' and prec = 4 gives a result accurate to 1". ind is interpreted as in DMS::Encode with the additional facility that DMS::NUMBER represents angle as a number in fixed format with precision prec.

Definition at line 332 of file DMS.hpp.

static void GeographicLib::DMS::Encode ( real  ang,
real &  d,
real &  m 
) throw () [inline, static]

Split angle into degrees and minutes

Parameters:
[in]angangle (degrees)
[out]ddegrees (an integer returned as a real)
[out]marc minutes.

Definition at line 348 of file DMS.hpp.

static void GeographicLib::DMS::Encode ( real  ang,
real &  d,
real &  m,
real &  s 
) throw () [inline, static]

Split angle into degrees and minutes and seconds.

Parameters:
[in]angangle (degrees)
[out]ddegrees (an integer returned as a real)
[out]marc minutes (an integer returned as a real)
[out]sarc seconds.

Definition at line 360 of file DMS.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/Gnomonic_8cpp_source.html0000644000175000017500000002306511745620414022550 0ustar frankiefrankie GeographicLib: Gnomonic.cpp Source File
Gnomonic.cpp
Go to the documentation of this file.
00001 /**
00002  * \file Gnomonic.cpp
00003  * \brief Implementation for GeographicLib::Gnomonic class
00004  *
00005  * Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/Gnomonic.hpp>
00011 
00012 #define GEOGRAPHICLIB_GNOMONIC_CPP \
00013   "$Id: 1abf2f2ebdc8a805d0d205051120809f0c0e6071 $"
00014 
00015 RCSID_DECL(GEOGRAPHICLIB_GNOMONIC_CPP)
00016 RCSID_DECL(GEOGRAPHICLIB_GNOMONIC_HPP)
00017 
00018 namespace GeographicLib {
00019 
00020   using namespace std;
00021 
00022   const Math::real Gnomonic::eps0_ = numeric_limits<real>::epsilon();
00023   const Math::real Gnomonic::eps_ = real(0.01) * sqrt(eps0_);
00024 
00025   void Gnomonic::Forward(real lat0, real lon0, real lat, real lon,
00026                          real& x, real& y, real& azi, real& rk)
00027     const throw() {
00028     real azi0, m, M, t;
00029     _earth.GenInverse(lat0, lon0, lat, lon,
00030                       Geodesic::AZIMUTH | Geodesic::REDUCEDLENGTH |
00031                       Geodesic::GEODESICSCALE,
00032                       t, azi0, azi, m, M, t, t);
00033     rk = M;
00034     if (M <= 0)
00035       x = y = Math::NaN<real>();
00036     else {
00037       real rho = m/M;
00038       azi0 *= Math::degree<real>();
00039       x = rho * sin(azi0);
00040       y = rho * cos(azi0);
00041     }
00042   }
00043 
00044   void Gnomonic::Reverse(real lat0, real lon0, real x, real y,
00045                          real& lat, real& lon, real& azi, real& rk)
00046     const throw() {
00047     real
00048       azi0 = atan2(x, y) / Math::degree<real>(),
00049       rho = Math::hypot(x, y),
00050       s = _a * atan(rho/_a);
00051     bool little = rho <= _a;
00052     if (!little)
00053       rho = 1/rho;
00054     GeodesicLine line(_earth.Line(lat0, lon0, azi0,
00055                                   Geodesic::LATITUDE | Geodesic::LONGITUDE |
00056                                   Geodesic::AZIMUTH | Geodesic::DISTANCE_IN |
00057                                   Geodesic::REDUCEDLENGTH |
00058                                   Geodesic::GEODESICSCALE));
00059     int count = numit_, trip = 0;
00060     real lat1, lon1, azi1, M;
00061     while (count--) {
00062       real m, t;
00063       line.Position(s, lat1, lon1, azi1, m, M, t);
00064       if (trip)
00065         break;
00066       // If little, solve rho(s) = rho with drho(s)/ds = 1/M^2
00067       // else solve 1/rho(s) = 1/rho with d(1/rho(s))/ds = -1/m^2
00068       real ds = little ? (m/M - rho) * M * M : (rho - M/m) * m * m;
00069       s -= ds;
00070       if (!(abs(ds) >= eps_ * _a))
00071         ++trip;
00072     }
00073     if (trip) {
00074       lat = lat1; lon = lon1; azi = azi1; rk = M;
00075     } else
00076       lat = lon = azi = rk = Math::NaN<real>();
00077     return;
00078   }
00079 
00080 } // namespace GeographicLib
geographiclib-1.21/doc/html/SphericalEngine_8cpp_source.html0000644000175000017500000017572311745620414024050 0ustar frankiefrankie GeographicLib: SphericalEngine.cpp Source File
SphericalEngine.cpp
Go to the documentation of this file.
00001 /**
00002  * \file SphericalEngine.cpp
00003  * \brief Implementation for GeographicLib::SphericalEngine class
00004  *
00005  * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under
00006  * the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  *
00009  * The general sum is\verbatim
00010  V(r, theta, lambda) = sum(n = 0..N) sum(m = 0..n)
00011    q^(n+1) * (C[n,m] * cos(m*lambda) + S[n,m] * sin(m*lambda)) * P[n,m](t)
00012 \endverbatim
00013  * where <tt>t = cos(theta)</tt>, <tt>q = a/r</tt>.  In addition write <tt>u =
00014  * sin(theta)</tt>.
00015  *
00016  * <tt>P[n,m]</tt> is a normalized associated Legendre function of degree
00017  * <tt>n</tt> and order <tt>m</tt>.  Here the formulas are given for full
00018  * normalized functions (usually denoted <tt>Pbar</tt>).
00019  *
00020  * Rewrite outer sum\verbatim
00021  V(r, theta, lambda) = sum(m = 0..N) * P[m,m](t) * q^(m+1) *
00022     [Sc[m] * cos(m*lambda) + Ss[m] * sin(m*lambda)]
00023 \endverbatim
00024  * where the inner sums are\verbatim
00025    Sc[m] = sum(n = m..N) q^(n-m) * C[n,m] * P[n,m](t)/P[m,m](t)
00026    Ss[m] = sum(n = m..N) q^(n-m) * S[n,m] * P[n,m](t)/P[m,m](t)
00027 \endverbatim
00028  * Evaluate sums via Clenshaw method.  The overall framework is similar to
00029  * Deakin with the following changes:
00030  * - Clenshaw summation is used to roll the computation of
00031  *   <tt>cos(m*lambda)</tt> and <tt>sin(m*lambda)</tt> into the evaluation of
00032  *   the outer sum (rather than independently computing an array of these
00033  *   trigonometric terms).
00034  * - Scale the coefficients to guard against overflow when <tt>N</tt> is large.
00035  * .
00036  * For the general framework of Clenshaw, see
00037  * http://mathworld.wolfram.com/ClenshawRecurrenceFormula.html
00038  *
00039  * Let\verbatim
00040     S = sum(k = 0..N) c[k] * F[k](x)
00041     F[n+1](x) = alpha[n](x) * F[n](x) + beta[n](x) * F[n-1](x)
00042 \endverbatim
00043  * Evaluate <tt>S</tt> with\verbatim
00044     y[N+2] = y[N+1] = 0
00045     y[k] = alpha[k] * y[k+1] + beta[k+1] * y[k+2] + c[k]
00046     S = c[0] * F[0] + y[1] * F[1] + beta[1] * F[0] * y[2]
00047 \endverbatim
00048  * \e IF <tt>F[0](x) = 1</tt> and <tt>beta(0,x) = 0</tt>, then <tt>F[1](x) =
00049  * alpha(0,x)</tt> and we can continue the recursion for <tt>y[k]</tt> until
00050  * <tt>y[0]</tt>, giving\verbatim
00051     S = y[0]
00052 \endverbatim
00053  *
00054  * Evaluating the inner sum\verbatim
00055  l = n-m; n = l+m
00056  Sc[m] = sum(l = 0..N-m) C[l+m,m] * q^l * P[l+m,m](t)/P[m,m](t)
00057  F[l] = q^l * P[l+m,m](t)/P[m,m](t)
00058 \endverbatim
00059  * Holmes + Featherstone, Eq. (11), give\verbatim
00060    P[n,m] = sqrt((2*n-1)*(2*n+1)/((n-m)*(n+m))) * t * P[n-1,m] -
00061             sqrt((2*n+1)*(n+m-1)*(n-m-1)/((n-m)*(n+m)*(2*n-3))) * P[n-2,m]
00062 \endverbatim
00063  * thus\verbatim
00064    alpha[l] = t * q * sqrt(((2*n+1)*(2*n+3))/
00065                            ((n-m+1)*(n+m+1)))
00066    beta[l+1] = - q^2 * sqrt(((n-m+1)*(n+m+1)*(2*n+5))/
00067                             ((n-m+2)*(n+m+2)*(2*n+1)))
00068 \endverbatim
00069  * In this case, <tt>F[0] = 1</tt> and <tt>beta[0] = 0</tt>, so the <tt>Sc[m]
00070  * = y[0]</tt>.
00071  *
00072  * Evaluating the outer sum\verbatim
00073  V = sum(m = 0..N) Sc[m] * q^(m+1) * cos(m*lambda) * P[m,m](t)
00074    + sum(m = 0..N) Ss[m] * q^(m+1) * cos(m*lambda) * P[m,m](t)
00075  F[m] = q^(m+1) * cos(m*lambda) * P[m,m](t) [or sin(m*lambda)]
00076 \endverbatim
00077  * Holmes + Featherstone, Eq. (13), give\verbatim
00078    P[m,m] = u * sqrt((2*m+1)/((m>1?2:1)*m)) * P[m-1,m-1]
00079 \endverbatim
00080  * also, we have\verbatim
00081    cos((m+1)*lambda) = 2*cos(lambda)*cos(m*lambda) - cos((m-1)*lambda)
00082 \endverbatim
00083  * thus\verbatim
00084    alpha[m] = 2*cos(lambda) * sqrt((2*m+3)/(2*(m+1))) * u * q
00085             =   cos(lambda) * sqrt( 2*(2*m+3)/(m+1) ) * u * q
00086    beta[m+1] = -sqrt((2*m+3)*(2*m+5)/(4*(m+1)*(m+2))) * u^2 * q^2
00087                * (m == 0 ? sqrt(2) : 1)
00088 \endverbatim
00089  * Thus\verbatim
00090  F[0] = q                                [or 0]
00091  F[1] = cos(lambda) * sqrt(3) * u * q^2  [or sin(lambda)]
00092  beta[1] = - sqrt(15/4) * u^2 * q^2
00093 \endverbatim
00094  *
00095  * Here is how the various components of the gradient are computed
00096  *
00097  * Differentiate wrt <tt>r</tt>\verbatim
00098    d q^(n+1) / dr = (-1/r) * (n+1) * q^(n+1)
00099 \endverbatim
00100  * so multiply <tt>C[n,m]</tt> by <tt>n+1</tt> in inner sum and multiply the
00101  * sum by <tt>-1/r</tt>.
00102  *
00103  * Differentiate wrt <tt>lambda</tt>\verbatim
00104    d cos(m*lambda) = -m * sin(m*lambda)
00105    d sin(m*lambda) =  m * cos(m*lambda)
00106 \endverbatim
00107  * so multiply terms by <tt>m</tt> in outer sum and swap sine and cosine
00108  * variables.
00109  *
00110  * Differentiate wrt <tt>theta</tt>\verbatim
00111   dV/dtheta = V' = -u * dV/dt = -u * V'
00112 \endverbatim
00113  * here <tt>'</tt> denotes differentiation wrt <tt>theta</tt>.\verbatim
00114    d/dtheta (Sc[m] * P[m,m](t)) = Sc'[m] * P[m,m](t) + Sc[m] * P'[m,m](t)
00115 \endverbatim
00116  * Now <tt>P[m,m](t) = const * u^m</tt>, so <tt>P'[m,m](t) = m * t/u *
00117  * P[m,m](t)</tt>, thus\verbatim
00118    d/dtheta (Sc[m] * P[m,m](t)) = (Sc'[m] + m * t/u * Sc[m]) * P[m,m](t)
00119 \endverbatim
00120  * Clenshaw recursion for <tt>Sc[m]</tt> reads\verbatim
00121     y[k] = alpha[k] * y[k+1] + beta[k+1] * y[k+2] + c[k]
00122 \endverbatim
00123  * Substituting <tt>alpha[k] = const * t</tt>, <tt>alpha'[k] = -u/t *
00124  * alpha[k]</tt>, <tt>beta'[k] = c'[k] = 0</tt> gives\verbatim
00125     y'[k] = alpha[k] * y'[k+1] + beta[k+1] * y'[k+2] - u/t * alpha[k] * y[k+1]
00126 \endverbatim
00127  *
00128  * Finally, given the derivatives of <tt>V</tt>, we can compute the components
00129  * of the gradient in spherical coordinates and transform the result into
00130  * cartesian coordinates.
00131  **********************************************************************/
00132 
00133 #include <GeographicLib/SphericalEngine.hpp>
00134 #include <limits>
00135 #include <algorithm>
00136 #include <GeographicLib/CircularEngine.hpp>
00137 #include <GeographicLib/Utility.hpp>
00138 
00139 #define GEOGRAPHICLIB_SPHERICALENGINE_CPP \
00140   "$Id: 861a718d09c83cdd9bf58939d938a25797b9f306 $"
00141 
00142 RCSID_DECL(GEOGRAPHICLIB_SPHERICALENGINE_CPP)
00143 RCSID_DECL(GEOGRAPHICLIB_SPHERICALENGINE_HPP)
00144 
00145 namespace GeographicLib {
00146 
00147   using namespace std;
00148 
00149   const Math::real SphericalEngine::scale_ =
00150     pow(real(numeric_limits<real>::radix),
00151         -3 * numeric_limits<real>::max_exponent / 5);
00152   const Math::real SphericalEngine::eps_ =
00153     numeric_limits<real>::epsilon() * sqrt(numeric_limits<real>::epsilon());
00154 
00155   const vector<Math::real> SphericalEngine::Z_(0);
00156   vector<Math::real> SphericalEngine::root_(0);
00157 
00158   template<bool gradp, SphericalEngine::normalization norm, int L>
00159   Math::real SphericalEngine::Value(const coeff c[], const real f[],
00160                                     real x, real y, real z, real a,
00161                                     real& gradx, real& grady, real& gradz)
00162     throw() {
00163     STATIC_ASSERT(L > 0, "L must be positive");
00164     STATIC_ASSERT(norm == FULL || norm == SCHMIDT, "Unknown normalization");
00165     int N = c[0].nmx(), M = c[0].mmx();
00166 
00167     real
00168       p = Math::hypot(x, y),
00169       cl = p ? x / p : 1,       // cos(lambda); at pole, pick lambda = 0
00170       sl = p ? y / p : 0,       // sin(lambda)
00171       r = Math::hypot(z, p),
00172       t = r ? z / r : 0,            // cos(theta); at origin, pick theta = pi/2
00173       u = r ? max(p / r, eps_) : 1, // sin(theta); but avoid the pole
00174       q = a / r;
00175     real
00176       q2 = Math::sq(q),
00177       uq = u * q,
00178       uq2 = Math::sq(uq),
00179       tu = t / u;
00180     // Initialize outer sum
00181     real vc  = 0, vc2  = 0, vs  = 0, vs2  = 0;   // v [N + 1], v [N + 2]
00182     // vr, vt, vl and similar w variable accumulate the sums for the
00183     // derivatives wrt r, theta, and lambda, respectively.
00184     real vrc = 0, vrc2 = 0, vrs = 0, vrs2 = 0;   // vr[N + 1], vr[N + 2]
00185     real vtc = 0, vtc2 = 0, vts = 0, vts2 = 0;   // vt[N + 1], vt[N + 2]
00186     real vlc = 0, vlc2 = 0, vls = 0, vls2 = 0;   // vl[N + 1], vl[N + 2]
00187     int k[L];
00188     for (int m = M; m >= 0; --m) {   // m = M .. 0
00189       // Initialize inner sum
00190       real wc  = 0, wc2  = 0, ws  = 0, ws2  = 0; // w [N - m + 1], w [N - m + 2]
00191       real wrc = 0, wrc2 = 0, wrs = 0, wrs2 = 0; // wr[N - m + 1], wr[N - m + 2]
00192       real wtc = 0, wtc2 = 0, wts = 0, wts2 = 0; // wt[N - m + 1], wt[N - m + 2]
00193       for (int l = 0; l < L; ++l)
00194         k[l] = c[l].index(N, m) + 1;
00195       for (int n = N; n >= m; --n) {             // n = N .. m; l = N - m .. 0
00196         real w, A, Ax, B, R;    // alpha[l], beta[l + 1]
00197         switch (norm) {
00198         case FULL:
00199           w = root_[2 * n + 1] / (root_[n - m + 1] * root_[n + m + 1]);
00200           Ax = q * w * root_[2 * n + 3];
00201           A = t * Ax;
00202           B = - q2 * root_[2 * n + 5] /
00203             (w * root_[n - m + 2] * root_[n + m + 2]);
00204           break;
00205         case SCHMIDT:
00206           w = root_[n - m + 1] * root_[n + m + 1];
00207           Ax = q * (2 * n + 1) / w;
00208           A = t * Ax;
00209           B = - q2 * w / (root_[n - m + 2] * root_[n + m + 2]);
00210           break;
00211         }
00212         R = c[0].Cv(--k[0]);
00213         for (int l = 1; l < L; ++l)
00214           R += c[l].Cv(--k[l], n, m, f[l]);
00215         R *= scale_;
00216         w = A * wc + B * wc2 + R; wc2 = wc; wc = w;
00217         if (gradp) {
00218           w = A * wrc + B * wrc2 + (n + 1) * R; wrc2 = wrc; wrc = w;
00219           w = A * wtc + B * wtc2 -  u*Ax * wc2; wtc2 = wtc; wtc = w;
00220         }
00221         if (m) {
00222           R = c[0].Sv(k[0]);
00223           for (int l = 1; l < L; ++l)
00224             R += c[l].Sv(k[l], n, m, f[l]);
00225           R *= scale_;
00226           w = A * ws + B * ws2 + R; ws2 = ws; ws = w;
00227           if (gradp) {
00228             w = A * wrs + B * wrs2 + (n + 1) * R; wrs2 = wrs; wrs = w;
00229             w = A * wts + B * wts2 -  u*Ax * ws2; wts2 = wts; wts = w;
00230           }
00231         }
00232       }
00233       // Now Sc[m] = wc, Ss[m] = ws
00234       // Sc'[m] = wtc, Ss'[m] = wtc
00235       if (m) {
00236         real v, A, B;           // alpha[m], beta[m + 1]
00237         switch (norm) {
00238         case FULL:
00239           v = root_[2] * root_[2 * m + 3] / root_[m + 1];
00240           A = cl * v * uq;
00241           B = - v * root_[2 * m + 5] / (root_[8] * root_[m + 2]) * uq2;
00242           break;
00243         case SCHMIDT:
00244           v = root_[2] * root_[2 * m + 1] / root_[m + 1];
00245           A = cl * v * uq;
00246           B = - v * root_[2 * m + 3] / (root_[8] * root_[m + 2]) * uq2;
00247           break;
00248         }
00249         v = A * vc  + B * vc2  +  wc ; vc2  = vc ; vc  = v;
00250         v = A * vs  + B * vs2  +  ws ; vs2  = vs ; vs  = v;
00251         if (gradp) {
00252           // Include the terms Sc[m] * P'[m,m](t) and Ss[m] * P'[m,m](t)
00253           wtc += m * tu * wc; wts += m * tu * ws;
00254           v = A * vrc + B * vrc2 +  wrc; vrc2 = vrc; vrc = v;
00255           v = A * vrs + B * vrs2 +  wrs; vrs2 = vrs; vrs = v;
00256           v = A * vtc + B * vtc2 +  wtc; vtc2 = vtc; vtc = v;
00257           v = A * vts + B * vts2 +  wts; vts2 = vts; vts = v;
00258           v = A * vlc + B * vlc2 + m*ws; vlc2 = vlc; vlc = v;
00259           v = A * vls + B * vls2 - m*wc; vls2 = vls; vls = v;
00260         }
00261       } else {
00262         real A, B, qs;
00263         switch (norm) {
00264         case FULL:
00265           A = root_[3] * uq;       // F[1]/(q*cl) or F[1]/(q*sl)
00266           B = - root_[15]/2 * uq2; // beta[1]/q
00267           break;
00268         case SCHMIDT:
00269           A = uq;
00270           B = - root_[3]/2 * uq2;
00271           break;
00272         }
00273         qs = q / scale_;
00274         vc = qs * (wc + A * (cl * vc + sl * vs ) + B * vc2);
00275         if (gradp) {
00276           qs /= r;
00277           // The components of the gradient in spherical coordinates are
00278           // r: dV/dr
00279           // theta: 1/r * dV/dtheta
00280           // lambda: 1/(r*u) * dV/dlambda
00281           vrc =   - qs * (wrc + A * (cl * vrc + sl * vrs) + B * vrc2);
00282           vtc =     qs * (wtc + A * (cl * vtc + sl * vts) + B * vtc2);
00283           vlc = qs / u * (      A * (cl * vlc + sl * vls) + B * vlc2);
00284         }
00285       }
00286     }
00287 
00288     if (gradp) {
00289       // Rotate into cartesian (geocentric) coordinates
00290       gradx = cl * (u * vrc + t * vtc) - sl * vlc;
00291       grady = sl * (u * vrc + t * vtc) + cl * vlc;
00292       gradz =       t * vrc - u * vtc            ;
00293     }
00294     return vc;
00295   }
00296 
00297   template<bool gradp, SphericalEngine::normalization norm, int L>
00298   CircularEngine SphericalEngine::Circle(const coeff c[], const real f[],
00299                                          real p, real z, real a) {
00300 
00301     STATIC_ASSERT(L > 0, "L must be positive");
00302     STATIC_ASSERT(norm == FULL || norm == SCHMIDT, "Unknown normalization");
00303     int N = c[0].nmx(), M = c[0].mmx();
00304 
00305     real
00306       r = Math::hypot(z, p),
00307       t = r ? z / r : 0,            // cos(theta); at origin, pick theta = pi/2
00308       u = r ? max(p / r, eps_) : 1, // sin(theta); but avoid the pole
00309       q = a / r;
00310     real
00311       q2 = Math::sq(q),
00312       tu = t / u;
00313     CircularEngine circ(M, gradp, norm, a, r, u, t);
00314     int k[L];
00315     for (int m = M; m >= 0; --m) {   // m = M .. 0
00316       // Initialize inner sum
00317       real wc  = 0, wc2  = 0, ws  = 0, ws2  = 0; // w [N - m + 1], w [N - m + 2]
00318       real wrc = 0, wrc2 = 0, wrs = 0, wrs2 = 0; // wr[N - m + 1], wr[N - m + 2]
00319       real wtc = 0, wtc2 = 0, wts = 0, wts2 = 0; // wt[N - m + 1], wt[N - m + 2]
00320       for (int l = 0; l < L; ++l)
00321         k[l] = c[l].index(N, m) + 1;
00322       for (int n = N; n >= m; --n) {             // n = N .. m; l = N - m .. 0
00323         real w, A, Ax, B, R;    // alpha[l], beta[l + 1]
00324         switch (norm) {
00325         case FULL:
00326           w = root_[2 * n + 1] / (root_[n - m + 1] * root_[n + m + 1]);
00327           Ax = q * w * root_[2 * n + 3];
00328           A = t * Ax;
00329           B = - q2 * root_[2 * n + 5] /
00330             (w * root_[n - m + 2] * root_[n + m + 2]);
00331           break;
00332         case SCHMIDT:
00333           w = root_[n - m + 1] * root_[n + m + 1];
00334           Ax = q * (2 * n + 1) / w;
00335           A = t * Ax;
00336           B = - q2 * w / (root_[n - m + 2] * root_[n + m + 2]);
00337           break;
00338         }
00339         R = c[0].Cv(--k[0]);
00340         for (int l = 1; l < L; ++l)
00341           R += c[l].Cv(--k[l], n, m, f[l]);
00342         R *= scale_;
00343         w = A * wc + B * wc2 + R; wc2 = wc; wc = w;
00344         if (gradp) {
00345           w = A * wrc + B * wrc2 + (n + 1) * R; wrc2 = wrc; wrc = w;
00346           w = A * wtc + B * wtc2 -  u*Ax * wc2; wtc2 = wtc; wtc = w;
00347         }
00348         if (m) {
00349           R = c[0].Sv(k[0]);
00350           for (int l = 1; l < L; ++l)
00351             R += c[l].Sv(k[l], n, m, f[l]);
00352           R *= scale_;
00353           w = A * ws + B * ws2 + R; ws2 = ws; ws = w;
00354           if (gradp) {
00355             w = A * wrs + B * wrs2 + (n + 1) * R; wrs2 = wrs; wrs = w;
00356             w = A * wts + B * wts2 -  u*Ax * ws2; wts2 = wts; wts = w;
00357           }
00358         }
00359       }
00360       if (!gradp)
00361         circ.SetCoeff(m, wc, ws);
00362       else {
00363         // Include the terms Sc[m] * P'[m,m](t) and  Ss[m] * P'[m,m](t)
00364         wtc += m * tu * wc; wts += m * tu * ws;
00365         circ.SetCoeff(m, wc, ws, wrc, wrs, wtc, wts);
00366       }
00367     }
00368 
00369     return circ;
00370   }
00371 
00372   void SphericalEngine::RootTable(int N) {
00373     // Need square roots up to max(2 * N + 5, 15).
00374     int L = max(2 * N + 5, 15) + 1, oldL = int(root_.size());
00375     if (oldL >= L)
00376       return;
00377     root_.resize(L);
00378     for (int l = oldL; l < L; ++l)
00379       root_[l] = sqrt(real(l));
00380   }
00381 
00382   void SphericalEngine::coeff::readcoeffs(std::istream& stream, int& N, int& M,
00383                                           std::vector<real>& C,
00384                                           std::vector<real>& S) {
00385     int nm[2];
00386     Utility::readarray<int, int, false>(stream, nm, 2);
00387     N = nm[0]; M = nm[1];
00388     if (!(N >= M && M >= -1 && N * M >= 0))
00389       // The last condition is that M = -1 implies N = -1 and vice versa.
00390       throw GeographicErr("Bad degree and order " +
00391                           Utility::str(N) + " " + Utility::str(M));
00392     C.resize(SphericalEngine::coeff::Csize(N, M));
00393     Utility::readarray<double, real, false>(stream, C);
00394     S.resize(SphericalEngine::coeff::Ssize(N, M));
00395     Utility::readarray<double, real, false>(stream, S);
00396     return;
00397   }
00398 
00399   /// \cond SKIP
00400   template
00401   Math::real SphericalEngine::Value<true, SphericalEngine::FULL, 1>
00402   (const coeff[], const real[], real, real, real, real, real&, real&, real&);
00403   template
00404   Math::real SphericalEngine::Value<false, SphericalEngine::FULL, 1>
00405   (const coeff[], const real[], real, real, real, real, real&, real&, real&);
00406   template
00407   Math::real SphericalEngine::Value<true, SphericalEngine::SCHMIDT, 1>
00408   (const coeff[], const real[], real, real, real, real, real&, real&, real&);
00409   template
00410   Math::real SphericalEngine::Value<false, SphericalEngine::SCHMIDT, 1>
00411   (const coeff[], const real[], real, real, real, real, real&, real&, real&);
00412 
00413   template
00414   Math::real SphericalEngine::Value<true, SphericalEngine::FULL, 2>
00415   (const coeff[], const real[], real, real, real, real, real&, real&, real&);
00416   template
00417   Math::real SphericalEngine::Value<false, SphericalEngine::FULL, 2>
00418   (const coeff[], const real[], real, real, real, real, real&, real&, real&);
00419   template
00420   Math::real SphericalEngine::Value<true, SphericalEngine::SCHMIDT, 2>
00421   (const coeff[], const real[], real, real, real, real, real&, real&, real&);
00422   template
00423   Math::real SphericalEngine::Value<false, SphericalEngine::SCHMIDT, 2>
00424   (const coeff[], const real[], real, real, real, real, real&, real&, real&);
00425 
00426   template
00427   Math::real SphericalEngine::Value<true, SphericalEngine::FULL, 3>
00428   (const coeff[], const real[], real, real, real, real, real&, real&, real&);
00429   template
00430   Math::real SphericalEngine::Value<false, SphericalEngine::FULL, 3>
00431   (const coeff[], const real[], real, real, real, real, real&, real&, real&);
00432   template
00433   Math::real SphericalEngine::Value<true, SphericalEngine::SCHMIDT, 3>
00434   (const coeff[], const real[], real, real, real, real, real&, real&, real&);
00435   template
00436   Math::real SphericalEngine::Value<false, SphericalEngine::SCHMIDT, 3>
00437   (const coeff[], const real[], real, real, real, real, real&, real&, real&);
00438 
00439   template
00440   CircularEngine SphericalEngine::Circle<true, SphericalEngine::FULL, 1>
00441   (const coeff[], const real[], real, real, real);
00442   template
00443   CircularEngine SphericalEngine::Circle<false, SphericalEngine::FULL, 1>
00444   (const coeff[], const real[], real, real, real);
00445   template
00446   CircularEngine SphericalEngine::Circle<true, SphericalEngine::SCHMIDT, 1>
00447   (const coeff[], const real[], real, real, real);
00448   template
00449   CircularEngine SphericalEngine::Circle<false, SphericalEngine::SCHMIDT, 1>
00450   (const coeff[], const real[], real, real, real);
00451 
00452   template
00453   CircularEngine SphericalEngine::Circle<true, SphericalEngine::FULL, 2>
00454   (const coeff[], const real[], real, real, real);
00455   template
00456   CircularEngine SphericalEngine::Circle<false, SphericalEngine::FULL, 2>
00457   (const coeff[], const real[], real, real, real);
00458   template
00459   CircularEngine SphericalEngine::Circle<true, SphericalEngine::SCHMIDT, 2>
00460   (const coeff[], const real[], real, real, real);
00461   template
00462   CircularEngine SphericalEngine::Circle<false, SphericalEngine::SCHMIDT, 2>
00463   (const coeff[], const real[], real, real, real);
00464 
00465   template
00466   CircularEngine SphericalEngine::Circle<true, SphericalEngine::FULL, 3>
00467   (const coeff[], const real[], real, real, real);
00468   template
00469   CircularEngine SphericalEngine::Circle<false, SphericalEngine::FULL, 3>
00470   (const coeff[], const real[], real, real, real);
00471   template
00472   CircularEngine SphericalEngine::Circle<true, SphericalEngine::SCHMIDT, 3>
00473   (const coeff[], const real[], real, real, real);
00474   template
00475   CircularEngine SphericalEngine::Circle<false, SphericalEngine::SCHMIDT, 3>
00476   (const coeff[], const real[], real, real, real);
00477   /// \endcond
00478 
00479 } // namespace GeographicLib
geographiclib-1.21/doc/html/tab_a.png0000644000175000017500000000021411745620414017342 0ustar frankiefrankie‰PNG  IHDR$ÇÇ[SIDATxí» €@wçÉ¡œˆ˜*æ‚M˜ØIïÎF†ýL :®‡±nÌëN™ ¶±Á’„ØN&â¼_ ɭɾ}Õ¶8~î¾îOwv-ÿêA4Y)Ñ}IEND®B`‚geographiclib-1.21/doc/html/tab_b.png0000644000175000017500000000026211745620415017347 0ustar frankiefrankie‰PNG  IHDR$ÇÇ[yIDATxíÝÛ Â €Ñ?|SVÓˆ´bB#P®½8³‰O¾:É™D>ßm{SûIí'¹äz(!•TBÞ‰y#¤WìJDp¾ã|Ã…†ó »ìR˜]áá æ™Ð6q·‰›]ç•qŠŒÓÊÕD.&0èÀ =ƒJD”ˆü=@*é*ç×IEND®B`‚geographiclib-1.21/doc/html/magnetic.html0000644000175000017500000003713711745620415020262 0ustar frankiefrankie GeographicLib: Magnetic models
Magnetic models
Back to Gravity models. Forward to Geodesics on the ellipsoid. Up to Contents.

GeographicLib can compute the earth's magnetic field by a magnetic model using the GeographicLib::MagneticModel and GeographicLib::MagneticCircle classes and with the MagneticField utility. These models expand the internal magnetic potential of the earth as sum of spherical harmonics. They neglect magnetic fields due to the ionosphere, the magnetosphere, nearby magnetized materials, electric machinery, etc. Users of GeographicLib::MagneticModel are advised to read the "Health Warning" this is provided with igrf11. Although the advice is specific to igrf11, many of the comments apply to all magnetic field models.

The supported models are

Go to

Installing the magnetic field models

These magnetic models are available for download:

Available magnetic models
name max
degree
time
interval
size
(kB)
Download Links (size, kB)
tar file Windows
installer
zip file
wmm2010
12
2010–2015
3
link (2)
link (300)
link (2)
igrf11
13
1900–2015
25
link (7)
link (310)
link (8)
emm2010
739
2010–2015
4400
link (3700)
link (3000)
link (4100)

The "size" column is the size of the uncompressed data.

For Linux and Unix systems, GeographicLib provides a shell script geographiclib-get-magnetic (typically installed in /usr/local/sbin) which automates the process of downloading and installing the magnetic models. For example

   geographiclib-get-magnetic all  # to install wmm2010, igrf11, emm2010
   geographiclib-get-magnetic -h   # for help

This script should be run as a user with write access to the installation directory, which is typically /usr/local/share/GeographicLib (this can be overridden with the -p flag), and the data will then be placed in the "magnetic" subdirectory.

Windows users should download and run the Windows installers. These will prompt for an installation directory with the default being one of

   C:/Documents and Settings/All Users/Application Data/GeographicLib
   C:/ProgramData/GeographicLib

(which you probably should not change) and the data is installed in the "magnetic" sub-directory. (The second directory name is an alternate name that Windows 7 for the "Application Data" directory.)

Otherwise download either the tar.bz2 file or the zip file (they have the same contents). To unpack these, run, for example

   mkdir -p /usr/local/share/GeographicLib
   tar xofjC wmm2010.tar.bz2 /usr/local/share/GeographicLib
   tar xofjC emm2010.tar.bz2 /usr/local/share/GeographicLib
   etc.

and, again, the data will be placed in the "magnetic" subdirectory.

However you install the magnetic models, all the datasets should be installed in the same directory. GeographicLib::MagneticModel and MagneticField uses a compile time default to locate the datasets. This is

  • /usr/local/share/GeographicLib/magnetic, for non-Windows systems
  • C:/Documents and Settings/All Users/Application Data/GeographicLib/magnetic, for Windows systems

consistent with the examples above. This may be overridden at run-time by defining the MAGNETIC_PATH or the GEOGRAPHIC_DATA environment variables; see GeographicLib::MagneticModel::DefaultMagneticPath() for details. Finally, the path may be set using the optional second argument to the GeographicLib::MagneticModel constructor or with the "-d" flag to MagneticField. Supplying the "-h" flag to MagneticField reports the default path for magnetic models for that utility. The "-v" flag causes MagneticField to report the full path name of the data file it uses.

The format of the magnetic model files

The constructor for GeographicLib::MagneticModel reads a file called NAME.wmm which specifies various properties for the magnetic model. It then opens a binary file NAME.wmm.cof to obtain the coefficients of the spherical harmonic sum.

The first line of the .wmm file must consist of "WMMF-v" where WMMF stands for "World Magnetic Model Format" and v is the version number of the format (currently "1").

The rest of the File is read a line at a time. A # character and everything after it are discarded. If the result is just white space it is discarded. The remaining lines are of the form "KEY WHITESPACE VALUE". In general, the KEY and the VALUE are case-sensitive.

GeographicLib::MagneticModel only pays attention to the following keywords

  • keywords that affect the field calculation, namely:
    • Radius (required), the normalizing radius of the model in meters.
    • NumModels (default 1), the number of models. WMM2010 consists of a single model giving the magnetic field and its time variation at 2010. IGRF11 consists of 23 models for 1900 thru 2010 at 5 year intervals. The time variation is given only for the last model to allow extrapolation beyond 2010. For dates prior to 2010, linear interpolation is used.
    • Epoch (required), the time origin (in fractional years) for the first model.
    • DeltaEpoch (default 1), the interval between models in years (only relevant for NumModels > 1).
    • Normalization (default schmidt), the normalization used for the associated Legendre functions (schmidt or full).
    • ID (required), 8 printable characters which serve as a signature for the .wmm.cof file (they must appear as the first 8 bytes of this file).
  • keywords that store data that the user can query:
    • Name, the name of the model.
    • Description, a more descriptive name of the model.
    • ReleaseDate, when the model was created.
    • MinTime, the minimum date at which the model should be used.
    • MaxTime, the maximum date at which the model should be used.
    • MinHeight, the minimum height above the ellipsoid for which the model should be used.
    • MaxHeight, the maximum height above the ellipsoid for which the model should be used.
    GeographicLib::MagneticModel does not enforce the restrictions implied by last four quantities. However, MagneticField issues a warning if these limits are exceeded.
  • keywords that are examined to verify that their values are valid:
    • Type (default linear), the type of the model. "linear" means that the time variation is piece-wise linear (either using interpolation between the field at two dates or using the field and its first derivative with respect to time). This is the only type of model supported at present.
    • ByteOrder (default little), the order of bytes in the .wmm.cof file. Only little endian is supported at present.

Other keywords are ignored.

The coefficient file NAME.wmm.cof is a binary file in little endian order. The first 8 bytes of this file must match the ID given in NAME.wmm. This is followed by NumModels + 1 sets of spherical harmonic coefficients. The first NumModels of these model the magnetic field at Epoch + i * DeltaEpoch for 0 <= i < NumModels. The last set of coefficients model the rate of change of the magnetic field at Epoch + (NumModels - 1) * DeltaEpoch. The format for each set of coefficients is:

  • N, the maximum degree of the sum stored as a 4-byte signed integer. This must satisfy N >= -1.
  • M, the maximum order of the sum stored as a 4-byte signed integer. This must satisfy N >= M >= -1.
  • Cnm, the coefficients of the cosine coefficients of the sum in column (i.e., m) major order. There are (M + 1) (2N - M + 2) / 2 elements which are stored as IEEE doubles (8 bytes). For example for N = M = 3, there are 10 coefficients arranged as C00, C10, C20, C30, C11, C21, C31, C22, C32, C33.
  • Snm, the coefficients of the sine coefficients of the sum in column (i.e., m) major order starting at m = 1. There are M (2N - M + 1) / 2 elements which are stored as IEEE doubles (8 bytes). For example for N = M = 3, there are 6 coefficients arranged as S11, S21, S31, S22, S32, S33.

Although the coefficient file is in little endian order, GeographicLib can read it on big endian machines. It can only be read on machines which store doubles in IEEE format.

As an illustration, here is igrf11.wmm:

WMMF-1
# A World Magnetic Model (Format 1) file.  For documentation on the
# format of this file see
# http://geographiclib.sf.net/html/magnetic.html#magneticformat
Name            igrf11
Description     International Geomagnetic Reference Field 11th Generation
URL             http://ngdc.noaa.gov/IAGA/vmod/igrf.html
Publisher       National Oceanic and Atmospheric Administration
ReleaseDate     2009-12-15
DataCutOff      2009-10-01
ConversionDate  2011-11-04
DataVersion     1
Radius          6371200
NumModels       23
Epoch           1900
DeltaEpoch      5
MinTime         1900
MaxTime         2015
MinHeight       -1000
MaxHeight       600000

# The coefficients are stored in a file obtained by appending ".cof" to
# the name of this file.  The coefficients were obtained from IGRF11.COF
# in the geomag70 distribution.
ID              IGRF11-A
Back to Gravity models. Forward to Geodesics on the ellipsoid. Up to Contents.
geographiclib-1.21/doc/html/SphericalHarmonic_8hpp_source.html0000644000175000017500000011736211745620414024403 0ustar frankiefrankie GeographicLib: SphericalHarmonic.hpp Source File
SphericalHarmonic.hpp
Go to the documentation of this file.
00001 /**
00002  * \file SphericalHarmonic.hpp
00003  * \brief Header for GeographicLib::SphericalHarmonic class
00004  *
00005  * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under
00006  * the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_SPHERICALHARMONIC_HPP)
00011 #define GEOGRAPHICLIB_SPHERICALHARMONIC_HPP \
00012   "$Id: 6fa804c46efd01670cfb7835dd022791b60d2942 $"
00013 
00014 #include <vector>
00015 #include <GeographicLib/Constants.hpp>
00016 #include <GeographicLib/SphericalEngine.hpp>
00017 #include <GeographicLib/CircularEngine.hpp>
00018 #include <GeographicLib/Geocentric.hpp>
00019 
00020 namespace GeographicLib {
00021 
00022   /**
00023    * \brief Spherical Harmonic series
00024    *
00025    * This class evaluates the spherical harmonic sum \verbatim
00026  V(x, y, z) = sum(n = 0..N)[ q^(n+1) * sum(m = 0..n)[
00027    (C[n,m] * cos(m*lambda) + S[n,m] * sin(m*lambda)) *
00028    P[n,m](cos(theta)) ] ]
00029 \endverbatim
00030    * where
00031    * - <i>p</i><sup>2</sup> = <i>x</i><sup>2</sup> + <i>y</i><sup>2</sup>,
00032    * - <i>r</i><sup>2</sup> = <i>p</i><sup>2</sup> + <i>z</i><sup>2</sup>,
00033    * - \e q = <i>a</i>/<i>r</i>,
00034    * - \e theta = atan2(\e p, \e z) = the spherical \e colatitude,
00035    * - \e lambda = atan2(\e y, \e x) = the longitude.
00036    * - P<sub>\e nm</sub>(\e t) is the associated Legendre polynomial of degree
00037    *   \e n and order \e m.
00038    *
00039    * Two normalizations are supported for P<sub>\e nm</sub>
00040    * - fully normalized denoted by SphericalHarmonic::FULL.
00041    * - Schmidt semi-normalized denoted by SphericalHarmonic::SCHMIDT.
00042    *
00043    * Clenshaw summation is used for the sums over both \e n and \e m.  This
00044    * allows the computation to be carried out without the need for any
00045    * temporary arrays.  See SphericalEngine.cpp for more information on the
00046    * implementation.
00047    *
00048    * References:
00049    * - C. W. Clenshaw, A note on the summation of Chebyshev series,
00050    *   %Math. Tables Aids Comput. 9(51), 118-120 (1955).
00051    * - R. E. Deakin, Derivatives of the earth's potentials, Geomatics
00052    *   Research Australasia 68, 31-60, (June 1998).
00053    * - W. A. Heiskanen and H. Moritz, Physical Geodesy, (Freeman, San
00054    *   Francisco, 1967).  (See Sec. 1-14, for a definition of Pbar.)
00055    * - S. A. Holmes and W. E. Featherstone, A unified approach to the
00056    *   Clenshaw summation and the recursive computation of very high degree
00057    *   and order normalised associated Legendre functions, J. Geod. 76(5),
00058    *   279-299 (2002).
00059    * - C. C. Tscherning and K. Poder, Some geodetic applications of Clenshaw
00060    *   summation, Boll. Geod. Sci. Aff. 41(4), 349-375 (1982).
00061    *
00062    * Example of use:
00063    * \include example-SphericalHarmonic.cpp
00064    **********************************************************************/
00065 
00066   class GEOGRAPHIC_EXPORT SphericalHarmonic {
00067   public:
00068     /**
00069      * Supported normalizations for the associated Legendre polynomials.
00070      **********************************************************************/
00071     enum normalization {
00072       /**
00073        * Fully normalized associated Legendre polynomials.
00074        *
00075        * These are defined by <i>P</i><sub><i>nm</i></sub><sup>full</sup>(\e z)
00076        * = (-1)<sup><i>m</i></sup> sqrt(\e k (2\e n + 1) (\e n - \e m)! / (\e n
00077        * + \e m)!) <b>P</b><sub><i>n</i></sub><sup><i>m</i></sup>(\e z), where
00078        * <b>P</b><sub><i>n</i></sub><sup><i>m</i></sup>(\e z) is Ferrers
00079        * function (also known as the Legendre function on the cut or the
00080        * associated Legendre polynomial) http://dlmf.nist.gov/14.7.E10 and \e k
00081        * = 1 for \e m = 0 and \e k = 2 otherwise.
00082        *
00083        * The mean squared value of
00084        * <i>P</i><sub><i>nm</i></sub><sup>full</sup>(cos \e theta) cos(\e m \e
00085        * lambda) and <i>P</i><sub><i>nm</i></sub><sup>full</sup>(cos \e theta)
00086        * sin(\e m \e lambda) over the sphere is 1.
00087        *
00088        * @hideinitializer
00089        **********************************************************************/
00090       FULL = SphericalEngine::FULL,
00091       /**
00092        * Schmidt semi-normalized associated Legendre polynomials.
00093        *
00094        * These are defined by <i>P</i><sub><i>nm</i></sub><sup>schmidt</sup>(\e
00095        * z) = (-1)<sup><i>m</i></sup> sqrt(\e k (\e n - \e m)! / (\e n + \e
00096        * m)!)  <b>P</b><sub><i>n</i></sub><sup><i>m</i></sup>(\e z), where
00097        * <b>P</b><sub><i>n</i></sub><sup><i>m</i></sup>(\e z) is Ferrers
00098        * function (also known as the Legendre function on the cut or the
00099        * associated Legendre polynomial) http://dlmf.nist.gov/14.7.E10 and \e k
00100        * = 1 for \e m = 0 and \e k = 2 otherwise.
00101        *
00102        * The mean squared value of
00103        * <i>P</i><sub><i>nm</i></sub><sup>schmidt</sup>(cos \e theta) cos(\e m
00104        * \e lambda) and <i>P</i><sub><i>nm</i></sub><sup>schmidt</sup>(cos \e
00105        * theta) sin(\e m \e lambda) over the sphere is 1/(2\e n + 1).
00106        *
00107        * @hideinitializer
00108        **********************************************************************/
00109       SCHMIDT = SphericalEngine::SCHMIDT,
00110       /// \cond SKIP
00111       // These are deprecated...
00112       full = FULL,
00113       schmidt = SCHMIDT,
00114       /// \endcond
00115     };
00116 
00117   private:
00118     typedef Math::real real;
00119     SphericalEngine::coeff _c[1];
00120     real _a;
00121     unsigned _norm;
00122 
00123   public:
00124     /**
00125      * Constructor with a full set of coefficients specified.
00126      *
00127      * @param[in] C the coefficients \e C<sub>\e nm</sub>.
00128      * @param[in] S the coefficients \e S<sub>\e nm</sub>.
00129      * @param[in] N the maximum degree and order of the sum
00130      * @param[in] a the reference radius appearing in the definition of the
00131      *   sum.
00132      * @param[in] norm the normalization for the associated Legendre
00133      *   polynomials, either SphericalHarmonic::full (the default) or
00134      *   SphericalHarmonic::schmidt.
00135      *
00136      * The coefficients \e C<sub>\e nm</sub> and \e S<sub>\e nm</sub> are
00137      * stored in the one-dimensional vectors \e C and \e S which must contain
00138      * (\e N + 1)(\e N + 2)/2 and N (\e N + 1)/2 elements, respectively, stored
00139      * in "column-major" order.  Thus for \e N = 3, the order would be:
00140      * <i>C</i><sub>00</sub>,
00141      * <i>C</i><sub>10</sub>,
00142      * <i>C</i><sub>20</sub>,
00143      * <i>C</i><sub>30</sub>,
00144      * <i>C</i><sub>11</sub>,
00145      * <i>C</i><sub>21</sub>,
00146      * <i>C</i><sub>31</sub>,
00147      * <i>C</i><sub>22</sub>,
00148      * <i>C</i><sub>32</sub>,
00149      * <i>C</i><sub>33</sub>.
00150      * In general the (\e n,\e m) element is at index \e m*\e N - \e m*(\e m -
00151      * 1)/2 + \e n.  The layout of \e S is the same except that the first
00152      * column is omitted (since the \e m = 0 terms never contribute to the sum)
00153      * and the 0th element is <i>S</i><sub>11</sub>
00154      *
00155      * The class stores <i>pointers</i> to the first elements of \e C and \e S.
00156      * These arrays should not be altered or destroyed during the lifetime of a
00157      * SphericalHarmonic object.
00158      **********************************************************************/
00159     SphericalHarmonic(const std::vector<real>& C,
00160                       const std::vector<real>& S,
00161                       int N, real a, unsigned norm = FULL)
00162       : _a(a)
00163       , _norm(norm)
00164     { _c[0] = SphericalEngine::coeff(C, S, N); }
00165 
00166     /**
00167      * Constructor with a subset of coefficients specified.
00168      *
00169      * @param[in] C the coefficients \e C<sub>\e nm</sub>.
00170      * @param[in] S the coefficients \e S<sub>\e nm</sub>.
00171      * @param[in] N the degree used to determine the layout of \e C and \e S.
00172      * @param[in] nmx the maximum degree used in the sum.  The sum over \e n is
00173      *   from 0 thru \e nmx.
00174      * @param[in] mmx the maximum order used in the sum.  The sum over \e m is
00175      *   from 0 thru min(\e n, \e mmx).
00176      * @param[in] a the reference radius appearing in the definition of the
00177      *   sum.
00178      * @param[in] norm the normalization for the associated Legendre
00179      *   polynomials, either SphericalHarmonic::FULL (the default) or
00180      *   SphericalHarmonic::SCHMIDT.
00181      *
00182      * The class stores <i>pointers</i> to the first elements of \e C and \e S.
00183      * These arrays should not be altered or destroyed during the lifetime of a
00184      * SphericalHarmonic object.
00185      **********************************************************************/
00186     SphericalHarmonic(const std::vector<real>& C,
00187                       const std::vector<real>& S,
00188                       int N, int nmx, int mmx,
00189                       real a, unsigned norm = FULL)
00190       : _a(a)
00191       , _norm(norm)
00192     { _c[0] = SphericalEngine::coeff(C, S, N, nmx, mmx); }
00193 
00194     /**
00195      * A default constructor so that the object can be created when the
00196      * constructor for another object is initialized.  This default object can
00197      * then be reset with the default copy assignment operator.
00198      **********************************************************************/
00199     SphericalHarmonic() {}
00200 
00201     /**
00202      * Compute the spherical harmonic sum.
00203      *
00204      * @param[in] x cartesian coordinate.
00205      * @param[in] y cartesian coordinate.
00206      * @param[in] z cartesian coordinate.
00207      * @return \e V the spherical harmonic sum.
00208      *
00209      * This routine requires constant memory and thus never throws an
00210      * exception.
00211      **********************************************************************/
00212     Math::real operator()(real x, real y, real z) const throw() {
00213       real f[] = {1};
00214       real v = 0;
00215       real dummy;
00216       switch (_norm) {
00217       case FULL:
00218         v = SphericalEngine::Value<false, SphericalEngine::FULL, 1>
00219           (_c, f, x, y, z, _a, dummy, dummy, dummy);
00220         break;
00221       case SCHMIDT:
00222         v = SphericalEngine::Value<false, SphericalEngine::SCHMIDT, 1>
00223           (_c, f, x, y, z, _a, dummy, dummy, dummy);
00224         break;
00225       }
00226       return v;
00227     }
00228 
00229     /**
00230      * Compute a spherical harmonic sum and its gradient.
00231      *
00232      * @param[in] x cartesian coordinate.
00233      * @param[in] y cartesian coordinate.
00234      * @param[in] z cartesian coordinate.
00235      * @param[out] gradx \e x component of the gradient
00236      * @param[out] grady \e y component of the gradient
00237      * @param[out] gradz \e z component of the gradient
00238      * @return \e V the spherical harmonic sum.
00239      *
00240      * This is the same as the previous function, except that the components of
00241      * the gradients of the sum in the \e x, \e y, and \e z directions are
00242      * computed.  This routine requires constant memory and thus never throws
00243      * an exception.
00244      **********************************************************************/
00245     Math::real operator()(real x, real y, real z,
00246                           real& gradx, real& grady, real& gradz) const throw() {
00247       real f[] = {1};
00248       real v = 0;
00249       switch (_norm) {
00250       case FULL:
00251         v = SphericalEngine::Value<true, SphericalEngine::FULL, 1>
00252           (_c, f, x, y, z, _a, gradx, grady, gradz);
00253         break;
00254       case SCHMIDT:
00255         v = SphericalEngine::Value<true, SphericalEngine::SCHMIDT, 1>
00256           (_c, f, x, y, z, _a, gradx, grady, gradz);
00257         break;
00258       }
00259       return v;
00260     }
00261 
00262     /**
00263      * Create a CircularEngine to allow the efficient evaluation of several
00264      * points on a circle of latitude.
00265      *
00266      * @param[in] p the radius of the circle.
00267      * @param[in] z the height of the circle above the equatorial plane.
00268      * @param[in] gradp if true the returned object will be able to compute the
00269      *   gradient of the sum.
00270      * @return the CircularEngine object.
00271      *
00272      * SphericalHarmonic::operator()() exchanges the order of the sums in the
00273      * definition, i.e., sum(n = 0..N)[sum(m = 0..n)[...]] becomes sum(m =
00274      * 0..N)[sum(n = m..N)[...]].  SphericalHarmonic::Circle performs the inner
00275      * sum over degree \e n (which entails about <i>N</i><sup>2</sup>
00276      * operations).  Calling CircularEngine::operator()() on the returned
00277      * object performs the outer sum over the order \e m (about \e N
00278      * operations).  This routine may throw a bad_alloc exception in the
00279      * CircularEngine constructor.
00280      *
00281      * Here's an example of computing the spherical sum at a sequence of
00282      * longitudes without using a CircularEngine object
00283      \code
00284   SphericalHarmonic h(...);     // Create the SphericalHarmonic object
00285   double r = 2, lat = 33, lon0 = 44, dlon = 0.01;
00286   double
00287     phi = lat * Math::degree<double>(),
00288     z = r * sin(phi), p = r * cos(phi);
00289   for (int i = 0; i <= 100; ++i) {
00290     real
00291       lon = lon0 + i * dlon,
00292       lam = lon * Math::degree<double>();
00293     std::cout << lon << " " << h(p * cos(lam), p * sin(lam), z) << "\n";
00294   }
00295      \endcode
00296      * Here is the same calculation done using a CircularEngine object.  This
00297      * will be about <i>N</i>/2 times faster.
00298      \code
00299   SphericalHarmonic h(...);     // Create the SphericalHarmonic object
00300   double r = 2, lat = 33, lon0 = 44, dlon = 0.01;
00301   double
00302     phi = lat * Math::degree<double>(),
00303     z = r * sin(phi), p = r * cos(phi);
00304   CircularEngine c(h(p, z, false)); // Create the CircularEngine object
00305   for (int i = 0; i <= 100; ++i) {
00306     real
00307       lon = lon0 + i * dlon;
00308     std::cout << lon << " " << c(lon) << "\n";
00309   }
00310      \endcode
00311      **********************************************************************/
00312     CircularEngine Circle(real p, real z, bool gradp) const {
00313       real f[] = {1};
00314       switch (_norm) {
00315       case FULL:
00316         return gradp ?
00317           SphericalEngine::Circle<true, SphericalEngine::FULL, 1>
00318           (_c, f, p, z, _a) :
00319           SphericalEngine::Circle<false, SphericalEngine::FULL, 1>
00320           (_c, f, p, z, _a);
00321         break;
00322       case SCHMIDT:
00323       default:                  // To avoid compiler warnings
00324         return gradp ?
00325           SphericalEngine::Circle<true, SphericalEngine::SCHMIDT, 1>
00326           (_c, f, p, z, _a) :
00327           SphericalEngine::Circle<false, SphericalEngine::SCHMIDT, 1>
00328           (_c, f, p, z, _a);
00329         break;
00330       }
00331     }
00332 
00333     /**
00334      * @return the zeroth SphericalEngine::coeff object.
00335      **********************************************************************/
00336     const SphericalEngine::coeff& Coefficients() const throw()
00337     { return _c[0]; }
00338   };
00339 
00340 } // namespace GeographicLib
00341 
00342 #endif  // GEOGRAPHICLIB_SPHERICALHARMONIC_HPP
geographiclib-1.21/doc/html/classGeographicLib_1_1PolarStereographic-members.html0000644000175000017500000001311411745620414030012 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::PolarStereographic Member List
This is the complete list of members for GeographicLib::PolarStereographic, including all inherited members.
CentralScale() const GeographicLib::PolarStereographic [inline]
Flattening() const GeographicLib::PolarStereographic [inline]
Forward(bool northp, real lat, real lon, real &x, real &y, real &gamma, real &k) const GeographicLib::PolarStereographic
Forward(bool northp, real lat, real lon, real &x, real &y) const GeographicLib::PolarStereographic [inline]
MajorRadius() const GeographicLib::PolarStereographic [inline]
PolarStereographic(real a, real f, real k0)GeographicLib::PolarStereographic
Reverse(bool northp, real x, real y, real &lat, real &lon, real &gamma, real &k) const GeographicLib::PolarStereographic
Reverse(bool northp, real x, real y, real &lat, real &lon) const GeographicLib::PolarStereographic [inline]
SetScale(real lat, real k=real(1))GeographicLib::PolarStereographic
UPSGeographicLib::PolarStereographic [static]
geographiclib-1.21/doc/html/tab_h.png0000644000175000017500000000030011745620415017346 0ustar frankiefrankie‰PNG  IHDR$ÇÇ[‡IDATxíÝÛ ‚`€áÿ¥ºˆFŠ¢‚hšYÒ ÿÌ26@c´HwÍñì!ïÏ—K1ê^‰©HtO’÷ÄyG˜µD׎ k9¦ç?iðâ7zá„vPaŸž˜þãÏðJŒ}ÉÆ)غwV»‚õ®`ai–Ö¥¥™›Z‰ˆšŒP³éøC"àèP=€IEND®B`‚geographiclib-1.21/doc/html/GeoidEval_8cpp.html0000644000175000017500000001707011745620414021255 0ustar frankiefrankie GeographicLib: GeoidEval.cpp File Reference
GeoidEval.cpp File Reference

Command line utility for evaluating geoid heights. More...

#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
#include <GeographicLib/Geoid.hpp>
#include <GeographicLib/DMS.hpp>
#include <GeographicLib/Utility.hpp>
#include <GeographicLib/GeoCoords.hpp>
#include "GeoidEval.usage"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Detailed Description

Command line utility for evaluating geoid heights.

Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Compile and link with g++ -g -O3 -I../include -I../man -o GeoidEval \ GeoidEval.cpp \ ../src/DMS.cpp \ ../src/GeoCoords.cpp \ ../src/Geoid.cpp \ ../src/MGRS.cpp \ ../src/PolarStereographic.cpp \ ../src/TransverseMercator.cpp \ ../src/UTMUPS.cpp

See the man page for usage information.

Definition in file GeoidEval.cpp.


Function Documentation

geographiclib-1.21/doc/html/Geod.1.html0000644000175000017500000003246011745620415017502 0ustar frankiefrankie Geod -- perform geodesic calculations


NAME

Geod -- perform geodesic calculations


SYNOPSIS

Geod [ -i | -l lat1 lon1 azi1 ] [ -a ] [ -e a f ] [ -d | -: ] [ -b ] [ -f ] [ -p prec ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

The shortest path between two points on the ellipsoid at (lat1, lon1) and (lat2, lon2) is called the geodesic. Its length is s12 and the geodesic from point 1 to point 2 has azimuths azi1 and azi2 at the two end points.

Geod operates in one of three modes:

  1. By default, Geod accepts lines on the standard input containing lat1 lon1 azi1 s12 and prints lat2 lon2 azi2 on standard output. This is the direct geodesic calculation.

  2. Command line arguments -l lat1 lon1 azi1 specify a geodesic line. Geod then accepts a sequence of s12 values (one per line) on standard input and prints lat2 lon2 azi2 for each. This generates a sequence of points on a single geodesic.

  3. With the -i command line argument, Geod performs the inverse geodesic calculation. It reads lines containing lat1 lon1 lat2 lon2 and prints the corresponding values of azi1 azi2 s12.


OPTIONS

-i

perform an inverse geodesic calculation (see 3 above).

-l

line mode (see 2 above); generate a sequence of points along the geodesic specified by lat1 lon1 azi1.

-a

arc mode; on input and output s12 is replaced by a12 the arc length (in degrees) on the auxiliary sphere. See AUXILIARY SPHERE.

-e

specify the ellipsoid via a f; the equatorial radius is a and the flattening is f. Setting f = 0 results in a sphere. Specify f < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.

-d

output angles as degrees, minutes, seconds instead of decimal degrees.

-:

like -d, except use : as a separator instead of the d, ', and " delimiters.

-b

report the back azimuth at point 2 instead of the forward azimuth.

-f

full output; each line of output consists of 12 quantities: lat1 lon1 azi1 lat2 lon2 azi2 s12 a12 m12 M12 M21 S12. a12 is described in AUXILIARY SPHERE. The four quantities m12, M12, M21, and S12 are described in ADDITIONAL QUANTITIES.

-p

set the output precision to prec (default 3); prec is the precision relative to 1 m. See PRECISION.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


INPUT

Geod measures all angles in degrees and all lengths (s12) in meters. On input angles (latitude, longitude, azimuth, arc length) can be as decimal degrees or degrees (d), minutes ('), seconds ("). A decimal point can only appear in the least significant component and the designator (d, ', or ") for this component is optional; thus 40d30, 40d30', 40.5d, and 40.5 are all equivalent. By default, latitude precedes longitude for each point; however on input either may be given first by appending (or prepending) N or S to the latitude and E or W to the longitude. Azimuths are measured clockwise from north; however this may be overridden with E or W.


AUXILIARY SPHERE

Geodesics on the ellipsoid can be transferred to the auxiliary sphere on which the distance is measured in terms of the arc length a12 (measured in degrees) instead of s12. In terms of a12, 180 degrees is the distance from one equator crossing to the next or from the minimum latitude to the maximum latitude. Geodesics with a12 > 180 degrees do not correspond to shortest paths. With the -a flag, s12 (on both input and output) is replaced by a12. The -a flag does not affect the full output given by the -f flag (which always includes both s12 and a12).


ADDITIONAL QUANTITIES

The -f flag reports four additional quantities.

The reduced length of the geodesic, m12, is defined such that if the initial azimuth is perturbed by dazi1 (radians) then the second point is displaced by m12 dazi1 in the direction perpendicular to the geodesic. m12 is given in meters. On a curved surface the reduced length obeys a symmetry relation, m12 + m21 = 0. On a flat surface, we have m12 = s12.

M12 and M21 are geodesic scales. If two geodesics are parallel at point 1 and separated by a small distance dt, then they are separated by a distance M12 dt at point 2. M21 is defined similarly (with the geodesics being parallel to one another at point 2). M12 and M21 are dimensionless quantities. On a flat surface, we have M12 = M21 = 1.

If points 1, 2, and 3 lie on a single geodesic, then the following addition rules hold, m13 = m12 M23 + m23 M21, M13 = M12 M23 - (1 - M12 M21) m23 / m12, and M31 = M32 M21 - (1 - M23 M32) m12 / m23.

Finally, S12 is the area between the geodesic from point 1 to point 2 and the equator; i.e., it is the area, measured counter-clockwise, of the quadrilateral with corners (lat1,lon1), (0,lon1), (0,lon2), and (lat2,lon2). It is given in meters^2.


PRECISION

prec gives precision of the output with prec = 0 giving 1 m precision, prec = 3 giving 1 mm precision, etc. prec is the number of digits after the decimal point for lengths. For decimal degrees, the number of digits after the decimal point is 5 + prec. For DMS (degree, minute, seconds) output, the number of digits after the decimal point in the seconds component is 1 + prec. The minimum value of prec is 0 and the maximum is 10.


ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes Geod to return an exit code of 1. However, an error does not cause Geod to terminate; following lines will be converted.


EXAMPLES

Route from JFK Airport to Singapore Changi Airport:

   echo 40:38:23N 073:46:44W 01:21:33N 103:59:22E |
   Geod -i -: -p 0
   003:18:29.9 177:29:09.2 15347628

Waypoints on the route at intervals of 2000km:

   for ((i = 0; i <= 16; i += 2)); do echo ${i}000000;done |
   Geod -l 40:38:23N 073:46:44W 003:18:29.9 -: -p 0
   40:38:23.0N 073:46:44.0W 003:18:29.9
   58:34:45.1N 071:49:36.7W 004:48:48.8
   76:22:28.4N 065:32:17.8W 010:41:38.4
   84:50:28.0N 075:04:39.2E 150:55:00.9
   67:26:20.3N 098:00:51.2E 173:27:20.3
   49:33:03.2N 101:06:52.6E 176:07:54.3
   31:34:16.5N 102:30:46.3E 177:03:08.4
   13:31:56.0N 103:26:50.7E 177:24:55.0
   04:32:05.7S 104:14:48.7E 177:28:43.6


SEE ALSO

The algorithms are described in C. F. F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011; preprint http://arxiv.org/abs/1102.1215. See also C. F. F. Karney, Algorithms for geodesics, Sept. 2011; preprint http://arxiv.org/abs/1109.4448.


AUTHOR

Geod was written by Charles Karney.


HISTORY

Geod was added to GeographicLib, http://geographiclib.sf.net, in 2009-03.

geographiclib-1.21/doc/html/Gravity.1.html0000644000175000017500000003146511745620414020254 0ustar frankiefrankie Gravity -- compute the earth's gravity field


NAME

Gravity -- compute the earth's gravity field


SYNOPSIS

Gravity [ -n name ] [ -d dir ] [ -G | -D | -A | -H ] [ -c lat h ] [ -p prec ] [ -v ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

Gravity reads in positions on standard input and prints out the gravitational field on standard output.

The input line is of the form lat lon h. lat and lon are the latitude and longitude expressed as decimal degrees or degrees, minutes, and seconds; see GeoConvert(1) for details. h is the height above the ellipsoid in meters; this quantity is optional and defaults to 0. Alternatively, the gravity field can be computed at various points on a circle of latitude (constant lat and h) via the -c option; in this case only the longitude should be given on the input lines. The quantities printed out are governed by the -G (default), -D, -A, or -H options.

All the supported gravity models use WGS84 as the reference ellipsoid a = 6378137 m, f = 1/298.257223563, omega = 7292115e-11 rad/s, and GM = 3986004.418e8 m^3/s^2.


OPTIONS

-n

use gravity field model name instead of the default egm96. See MODELS.

-d

read gravity models from dir instead of the default. See MODELS.

-G

compute the acceleration due to gravity (including the centrifugal acceleration due the the earth's rotation) g. The output consists of gx gy gz (all in m/s^2), where the x, y, and z components are in easterly, northerly, and up directions, respectively. Usually gz is negative.

-D

compute the gravity disturbance delta = g - gamma, where gamma is the "normal" gravity due to the reference ellipsoid . The output consists of deltax deltay deltaz (all in mGal, 1 mGal = 10^-5 m/s^2), where the x, y, and z components are in easterly, northerly, and up directions, respectively. Note that deltax = gx, because gammax = 0.

-A

computes the gravitational anomaly. The output consists of 3 items Dg01 xi eta, where Dg01 is in mGal (1 mGal = 10^-5 m/s^2) and xi and eta are in arcseconds. The gravitational anomaly compares the gravitational field g at P with the normal gravity gamma at Q where the P is vertically above Q and the gravitational potential at P equals the normal potential at Q. Dg01 gives the difference in the magnitudes of these two vectors and xi and eta give the difference in their directions (as northerly and easterly components). The calculation uses a spherical approximation to match the results of the NGA's synthesis programs.

-H

compute the height of the geoid above the reference ellipsoid (in meters). In this case, h should be zero. The results accurately match the results of the NGA's synthesis programs. GeoidEval(1) can compute geoid heights much more quickly by interpolating on a grid of precomputed results; however the results from GeoidEval(1) are only accurate to a few millimeters.

-c

evaluate the field on a circle of latitude given by lat and h instead of reading these quantities from the input lines. In this case, Gravity can calculate the field considerably more quickly. If geoid heights are being computed (the -H option), then h must be zero.

-p

set the output precision to prec. By default prec is 5 for acceleration due to gravity, 3 for the gravity disturbance and anomaly, and 4 for the geoid height.

-v

print information about the gravity model on standard error before processing the input.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage, the default gravity path and name, and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


MODELS

Gravity computes the gravity field using one of the following models

    egm84, earth gravity model 1984.  See
      http://earth-info.nga.mil/GandG/wgs84/gravitymod/wgs84_180/wgs84_180.html
    egm96, earth gravity model 1996.  See
      http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html
    egm2008, earth gravity model 2008.  See
      http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008
    wgs84, world geodetic system 1984.  This returns the normal
      gravity for the WGS84 ellipsoid.

These models approximate the gravitation field above the surface of the earth. By default, the egm96 gravity model is used. This may changed by setting the environment variable GRAVITY_NAME or with the -n option.

The gravity models will be loaded from a directory specified at compile time. This may changed by setting the environment variables GRAVITY_PATH or GEOGRAPHICLIB_DATA, or with the -d option. The -h option prints the default gravity path and name. Use the -v option to ascertain the full path name of the data file.

Instructions for downloading and installing gravity models are available at http://geographiclib.sf.net/html/gravity.html#gravityinst.


ENVIRONMENT

GRAVITY_NAME

Override the compile-time default gravity name of egm96. The -h option reports the value of GRAVITY_NAME, if defined, otherwise it reports the compile-time value. If the -n name option is used, then name takes precedence.

GRAVITY_PATH

Override the compile-time default gravity path. This is typically /usr/local/share/GeographicLib/gravity on Unix-like systems and C:/Documents and Settings/All Users/Application Data/GeographicLib/gravity on Windows systems. The -h option reports the value of GRAVITY_PATH, if defined, otherwise it reports the compile-time value. If the -d dir option is used, then dir takes precedence.

GEOGRAPHICLIB_DATA

Another way of overriding the compile-time default gravity path. If it is set (and if GRAVITY_PATH is not set), then $GEOGRAPHICLIB_DATA/gravity is used.


ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes Gravity to return an exit code of 1. However, an error does not cause Gravity to terminate; following lines will be converted.


EXAMPLES

The gravity field from EGM2008 at the top of Mount Everest

    echo 27:59:17N 86:55:32E 8820 | Gravity -n egm2008
    => -0.00001 0.00103 -9.76782


SEE ALSO

GeoConvert(1), GeoidEval(1).


AUTHOR

Gravity was written by Charles Karney.


HISTORY

Gravity was added to GeographicLib, http://geographiclib.sf.net, in version 1.16.

geographiclib-1.21/doc/html/CassiniSoldner_8hpp.html0000644000175000017500000001311311745620414022335 0ustar frankiefrankie GeographicLib: CassiniSoldner.hpp File Reference
CassiniSoldner.hpp File Reference

Header for GeographicLib::CassiniSoldner class. More...

Go to the source code of this file.

Classes

class  GeographicLib::CassiniSoldner
 Cassini-Soldner Projection. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_CASSINISOLDNER_HPP   "$Id: d794ea8a1e64fd9cbb8dcee34755b6dc4fee623a $"

Detailed Description

Header for GeographicLib::CassiniSoldner class.

Copyright (c) Charles Karney (2009-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file CassiniSoldner.hpp.


Define Documentation

#define GEOGRAPHICLIB_CASSINISOLDNER_HPP   "$Id: d794ea8a1e64fd9cbb8dcee34755b6dc4fee623a $"

Definition at line 11 of file CassiniSoldner.hpp.

geographiclib-1.21/doc/html/Constants_8hpp_source.html0000644000175000017500000013710111745620414022755 0ustar frankiefrankie GeographicLib: Constants.hpp Source File
Constants.hpp
Go to the documentation of this file.
00001 /**
00002  * \file Constants.hpp
00003  * \brief Header for GeographicLib::Constants class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_CONSTANTS_HPP)
00011 #define GEOGRAPHICLIB_CONSTANTS_HPP \
00012   "$Id: 895e4bd91979aae347436bbf6be37964f05f5b6f $"
00013 
00014 #include <GeographicLib/Config.h>
00015 
00016 /**
00017  * A compile-time assert.  Use C++11 static_assert, if available.
00018  **********************************************************************/
00019 #if !defined(STATIC_ASSERT)
00020 #  if defined(__GXX_EXPERIMENTAL_CXX0X__)
00021 #    define STATIC_ASSERT static_assert
00022 #  elif defined(_MSC_VER) && _MSC_VER >= 1600
00023 #    define STATIC_ASSERT static_assert
00024 #  else
00025 #    define STATIC_ASSERT(cond,reason) \
00026             { enum{ STATIC_ASSERT_ENUM = 1/int(cond) }; }
00027 #  endif
00028 #endif
00029 
00030 #if defined(__GNUC__)
00031 // Suppress "defined but not used" warnings
00032 #  define RCSID_DECL(x) namespace \
00033           { char VAR_ ## x [] __attribute__((used)) = x; }
00034 #else
00035 /**
00036  * Insertion of RCS Id strings into the object file.
00037  **********************************************************************/
00038 #  define RCSID_DECL(x) namespace { char VAR_ ## x [] = x; }
00039 #endif
00040 
00041 #if defined(_WIN32) && defined(GEOGRAPHIC_SHARED_LIB)
00042 #  if defined(Geographic_EXPORTS)
00043 #    define GEOGRAPHIC_EXPORT __declspec(dllexport)
00044 #  else
00045 #    define GEOGRAPHIC_EXPORT __declspec(dllimport)
00046 #  endif
00047 #else
00048 #  define GEOGRAPHIC_EXPORT
00049 #endif
00050 
00051 #include <stdexcept>
00052 #include <GeographicLib/Math.hpp>
00053 
00054 /**
00055  * \brief Namespace for %GeographicLib
00056  *
00057  * All of %GeographicLib is defined within the GeographicLib namespace.  In
00058  * addition all the header files are included via %GeographicLib/filename.
00059  * This minimizes the likelihood of conflicts with other packages.
00060  **********************************************************************/
00061 namespace GeographicLib {
00062 
00063   /**
00064    * \brief %Constants needed by %GeographicLib
00065    *
00066    * Define constants specifying the WGS84 ellipsoid, the UTM and UPS
00067    * projections, and various unit conversions.
00068    *
00069    * Example of use:
00070    * \include example-Constants.cpp
00071    **********************************************************************/
00072   class GEOGRAPHIC_EXPORT Constants {
00073   private:
00074     typedef Math::real real;
00075     Constants();                // Disable constructor
00076 
00077   public:
00078     /**
00079      * A synonym for Math::degree<real>().
00080      **********************************************************************/
00081     static inline Math::real degree() throw() { return Math::degree<real>(); }
00082     /**
00083      * @return the number of radians in an arcminute.
00084      **********************************************************************/
00085     static inline Math::real arcminute() throw()
00086     { return Math::degree<real>() / 60; }
00087     /**
00088      * @return the number of radians in an arcsecond.
00089      **********************************************************************/
00090     static inline Math::real arcsecond() throw()
00091     { return Math::degree<real>() / 3600; }
00092 
00093     /** \name Ellipsoid parameters
00094      **********************************************************************/
00095     ///@{
00096     /**
00097      * @tparam T the type of the returned value.
00098      * @return the equatorial radius of WGS84 ellipsoid (6378137 m).
00099      **********************************************************************/
00100     template<typename T> static inline T WGS84_a() throw()
00101     { return T(6378137) * meter<T>(); }
00102     /**
00103      * A synonym for WGS84_a<real>().
00104      **********************************************************************/
00105     static inline Math::real WGS84_a() throw() { return WGS84_a<real>(); }
00106     /**
00107      * @tparam T the type of the returned value.
00108      * @return the flattening of WGS84 ellipsoid (1/298.257223563).
00109      **********************************************************************/
00110     template<typename T> static inline T WGS84_f() throw()
00111     { return T(1) / ( T(298) + T(257223563) / T(1000000000) ); }
00112     /**
00113      * A synonym for WGS84_f<real>().
00114      **********************************************************************/
00115     static inline Math::real WGS84_f() throw() { return WGS84_f<real>(); }
00116     /**
00117      * @tparam T the type of the returned value.
00118      * @return the gravitational constant of the WGS84 ellipsoid, \e GM, in
00119      *   m<sup>3</sup> s<sup>-2</sup>.
00120      **********************************************************************/
00121     template<typename T> static inline T WGS84_GM() throw()
00122     { return T(3986004) * T(100000000) + T(41800000); }
00123     /**
00124      * @tparam T the type of the returned value.
00125      * @return the angular velocity of the the WGS84 ellipsoid, \e omega, in
00126      *   rad s<sup>-1</sup>.
00127      **********************************************************************/
00128     template<typename T> static inline T WGS84_omega() throw()
00129     { return T(7292115) / (T(1000000) * T(100000)); }
00130     /// \cond SKIP
00131     /**
00132      * <b>DEPRECATED</b>
00133      * @return the reciprocal flattening of WGS84 ellipsoid.
00134      **********************************************************************/
00135     template<typename T> static inline T WGS84_r() throw()
00136     { return 1/WGS84_f<T>(); }
00137     /**
00138      * <b>DEPRECATED</b>
00139      * A synonym for WGS84_r<real>().
00140      **********************************************************************/
00141     /// \endcond
00142     static inline Math::real WGS84_r() throw() { return WGS84_r<real>(); }
00143     /**
00144      * @tparam T the type of the returned value.
00145      * @return the equatorial radius of GRS80 ellipsoid, \e a, in m.
00146      **********************************************************************/
00147     template<typename T> static inline T GRS80_a() throw()
00148     { return T(6378137); }
00149     /**
00150      * @tparam T the type of the returned value.
00151      * @return the gravitational constant of the GRS80 ellipsoid, \e GM, in
00152      *   m<sup>3</sup> s<sup>-2</sup>.
00153      **********************************************************************/
00154     template<typename T> static inline T GRS80_GM() throw()
00155     { return T(3986005) * T(100000000); }
00156     /**
00157      * @tparam T the type of the returned value.
00158      * @return the angular velocity of the the GRS80 ellipsoid, \e omega, in
00159      *   rad s<sup>-1</sup>.
00160      *
00161      * This is about 2*pi*366.25 / (365.25*24*3600) rad s<sup>-1</sup>.  365.25
00162      * is the number of days in a Julian year and 365.35/366.25 converts from
00163      * solar days to sidereal days.  Using the number of days in a Gregorian
00164      * year (365.2425) results in a worse approximation (because the Gregorian
00165      * year includes the precession of the earth's axis).
00166      **********************************************************************/
00167     template<typename T> static inline T GRS80_omega() throw()
00168     { return T(7292115) / (T(1000000) * T(100000)); }
00169     /**
00170      * @tparam T the type of the returned value.
00171      * @return the dynamical form factor of the GRS80 ellipsoid,
00172      *   <i>J</i><sub>2</sub>.
00173      **********************************************************************/
00174     template<typename T> static inline T GRS80_J2() throw()
00175     { return T(108263) / T(100000000); }
00176     /**
00177      * @tparam T the type of the returned value.
00178      * @return the central scale factor for UTM (0.9996).
00179      **********************************************************************/
00180     template<typename T> static inline T UTM_k0() throw()
00181     {return T(9996) / T(10000); }
00182     /**
00183      * A synonym for UTM_k0<real>().
00184      **********************************************************************/
00185     static inline Math::real UTM_k0() throw() { return UTM_k0<real>(); }
00186     /**
00187      * @tparam T the type of the returned value.
00188      * @return the central scale factor for UPS (0.994).
00189      **********************************************************************/
00190     template<typename T> static inline T UPS_k0() throw()
00191     { return T(994) / T(1000); }
00192     /**
00193      * A synonym for UPS_k0<real>().
00194      **********************************************************************/
00195     static inline Math::real UPS_k0() throw() { return UPS_k0<real>(); }
00196     ///@}
00197 
00198     /** \name SI units
00199      **********************************************************************/
00200     ///@{
00201     /**
00202      * @tparam T the type of the returned value.
00203      * @return the number of meters in a meter.
00204      *
00205      * This is unity, but this lets the internal system of units be changed if
00206      * necessary.
00207      **********************************************************************/
00208     template<typename T> static inline T meter() throw() { return T(1); }
00209     /**
00210      * A synonym for meter<real>().
00211      **********************************************************************/
00212     static inline Math::real meter() throw() { return meter<real>(); }
00213     /**
00214      * @return the number of meters in a kilometer.
00215      **********************************************************************/
00216     static inline Math::real kilometer() throw()
00217     { return 1000 * meter<real>(); }
00218     /**
00219      * @return the number of meters in a nautical mile (approximately 1 arc
00220      *   minute)
00221      **********************************************************************/
00222     static inline Math::real nauticalmile() throw()
00223     { return 1852 * meter<real>(); }
00224 
00225     /**
00226      * @tparam T the type of the returned value.
00227      * @return the number of square meters in a square meter.
00228      *
00229      * This is unity, but this lets the internal system of units be changed if
00230      * necessary.
00231      **********************************************************************/
00232     template<typename T> static inline T square_meter() throw()
00233     { return meter<real>() * meter<real>(); }
00234     /**
00235      * A synonym for square_meter<real>().
00236      **********************************************************************/
00237     static inline Math::real square_meter() throw()
00238     { return square_meter<real>(); }
00239     /**
00240      * @return the number of square meters in a hectare.
00241      **********************************************************************/
00242     static inline Math::real hectare() throw()
00243     { return 10000 * square_meter<real>(); }
00244     /**
00245      * @return the number of square meters in a square kilometer.
00246      **********************************************************************/
00247     static inline Math::real square_kilometer() throw()
00248     { return kilometer() * kilometer(); }
00249     /**
00250      * @return the number of square meters in a square nautical mile.
00251      **********************************************************************/
00252     static inline Math::real square_nauticalmile() throw()
00253     { return nauticalmile() * nauticalmile(); }
00254     ///@}
00255 
00256     /** \name Anachronistic British units
00257      **********************************************************************/
00258     ///@{
00259     /**
00260      * @return the number of meters in an international foot.
00261      **********************************************************************/
00262     static inline Math::real foot() throw()
00263     { return real(0.0254L) * 12 * meter<real>(); }
00264     /**
00265      * @return the number of meters in a yard.
00266      **********************************************************************/
00267     static inline Math::real yard() throw() { return 3 * foot(); }
00268     /**
00269      * @return the number of meters in a fathom.
00270      **********************************************************************/
00271     static inline Math::real fathom() throw() { return 2 * yard(); }
00272     /**
00273      * @return the number of meters in a chain.
00274      **********************************************************************/
00275     static inline Math::real chain() throw() { return 22 * yard(); }
00276     /**
00277      * @return the number of meters in a furlong.
00278      **********************************************************************/
00279     static inline Math::real furlong() throw() { return 10 * chain(); }
00280     /**
00281      * @return the number of meters in a statute mile.
00282      **********************************************************************/
00283     static inline Math::real mile() throw() { return 8 * furlong(); }
00284     /**
00285      * @return the number of square meters in an acre.
00286      **********************************************************************/
00287     static inline Math::real acre() throw() { return chain() * furlong(); }
00288     /**
00289      * @return the number of square meters in a square statute mile.
00290      **********************************************************************/
00291     static inline Math::real square_mile() throw() { return mile() * mile(); }
00292     ///@}
00293 
00294     /** \name Anachronistic US units
00295      **********************************************************************/
00296     ///@{
00297     /**
00298      * @return the number of meters in a US survey foot.
00299      **********************************************************************/
00300     static inline Math::real surveyfoot() throw()
00301     { return real(1200) / real(3937) * meter<real>(); }
00302     ///@}
00303   };
00304 
00305   /**
00306    * \brief Exception handling for %GeographicLib
00307    *
00308    * A class to handle exceptions.  It's derived from std::runtime_error so it
00309    * can be caught by the usual catch clauses.
00310    *
00311    * Example of use:
00312    * \include example-GeographicErr.cpp
00313    **********************************************************************/
00314   class GeographicErr : public std::runtime_error {
00315   public:
00316 
00317     /**
00318      * Constructor
00319      *
00320      * @param[in] msg a string message, which is accessible in the catch
00321      *   clause, via what().
00322      **********************************************************************/
00323     GeographicErr(const std::string& msg) : std::runtime_error(msg) {}
00324   };
00325 
00326 } // namespace GeographicLib
00327 
00328 #endif  // GEOGRAPHICLIB_CONSTANTS_HPP
geographiclib-1.21/doc/html/tab_s.png0000644000175000017500000000027511745620415017374 0ustar frankiefrankie‰PNG  IHDR$ÇÇ[„IDATxíÝë ‚P@áKg"%(IE|¡%¦I¡7iÚlmÐ" ÓäÛC¼ÞòÛ“\.dåOZ̤ÅBr‰/¿‰(ŸˆÎ#a6⟂ôŽ› 8q÷ØÇëÐaF-û°Et¿Aó4¯fçÖlŠ]±¶äJjJC¢%Š!¿<Å#üÀÄ«IEND®B`‚geographiclib-1.21/doc/html/MagneticModel_8hpp_source.html0000644000175000017500000012662311745620415023521 0ustar frankiefrankie GeographicLib: MagneticModel.hpp Source File
MagneticModel.hpp
Go to the documentation of this file.
00001 /**
00002  * \file MagneticModel.hpp
00003  * \brief Header for GeographicLib::MagneticModel class
00004  *
00005  * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under
00006  * the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_MAGNETICMODEL_HPP)
00011 #define GEOGRAPHICLIB_MAGNETICMODEL_HPP \
00012   "$Id: 7f8c59ee3cdbfce252d1172c1bb4d7db7cf5ef38 $"
00013 
00014 #include <string>
00015 #include <sstream>
00016 #include <vector>
00017 #include <GeographicLib/Constants.hpp>
00018 #include <GeographicLib/Geocentric.hpp>
00019 #include <GeographicLib/SphericalHarmonic.hpp>
00020 
00021 #if defined(_MSC_VER)
00022 // Squelch warnings about dll vs vector
00023 #pragma warning (push)
00024 #pragma warning (disable: 4251)
00025 #endif
00026 
00027 namespace GeographicLib {
00028 
00029   class MagneticCircle;
00030 
00031   /**
00032    * \brief Model of the earth's magnetic field
00033    *
00034    * Evaluate the earth's magnetic field according to a model.  At present only
00035    * internal magnetic fields are handled.  These are due to the earth's code
00036    * and crust; these vary slowly (over many years).  Excluded are the effects
00037    * of currents in the ionosphere and magnetosphere which have daily and
00038    * annual variations.
00039    *
00040    * See \ref magnetic for details of how to install the magnetic model and the
00041    * data format.
00042    *
00043    * See
00044    * - General information:
00045    *   - http://geomag.org/models/index.html
00046    * - WMM2010:
00047    *   - http://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml
00048    *   - http://ngdc.noaa.gov/geomag/WMM/data/WMM2010/WMM2010COF.zip
00049    * - IGRF11:
00050    *   - http://ngdc.noaa.gov/IAGA/vmod/igrf.html
00051    *   - http://ngdc.noaa.gov/IAGA/vmod/igrf11coeffs.txt
00052    *   - http://ngdc.noaa.gov/IAGA/vmod/geomag70_linux.tar.gz
00053    * - EMM2010:
00054    *   - http://ngdc.noaa.gov/geomag/EMM/index.html
00055    *   - http://ngdc.noaa.gov/geomag/EMM/data/geomag/EMM2010_Sph_Windows_Linux.zip
00056    *
00057    * Example of use:
00058    * \include example-MagneticModel.cpp
00059    *
00060    * <a href="MagneticField.1.html">MagneticField</a> is a command-line utility
00061    * providing access to the functionality of MagneticModel and MagneticCircle.
00062    **********************************************************************/
00063 
00064   class GEOGRAPHIC_EXPORT MagneticModel {
00065   private:
00066     typedef Math::real real;
00067     static const int idlength_ = 8;
00068     std::string _name, _dir, _description, _date, _filename, _id;
00069     real _t0, _dt0, _tmin, _tmax, _a, _hmin, _hmax;
00070     int _Nmodels;
00071     SphericalHarmonic::normalization _norm;
00072     Geocentric _earth;
00073     std::vector< std::vector<real> > _G;
00074     std::vector< std::vector<real> > _H;
00075     std::vector<SphericalHarmonic> _harm;
00076     void Field(real t, real lat, real lon, real h, bool diffp,
00077                real& Bx, real& By, real& Bz,
00078                real& Bxt, real& Byt, real& Bzt) const throw();
00079     void ReadMetadata(const std::string& name);
00080     MagneticModel(const MagneticModel&); // copy constructor not allowed
00081     MagneticModel& operator=(const MagneticModel&); // nor copy assignment
00082   public:
00083 
00084     /** \name Setting up the magnetic model
00085      **********************************************************************/
00086     ///@{
00087     /**
00088      * Construct a magnetic model.
00089      *
00090      * @param[in] name the name of the model.
00091      * @param[in] path (optional) directory for data file.
00092      * @param[in] earth (optional) Geocentric object for converting
00093      *   coordinates; default Geocentric::WGS84.
00094      *
00095      * A filename is formed by appending ".wmm" (World Magnetic Model) to the
00096      * name.  If \e path is specified (and is non-empty), then the file is
00097      * loaded from directory, \e path.  Otherwise the path is given by the
00098      * DefaultMagneticPath().  This may throw an exception because the file
00099      * does not exist, is unreadable, or is corrupt.
00100      *
00101      * This file contains the metadata which specifies the properties of the
00102      * model.  The coefficients for the spherical harmonic sums are obtained
00103      * from a file obtained by appending ".cof" to metadata file (so the
00104      * filename ends in ".wwm.cof").
00105      *
00106      * The model is not tied to a particular ellipsoidal model of the earth.
00107      * The final earth argument to the constructor specify an ellipsoid to
00108      * allow geodetic coordinates to the transformed into the spherical
00109      * coordinates used in the spherical harmonic sum.
00110      **********************************************************************/
00111     explicit MagneticModel(const std::string& name,
00112                            const std::string& path = "",
00113                            const Geocentric& earth = Geocentric::WGS84);
00114     ///@}
00115 
00116     /** \name Compute the magnetic field
00117      **********************************************************************/
00118     ///@{
00119     /**
00120      * Evaluate the components of the geomagnetic field.
00121      *
00122      * @param[in] t the time (years).
00123      * @param[in] lat latitude of the point (degrees).
00124      * @param[in] lon longitude of the point (degrees).
00125      * @param[in] h the height of the point above the ellipsoid (meters).
00126      * @param[out] Bx the easterly component of the magnetic field (nanotesla).
00127      * @param[out] By the northerly component of the magnetic field (nanotesla).
00128      * @param[out] Bz the vertical (up) component of the magnetic field
00129      *   (nanotesla).
00130      **********************************************************************/
00131     void operator()(real t, real lat, real lon, real h,
00132                     real& Bx, real& By, real& Bz) const throw() {
00133       real dummy;
00134       Field(t, lat, lon, h, false, Bx, By, Bz, dummy, dummy, dummy);
00135     }
00136 
00137     /**
00138      * Evaluate the components of the geomagnetic field and their time
00139      * derivatives
00140      *
00141      * @param[in] t the time (years).
00142      * @param[in] lat latitude of the point (degrees).
00143      * @param[in] lon longitude of the point (degrees).
00144      * @param[in] h the height of the point above the ellipsoid (meters).
00145      * @param[out] Bx the easterly component of the magnetic field (nanotesla).
00146      * @param[out] By the northerly component of the magnetic field (nanotesla).
00147      * @param[out] Bz the vertical (up) component of the magnetic field
00148      *   (nanotesla).
00149      * @param[out] Bxt the rate of change of \e Bx (nT/yr).
00150      * @param[out] Byt the rate of change of \e By (nT/yr).
00151      * @param[out] Bzt the rate of change of \e Bz (nT/yr).
00152      **********************************************************************/
00153     void operator()(real t, real lat, real lon, real h,
00154                     real& Bx, real& By, real& Bz,
00155                     real& Bxt, real& Byt, real& Bzt) const throw() {
00156       Field(t, lat, lon, h, true, Bx, By, Bz, Bxt, Byt, Bzt);
00157     }
00158 
00159     /**
00160      * Create a MagneticCircle object to allow the geomagnetic field at many
00161      * points with constant \e lat, \e h, and \e t and varying \e lon to be
00162      * computed efficiently.
00163      *
00164      * @param[in] t the time (years).
00165      * @param[in] lat latitude of the point (degrees).
00166      * @param[in] h the height of the point above the ellipsoid (meters).
00167      * @return a MagneticCircle object whose MagneticCircle::operator()(real
00168      *   lon) member function computes the field at particular values of \e
00169      *   lon.
00170      *
00171      * If the field at several points on a circle of latitude need to be
00172      * calculated then creating a MagneticCircle and using its member functions
00173      * will be substantially faster, especially for high-degree models.
00174      **********************************************************************/
00175     MagneticCircle Circle(real t, real lat, real h) const;
00176 
00177     /**
00178      * Compute various quantities dependent on the magnetic field.
00179      *
00180      * @param[in] Bx the \e x (easterly) component of the magnetic field (nT).
00181      * @param[in] By the \e y (northerly) component of the magnetic field (nT).
00182      * @param[in] Bz the \e z (vertical, up positive) component of the magnetic
00183      *   field (nT).
00184      * @param[out] H the horizontal magnetic field (nT).
00185      * @param[out] F the total magnetic field (nT).
00186      * @param[out] D the declination of the field (degrees east of north).
00187      * @param[out] I the inclination of the field (degrees down from
00188      *   horizontal).
00189      **********************************************************************/
00190     static void FieldComponents(real Bx, real By, real Bz,
00191                                 real& H, real& F, real& D, real& I) throw() {
00192       real Ht, Ft, Dt, It;
00193       FieldComponents(Bx, By, Bz, real(0), real(1), real(0),
00194                       H, F, D, I, Ht, Ft, Dt, It);
00195     }
00196 
00197     /**
00198      * Compute various quantities dependent on the magnetic field and its rate
00199      * of change.
00200      *
00201      * @param[in] Bx the \e x (easterly) component of the magnetic field (nT).
00202      * @param[in] By the \e y (northerly) component of the magnetic field (nT).
00203      * @param[in] Bz the \e z (vertical, up positive) component of the magnetic
00204      *   field (nT).
00205      * @param[in] Bxt the rate of change of \e Bx (nT/yr).
00206      * @param[in] Byt the rate of change of \e By (nT/yr).
00207      * @param[in] Bzt the rate of change of \e Bz (nT/yr).
00208      * @param[out] H the horizontal magnetic field (nT).
00209      * @param[out] F the total magnetic field (nT).
00210      * @param[out] D the declination of the field (degrees east of north).
00211      * @param[out] I the inclination of the field (degrees down from
00212      *   horizontal).
00213      * @param[out] Ht the rate of change of \e H (nT/yr).
00214      * @param[out] Ft the rate of change of \e F (nT/yr).
00215      * @param[out] Dt the rate of change of \e D (degrees/yr).
00216      * @param[out] It the rate of change of \e I (degrees/yr).
00217      **********************************************************************/
00218     static void FieldComponents(real Bx, real By, real Bz,
00219                                 real Bxt, real Byt, real Bzt,
00220                                 real& H, real& F, real& D, real& I,
00221                                 real& Ht, real& Ft, real& Dt, real& It) throw();
00222     ///@}
00223 
00224     /** \name Inspector functions
00225      **********************************************************************/
00226     ///@{
00227     /**
00228      * @return the description of the magnetic model, if available, from the
00229      *   Description file in the data file; if absent, return "NONE".
00230      **********************************************************************/
00231     const std::string& Description() const throw() { return _description; }
00232 
00233     /**
00234      * @return date of the model, if available, from the ReleaseDate field in
00235      *   the data file; if absent, return "UNKNOWN".
00236      **********************************************************************/
00237     const std::string& DateTime() const throw() { return _date; }
00238 
00239     /**
00240      * @return full file name used to load the magnetic model.
00241      **********************************************************************/
00242     const std::string& MagneticFile() const throw() { return _filename; }
00243 
00244     /**
00245      * @return "name" used to load the magnetic model (from the first argument
00246      *   of the constructor, but this may be overridden by the model file).
00247      **********************************************************************/
00248     const std::string& MagneticModelName() const throw() { return _name; }
00249 
00250     /**
00251      * @return directory used to load the magnetic model.
00252      **********************************************************************/
00253     const std::string& MagneticModelDirectory() const throw() { return _dir; }
00254 
00255     /**
00256      * @return the minimum height above the ellipsoid (in meters) for which
00257      *   this MagneticModel should be used.
00258      *
00259      * Because the model will typically provide useful results
00260      * slightly outside the range of allowed heights, no check of \e t
00261      * argument is made by MagneticModel::operator()() or
00262      * MagneticModel::Circle.
00263      **********************************************************************/
00264     Math::real MinHeight() const throw() { return _hmin; }
00265 
00266     /**
00267      * @return the maximum height above the ellipsoid (in meters) for which
00268      *   this MagneticModel should be used.
00269      *
00270      * Because the model will typically provide useful results
00271      * slightly outside the range of allowed heights, no check of \e t
00272      * argument is made by MagneticModel::operator()() or
00273      * MagneticModel::Circle.
00274      **********************************************************************/
00275     Math::real MaxHeight() const throw() { return _hmax; }
00276 
00277     /**
00278      * @return the minimum time (in years) for which this MagneticModel should
00279      *   be used.
00280      *
00281      * Because the model will typically provide useful results
00282      * slightly outside the range of allowed times, no check of \e t
00283      * argument is made by MagneticModel::operator()() or
00284      * MagneticModel::Circle.
00285      **********************************************************************/
00286     Math::real MinTime() const throw() { return _tmin; }
00287 
00288     /**
00289      * @return the maximum time (in years) for which this MagneticModel should
00290      *   be used.
00291      *
00292      * Because the model will typically provide useful results
00293      * slightly outside the range of allowed times, no check of \e t
00294      * argument is made by MagneticModel::operator()() or
00295      * MagneticModel::Circle.
00296      **********************************************************************/
00297     Math::real MaxTime() const throw() { return _tmax; }
00298 
00299     /**
00300      * @return \e a the equatorial radius of the ellipsoid (meters).  This is
00301      *   the value of \e a inherited from the Geocentric object used in the
00302      *   constructor.
00303      **********************************************************************/
00304     Math::real MajorRadius() const throw() { return _earth.MajorRadius(); }
00305 
00306     /**
00307      * @return \e f the flattening of the ellipsoid.  This is the value
00308      *   inherited from the Geocentric object used in the constructor.
00309      **********************************************************************/
00310     Math::real Flattening() const throw() { return _earth.Flattening(); }
00311     ///@}
00312 
00313     /**
00314      * @return the default path for magnetic model data files.
00315      *
00316      * This is the value of the environment variable MAGNETIC_PATH, if set;
00317      * otherwise, it is $GEOGRAPHICLIB_DATA/magnetic if the environment
00318      * variable GEOGRAPHICLIB_DATA is set; otherwise, it is a compile-time
00319      * default (/usr/local/share/GeographicLib/magnetic on non-Windows systems
00320      * and C:/Documents and Settings/All Users/Application
00321      * Data/GeographicLib/magnetic on Windows systems).
00322      **********************************************************************/
00323     static std::string DefaultMagneticPath();
00324 
00325     /**
00326      * @return the default name for the magnetic model.
00327      *
00328      * This is the value of the environment variable MAGNETIC_NAME, if set,
00329      * otherwise, it is "wmm2010".  The MagneticModel class does not use this
00330      * function; it is just provided as a convenience for a calling program
00331      * when constructing a MagneticModel object.
00332      **********************************************************************/
00333     static std::string DefaultMagneticName();
00334   };
00335 
00336 } // namespace GeographicLib
00337 
00338 #if defined(_MSC_VER)
00339 #pragma warning (pop)
00340 #endif
00341 
00342 #endif  // GEOGRAPHICLIB_MAGNETICMODEL_HPP
geographiclib-1.21/doc/html/intro.html0000644000175000017500000001211111745620414017606 0ustar frankiefrankie GeographicLib: Introduction
Introduction
Forward to Installing GeographicLib. Up to Contents.

GeographicLib offers a C++ interfaces to a small (but important!) set of geographic transformations. It grew out of a desire to improve on the geotrans package for transforming between geographic and MGRS coordinates. At present, GeographicLib provides UTM, UPS, MGRS, geocentric, and local cartesian projections, gravity and geomagnetic models, and classes for geodesic calculations.

The goals of GeographicLib are:

  • Accuracy. In most applications the accuracy is close to round-off, about 5 nm (5 nanometers). Even though in many geographic applications 1 cm is considered "accurate enough", there is little penalty in providing much better accuracy. If situations where a faster approximate algorithm is necessary, GeographicLib offers an accurate benchmark to guide the development.
  • Completeness. For each of the projections included, an attempt is made to provide a complete solution. For example, GeographicLib::Geodesic::Inverse works for anti-podal points. Similarly, GeographicLib::Geocentric.Reverse will return accurate geodetic coordinates even for points close to the center of the earth.
  • C++ interface. For the projection methods, this allows encapsulation of the ellipsoid parameters.
  • Emphasis on projections necessary for analyzing military data.
  • Uniform treatment of UTM/UPS. The GeographicLib::UTMUPS class treats UPS as zone 0. This simplifies conversions between UTM and UPS coordinates, etc.
  • Well defined and stable conventions for the conversion between UTM/UPS to MGRS coordinates.
  • Detailed internal documentation on the algorithms. For the most part GeographicLib uses published algorithms and references are given. If changes have been made (usually to improve the numerical accuracy), these are described in the code.

Various Utility programs are provided with the library. These illustrate the use of the library and are useful in their own right. This library and the utilities have been tested with g++ 4.4 under Linux, with g++ 4.2 under Mac OS X, and with MS Visual Studio 2008 and 2010.

Matlab, Javascript, and Python interfaces are provided to portions of GeographicLib; see Other interfaces (Javascript, Python, Matlab, Octave).

The section Geodesics on the ellipsoid documents the method of solving the geodesic problem.

The section Transverse Mercator projection documents various properties of this projection.

Undoubtedly, bugs lurk in this code and in the documentation. Please report any you find to <charles@karney.com>.

Forward to Installing GeographicLib. Up to Contents.
geographiclib-1.21/doc/html/CassiniSoldner_8cpp.html0000644000175000017500000001137311745620414022336 0ustar frankiefrankie GeographicLib: CassiniSoldner.cpp File Reference
CassiniSoldner.cpp File Reference

Implementation for GeographicLib::CassiniSoldner class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_CASSINISOLDNER_CPP   "$Id: 2823df38f3e31fd8b882e2f55ad72d6419b03246 $"

Detailed Description

Implementation for GeographicLib::CassiniSoldner class.

Copyright (c) Charles Karney (2009-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file CassiniSoldner.cpp.


Define Documentation

#define GEOGRAPHICLIB_CASSINISOLDNER_CPP   "$Id: 2823df38f3e31fd8b882e2f55ad72d6419b03246 $"

Definition at line 12 of file CassiniSoldner.cpp.

geographiclib-1.21/doc/html/MagneticField_8cpp.html0000644000175000017500000001632411745620414022112 0ustar frankiefrankie GeographicLib: MagneticField.cpp File Reference
MagneticField.cpp File Reference

Command line utility for evaluating magnetic fields. More...

#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
#include <GeographicLib/MagneticModel.hpp>
#include <GeographicLib/MagneticCircle.hpp>
#include <GeographicLib/DMS.hpp>
#include <GeographicLib/Utility.hpp>
#include "MagneticField.usage"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Detailed Description

Command line utility for evaluating magnetic fields.

Copyright (c) Charles Karney (2011, 2012) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Compile and link with g++ -g -O3 -I../include -I../man -o MagneticField \ MagneticField.cpp \ ../src/CircularEngine.cpp \ ../src/DMS.cpp \ ../src/Geocentric.cpp \ ../src/MagneticCircle.cpp \ ../src/MagneticModel.cpp \ ../src/SphericalEngine.cpp \ ../src/Utility.cpp

See the man page for usage information.

Definition in file MagneticField.cpp.


Function Documentation

geographiclib-1.21/doc/html/classGeographicLib_1_1GravityModel.html0000644000175000017500000022532011745620414025177 0ustar frankiefrankie GeographicLib: GeographicLib::GravityModel Class Reference
GeographicLib::GravityModel Class Reference

Model of the earth's gravity field. More...

#include <GeographicLib/GravityModel.hpp>

List of all members.

Public Types

enum  mask {
  NONE, GRAVITY, DISTURBANCE, DISTURBING_POTENTIAL,
  SPHERICAL_ANOMALY, GEOID_HEIGHT, ALL
}

Public Member Functions

Setting up the gravity model
 GravityModel (const std::string &name, const std::string &path="")
Compute gravity in geodetic coordinates
Math::real Gravity (real lat, real lon, real h, real &gx, real &gy, real &gz) const throw ()
Math::real Disturbance (real lat, real lon, real h, real &deltax, real &deltay, real &deltaz) const throw ()
Math::real GeoidHeight (real lat, real lon) const throw ()
void SphericalAnomaly (real lat, real lon, real h, real &Dg01, real &xi, real &eta) const throw ()
Compute gravity in geocentric coordinates
Math::real W (real X, real Y, real Z, real &gX, real &gY, real &gZ) const throw ()
Math::real V (real X, real Y, real Z, real &GX, real &GY, real &GZ) const throw ()
Math::real T (real X, real Y, real Z, real &deltaX, real &deltaY, real &deltaZ) const throw ()
Math::real T (real X, real Y, real Z) const throw ()
Math::real U (real X, real Y, real Z, real &gammaX, real &gammaY, real &gammaZ) const throw ()
Math::real Phi (real X, real Y, real &fX, real &fY) const throw ()
Compute gravity on a circle of constant latitude
GravityCircle Circle (real lat, real h, unsigned caps=ALL) const
Inspector functions
const NormalGravityReferenceEllipsoid () const throw ()
const std::string & Description () const throw ()
const std::string & DateTime () const throw ()
const std::string & GravityFile () const throw ()
const std::string & GravityModelName () const throw ()
const std::string & GravityModelDirectory () const throw ()
Math::real MajorRadius () const throw ()
Math::real MassConstant () const throw ()
Math::real ReferenceMassConstant () const throw ()
Math::real AngularVelocity () const throw ()
Math::real Flattening () const throw ()

Static Public Member Functions

static std::string DefaultGravityPath ()
static std::string DefaultGravityName ()

Friends

class GravityCircle

Detailed Description

Model of the earth's gravity field.

Evaluate the earth's gravity field according to a model. The supported models treat only the gravitational field exterior to the mass of the earth. When computing the field at points near (but above) the surface of the earth a small correction can be applied to account for the mass of the atomsphere above the point in question; see The effect of the mass of the atmosphere. Determining the geoid height entails correcting for the mass of the earth above the geoid. The egm96 and egm2008 include separate correction terms to account for this mass.

Definitions and terminology (from Heiskanen and Moritz, Sec 2-13):

  • V = gravitational potential;
  • Phi = rotational potential;
  • W = V + Phi = T + U = total potential;
  • V0 = normal gravitation potential;
  • U = V0 + Phi = total normal potential;
  • T = W - U = V - V0 = anomalous or disturbing potential;
  • g = grad W = gamma + delta;
  • f = grad Phi;
  • Gamma = grad V0;
  • gamma = grad U;
  • delta = grad T = gravity disturbance vector = gP - gammaP;
  • delta g = gravity disturbance = gP - gammaP;
  • Delta g = gravity anomaly vector = gP - gammaQ; here the line PQ is perpendicular to ellipsoid and the potential at P equals the normal potential at Q;
  • Delta g = gravity anomaly = gP - gammaQ;
  • (xi, eta) deflection of the vertical, the difference in directions of gP and gammaQ, xi = NS, eta = EW.
  • X, Y, Z, geocentric coordinates;
  • x, y, z, local cartesian coordinates used to denote the east, north and up directions.

See Gravity models for details of how to install the gravity model and the data format.

References:

  • W. A. Heiskanen and H. Moritz, Physical Geodesy (Freeman, San Francisco, 1967).

Example of use:

// Example of using the GeographicLib::GravityModel class
// $Id: fde4f431ed9c43e9e0ec797e302f32a373cdd219 $

#include <iostream>
#include <exception>
#include <GeographicLib/GravityModel.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    GravityModel grav("egm96");
    double lat = 27.99, lon = 86.93, h = 8820; // Mt Everest
    double gx, gy, gz;
    grav.Gravity(lat,lon, h, gx, gy, gz);
    cout << gx << " " << gy << " " << gz << "\n";
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Gravity is a command-line utility providing access to the functionality of GravityModel and GravityCircle.


Member Enumeration Documentation

Bit masks for the capabilities to be given to the GravityCircle object produced by Circle.

Enumerator:
NONE 

No capabilities.

GRAVITY 

Allow calls to GravityCircle::Gravity, GravityCircle::W, and GravityCircle::V.

DISTURBANCE 

Allow calls to GravityCircle::Disturbance and GravityCircle::T.

DISTURBING_POTENTIAL 

Allow calls to GravityCircle::T(real lon) (i.e., computing the disturbing potential and not the gravity disturbance vector).

SPHERICAL_ANOMALY 

Allow calls to GravityCircle::SphericalAnomaly.

GEOID_HEIGHT 

Allow calls to GravityCircle::GeoidHeight.

ALL 

All capabilities.

Definition at line 122 of file GravityModel.hpp.


Constructor & Destructor Documentation

GeographicLib::GravityModel::GravityModel ( const std::string &  name,
const std::string &  path = "" 
) [explicit]

Construct a gravity model.

Parameters:
[in]namethe name of the model.
[in]path(optional) directory for data file.

A filename is formed by appending ".egm" (World Gravity Model) to the name. If path is specified (and is non-empty), then the file is loaded from directory, path. Otherwise the path is given by DefaultGravityPath(). This may throw an exception because the file does not exist, is unreadable, or is corrupt.

This file contains the metadata which specifies the properties of the model. The coefficients for the spherical harmonic sums are obtained from a file obtained by appending ".cof" to metadata file (so the filename ends in ".egm.cof").

Definition at line 43 of file GravityModel.cpp.

References DefaultGravityPath(), GeographicLib::SphericalEngine::coeff::readcoeffs(), GeographicLib::SphericalHarmonic::Coefficients(), GeographicLib::SphericalEngine::coeff::nmx(), GeographicLib::Math::sq(), GeographicLib::NormalGravity::MassConstant(), GeographicLib::SphericalEngine::coeff::N(), and GeographicLib::SphericalEngine::coeff::mmx().


Member Function Documentation

Math::real GeographicLib::GravityModel::Gravity ( real  lat,
real  lon,
real  h,
real &  gx,
real &  gy,
real &  gz 
) const throw ()

Evaluate the gravity at an arbitrary point above (or below) the ellipsoid.

Parameters:
[in]latthe geographic latitude (degrees).
[in]lonthe geographic longitude (degrees).
[in]hthe height above the ellipsoid (meters).
[out]gxthe easterly component of the acceleration (m s-2).
[out]gythe northerly component of the acceleration (m s-2).
[out]gzthe upward component of the acceleration (m s-2); this is usually negative.
Returns:
W the sum of the gravitational and centrifugal potentials.

The function includes the effects of the earth's rotation.

Definition at line 291 of file GravityModel.cpp.

Referenced by main().

Math::real GeographicLib::GravityModel::Disturbance ( real  lat,
real  lon,
real  h,
real &  deltax,
real &  deltay,
real &  deltaz 
) const throw ()

Evaluate the gravity disturbance vector at an arbitrary point above (or below) the ellipsoid.

Parameters:
[in]latthe geographic latitude (degrees).
[in]lonthe geographic longitude (degrees).
[in]hthe height above the ellipsoid (meters).
[out]deltaxthe easterly component of the disturbance vector (m s-2).
[out]deltaythe northerly component of the disturbance vector (m s-2).
[out]deltazthe upward component of the disturbance vector (m s-2).
Returns:
T the corresponding disturbing potential.

Definition at line 299 of file GravityModel.cpp.

Referenced by main().

Math::real GeographicLib::GravityModel::GeoidHeight ( real  lat,
real  lon 
) const throw ()

Evaluate the geoid height.

Parameters:
[in]latthe geographic latitude (degrees).
[in]lonthe geographic longitude (degrees).
Returns:
N the height of the geoid above the ReferenceEllipsoid() (meters).

This calls NormalGravity::U for ReferenceEllipsoid(). Some approximations are made in computing the geoid height so that the results of the NGA codes are reproduced accurately. Details are given in Details of the geoid height and anomaly calculations.

Definition at line 277 of file GravityModel.cpp.

References GeographicLib::Math::hypot().

Referenced by main().

void GeographicLib::GravityModel::SphericalAnomaly ( real  lat,
real  lon,
real  h,
real &  Dg01,
real &  xi,
real &  eta 
) const throw ()

Evaluate the components of the gravity anomaly vector using the spherical approximation.

Parameters:
[in]latthe geographic latitude (degrees).
[in]lonthe geographic longitude (degrees).
[in]hthe height above the ellipsoid (meters).
[out]Dg01the gravity anomaly (m s-2).
[out]xithe northerly component of the deflection of the vertical (degrees).
[out]etathe easterly component of the deflection of the vertical (degrees).

The spherical approximation (see Heiskanen and Moritz, Sec 2-14) is used so that the results of the NGA codes are reproduced accurately. approximations used here. Details are given in Details of the geoid height and anomaly calculations.

Definition at line 250 of file GravityModel.cpp.

References GeographicLib::Math::hypot().

Referenced by main().

Math::real GeographicLib::GravityModel::W ( real  X,
real  Y,
real  Z,
real &  gX,
real &  gY,
real &  gZ 
) const throw ()

Evaluate the components of the acceleration due to gravity and the centrifugal acceleration in geocentric coordinates.

Parameters:
[in]Xgeocentric coordinate of point (meters).
[in]Ygeocentric coordinate of point (meters).
[in]Zgeocentric coordinate of point (meters).
[out]gXthe X component of the acceleration (m s-2).
[out]gYthe Y component of the acceleration (m s-2).
[out]gZthe Z component of the acceleration (m s-2).
Returns:
W = V + Phi the sum of the gravitational and centrifugal potentials (m2 s-2).

This calls NormalGravity::U for ReferenceEllipsoid().

Definition at line 241 of file GravityModel.cpp.

Math::real GeographicLib::GravityModel::V ( real  X,
real  Y,
real  Z,
real &  GX,
real &  GY,
real &  GZ 
) const throw ()

Evaluate the components of the acceleration due to gravity in geocentric coordinates.

Parameters:
[in]Xgeocentric coordinate of point (meters).
[in]Ygeocentric coordinate of point (meters).
[in]Zgeocentric coordinate of point (meters).
[out]GXthe X component of the acceleration (m s-2).
[out]GYthe Y component of the acceleration (m s-2).
[out]GZthe Z component of the acceleration (m s-2).
Returns:
V = W - Phi the gravitational potential (m2 s-2).

Definition at line 229 of file GravityModel.cpp.

Math::real GeographicLib::GravityModel::T ( real  X,
real  Y,
real  Z,
real &  deltaX,
real &  deltaY,
real &  deltaZ 
) const throw () [inline]

Evaluate the components of the gravity disturbance in geocentric coordinates.

Parameters:
[in]Xgeocentric coordinate of point (meters).
[in]Ygeocentric coordinate of point (meters).
[in]Zgeocentric coordinate of point (meters).
[out]deltaXthe X component of the gravity disturbance (m s-2).
[out]deltaYthe Y component of the gravity disturbance (m s-2).
[out]deltaZthe Z component of the gravity disturbance (m s-2).
Returns:
T = W - U the disturbing potential (also called the anomalous potential) (m2 s-2).

Definition at line 322 of file GravityModel.hpp.

Math::real GeographicLib::GravityModel::T ( real  X,
real  Y,
real  Z 
) const throw () [inline]

Evaluate disturbing potential in geocentric coordinates.

Parameters:
[in]Xgeocentric coordinate of point (meters).
[in]Ygeocentric coordinate of point (meters).
[in]Zgeocentric coordinate of point (meters).
Returns:
T = W - U the disturbing potential (also called the anomalous potential) (m2 s-2).

Definition at line 335 of file GravityModel.hpp.

Math::real GeographicLib::GravityModel::U ( real  X,
real  Y,
real  Z,
real &  gammaX,
real &  gammaY,
real &  gammaZ 
) const throw () [inline]

Evaluate the components of the acceleration due to normal gravity and the centrifugal acceleration in geocentric coordinates.

Parameters:
[in]Xgeocentric coordinate of point (meters).
[in]Ygeocentric coordinate of point (meters).
[in]Zgeocentric coordinate of point (meters).
[out]gammaXthe X component of the normal acceleration (m s-2).
[out]gammaYthe Y component of the normal acceleration (m s-2).
[out]gammaZthe Z component of the normal acceleration (m s-2).
Returns:
U = V0 + Phi the sum of the normal gravitational and centrifugal potentials (m2 s-2).

This calls NormalGravity::U for ReferenceEllipsoid().

Definition at line 359 of file GravityModel.hpp.

Math::real GeographicLib::GravityModel::Phi ( real  X,
real  Y,
real &  fX,
real &  fY 
) const throw () [inline]

Evaluate the centrifugal acceleration in geocentric coordinates.

Parameters:
[in]Xgeocentric coordinate of point (meters).
[in]Ygeocentric coordinate of point (meters).
[out]fXthe X component of the centrifugal acceleration (m s-2).
[out]fYthe Y component of the centrifugal acceleration (m s-2).
Returns:
Phi the centrifugal potential (m2 s-2).

This calls NormalGravity::Phi for ReferenceEllipsoid().

Definition at line 376 of file GravityModel.hpp.

GravityCircle GeographicLib::GravityModel::Circle ( real  lat,
real  h,
unsigned  caps = ALL 
) const

Create a GravityCircle object to allow the gravity field at many points with constant lat and h and varying lon to be computed efficiently.

Parameters:
[in]latlatitude of the point (degrees).
[in]hthe height of the point above the ellipsoid (meters).
[in]capsbitor'ed combination of GravityModel::mask values specifying the capabilities of the resulting GravityCircle object.
Returns:
a GravityCircle object whose member functions computes the gravitational field at a particular values of lon.

The GravityModel::mask values are

The default value of caps is GravityModel::ALL which turns on all the capabilities. If an unsupported function is invoked, it will return NaNs. Note that GravityModel::GEOID_HEIGHT will only be honored if h = 0.

If the field at several points on a circle of latitude need to be calculated then creating a GravityCircle object and using its member functions will be substantially faster, especially for high-degree models. See Geoid heights on a multi-processor system for an example of using GravityCircle (together with OpenMP) to speed up the computation of geoid heights.

Definition at line 309 of file GravityModel.cpp.

References GeographicLib::NormalGravity::Earth(), GeographicLib::Math::hypot(), GeographicLib::NormalGravity::SurfaceGravity(), GeographicLib::NormalGravity::U(), GeographicLib::NormalGravity::Phi(), GravityCircle, GeographicLib::SphericalHarmonic::Circle(), and GeographicLib::SphericalHarmonic1::Circle().

Referenced by main().

const NormalGravity& GeographicLib::GravityModel::ReferenceEllipsoid ( ) const throw () [inline]
Returns:
the NormalGravity object for the reference ellipsoid.

Definition at line 423 of file GravityModel.hpp.

const std::string& GeographicLib::GravityModel::Description ( ) const throw () [inline]
Returns:
the description of the gravity model, if available, in the data file; if absent, return "NONE".

Definition at line 429 of file GravityModel.hpp.

Referenced by main().

const std::string& GeographicLib::GravityModel::DateTime ( ) const throw () [inline]
Returns:
date of the model; if absent, return "UNKNOWN".

Definition at line 434 of file GravityModel.hpp.

Referenced by main().

const std::string& GeographicLib::GravityModel::GravityFile ( ) const throw () [inline]
Returns:
full file name used to load the gravity model.

Definition at line 439 of file GravityModel.hpp.

Referenced by main().

const std::string& GeographicLib::GravityModel::GravityModelName ( ) const throw () [inline]
Returns:
"name" used to load the gravity model (from the first argument of the constructor, but this may be overridden by the model file).

Definition at line 445 of file GravityModel.hpp.

Referenced by main().

const std::string& GeographicLib::GravityModel::GravityModelDirectory ( ) const throw () [inline]
Returns:
directory used to load the gravity model.

Definition at line 450 of file GravityModel.hpp.

Math::real GeographicLib::GravityModel::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters).

Definition at line 455 of file GravityModel.hpp.

Math::real GeographicLib::GravityModel::MassConstant ( ) const throw () [inline]
Returns:
GM the mass constant of the model (m3 s-2); this is the product of G the gravitational constant and M the mass of the earth (usually including the mass of the earth's atmosphere).

Definition at line 463 of file GravityModel.hpp.

Math::real GeographicLib::GravityModel::ReferenceMassConstant ( ) const throw () [inline]
Returns:
GM the mass constant of the ReferenceEllipsoid() (m3 s-2).

Definition at line 469 of file GravityModel.hpp.

Math::real GeographicLib::GravityModel::AngularVelocity ( ) const throw () [inline]
Returns:
omega the angular velocity of the model and the ReferenceEllipsoid() (rad s-1).

Definition at line 476 of file GravityModel.hpp.

Math::real GeographicLib::GravityModel::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid.

Definition at line 482 of file GravityModel.hpp.

std::string GeographicLib::GravityModel::DefaultGravityPath ( ) [static]
Returns:
the default path for gravity model data files.

This is the value of the environment variable GRAVITY_PATH, if set; otherwise, it is $GEOGRAPHICLIB_DATA/gravity if the environment variable GEOGRAPHICLIB_DATA is set; otherwise, it is a compile-time default (/usr/local/share/GeographicLib/gravity on non-Windows systems and C:/Documents and Settings/All Users/Application Data/GeographicLib/gravity on Windows systems).

Definition at line 343 of file GravityModel.cpp.

References GEOGRAPHICLIB_DATA.

Referenced by main(), and GravityModel().

std::string GeographicLib::GravityModel::DefaultGravityName ( ) [static]
Returns:
the default name for the gravity model.

This is the value of the environment variable GRAVITY_NAME, if set, otherwise, it is "egm96". The GravityModel class does not use this function; it is just provided as a convenience for a calling program when constructing a GravityModel object.

Definition at line 356 of file GravityModel.cpp.

References GRAVITY_DEFAULT_NAME.

Referenced by main().


Friends And Related Function Documentation

friend class GravityCircle [friend]

Definition at line 90 of file GravityModel.hpp.

Referenced by Circle().


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/Geocentric_8hpp_source.html0000644000175000017500000010644511745620414023072 0ustar frankiefrankie GeographicLib: Geocentric.hpp Source File
Geocentric.hpp
Go to the documentation of this file.
00001 /**
00002  * \file Geocentric.hpp
00003  * \brief Header for GeographicLib::Geocentric class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_GEOCENTRIC_HPP)
00011 #define GEOGRAPHICLIB_GEOCENTRIC_HPP \
00012   "$Id: e9f709c85e61f60509c492429061cba04350eea8 $"
00013 
00014 #include <vector>
00015 #include <algorithm>
00016 #include <GeographicLib/Constants.hpp>
00017 
00018 namespace GeographicLib {
00019 
00020   /**
00021    * \brief %Geocentric coordinates
00022    *
00023    * Convert between geodetic coordinates latitude = \e lat, longitude = \e
00024    * lon, height = \e h (measured vertically from the surface of the ellipsoid)
00025    * to geocentric coordinates (\e X, \e Y, \e Z).  The origin of geocentric
00026    * coordinates is at the center of the earth.  The \e Z axis goes thru the
00027    * north pole, \e lat = 90<sup>o</sup>.  The \e X axis goes thru \e lat = 0,
00028    * \e lon = 0.  %Geocentric coordinates are also known as earth centered,
00029    * earth fixed (ECEF) coordinates.
00030    *
00031    * The conversion from geographic to geocentric coordinates is
00032    * straightforward.  For the reverse transformation we use
00033    * - H. Vermeille,
00034    *   <a href="http://dx.doi.org/10.1007/s00190-002-0273-6"> Direct
00035    *   transformation from geocentric coordinates to geodetic coordinates</a>,
00036    *   J. Geodesy 76, 451&ndash;454 (2002).
00037    * .
00038    * Several changes have been made to ensure that the method returns accurate
00039    * results for all finite inputs (even if \e h is infinite).  The changes are
00040    * described in Appendix B of
00041    * - C. F. F. Karney,
00042    *   <a href="http://arxiv.org/abs/1102.1215v1">Geodesics
00043    *   on an ellipsoid of revolution</a>,
00044    *   Feb. 2011;
00045    *   preprint
00046    *   <a href="http://arxiv.org/abs/1102.1215v1">arxiv:1102.1215v1</a>.
00047    * .
00048    * See \ref geocentric for more information.
00049    *
00050    * The errors in these routines are close to round-off.  Specifically, for
00051    * points within 5000 km of the surface of the ellipsoid (either inside or
00052    * outside the ellipsoid), the error is bounded by 7 nm (7 nanometers) for
00053    * the WGS84 ellipsoid.  See \ref geocentric for further information on the
00054    * errors.
00055    *
00056    * Example of use:
00057    * \include example-Geocentric.cpp
00058    *
00059    * <a href="CartConvert.1.html">CartConvert</a> is a command-line utility
00060    * providing access to the functionality of Geocentric and LocalCartesian.
00061    **********************************************************************/
00062 
00063   class GEOGRAPHIC_EXPORT Geocentric {
00064   private:
00065     typedef Math::real real;
00066     friend class LocalCartesian;
00067     friend class MagneticCircle; // MagneticCircle uses Rotation
00068     friend class MagneticModel;  // MagneticModel uses IntForward
00069     friend class GravityCircle;  // GravityCircle uses Rotation
00070     friend class GravityModel;   // GravityModel uses IntForward
00071     friend class NormalGravity;  // NormalGravity uses IntForward
00072     friend class SphericalHarmonic;
00073     friend class SphericalHarmonic1;
00074     friend class SphericalHarmonic2;
00075     static const size_t dim_ = 3;
00076     static const size_t dim2_ = dim_ * dim_;
00077     real _a, _f, _e2, _e2m, _e2a, _e4a, _maxrad;
00078     static void Rotation(real sphi, real cphi, real slam, real clam,
00079                          real M[dim2_]) throw();
00080     static void Rotate(real M[dim2_], real x, real y, real z,
00081                        real& X, real& Y, real& Z) throw() {
00082       // Perform [X,Y,Z]^t = M.[x,y,z]^t
00083       // (typically local cartesian to geocentric)
00084       X = M[0] * x + M[1] * y + M[2] * z;
00085       Y = M[3] * x + M[4] * y + M[5] * z;
00086       Z = M[6] * x + M[7] * y + M[8] * z;
00087     }
00088     static void Unrotate(real M[dim2_], real X, real Y, real Z,
00089                          real& x, real& y, real& z) throw()  {
00090       // Perform [x,y,z]^t = M^t.[X,Y,Z]^t
00091       // (typically geocentric to local cartesian)
00092       x = M[0] * X + M[3] * Y + M[6] * Z;
00093       y = M[1] * X + M[4] * Y + M[7] * Z;
00094       z = M[2] * X + M[5] * Y + M[8] * Z;
00095     }
00096     void IntForward(real lat, real lon, real h, real& X, real& Y, real& Z,
00097                     real M[dim2_]) const throw();
00098     void IntReverse(real X, real Y, real Z, real& lat, real& lon, real& h,
00099                     real M[dim2_]) const throw();
00100 
00101   public:
00102 
00103     /**
00104      * Constructor for a ellipsoid with
00105      *
00106      * @param[in] a equatorial radius (meters).
00107      * @param[in] f flattening of ellipsoid.  Setting \e f = 0 gives a sphere.
00108      *   Negative \e f gives a prolate ellipsoid.  If \e f > 1, set flattening
00109      *   to 1/\e f.
00110      *
00111      * An exception is thrown if either of the axes of the ellipsoid is
00112      * non-positive.
00113      **********************************************************************/
00114     Geocentric(real a, real f);
00115 
00116     /**
00117      * A default constructor (for use by NormalGravity).
00118      **********************************************************************/
00119     Geocentric() : _a(-1) {}
00120 
00121     /**
00122      * Convert from geodetic to geocentric coordinates.
00123      *
00124      * @param[in] lat latitude of point (degrees).
00125      * @param[in] lon longitude of point (degrees).
00126      * @param[in] h height of point above the ellipsoid (meters).
00127      * @param[out] X geocentric coordinate (meters).
00128      * @param[out] Y geocentric coordinate (meters).
00129      * @param[out] Z geocentric coordinate (meters).
00130      *
00131      * \e lat should be in the range [-90, 90]; \e lon and \e lon0 should be in
00132      * the range [-180, 360].
00133      **********************************************************************/
00134     void Forward(real lat, real lon, real h, real& X, real& Y, real& Z)
00135       const throw() {
00136       if (Init())
00137         IntForward(lat, lon, h, X, Y, Z, NULL);
00138     }
00139 
00140     /**
00141      * Convert from geodetic to geocentric coordinates and return rotation
00142      * matrix.
00143      *
00144      * @param[in] lat latitude of point (degrees).
00145      * @param[in] lon longitude of point (degrees).
00146      * @param[in] h height of point above the ellipsoid (meters).
00147      * @param[out] X geocentric coordinate (meters).
00148      * @param[out] Y geocentric coordinate (meters).
00149      * @param[out] Z geocentric coordinate (meters).
00150      * @param[out] M if the length of the vector is 9, fill with the rotation
00151      *   matrix in row-major order.
00152      *
00153      * Let \e v be a unit vector located at (\e lat, \e lon, \e h).  We can
00154      * express \e v as \e column vectors in one of two ways
00155      * - in east, north, up coordinates (where the components are relative to a
00156      *   local coordinate system at (\e lat, \e lon, \e h)); call this
00157      *   representation \e v1.
00158      * - in geocentric \e X, \e Y, \e Z coordinates; call this representation
00159      *   \e v0.
00160      * .
00161      * Then we have \e v0 = \e M . \e v1.
00162      **********************************************************************/
00163     void Forward(real lat, real lon, real h, real& X, real& Y, real& Z,
00164                  std::vector<real>& M)
00165       const throw() {
00166       if (!Init())
00167         return;
00168       if (M.end() == M.begin() + dim2_) {
00169         real t[dim2_];
00170         IntForward(lat, lon, h, X, Y, Z, t);
00171         copy(t, t + dim2_, M.begin());
00172       } else
00173         IntForward(lat, lon, h, X, Y, Z, NULL);
00174     }
00175 
00176     /**
00177      * Convert from geocentric to geodetic to coordinates.
00178      *
00179      * @param[in] X geocentric coordinate (meters).
00180      * @param[in] Y geocentric coordinate (meters).
00181      * @param[in] Z geocentric coordinate (meters).
00182      * @param[out] lat latitude of point (degrees).
00183      * @param[out] lon longitude of point (degrees).
00184      * @param[out] h height of point above the ellipsoid (meters).
00185      *
00186      * In general there are multiple solutions and the result which maximizes
00187      * \e h is returned.  If there are still multiple solutions with different
00188      * latitudes (applies only if \e Z = 0), then the solution with \e lat > 0
00189      * is returned.  If there are still multiple solutions with different
00190      * longitudes (applies only if \e X = \e Y = 0) then \e lon = 0 is
00191      * returned.  The value of \e h returned satisfies \e h >= - \e a (1 -
00192      * <i>e</i><sup>2</sup>) / sqrt(1 - <i>e</i><sup>2</sup> sin<sup>2</sup>\e
00193      * lat).  The value of \e lon returned is in the range [-180, 180).
00194      **********************************************************************/
00195     void Reverse(real X, real Y, real Z, real& lat, real& lon, real& h)
00196       const throw() {
00197       if (Init())
00198         IntReverse(X, Y, Z, lat, lon, h, NULL);
00199     }
00200 
00201     /**
00202      * Convert from geocentric to geodetic to coordinates.
00203      *
00204      * @param[in] X geocentric coordinate (meters).
00205      * @param[in] Y geocentric coordinate (meters).
00206      * @param[in] Z geocentric coordinate (meters).
00207      * @param[out] lat latitude of point (degrees).
00208      * @param[out] lon longitude of point (degrees).
00209      * @param[out] h height of point above the ellipsoid (meters).
00210      * @param[out] M if the length of the vector is 9, fill with the rotation
00211      *   matrix in row-major order.
00212      *
00213      * Let \e v be a unit vector located at (\e lat, \e lon, \e h).  We can
00214      * express \e v as \e column vectors in one of two ways
00215      * - in east, north, up coordinates (where the components are relative to a
00216      *   local coordinate system at (\e lat, \e lon, \e h)); call this
00217      *   representation \e v1.
00218      * - in geocentric \e X, \e Y, \e Z coordinates; call this representation
00219      *   \e v0.
00220      * .
00221      * Then we have \e v1 = \e M^T . \e v0, where \e M^T is the transpose of \e
00222      * M.
00223      **********************************************************************/
00224     void Reverse(real X, real Y, real Z, real& lat, real& lon, real& h,
00225                  std::vector<real>& M)
00226       const throw() {
00227       if (!Init())
00228         return;
00229       if (M.end() == M.begin() + dim2_) {
00230         real t[dim2_];
00231         IntReverse(X, Y, Z, lat, lon, h, t);
00232         copy(t, t + dim2_, M.begin());
00233       } else
00234         IntReverse(X, Y, Z, lat, lon, h, NULL);
00235     }
00236 
00237     /** \name Inspector functions
00238      **********************************************************************/
00239     ///@{
00240     /**
00241      * @return true if the object has been initialized.
00242      **********************************************************************/
00243     bool Init() const throw() { return _a > 0; }
00244     /**
00245      * @return \e a the equatorial radius of the ellipsoid (meters).  This is
00246      *   the value used in the constructor.
00247      **********************************************************************/
00248     Math::real MajorRadius() const throw()
00249     { return Init() ? _a : Math::NaN<real>(); }
00250 
00251     /**
00252      * @return \e f the  flattening of the ellipsoid.  This is the
00253      *   value used in the constructor.
00254      **********************************************************************/
00255     Math::real Flattening() const throw()
00256     { return Init() ? _f : Math::NaN<real>(); }
00257     ///@}
00258 
00259     /// \cond SKIP
00260     /**
00261      * <b>DEPRECATED</b>
00262      * @return \e r the inverse flattening of the ellipsoid.
00263      **********************************************************************/
00264     Math::real InverseFlattening() const throw()
00265     { return Init() ? 1/_f : Math::NaN<real>(); }
00266     /// \endcond
00267 
00268     /**
00269      * A global instantiation of Geocentric with the parameters for the WGS84
00270      * ellipsoid.
00271      **********************************************************************/
00272     static const Geocentric WGS84;
00273   };
00274 
00275 } // namespace GeographicLib
00276 
00277 #endif  // GEOGRAPHICLIB_GEOCENTRIC_HPP
geographiclib-1.21/doc/html/GeodesicLine_8cpp_source.html0000644000175000017500000006276711745620414023345 0ustar frankiefrankie GeographicLib: GeodesicLine.cpp Source File
GeodesicLine.cpp
Go to the documentation of this file.
00001 /**
00002  * \file GeodesicLine.cpp
00003  * \brief Implementation for GeographicLib::GeodesicLine class
00004  *
00005  * Copyright (c) Charles Karney (2009-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  *
00009  * This is a reformulation of the geodesic problem.  The notation is as
00010  * follows:
00011  * - at a general point (no suffix or 1 or 2 as suffix)
00012  *   - phi = latitude
00013  *   - beta = latitude on auxiliary sphere
00014  *   - omega = longitude on auxiliary sphere
00015  *   - lambda = longitude
00016  *   - alpha = azimuth of great circle
00017  *   - sigma = arc length along great circle
00018  *   - s = distance
00019  *   - tau = scaled distance (= sigma at multiples of pi/2)
00020  * - at northwards equator crossing
00021  *   - beta = phi = 0
00022  *   - omega = lambda = 0
00023  *   - alpha = alpha0
00024  *   - sigma = s = 0
00025  * - a 12 suffix means a difference, e.g., s12 = s2 - s1.
00026  * - s and c prefixes mean sin and cos
00027  **********************************************************************/
00028 
00029 #include <GeographicLib/GeodesicLine.hpp>
00030 
00031 #define GEOGRAPHICLIB_GEODESICLINE_CPP \
00032   "$Id: d95fea8e73fd86fdc558e5b0397a97241cfe40c2 $"
00033 
00034 RCSID_DECL(GEOGRAPHICLIB_GEODESICLINE_CPP)
00035 RCSID_DECL(GEOGRAPHICLIB_GEODESICLINE_HPP)
00036 
00037 namespace GeographicLib {
00038 
00039   using namespace std;
00040 
00041   GeodesicLine::GeodesicLine(const Geodesic& g,
00042                              real lat1, real lon1, real azi1,
00043                              unsigned caps) throw()
00044     : _a(g._a)
00045     , _f(g._f)
00046     , _b(g._b)
00047     , _c2(g._c2)
00048     , _f1(g._f1)
00049       // Always allow latitude and azimuth
00050     , _caps(caps | LATITUDE | AZIMUTH)
00051   {
00052     azi1 = Geodesic::AngNormalize(azi1);
00053     // Guard against underflow in salp0
00054     azi1 = Geodesic::AngRound(azi1);
00055     lon1 = Geodesic::AngNormalize(lon1);
00056     _lat1 = lat1;
00057     _lon1 = lon1;
00058     _azi1 = azi1;
00059     // alp1 is in [0, pi]
00060     real alp1 = azi1 * Math::degree<real>();
00061     // Enforce sin(pi) == 0 and cos(pi/2) == 0.  Better to face the ensuing
00062     // problems directly than to skirt them.
00063     _salp1 =     azi1  == -180 ? 0 : sin(alp1);
00064     _calp1 = abs(azi1) ==   90 ? 0 : cos(alp1);
00065     real cbet1, sbet1, phi;
00066     phi = lat1 * Math::degree<real>();
00067     // Ensure cbet1 = +epsilon at poles
00068     sbet1 = _f1 * sin(phi);
00069     cbet1 = abs(lat1) == 90 ? Geodesic::tiny_ : cos(phi);
00070     Geodesic::SinCosNorm(sbet1, cbet1);
00071 
00072     // Evaluate alp0 from sin(alp1) * cos(bet1) = sin(alp0),
00073     _salp0 = _salp1 * cbet1; // alp0 in [0, pi/2 - |bet1|]
00074     // Alt: calp0 = hypot(sbet1, calp1 * cbet1).  The following
00075     // is slightly better (consider the case salp1 = 0).
00076     _calp0 = Math::hypot(_calp1, _salp1 * sbet1);
00077     // Evaluate sig with tan(bet1) = tan(sig1) * cos(alp1).
00078     // sig = 0 is nearest northward crossing of equator.
00079     // With bet1 = 0, alp1 = pi/2, we have sig1 = 0 (equatorial line).
00080     // With bet1 =  pi/2, alp1 = -pi, sig1 =  pi/2
00081     // With bet1 = -pi/2, alp1 =  0 , sig1 = -pi/2
00082     // Evaluate omg1 with tan(omg1) = sin(alp0) * tan(sig1).
00083     // With alp0 in (0, pi/2], quadrants for sig and omg coincide.
00084     // No atan2(0,0) ambiguity at poles since cbet1 = +epsilon.
00085     // With alp0 = 0, omg1 = 0 for alp1 = 0, omg1 = pi for alp1 = pi.
00086     _ssig1 = sbet1; _somg1 = _salp0 * sbet1;
00087     _csig1 = _comg1 = sbet1 != 0 || _calp1 != 0 ? cbet1 * _calp1 : 1;
00088     Geodesic::SinCosNorm(_ssig1, _csig1); // sig1 in (-pi, pi]
00089     Geodesic::SinCosNorm(_somg1, _comg1);
00090 
00091     _k2 = Math::sq(_calp0) * g._ep2;
00092     real eps = _k2 / (2 * (1 + sqrt(1 + _k2)) + _k2);
00093 
00094     if (_caps & CAP_C1) {
00095       _A1m1 = Geodesic::A1m1f(eps);
00096       Geodesic::C1f(eps, _C1a);
00097       _B11 = Geodesic::SinCosSeries(true, _ssig1, _csig1, _C1a, nC1_);
00098       real s = sin(_B11), c = cos(_B11);
00099       // tau1 = sig1 + B11
00100       _stau1 = _ssig1 * c + _csig1 * s;
00101       _ctau1 = _csig1 * c - _ssig1 * s;
00102       // Not necessary because C1pa reverts C1a
00103       //    _B11 = -SinCosSeries(true, _stau1, _ctau1, _C1pa, nC1p_);
00104     }
00105 
00106     if (_caps & CAP_C1p)
00107       Geodesic::C1pf(eps, _C1pa);
00108 
00109     if (_caps & CAP_C2) {
00110       _A2m1 = Geodesic::A2m1f(eps);
00111       Geodesic::C2f(eps, _C2a);
00112       _B21 = Geodesic::SinCosSeries(true, _ssig1, _csig1, _C2a, nC2_);
00113     }
00114 
00115     if (_caps & CAP_C3) {
00116       g.C3f(eps, _C3a);
00117       _A3c = -_f * _salp0 * g.A3f(eps);
00118       _B31 = Geodesic::SinCosSeries(true, _ssig1, _csig1, _C3a, nC3_-1);
00119     }
00120 
00121     if (_caps & CAP_C4) {
00122       g.C4f(_k2, _C4a);
00123       // Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0)
00124       _A4 = Math::sq(_a) * _calp0 * _salp0 * g._e2;
00125       _B41 = Geodesic::SinCosSeries(false, _ssig1, _csig1, _C4a, nC4_);
00126     }
00127   }
00128 
00129   Math::real GeodesicLine::GenPosition(bool arcmode, real s12_a12,
00130                                        unsigned outmask,
00131                                        real& lat2, real& lon2, real& azi2,
00132                                        real& s12, real& m12,
00133                                        real& M12, real& M21,
00134                                        real& S12)
00135   const throw() {
00136     outmask &= _caps & OUT_ALL;
00137     if (!( Init() && (arcmode || (_caps & DISTANCE_IN & OUT_ALL)) ))
00138       // Uninitialized or impossible distance calculation requested
00139       return Math::NaN<real>();
00140 
00141     // Avoid warning about uninitialized B12.
00142     real sig12, ssig12, csig12, B12 = 0, AB1 = 0;
00143     if (arcmode) {
00144       // Interpret s12_a12 as spherical arc length
00145       sig12 = s12_a12 * Math::degree<real>();
00146       real s12a = abs(s12_a12);
00147       s12a -= 180 * floor(s12a / 180);
00148       ssig12 = s12a ==  0 ? 0 : sin(sig12);
00149       csig12 = s12a == 90 ? 0 : cos(sig12);
00150     } else {
00151       // Interpret s12_a12 as distance
00152       real
00153         tau12 = s12_a12 / (_b * (1 + _A1m1)),
00154         s = sin(tau12),
00155         c = cos(tau12);
00156       // tau2 = tau1 + tau12
00157       B12 = - Geodesic::SinCosSeries(true, _stau1 * c + _ctau1 * s,
00158                                      _ctau1 * c - _stau1 * s,
00159                                      _C1pa, nC1p_);
00160       sig12 = tau12 - (B12 - _B11);
00161       ssig12 = sin(sig12);
00162       csig12 = cos(sig12);
00163     }
00164 
00165     real omg12, lam12, lon12;
00166     real ssig2, csig2, sbet2, cbet2, somg2, comg2, salp2, calp2;
00167     // sig2 = sig1 + sig12
00168     ssig2 = _ssig1 * csig12 + _csig1 * ssig12;
00169     csig2 = _csig1 * csig12 - _ssig1 * ssig12;
00170     if (outmask & (DISTANCE | REDUCEDLENGTH | GEODESICSCALE)) {
00171       if (arcmode)
00172         B12 = Geodesic::SinCosSeries(true, ssig2, csig2, _C1a, nC1_);
00173       AB1 = (1 + _A1m1) * (B12 - _B11);
00174     }
00175     // sin(bet2) = cos(alp0) * sin(sig2)
00176     sbet2 = _calp0 * ssig2;
00177     // Alt: cbet2 = hypot(csig2, salp0 * ssig2);
00178     cbet2 = Math::hypot(_salp0, _calp0 * csig2);
00179     if (cbet2 == 0)
00180       // I.e., salp0 = 0, csig2 = 0.  Break the degeneracy in this case
00181       cbet2 = csig2 = Geodesic::tiny_;
00182     // tan(omg2) = sin(alp0) * tan(sig2)
00183     somg2 = _salp0 * ssig2; comg2 = csig2;  // No need to normalize
00184     // tan(alp0) = cos(sig2)*tan(alp2)
00185     salp2 = _salp0; calp2 = _calp0 * csig2; // No need to normalize
00186     // omg12 = omg2 - omg1
00187     omg12 = atan2(somg2 * _comg1 - comg2 * _somg1,
00188                   comg2 * _comg1 + somg2 * _somg1);
00189 
00190     if (outmask & DISTANCE)
00191       s12 = arcmode ? _b * ((1 + _A1m1) * sig12 + AB1) : s12_a12;
00192 
00193     if (outmask & LONGITUDE) {
00194       lam12 = omg12 + _A3c *
00195         ( sig12 + (Geodesic::SinCosSeries(true, ssig2, csig2, _C3a, nC3_-1)
00196                    - _B31));
00197       lon12 = lam12 / Math::degree<real>();
00198       // Can't use AngNormalize because longitude might have wrapped multiple
00199       // times.
00200       lon12 = lon12 - 360 * floor(lon12/360 + real(0.5));
00201       lon2 = Geodesic::AngNormalize(_lon1 + lon12);
00202     }
00203 
00204     if (outmask & LATITUDE)
00205       lat2 = atan2(sbet2, _f1 * cbet2) / Math::degree<real>();
00206 
00207     if (outmask & AZIMUTH)
00208       // minus signs give range [-180, 180). 0- converts -0 to +0.
00209       azi2 = 0 - atan2(-salp2, calp2) / Math::degree<real>();
00210 
00211     if (outmask & (REDUCEDLENGTH | GEODESICSCALE)) {
00212       real
00213         ssig1sq = Math::sq(_ssig1),
00214         ssig2sq = Math::sq( ssig2),
00215         w1 = sqrt(1 + _k2 * ssig1sq),
00216         w2 = sqrt(1 + _k2 * ssig2sq),
00217         B22 = Geodesic::SinCosSeries(true, ssig2, csig2, _C2a, nC2_),
00218         AB2 = (1 + _A2m1) * (B22 - _B21),
00219         J12 = (_A1m1 - _A2m1) * sig12 + (AB1 - AB2);
00220       if (outmask & REDUCEDLENGTH)
00221         // Add parens around (_csig1 * ssig2) and (_ssig1 * csig2) to ensure
00222         // accurate cancellation in the case of coincident points.
00223         m12 = _b * ((w2 * (_csig1 * ssig2) - w1 * (_ssig1 * csig2))
00224                   - _csig1 * csig2 * J12);
00225       if (outmask & GEODESICSCALE) {
00226         M12 = csig12 + (_k2 * (ssig2sq - ssig1sq) *  ssig2 / (w1 + w2)
00227                         - csig2 * J12) * _ssig1 / w1;
00228         M21 = csig12 - (_k2 * (ssig2sq - ssig1sq) * _ssig1 / (w1 + w2)
00229                         - _csig1 * J12) * ssig2 / w2;
00230       }
00231     }
00232 
00233     if (outmask & AREA) {
00234       real
00235         B42 = Geodesic::SinCosSeries(false, ssig2, csig2, _C4a, nC4_);
00236       real salp12, calp12;
00237       if (_calp0 == 0 || _salp0 == 0) {
00238         // alp12 = alp2 - alp1, used in atan2 so no need to normalized
00239         salp12 = salp2 * _calp1 - calp2 * _salp1;
00240         calp12 = calp2 * _calp1 + salp2 * _salp1;
00241         // The right thing appears to happen if alp1 = +/-180 and alp2 = 0, viz
00242         // salp12 = -0 and alp12 = -180.  However this depends on the sign being
00243         // attached to 0 correctly.  The following ensures the correct behavior.
00244         if (salp12 == 0 && calp12 < 0) {
00245           salp12 = Geodesic::tiny_ * _calp1;
00246           calp12 = -1;
00247         }
00248       } else {
00249         // tan(alp) = tan(alp0) * sec(sig)
00250         // tan(alp2-alp1) = (tan(alp2) -tan(alp1)) / (tan(alp2)*tan(alp1)+1)
00251         // = calp0 * salp0 * (csig1-csig2) / (salp0^2 + calp0^2 * csig1*csig2)
00252         // If csig12 > 0, write
00253         //   csig1 - csig2 = ssig12 * (csig1 * ssig12 / (1 + csig12) + ssig1)
00254         // else
00255         //   csig1 - csig2 = csig1 * (1 - csig12) + ssig12 * ssig1
00256         // No need to normalize
00257         salp12 = _calp0 * _salp0 *
00258           (csig12 <= 0 ? _csig1 * (1 - csig12) + ssig12 * _ssig1 :
00259            ssig12 * (_csig1 * ssig12 / (1 + csig12) + _ssig1));
00260         calp12 = Math::sq(_salp0) + Math::sq(_calp0) * _csig1 * csig2;
00261       }
00262       S12 = _c2 * atan2(salp12, calp12) + _A4 * (B42 - _B41);
00263     }
00264 
00265     return arcmode ? s12_a12 : sig12 / Math::degree<real>();
00266   }
00267 
00268 } // namespace GeographicLib
geographiclib-1.21/doc/html/classGeographicLib_1_1Gnomonic-members.html0000644000175000017500000001102411745620414025764 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::Gnomonic Member List
This is the complete list of members for GeographicLib::Gnomonic, including all inherited members.
Flattening() const GeographicLib::Gnomonic [inline]
Forward(real lat0, real lon0, real lat, real lon, real &x, real &y, real &azi, real &rk) const GeographicLib::Gnomonic
Forward(real lat0, real lon0, real lat, real lon, real &x, real &y) const GeographicLib::Gnomonic [inline]
Gnomonic(const Geodesic &earth=Geodesic::WGS84)GeographicLib::Gnomonic [inline, explicit]
MajorRadius() const GeographicLib::Gnomonic [inline]
Reverse(real lat0, real lon0, real x, real y, real &lat, real &lon, real &azi, real &rk) const GeographicLib::Gnomonic
Reverse(real lat0, real lon0, real x, real y, real &lat, real &lon) const GeographicLib::Gnomonic [inline]
geographiclib-1.21/doc/html/classGeographicLib_1_1CircularEngine.html0000644000175000017500000005605311745620414025470 0ustar frankiefrankie GeographicLib: GeographicLib::CircularEngine Class Reference
GeographicLib::CircularEngine Class Reference

Spherical Harmonic sums for a circle. More...

#include <GeographicLib/CircularEngine.hpp>

List of all members.

Public Member Functions

 CircularEngine ()
Math::real operator() (real coslon, real sinlon) const throw ()
Math::real operator() (real lon) const throw ()
Math::real operator() (real coslon, real sinlon, real &gradx, real &grady, real &gradz) const throw ()
Math::real operator() (real lon, real &gradx, real &grady, real &gradz) const throw ()

Friends

class SphericalEngine
class GravityCircle
class MagneticCircle

Detailed Description

Spherical Harmonic sums for a circle.

The class is a companion to SphericalEngine. If the results of a spherical harmonic sum are needed for several points on a circle of constant latitude lat and height h, then SphericalEngine::Circle can compute the inner sum, which is independent of longitude lon, and produce a CircularEngine object. CircularEngine::operator()() can then be used to perform the outer sum for particular vales of lon. This can lead to substantial improvements in computational speed for high degree sum (approximately by a factor of N / 2 where N is the maximum degree).

CircularEngine is tightly linked to the internals of SphericalEngine. For that reason, the constructor for this class is private. Use SphericalHarmonic::Circle, SphericalHarmonic1::Circle, and SphericalHarmonic2::Circle to create instances of this class.

CircularEngine stores the coefficients needed to allow the summation over order to be performed in 2 or 6 vectors of length M + 1 (depending on whether gradients are to be calculated). For this reason the constructor may throw a bad_alloc exception.

Example of use:

// Example of using the GeographicLib::CircularEngine class
// $Id: a742c5ccdb47b73fcd599dc1adda36a70450b5a5 $

#include <iostream>
#include <exception>
#include <vector>
#include <GeographicLib/CircularEngine.hpp>
#include <GeographicLib/SphericalHarmonic.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  // This computes the same value as example-SphericalHarmonic.cpp using a
  // CircularEngine (which will be faster if many values on a circle of
  // latitude are to be found).
  try {
    int N = 3;                  // The maxium degree
    double ca[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients
    vector<double> C(ca, ca + (N + 1) * (N + 2) / 2);
    double sa[] = {6, 5, 4, 3, 2, 1}; // sine coefficients
    vector<double> S(sa, sa + N * (N + 1) / 2);
    double a = 1;
    SphericalHarmonic h(C, S, N, a);
    double x = 2, y = 3, z = 1, p = Math::hypot(x, y);
    CircularEngine circ = h.Circle(p, z, true);
    double v, vx, vy, vz;
    v = circ(x/p, y/p, vx, vy, vz);
    cout << v << " " << vx << " " << vy << " " << vz << "\n";
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Constructor & Destructor Documentation

GeographicLib::CircularEngine::CircularEngine ( ) [inline]

A default constructor. CircularEngine::operator()() on the resulting object returns zero. The resulting object can be assigned to the result of SphericalHarmonic::Circle.

Definition at line 120 of file CircularEngine.hpp.


Member Function Documentation

Math::real GeographicLib::CircularEngine::operator() ( real  coslon,
real  sinlon 
) const throw () [inline]

Evaluate the sum for a particular longitude given in terms of its cosine and sine.

Parameters:
[in]coslonthe cosine of the longitude.
[in]sinlonthe sine of the longitude.
Returns:
V the value of the sum.

The arguments must satisfy coslon2 + sinlon2 = 1.

Definition at line 138 of file CircularEngine.hpp.

Math::real GeographicLib::CircularEngine::operator() ( real  lon) const throw () [inline]

Evaluate the sum for a particular longitude.

Parameters:
[in]lonthe longitude (degrees).
Returns:
V the value of the sum.

Definition at line 149 of file CircularEngine.hpp.

Math::real GeographicLib::CircularEngine::operator() ( real  coslon,
real  sinlon,
real &  gradx,
real &  grady,
real &  gradz 
) const throw () [inline]

Evaluate the sum and its gradient for a particular longitude given in terms of its cosine and sine.

Parameters:
[in]coslonthe cosine of the longitude.
[in]sinlonthe sine of the longitude.
[out]gradxx component of the gradient.
[out]gradyy component of the gradient.
[out]gradzz component of the gradient.
Returns:
V the value of the sum.

The gradients will only be computed if the CircularEngine object was created with this capability (e.g., via gradp = true in SphericalHarmonic::Circle). If not, gradx, etc., will not be touched. The arguments must satisfy coslon2 + sinlon2 = 1.

Definition at line 172 of file CircularEngine.hpp.

Math::real GeographicLib::CircularEngine::operator() ( real  lon,
real &  gradx,
real &  grady,
real &  gradz 
) const throw () [inline]

Evaluate the sum and its gradient for a particular longitude.

Parameters:
[in]lonthe longitude (degrees).
[out]gradxx component of the gradient.
[out]gradyy component of the gradient.
[out]gradzz component of the gradient.
Returns:
V the value of the sum.

The gradients will only be computed if the CircularEngine object was created with this capability (e.g., via gradp = true in SphericalHarmonic::Circle). If not, gradx, etc., will not be touched.

Definition at line 191 of file CircularEngine.hpp.


Friends And Related Function Documentation

friend class SphericalEngine [friend]

Definition at line 77 of file CircularEngine.hpp.

friend class GravityCircle [friend]

Definition at line 78 of file CircularEngine.hpp.

friend class MagneticCircle [friend]

Definition at line 79 of file CircularEngine.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/CassiniSoldner_8cpp_source.html0000644000175000017500000002553611745620414023724 0ustar frankiefrankie GeographicLib: CassiniSoldner.cpp Source File
CassiniSoldner.cpp
Go to the documentation of this file.
00001 /**
00002  * \file CassiniSoldner.cpp
00003  * \brief Implementation for GeographicLib::CassiniSoldner class
00004  *
00005  * Copyright (c) Charles Karney (2009-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/CassiniSoldner.hpp>
00011 
00012 #define GEOGRAPHICLIB_CASSINISOLDNER_CPP \
00013   "$Id: 2823df38f3e31fd8b882e2f55ad72d6419b03246 $"
00014 
00015 RCSID_DECL(GEOGRAPHICLIB_CASSINISOLDNER_CPP)
00016 RCSID_DECL(GEOGRAPHICLIB_CASSINISOLDNER_HPP)
00017 
00018 namespace GeographicLib {
00019 
00020   using namespace std;
00021 
00022   const Math::real CassiniSoldner::eps1_ =
00023     real(0.01) * sqrt(numeric_limits<real>::epsilon());
00024   const Math::real CassiniSoldner::tiny_ = sqrt(numeric_limits<real>::min());
00025 
00026   void CassiniSoldner::Reset(real lat0, real lon0) throw() {
00027     _meridian = _earth.Line(lat0, lon0, real(0),
00028                             Geodesic::LATITUDE | Geodesic::LONGITUDE |
00029                             Geodesic::DISTANCE | Geodesic::DISTANCE_IN |
00030                             Geodesic::AZIMUTH);
00031     real
00032       phi = LatitudeOrigin() * Math::degree<real>(),
00033       f = _earth.Flattening();
00034     _sbet0 = (1 - f) * sin(phi);
00035     _cbet0 = abs(LatitudeOrigin()) == 90 ? 0 : cos(phi);
00036     SinCosNorm(_sbet0, _cbet0);
00037   }
00038 
00039   void CassiniSoldner::Forward(real lat, real lon, real& x, real& y,
00040                                real& azi, real& rk) const throw() {
00041     if (!Init())
00042       return;
00043     real dlon = AngNormalize(lon - LongitudeOrigin());
00044     real sig12, s12, azi1, azi2;
00045     lat = AngRound(lat);
00046     sig12 = _earth.Inverse(lat, -abs(dlon), lat, abs(dlon), s12, azi1, azi2);
00047     if (sig12 < 100 * tiny_)
00048       sig12 = s12 = 0;
00049     sig12 *= real(0.5);
00050     s12 *= real(0.5);
00051     if (s12 == 0) {
00052       real da = (azi2 - azi1)/2;
00053       if (abs(dlon) <= 90) {
00054         azi1 = 90 - da;
00055         azi2 = 90 + da;
00056       } else {
00057         azi1 = -90 - da;
00058         azi2 = -90 + da;
00059       }
00060     }
00061     if (dlon < 0) {
00062       azi2 = azi1;
00063       s12 = -s12;
00064       sig12 = -sig12;
00065     }
00066     x = s12;
00067     azi = AngNormalize(azi2);
00068     GeodesicLine perp(_earth.Line(lat, dlon, azi2, Geodesic::GEODESICSCALE));
00069     real t;
00070     perp.GenPosition(true, -sig12,
00071                      Geodesic::GEODESICSCALE,
00072                      t, t, t, t, t, t, rk, t);
00073 
00074     real
00075       alp0 = perp.EquatorialAzimuth() * Math::degree<real>(),
00076       calp0 = cos(alp0), salp0 = sin(alp0),
00077       sbet1 = lat >=0 ? calp0 : -calp0,
00078       cbet1 = abs(dlon) <= 90 ? abs(salp0) : -abs(salp0),
00079       sbet01 = sbet1 * _cbet0 - cbet1 * _sbet0,
00080       cbet01 = cbet1 * _cbet0 + sbet1 * _sbet0,
00081       sig01 = atan2(sbet01, cbet01) / Math::degree<real>();
00082     _meridian.GenPosition(true, sig01,
00083                           Geodesic::DISTANCE,
00084                           t, t, t, y, t, t, t, t);
00085   }
00086 
00087   void CassiniSoldner::Reverse(real x, real y, real& lat, real& lon,
00088                                real& azi, real& rk) const throw() {
00089     if (!Init())
00090       return;
00091     real lat1, lon1;
00092     real azi0, t;
00093     _meridian.Position(y, lat1, lon1, azi0);
00094     _earth.Direct(lat1, lon1, azi0 + 90, x, lat, lon, azi, rk, t);
00095   }
00096 
00097 } // namespace GeographicLib
geographiclib-1.21/doc/html/Geoid_8hpp_source.html0000644000175000017500000017303511745620414022036 0ustar frankiefrankie GeographicLib: Geoid.hpp Source File
Geoid.hpp
Go to the documentation of this file.
00001 /**
00002  * \file Geoid.hpp
00003  * \brief Header for GeographicLib::Geoid class
00004  *
00005  * Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_GEOID_HPP)
00011 #define GEOGRAPHICLIB_GEOID_HPP \
00012   "$Id: 4e4eb5941d16ad00416798703d246a6f7ef5fe46 $"
00013 
00014 #include <string>
00015 #include <vector>
00016 #include <fstream>
00017 #include <GeographicLib/Constants.hpp>
00018 
00019 #if defined(_MSC_VER)
00020 // Squelch warnings about dll vs vector
00021 #pragma warning (push)
00022 #pragma warning (disable: 4251)
00023 #endif
00024 
00025 #if !defined(PGM_PIXEL_WIDTH)
00026 /**
00027  * The size of the pixel data in the pgm data files for the geoids.  2
00028  * is the standard size corresponding to a maxval 2^16-1.  Setting it
00029  * to 4 uses a maxval of 2^32-1 and changes the extension for the data
00030  * files from .pgm to .pgm4.  Note that the format of these pgm4 files
00031  * is a non-standard extension of the pgm format.
00032  **********************************************************************/
00033 #define PGM_PIXEL_WIDTH 2
00034 #endif
00035 
00036 namespace GeographicLib {
00037 
00038   /**
00039    * \brief Looking up the height of the geoid
00040    *
00041    * This class evaluated the height of one of the standard geoids, EGM84,
00042    * EGM96, or EGM2008 by bilinear or cubic interpolation into a rectangular
00043    * grid of data.  These geoid models are documented in
00044    * - EGM84:
00045    *   http://earth-info.nga.mil/GandG/wgs84/gravitymod/wgs84_180/wgs84_180.html
00046    * - EGM96:
00047    *   http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html
00048    * - EGM2008:
00049    *   http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008
00050    *
00051    * The geoids are defined in terms of spherical harmonics.  However in order
00052    * to provide a quick and flexible method of evaluating the geoid heights,
00053    * this class evaluates the height by interpolation into a grid of
00054    * precomputed values.
00055    *
00056    * See \ref geoid for details of how to install the data sets, the data
00057    * format, estimates of the interpolation errors, and how to use caching.
00058    *
00059    * In addition to returning the geoid height, the gradient of the geoid can
00060    * be calculated.  The gradient is defined as the rate of change of the geoid
00061    * as a function of position on the ellipsoid.  This uses the parameters for
00062    * the WGS84 ellipsoid.  The gradient defined in terms of the interpolated
00063    * heights.  As a result of the way that the geoid data is stored, the
00064    * calculation of gradients can result in large quantization errors.  This is
00065    * particularly acute for fine grids, at high latitudes, and for the easterly
00066    * gradient.
00067    *
00068    * This class is typically \e not thread safe in that a single instantiation
00069    * cannot be safely used by multiple threads because of the way the object
00070    * reads the data set and because it maintains a single-cell cache.  If
00071    * multiple threads need to calculate geoid heights they should all construct
00072    * thread-local instantiations.  Alternatively, set the optional \e
00073    * threadsafe parameter to true in the constructor.  This causes the
00074    * constructor to read all the data into memory and to turn off the
00075    * single-cell caching which results in a Geoid object which \e is thread
00076    * safe.
00077    *
00078    * Example of use:
00079    * \include example-Geoid.cpp
00080    *
00081    * <a href="GeoidEval.1.html">GeoidEval</a> is a command-line utility
00082    * providing access to the functionality of Geoid.
00083    **********************************************************************/
00084 
00085   class GEOGRAPHIC_EXPORT Geoid {
00086   private:
00087     typedef Math::real real;
00088 #if PGM_PIXEL_WIDTH != 4
00089     typedef unsigned short pixel_t;
00090     static const unsigned pixel_size_ = 2;
00091     static const unsigned pixel_max_ = 0xffffu;
00092 #else
00093     typedef unsigned pixel_t;
00094     static const unsigned pixel_size_ = 4;
00095     static const unsigned pixel_max_ = 0xffffffffu;
00096 #endif
00097     static const unsigned stencilsize_ = 12;
00098     static const unsigned nterms_ = ((3 + 1) * (3 + 2))/2; // for a cubic fit
00099     static const real c0_;
00100     static const real c0n_;
00101     static const real c0s_;
00102     static const real c3_[stencilsize_ * nterms_];
00103     static const real c3n_[stencilsize_ * nterms_];
00104     static const real c3s_[stencilsize_ * nterms_];
00105 
00106     std::string _name, _dir, _filename;
00107     const bool _cubic;
00108     const real _a, _e2, _degree, _eps;
00109     mutable std::ifstream _file;
00110     real _rlonres, _rlatres;
00111     std::string _description, _datetime;
00112     real _offset, _scale, _maxerror, _rmserror;
00113     int _width, _height;
00114     unsigned long long _datastart, _swidth;
00115     bool _threadsafe;
00116     // Area cache
00117     mutable std::vector< std::vector<pixel_t> > _data;
00118     mutable bool _cache;
00119     // NE corner and extent of cache
00120     mutable int _xoffset, _yoffset, _xsize, _ysize;
00121     // Cell cache
00122     mutable int _ix, _iy;
00123     mutable real _v00, _v01, _v10, _v11;
00124     mutable real _t[nterms_];
00125     void filepos(int ix, int iy) const {
00126       _file.seekg(
00127 #if !(defined(__GNUC__) && __GNUC__ < 4)
00128                   // g++ 3.x doesn't know about the cast to streamoff.
00129                   std::ios::streamoff
00130 #endif
00131                   (_datastart +
00132                    pixel_size_ * (unsigned(iy)*_swidth + unsigned(ix))));
00133     }
00134     real rawval(int ix, int iy) const {
00135       if (ix < 0)
00136         ix += _width;
00137       else if (ix >= _width)
00138         ix -= _width;
00139       if (_cache && iy >= _yoffset && iy < _yoffset + _ysize &&
00140           ((ix >= _xoffset && ix < _xoffset + _xsize) ||
00141            (ix + _width >= _xoffset && ix + _width < _xoffset + _xsize))) {
00142         return real(_data[iy - _yoffset]
00143                     [ix >= _xoffset ? ix - _xoffset : ix + _width - _xoffset]);
00144       } else {
00145         if (iy < 0 || iy >= _height) {
00146           iy = iy < 0 ? -iy : 2 * (_height - 1) - iy;
00147           ix += (ix < _width/2 ? 1 : -1) * _width/2;
00148         }
00149         try {
00150           filepos(ix, iy);
00151           char a, b;
00152           _file.get(a);
00153           _file.get(b);
00154           unsigned r = ((unsigned char)(a) << 8) | (unsigned char)(b);
00155           if (pixel_size_ == 4) {
00156             _file.get(a);
00157             _file.get(b);
00158             r = (r << 16) | ((unsigned char)(a) << 8) | (unsigned char)(b);
00159           }
00160           return real(r);
00161         }
00162         catch (const std::exception& e) {
00163           // throw GeographicErr("Error reading " + _filename + ": "
00164           //                      + e.what());
00165           // triggers complaints about the "binary '+'" under Visual Studio.
00166           // So use '+=' instead.
00167           std::string err("Error reading ");
00168           err += _filename;
00169           err += ": ";
00170           err += e.what();
00171           throw GeographicErr(err);
00172         }
00173       }
00174     }
00175     real height(real lat, real lon, bool gradp,
00176                 real& grade, real& gradn) const;
00177     Geoid(const Geoid&);            // copy constructor not allowed
00178     Geoid& operator=(const Geoid&); // copy assignment not allowed
00179   public:
00180 
00181     /**
00182      * Flags indicating conversions between heights above the geoid and heights
00183      * above the ellipsoid.
00184      **********************************************************************/
00185     enum convertflag {
00186       /**
00187        * The multiplier for converting from heights above the geoid to heights
00188        * above the ellipsoid.
00189        **********************************************************************/
00190       ELLIPSOIDTOGEOID = -1,
00191       /**
00192        * No conversion.
00193        **********************************************************************/
00194       NONE = 0,
00195       /**
00196        * The multiplier for converting from heights above the ellipsoid to
00197        * heights above the geoid.
00198        **********************************************************************/
00199       GEOIDTOELLIPSOID = 1,
00200     };
00201 
00202     /** \name Setting up the geoid
00203      **********************************************************************/
00204     ///@{
00205     /**
00206      * Construct a geoid.
00207      *
00208      * @param[in] name the name of the geoid.
00209      * @param[in] path (optional) directory for data file.
00210      * @param[in] cubic (optional) interpolation method; false means bilinear,
00211      *   true (the default) means cubic.
00212      * @param[in] threadsafe (optional), if true, construct a thread safe
00213      *   object.  The default is false
00214      *
00215      * The data file is formed by appending ".pgm" to the name.  If \e path is
00216      * specified (and is non-empty), then the file is loaded from directory, \e
00217      * path.  Otherwise the path is given by DefaultGeoidPath().  This may
00218      * throw an exception because the file does not exist, is unreadable, or is
00219      * corrupt.  If the \e threadsafe parameter is true, the data set is read
00220      * into memory (which this may also cause an exception to be thrown), the
00221      * data file is closed, and single-cell caching is turned off; this results
00222      * in a Geoid object which \e is thread safe.
00223      **********************************************************************/
00224     explicit Geoid(const std::string& name, const std::string& path = "",
00225                    bool cubic = true, bool threadsafe = false);
00226 
00227     /**
00228      * Set up a cache.
00229      *
00230      * @param[in] south latitude (degrees) of the south edge of the cached area.
00231      * @param[in] west longitude (degrees) of the west edge of the cached area.
00232      * @param[in] north latitude (degrees) of the north edge of the cached area.
00233      * @param[in] east longitude (degrees) of the east edge of the cached area.
00234      *
00235      * Cache the data for the specified "rectangular" area bounded by the
00236      * parallels \e south and \e north and the meridians \e west and \e east.
00237      * \e east is always interpreted as being east of \e west, if necessary by
00238      * adding 360<sup>o</sup> to its value.  This may throw an error because of
00239      * insufficient memory or because of an error reading the data from the
00240      * file.  In this case, you can catch the error and either do nothing (you
00241      * will have no cache in this case) or try again with a smaller area.  \e
00242      * south and \e north should be in the range [-90, 90]; \e west and \e east
00243      * should be in the range [-180, 360].  An exception is thrown if this
00244      * routine is called on a thread safe Geoid.
00245      **********************************************************************/
00246     void CacheArea(real south, real west, real north, real east) const;
00247 
00248     /**
00249      * Cache all the data.  On most computers, this is fast for data sets with
00250      * grid resolution of 5' or coarser.  For a 1' grid, the required RAM is
00251      * 450MB; a 2.5' grid needs 72MB; and a 5' grid needs 18MB.  This may throw
00252      * an error because of insufficient memory or because of an error reading
00253      * the data from the file.  In this case, you can catch the error and
00254      * either do nothing (you will have no cache in this case) or try using
00255      * Geoid::CacheArea on a specific area.  An exception is thrown if this
00256      * routine is called on a thread safe Geoid.
00257      **********************************************************************/
00258     void CacheAll() const { CacheArea(real(-90), real(0),
00259                                       real(90), real(360)); }
00260 
00261     /**
00262      * Clear the cache.  This never throws an error.  (This does nothing with a
00263      * thread safe Geoid.)
00264      **********************************************************************/
00265     void CacheClear() const throw();
00266 
00267     ///@}
00268 
00269     /** \name Compute geoid heights
00270      **********************************************************************/
00271     ///@{
00272     /**
00273      * Compute the geoid height at a point
00274      *
00275      * @param[in] lat latitude of the point (degrees).
00276      * @param[in] lon longitude of the point (degrees).
00277      * @return geoid height (meters).
00278      *
00279      * The latitude should be in [-90, 90] and longitude should be in
00280      * [-180,360].  This may throw an error because of an error reading data
00281      * from disk.  However, it will not throw if (\e lat, \e lon) is within a
00282      * successfully cached area.
00283      **********************************************************************/
00284     Math::real operator()(real lat, real lon) const {
00285       real gradn, grade;
00286       return height(lat, lon, false, gradn, grade);
00287     }
00288 
00289     /**
00290      * Compute the geoid height and gradient at a point
00291      *
00292      * @param[in] lat latitude of the point (degrees).
00293      * @param[in] lon longitude of the point (degrees).
00294      * @param[out] gradn northerly gradient (dimensionless).
00295      * @param[out] grade easterly gradient (dimensionless).
00296      * @return geoid height (meters).
00297      *
00298      * The latitude should be in [-90, 90] and longitude should be in [-180,
00299      * 360].  This may throw an error because of an error reading data from
00300      * disk.  However, it will not throw if (\e lat, \e lon) is within a
00301      * successfully cached area.  As a result of the way that the geoid data is
00302      * stored, the calculation of gradients can result in large quantization
00303      * errors.  This is particularly acute for fine grids, at high latitudes,
00304      * and for the easterly gradient.  If you need to compute the direction of
00305      * the acceleration due to gravity accurately, you should use
00306      * GravityModel::Gravity.
00307      **********************************************************************/
00308     Math::real operator()(real lat, real lon, real& gradn, real& grade) const {
00309       return height(lat, lon, true, gradn, grade);
00310     }
00311 
00312     /**
00313      * Convert a height above the geoid to a height above the ellipsoid and
00314      * vice versa.
00315      *
00316      * @param[in] lat latitude of the point (degrees).
00317      * @param[in] lon longitude of the point (degrees).
00318      * @param[in] h height of the point (degrees).
00319      * @param[in] d a Geoid::convertflag specifying the direction of the
00320      *   conversion; Geoid::GEOIDTOELLIPSOID means convert a height above the
00321      *   geoid to a height above the ellipsoid; Geoid::ELLIPSOIDTOGEOID means
00322      *   convert a height above the ellipsoid to a height above the geoid.
00323      * @return converted height (meters).
00324      **********************************************************************/
00325     Math::real ConvertHeight(real lat, real lon, real h,
00326                              convertflag d) const {
00327       real gradn, grade;
00328       return h + real(d) * height(lat, lon, true, gradn, grade);
00329     }
00330 
00331     ///@}
00332 
00333     /** \name Inspector functions
00334      **********************************************************************/
00335     ///@{
00336     /**
00337      * @return geoid description, if available, in the data file; if
00338      *   absent, return "NONE".
00339      **********************************************************************/
00340     const std::string& Description() const throw() { return _description; }
00341 
00342     /**
00343      * @return date of the data file; if absent, return "UNKNOWN".
00344      **********************************************************************/
00345     const std::string& DateTime() const throw() { return _datetime; }
00346 
00347     /**
00348      * @return full file name used to load the geoid data.
00349      **********************************************************************/
00350     const std::string& GeoidFile() const throw() { return _filename; }
00351 
00352     /**
00353      * @return "name" used to load the geoid data (from the first argument of
00354      *   the constructor).
00355      **********************************************************************/
00356     const std::string& GeoidName() const throw() { return _name; }
00357 
00358     /**
00359      * @return directory used to load the geoid data.
00360      **********************************************************************/
00361     const std::string& GeoidDirectory() const throw() { return _dir; }
00362 
00363     /**
00364      * @return interpolation method ("cubic" or "bilinear").
00365      **********************************************************************/
00366     const std::string Interpolation() const
00367     { return std::string(_cubic ? "cubic" : "bilinear"); }
00368 
00369     /**
00370      * @return estimate of the maximum interpolation and quantization error
00371      *   (meters).
00372      *
00373      * This relies on the value being stored in the data file.  If the value is
00374      * absent, return -1.
00375      **********************************************************************/
00376     Math::real MaxError() const throw() { return _maxerror; }
00377 
00378     /**
00379      * @return estimate of the RMS interpolation and quantization error
00380      *   (meters).
00381      *
00382      * This relies on the value being stored in the data file.  If the value is
00383      * absent, return -1.
00384      **********************************************************************/
00385     Math::real RMSError() const throw() { return _rmserror; }
00386 
00387     /**
00388      * @return offset (meters).
00389      *
00390      * This in used in converting from the pixel values in the data file to
00391      * geoid heights.
00392      **********************************************************************/
00393     Math::real Offset() const throw() { return _offset; }
00394 
00395     /**
00396      * @return scale (meters).
00397      *
00398      * This in used in converting from the pixel values in the data file to
00399      * geoid heights.
00400      **********************************************************************/
00401     Math::real Scale() const throw() { return _scale; }
00402 
00403     /**
00404      * @return true if the object is constructed to be thread safe.
00405      **********************************************************************/
00406     bool ThreadSafe() const throw() { return _threadsafe; }
00407 
00408     /**
00409      * @return true if a data cache is active.
00410      **********************************************************************/
00411     bool Cache() const throw() { return _cache; }
00412 
00413     /**
00414      * @return west edge of the cached area; the cache includes this edge.
00415      **********************************************************************/
00416     Math::real CacheWest() const throw() {
00417       return _cache ? ((_xoffset + (_xsize == _width ? 0 : _cubic)
00418                         + _width/2) % _width - _width/2) / _rlonres :
00419         0;
00420     }
00421 
00422     /**
00423      * @return east edge of the cached area; the cache excludes this edge.
00424      **********************************************************************/
00425     Math::real CacheEast() const throw() {
00426       return  _cache ?
00427         CacheWest() +
00428         (_xsize - (_xsize == _width ? 0 : 1 + 2 * _cubic)) / _rlonres :
00429         0;
00430     }
00431 
00432     /**
00433      * @return north edge of the cached area; the cache includes this edge.
00434      **********************************************************************/
00435     Math::real CacheNorth() const throw() {
00436       return _cache ? 90 - (_yoffset + _cubic) / _rlatres : 0;
00437     }
00438 
00439     /**
00440      * @return south edge of the cached area; the cache excludes this edge
00441      *   unless it's the south pole.
00442      **********************************************************************/
00443     Math::real CacheSouth() const throw() {
00444       return _cache ? 90 - ( _yoffset + _ysize - 1 - _cubic) / _rlatres : 0;
00445     }
00446 
00447     /**
00448      * @return \e a the equatorial radius of the WGS84 ellipsoid (meters).
00449      *
00450      * (The WGS84 value is returned because the supported geoid models are all
00451      * based on this ellipsoid.)
00452      **********************************************************************/
00453     Math::real MajorRadius() const throw()
00454     { return Constants::WGS84_a<real>(); }
00455 
00456     /**
00457      * @return \e f the flattening of the WGS84 ellipsoid.
00458      *
00459      * (The WGS84 value is returned because the supported geoid models are all
00460      * based on this ellipsoid.)
00461      **********************************************************************/
00462     Math::real Flattening() const throw() { return Constants::WGS84_f<real>(); }
00463     ///@}
00464 
00465     /// \cond SKIP
00466     /**
00467      * <b>DEPRECATED</b>
00468      * @return \e r the inverse flattening of the WGS84 ellipsoid.
00469      **********************************************************************/
00470     Math::real InverseFlattening() const throw()
00471     { return 1/Constants::WGS84_f<real>(); }
00472     /// \endcond
00473 
00474     /**
00475      * @return the default path for geoid data files.
00476      *
00477      * This is the value of the environment variable GEOID_PATH, if set;
00478      * otherwise, it is $GEOGRAPHICLIB_DATA/geoids if the environment variable
00479      * GEOGRAPHICLIB_DATA is set; otherwise, it is a compile-time default
00480      * (/usr/local/share/GeographicLib/geoids on non-Windows systems and
00481      * C:/Documents and Settings/All Users/Application
00482      * Data/GeographicLib/geoids on Windows systems).
00483      **********************************************************************/
00484     static std::string DefaultGeoidPath();
00485 
00486     /**
00487      * @return the default name for the geoid.
00488      *
00489      * This is the value of the environment variable GEOID_NAME, if set,
00490      * otherwise, it is "egm96-5".  The Geoid class does not use this function;
00491      * it is just provided as a convenience for a calling program when
00492      * constructing a Geoid object.
00493      **********************************************************************/
00494     static std::string DefaultGeoidName();
00495 
00496   };
00497 
00498 } // namespace GeographicLib
00499 
00500 #if defined(_MSC_VER)
00501 #pragma warning (pop)
00502 #endif
00503 
00504 #endif  // GEOGRAPHICLIB_GEOID_HPP
geographiclib-1.21/doc/html/classGeographicLib_1_1SphericalEngine-members.html0000644000175000017500000001152111745620414027255 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::SphericalEngine Member List
This is the complete list of members for GeographicLib::SphericalEngine, including all inherited members.
Circle(const coeff c[], const real f[], real p, real z, real a)GeographicLib::SphericalEngine [static]
CircularEngine classGeographicLib::SphericalEngine [friend]
ClearRootTable()GeographicLib::SphericalEngine [inline, static]
FULL enum valueGeographicLib::SphericalEngine
normalization enum nameGeographicLib::SphericalEngine
RootTable(int N)GeographicLib::SphericalEngine [static]
SCHMIDT enum valueGeographicLib::SphericalEngine
Value(const coeff c[], const real f[], real x, real y, real z, real a, real &gradx, real &grady, real &gradz)GeographicLib::SphericalEngine [static]
geographiclib-1.21/doc/html/GeoidEval.1.html0000644000175000017500000003715711745620414020472 0ustar frankiefrankie GeoidEval -- look up geoid heights


NAME

GeoidEval -- look up geoid heights


SYNOPSIS

GeoidEval [ -n name ] [ -d dir ] [ -l ] [ -a | -c south west north east ] [ -g ] [ -z zone ] [ --msltohae ] [ --haetomsl ] [ -v ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

GeoidEval reads in positions on standard input and prints out the corresponding geoid heights on standard output. Optionally, it also prints the northerly and easterly gradients of the geoid height.

Positions are given as latitude and longitude, UTM/UPS, or MGRS, in any of the formats accepted by GeoConvert(1). (MGRS coordinates signify the center of the corresponding MGRS square.) If the -z option is specified then the specified zone is prepended to each line of input (which must be in UTM/UPS coordinates). This allows a file with UTM eastings and northings in a single zone to be used as standard input.

More accurate results for the geoid height are provided by Gravity(1). This utility can also compute the direction of gravity accurately.


OPTIONS

-n

use geoid name instead of the default egm96-5. See GEOIDS.

-d

read geoid data from dir instead of the default. See GEOIDS.

-l

use bilinear interpolation instead of cubic. See INTERPOLATION.

-a

cache the entire data set in memory. See CACHE.

-c

cache the data bounded by south west north east in memory. See CACHE.

-g

print the northerly and easterly gradients after the geoid height (i.e., the rate at which the geoid height changes per unit distance along the WGS84 ellipsoid in the specified directions). As a result of the way that the geoid data is stored, the calculation of gradients can result in large quantization errors. This is particularly acute at high latitudes and for the easterly gradient.

-z

prefix each line of input by zone, e.g., 38N. This should be used when the input consists of UTM/UPS eastings and northings.

--msltohae

standard input should include a final token on each line which is treated as a height (in meters) above the geoid and the output echoes the input line with the height converted to height above ellipsoid (HAE). If -z zone is specified then the third token is treated as the height; this makes it possible to convert LIDAR data where each line consists of: easting northing height intensity.

--haetomsl

this is similar to --msltohae except that the height token is treated as a height (in meters) above the ellipsoid and the output echoes the input line with the height converted to height above the geoid (MSL).

-v

print information about the geoid on standard error before processing the input.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage, the default geoid path and name, and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


GEOIDS

GeoidEval computes geoid heights by interpolating on the data in a regularly spaced table (see INTERPOLATION). The following geoid tables are available (however, some may not be installed):

                                  bilinear error    cubic error
   name         geoid    grid     max      rms      max      rms
   egm84-30     EGM84    30'      1.546 m  70 mm    0.274 m  14 mm
   egm84-15     EGM84    15'      0.413 m  18 mm    0.021 m  1.2 mm
   egm96-15     EGM96    15'      1.152 m  40 mm    0.169 m  7.0 mm
   egm96-5      EGM96     5'      0.140 m  4.6 mm   .0032 m  0.7 mm
   egm2008-5    EGM2008   5'      0.478 m  12 mm    0.294 m  4.5 mm
   egm2008-2_5  EGM2008   2.5'    0.135 m  3.2 mm   0.031 m  0.8 mm
   egm2008-1    EGM2008   1'      0.025 m  0.8 mm   .0022 m  0.7 mm

By default, the egm96-5 geoid is used. This may changed by setting the environment variable GEOID_NAME or with the -n option. The errors listed here are estimates of the quantization and interpolation errors in the reported heights compared to the specified geoid.

The geoid data will be loaded from a directory specified at compile time. This may changed by setting the environment variables GEOID_PATH or GEOGRAPHICLIB_DATA, or with the -d option. The -h option prints the default geoid path and name. Use the -v option to ascertain the full path name of the data file.

Instructions for downloading and installing geoid data are available at http://geographiclib.sf.net/html/geoid.html#geoidinst.

NOTE: all the geoids above apply to the WGS84 ellipsoid (a = 6378137 m, f = 1/298.257223563) only.


INTERPOLATION

Cubic interpolation is used to compute the geoid height unless -l is specified in which case bilinear interpolation is used. The cubic interpolation is based on a least-squares fit of a cubic polynomial to a 12-point stencil

   . 1 1 .
   1 2 2 1
   1 2 2 1
   . 1 1 .

The cubic is constrained to be independent of longitude when evaluating the height at one of the poles. Cubic interpolation is considerably more accurate than bilinear; however it results in small discontinuities in the returned height on cell boundaries. The gradients are computed by differentiating the interpolated results.


CACHE

By default, the data file is randomly read to compute the geoid heights at the input positions. Usually this is sufficient for interactive use. If many heights are to be computed, use -c south west north east to notify GeoidEval to read a rectangle of data into memory; heights within the this rectangle can then be computed without any disk access. If -a is specified all the geoid data is read; in the case of egm2008-1, this requires about 0.5 GB of RAM. The evaluation of heights outside the cached area causes the necessary data to be read from disk. Use the -v option to verify the size of the cache.

Regardless of whether any cache is requested (with the -a or -c options), the data for the last grid cell in cached. This allows the geoid height along a continuous path to be returned with little disk overhead.


ENVIRONMENT

GEOID_NAME

Override the compile-time default geoid name of egm96-5. The -h option reports the value of GEOID_NAME, if defined, otherwise it reports the compile-time value. If the -n name option is used, then name takes precedence.

GEOID_PATH

Override the compile-time default geoid path. This is typically /usr/local/share/GeographicLib/geoids on Unix-like systems and C:/Documents and Settings/All Users/Application Data/GeographicLib/geoids on Windows systems. The -h option reports the value of GEOID_PATH, if defined, otherwise it reports the compile-time value. If the -d dir option is used, then dir takes precedence.

GEOGRAPHICLIB_DATA

Another way of overriding the compile-time default magnetic path. If it is set (and if MAGNETIC_PATH is not set), then $GEOGRAPHICLIB_DATA/magnetic is used.


ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes GeoidEval to return an exit code of 1. However, an error does not cause GeoidEval to terminate; following lines will be converted.


ABBREVIATIONS

The geoid is usually approximated by an "earth gravity model". The models published by the NGA are:

EGM84

An earth gravity model published by the NGA in 1984, http://earth-info.nga.mil/GandG/wgs84/gravitymod/wgs84_180/wgs84_180.html.

EGM96

An earth gravity model published by the NGA in 1996, http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html.

EGM2008

An earth gravity model published by the NGA in 2008, http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008.

WGS84

World Geodetic System 1984, http://en.wikipedia.org/wiki/WGS84.

HAE

Height above the WGS84 ellipsoid.

MSL

Mean sea level, used as a convenient short hand for the geoid. (However, typically, the geoid differs by a few meters from mean sea level.)


EXAMPLES

The height of the EGM96 geoid at Timbuktu

    echo 16:46:33N 3:00:34W | GeoidEval
    => 28.7068 -0.02e-6 -1.73e-6

The first number returned is the height of the geoid and the 2nd and 3rd are its slopes in the northerly and easterly directions.

Convert a point in UTM zone 18N from MSL to HAE

   echo 531595 4468135 23 | GeoidEval --msltohae -z 18N
   => 531595 4468135 -10.842


SEE ALSO

GeoConvert(1), Gravity(1).


AUTHOR

GeoidEval was written by Charles Karney.


HISTORY

GeoidEval was added to GeographicLib, http://geographiclib.sf.net, in 2009-09.

geographiclib-1.21/doc/html/SphericalHarmonic1_8hpp.html0000644000175000017500000001350111745620414023072 0ustar frankiefrankie GeographicLib: SphericalHarmonic1.hpp File Reference
SphericalHarmonic1.hpp File Reference

Header for GeographicLib::SphericalHarmonic1 class. More...

Go to the source code of this file.

Classes

class  GeographicLib::SphericalHarmonic1
 Spherical Harmonic series with a correction to the coefficients. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_SPHERICALHARMONIC1_HPP   "$Id: 9dd895ded08db0f7fdd82159399da511f40a17e1 $"

Detailed Description

Header for GeographicLib::SphericalHarmonic1 class.

Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file SphericalHarmonic1.hpp.


Define Documentation

#define GEOGRAPHICLIB_SPHERICALHARMONIC1_HPP   "$Id: 9dd895ded08db0f7fdd82159399da511f40a17e1 $"

Definition at line 11 of file SphericalHarmonic1.hpp.

geographiclib-1.21/doc/html/Utility_8cpp_source.html0000644000175000017500000001533711745620415022446 0ustar frankiefrankie GeographicLib: Utility.cpp Source File
Utility.cpp
Go to the documentation of this file.
00001 /**
00002  * \file Utility.cpp
00003  * \brief Implementation for GeographicLib::Utility class
00004  *
00005  * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under
00006  * the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/Utility.hpp>
00011 
00012 #define GEOGRAPHICLIB_UTILITY_CPP \
00013   "$Id: 6f06d5d8fa9d731dc5a5fa4516838f639a2ba40b $"
00014 
00015 RCSID_DECL(GEOGRAPHICLIB_UTILITY_CPP)
00016 RCSID_DECL(GEOGRAPHICLIB_UTILITY_HPP)
00017 
00018 namespace GeographicLib {
00019 
00020   using namespace std;
00021 
00022   bool Utility::ParseLine(const std::string& line,
00023                           std::string& key, std::string& val) {
00024     const char* spaces = " \t\n\v\f\r";
00025     string::size_type n0 = line.find_first_not_of(spaces);
00026     if (n0 == string::npos)
00027       return false;             // Blank line
00028     string::size_type n1 = line.find_first_of('#', n0);
00029     if (n0 == n1)
00030       return false;             // Only a comment
00031     val = line.substr(n0, n1 == string::npos ? n1 : n1 - n0);
00032     n0 = val.find_first_of(spaces);
00033     key = val.substr(0, n0);
00034     if (n0 == string::npos) {
00035       val = "";
00036       return true;
00037     }
00038     n0 = val.find_first_not_of(spaces, n0);
00039     if (n0 == string::npos) {
00040       val = "";
00041       return true;
00042     }
00043     n1 = val.find_last_not_of(spaces);
00044     val = val.substr(n0, n1 + 1 - n0);
00045     return true;
00046   }
00047 
00048 } // namespace GeographicLib
geographiclib-1.21/doc/html/classGeographicLib_1_1LambertConformalConic.html0000644000175000017500000012176211745620414027001 0ustar frankiefrankie GeographicLib: GeographicLib::LambertConformalConic Class Reference
GeographicLib::LambertConformalConic Class Reference

Lambert Conformal Conic Projection. More...

#include <GeographicLib/LambertConformalConic.hpp>

List of all members.

Public Member Functions

 LambertConformalConic (real a, real f, real stdlat, real k0)
 LambertConformalConic (real a, real f, real stdlat1, real stdlat2, real k1)
 LambertConformalConic (real a, real f, real sinlat1, real coslat1, real sinlat2, real coslat2, real k1)
void SetScale (real lat, real k=real(1))
void Forward (real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const throw ()
void Reverse (real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const throw ()
void Forward (real lon0, real lat, real lon, real &x, real &y) const throw ()
void Reverse (real lon0, real x, real y, real &lat, real &lon) const throw ()
Inspector functions
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()
Math::real OriginLatitude () const throw ()
Math::real CentralScale () const throw ()

Static Public Attributes

static const LambertConformalConic Mercator

Detailed Description

Lambert Conformal Conic Projection.

Implementation taken from the report,

This is a implementation of the equations in Snyder except that divided differences have been used to transform the expressions into ones which may be evaluated accurately and that Newton's method is used to invert the projection. In this implementation, the projection correctly becomes the Mercator projection or the polar stereographic projection when the standard latitude is the equator or a pole. The accuracy of the projections is about 10 nm (10 nanometers).

The ellipsoid parameters, the standard parallels, and the scale on the standard parallels are set in the constructor. Internally, the case with two standard parallels is converted into a single standard parallel, the latitude of tangency (also the latitude of minimum scale), with a scale specified on this parallel. This latitude is also used as the latitude of origin which is returned by LambertConformalConic::OriginLatitude. The scale on the latitude of origin is given by LambertConformalConic::CentralScale. The case with two distinct standard parallels where one is a pole is singular and is disallowed. The central meridian (which is a trivial shift of the longitude) is specified as the lon0 argument of the LambertConformalConic::Forward and LambertConformalConic::Reverse functions. There is no provision in this class for specifying a false easting or false northing or a different latitude of origin. However these are can be simply included by the calling function. For example the Pennsylvania South state coordinate system (EPSG:3364) is obtained by:

// Example of using the GeographicLib::LambertConformalConic class
// $Id: 5cb2532e2709bcafee50974307836930069b0cff $

#include <iostream>
#include <exception>
#include <GeographicLib/LambertConformalConic.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    // Define the Pennsylvania South state coordinate system EPSG:3364
    const double
      a = Constants::WGS84_a<double>(),
      f = 1/298.257222101,                      // GRS80
      lat1 = 40 + 58/60.0, lat2 = 39 + 56/60.0, // standard parallels
      k1 = 1,                                   // scale
      lat0 = 39 + 20/60.0, lon0 =-77 - 45/60.0, // origin
      fe = 600000, fn = 0;                      // false easting and northing
    // Set up basic projection
    const LambertConformalConic PASouth(a, f, lat1, lat2, k1);
    double x0, y0;
    // Transform origin point
    PASouth.Forward(lon0, lat0, lon0, x0, y0);
    x0 -= fe; y0 -= fn;
    {
      // Sample conversion from geodetic to PASouth grid
      double lat = 39.95, lon = -75.17;    // Philadelphia
      double x, y;
      PASouth.Forward(lon0, lat, lon, x, y);
      x -= x0; y -= y0;
      std::cout << x << " " << y << "\n";
    }
    {
      // Sample conversion from PASouth grid to geodetic
      double x = 820e3, y = 72e3;
      double lat, lon;
      x += x0; y += y0;
      PASouth.Reverse(lon0, x, y, lat, lon);
      std::cout << lat << " " << lon << "\n";
    }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

ConicProj is a command-line utility providing access to the functionality of LambertConformalConic and AlbersEqualArea.


Constructor & Destructor Documentation

GeographicLib::LambertConformalConic::LambertConformalConic ( real  a,
real  f,
real  stdlat,
real  k0 
)

Constructor with a single standard parallel.

Parameters:
[in]aequatorial radius of ellipsoid (meters).
[in]fflattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid. If f > 1, set flattening to 1/f.
[in]stdlatstandard parallel (degrees), the circle of tangency.
[in]k0scale on the standard parallel.

An exception is thrown if a or k0 is not positive or if stdlat is not in the range [-90, 90].

Definition at line 30 of file LambertConformalConic.cpp.

References GeographicLib::Math::isfinite().

GeographicLib::LambertConformalConic::LambertConformalConic ( real  a,
real  f,
real  stdlat1,
real  stdlat2,
real  k1 
)

Constructor with two standard parallels.

Parameters:
[in]aequatorial radius of ellipsoid (meters).
[in]fflattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid. If f > 1, set flattening to 1/f.
[in]stdlat1first standard parallel (degrees).
[in]stdlat2second standard parallel (degrees).
[in]k1scale on the standard parallels.

An exception is thrown if a or k0 is not positive or if stdlat1 or stdlat2 is not in the range [-90, 90]. In addition, if either stdlat1 or stdlat2 is a pole, then an exception is thrown if stdlat1 is not equal stdlat2.

Definition at line 54 of file LambertConformalConic.cpp.

References GeographicLib::Math::isfinite().

GeographicLib::LambertConformalConic::LambertConformalConic ( real  a,
real  f,
real  sinlat1,
real  coslat1,
real  sinlat2,
real  coslat2,
real  k1 
)

Constructor with two standard parallels specified by sines and cosines.

Parameters:
[in]aequatorial radius of ellipsoid (meters).
[in]fflattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid. If f > 1, set flattening to 1/f.
[in]sinlat1sine of first standard parallel.
[in]coslat1cosine of first standard parallel.
[in]sinlat2sine of second standard parallel.
[in]coslat2cosine of second standard parallel.
[in]k1scale on the standard parallels.

This allows parallels close to the poles to be specified accurately. This routine computes the latitude of origin and the scale at this latitude. In the case where lat1 and lat2 are different, the errors in this routines are as follows: if dlat = abs(lat2 - lat1) <= 160o and max(abs(lat1), abs(lat2)) <= 90 - min(0.0002, 2.2e-6(180 - dlat), 6e-8 dlat2) (in degrees), then the error in the latitude of origin is less than 4.5e-14o and the relative error in the scale is less than 7e-15.

Definition at line 81 of file LambertConformalConic.cpp.

References GeographicLib::Math::isfinite().


Member Function Documentation

void GeographicLib::LambertConformalConic::SetScale ( real  lat,
real  k = real(1) 
)

Set the scale for the projection.

Parameters:
[in]lat(degrees).
[in]kscale at latitude lat (default 1).

This allows a "latitude of true scale" to be specified. An exception is thrown if k is not positive or if stdlat is not in the range [-90, 90]

Definition at line 455 of file LambertConformalConic.cpp.

References GeographicLib::Math::isfinite(), and Forward().

void GeographicLib::LambertConformalConic::Forward ( real  lon0,
real  lat,
real  lon,
real &  x,
real &  y,
real &  gamma,
real &  k 
) const throw ()

Forward projection, from geographic to Lambert conformal conic.

Parameters:
[in]lon0central meridian longitude (degrees).
[in]latlatitude of point (degrees).
[in]lonlongitude of point (degrees).
[out]xeasting of point (meters).
[out]ynorthing of point (meters).
[out]gammameridian convergence at point (degrees).
[out]kscale of projection at point.

The latitude origin is given by LambertConformalConic::LatitudeOrigin(). No false easting or northing is added and lat should be in the range [-90, 90]; lon and lon0 should be in the range [-180, 360]. The error in the projection is less than about 10 nm (10 nanometers), true distance, and the errors in the meridian convergence and scale are consistent with this. The values of x and y returned for points which project to infinity (i.e., one or both of the poles) will be large but finite.

Definition at line 324 of file LambertConformalConic.cpp.

References GeographicLib::Math::asinh(), and GeographicLib::Math::sq().

Referenced by SetScale().

void GeographicLib::LambertConformalConic::Reverse ( real  lon0,
real  x,
real  y,
real &  lat,
real &  lon,
real &  gamma,
real &  k 
) const throw ()

Reverse projection, from Lambert conformal conic to geographic.

Parameters:
[in]lon0central meridian longitude (degrees).
[in]xeasting of point (meters).
[in]ynorthing of point (meters).
[out]latlatitude of point (degrees).
[out]lonlongitude of point (degrees).
[out]gammameridian convergence at point (degrees).
[out]kscale of projection at point.

The latitude origin is given by LambertConformalConic::LatitudeOrigin(). No false easting or northing is added. lon0 should be in the range [-180, 360]. The value of lon returned is in the range [-180, 180). The error in the projection is less than about 10 nm (10 nanometers), true distance, and the errors in the meridian convergence and scale are consistent with this.

Definition at line 371 of file LambertConformalConic.cpp.

References GeographicLib::Math::hypot(), GeographicLib::Math::sq(), and GeographicLib::Math::log1p().

void GeographicLib::LambertConformalConic::Forward ( real  lon0,
real  lat,
real  lon,
real &  x,
real &  y 
) const throw () [inline]

LambertConformalConic::Forward without returning the convergence and scale.

Definition at line 262 of file LambertConformalConic.hpp.

void GeographicLib::LambertConformalConic::Reverse ( real  lon0,
real  x,
real  y,
real &  lat,
real &  lon 
) const throw () [inline]

LambertConformalConic::Reverse without returning the convergence and scale.

Definition at line 272 of file LambertConformalConic.hpp.

Math::real GeographicLib::LambertConformalConic::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value used in the constructor.

Definition at line 285 of file LambertConformalConic.hpp.

Math::real GeographicLib::LambertConformalConic::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid. This is the value used in the constructor.

Definition at line 291 of file LambertConformalConic.hpp.

Math::real GeographicLib::LambertConformalConic::OriginLatitude ( ) const throw () [inline]
Returns:
latitude of the origin for the projection (degrees).

This is the latitude of minimum scale and equals the stdlat in the 1-parallel constructor and lies between stdlat1 and stdlat2 in the 2-parallel constructors.

Definition at line 308 of file LambertConformalConic.hpp.

Math::real GeographicLib::LambertConformalConic::CentralScale ( ) const throw () [inline]
Returns:
central scale for the projection. This is the scale on the latitude of origin.

Definition at line 314 of file LambertConformalConic.hpp.


Member Data Documentation

A global instantiation of LambertConformalConic with the WGS84 ellipsoid, stdlat = 0, and k0 = 1. This degenerates to the Mercator projection.

Definition at line 322 of file LambertConformalConic.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/classGeographicLib_1_1GeographicErr-members.html0000644000175000017500000000525311745620415026744 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::GeographicErr Member List
This is the complete list of members for GeographicLib::GeographicErr, including all inherited members.
GeographicErr(const std::string &msg)GeographicLib::GeographicErr [inline]
geographiclib-1.21/doc/html/annotated.html0000644000175000017500000002241411745620414020437 0ustar frankiefrankie GeographicLib: Class List
Class List
Here are the classes, structs, unions and interfaces with brief descriptions:
GeographicLib::AccumulatorAn accumulator for sums
GeographicLib::AlbersEqualAreaAlbers Equal Area Conic Projection
GeographicLib::AzimuthalEquidistantAzimuthal Equidistant Projection
GeographicLib::CassiniSoldnerCassini-Soldner Projection
GeographicLib::CircularEngineSpherical Harmonic sums for a circle
GeographicLib::SphericalEngine::coeffPackage up coefficients for SphericalEngine
GeographicLib::ConstantsConstants needed by GeographicLib
GeographicLib::DMSConvert between degrees and DMS representation
GeographicLib::EllipticFunctionElliptic functions needed for TransverseMercatorExact
GeographicLib::GeocentricGeocentric coordinates
GeographicLib::GeoCoordsConversion between geographic coordinates
GeographicLib::GeodesicGeodesic calculations
GeographicLib::GeodesicLineA geodesic line
GeographicLib::GeographicErrException handling for GeographicLib
GeographicLib::GeoidLooking up the height of the geoid
GeographicLib::GnomonicGnomonic Projection
GeographicLib::GravityCircleGravity on a circle of latitude
GeographicLib::GravityModelModel of the earth's gravity field
GeographicLib::LambertConformalConicLambert Conformal Conic Projection
GeographicLib::LocalCartesianLocal Cartesian coordinates
GeographicLib::MagneticCircleGeomagnetic field on a circle of latitude
GeographicLib::MagneticModelModel of the earth's magnetic field
GeographicLib::MathMathematical functions needed by GeographicLib
GeographicLib::MGRSConvert between UTM/UPS and MGRS
GeographicLib::NormalGravityThe normal gravity of the earth
GeographicLib::OSGBOrdnance Survey grid system for Great Britain
GeographicLib::PolarStereographicPolar Stereographic Projection
GeographicLib::PolygonAreaPolygon Areas
GeographicLib::SphericalEngineThe evaluation engine for SphericalHarmonic
GeographicLib::SphericalHarmonicSpherical Harmonic series
GeographicLib::SphericalHarmonic1Spherical Harmonic series with a correction to the coefficients
GeographicLib::SphericalHarmonic2Spherical Harmonic series with two corrections to the coefficients
GeographicLib::TransverseMercatorTransverse Mercator Projection
GeographicLib::TransverseMercatorExactAn exact implementation of the Transverse Mercator Projection
GeographicLib::UtilitySome utility routines for GeographicLib
GeographicLib::UTMUPSConvert between Geographic coordinates and UTM/UPS
geographiclib-1.21/doc/html/classGeographicLib_1_1GeoCoords.html0000644000175000017500000016575411745620414024473 0ustar frankiefrankie GeographicLib: GeographicLib::GeoCoords Class Reference
GeographicLib::GeoCoords Class Reference

Conversion between geographic coordinates. More...

#include <GeographicLib/GeoCoords.hpp>

List of all members.

Public Member Functions

Initializing the GeoCoords object
 GeoCoords () throw ()
 GeoCoords (const std::string &s, bool centerp=true, bool swaplatlong=false)
 GeoCoords (real latitude, real longitude, int zone=UTMUPS::STANDARD)
 GeoCoords (int zone, bool northp, real easting, real northing)
void Reset (const std::string &s, bool centerp=true, bool swaplatlong=false)
void Reset (real latitude, real longitude, int zone=UTMUPS::STANDARD)
void Reset (int zone, bool northp, real easting, real northing)
Querying the GeoCoords object
Math::real Latitude () const throw ()
Math::real Longitude () const throw ()
Math::real Easting () const throw ()
Math::real Northing () const throw ()
Math::real Convergence () const throw ()
Math::real Scale () const throw ()
bool Northp () const throw ()
char Hemisphere () const throw ()
int Zone () const throw ()
Setting and querying the alternate zone
void SetAltZone (int zone=UTMUPS::STANDARD) const
int AltZone () const throw ()
Math::real AltEasting () const throw ()
Math::real AltNorthing () const throw ()
Math::real AltConvergence () const throw ()
Math::real AltScale () const throw ()
String representations of the GeoCoords object
std::string GeoRepresentation (int prec=0, bool swaplatlong=false) const
std::string DMSRepresentation (int prec, bool swaplatlong, char dmssep) const
std::string DMSRepresentation (int prec=0, bool swaplatlong=false) const
std::string MGRSRepresentation (int prec=0) const
std::string UTMUPSRepresentation (int prec=0) const
std::string AltMGRSRepresentation (int prec=0) const
std::string AltUTMUPSRepresentation (int prec=0) const
Inspector functions
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()

Detailed Description

Conversion between geographic coordinates.

This class stores a geographic position which may be set via the constructors or Reset via

  • latitude and longitude
  • UTM or UPS coordinates
  • a string representation of these or an MGRS coordinate string

The state consists of the latitude and longitude and the supplied UTM or UPS coordinates (possibly derived from the MGRS coordinates). If latitude and longitude were given then the UTM/UPS coordinates follows the standard conventions.

The mutable state consists of the UTM or UPS coordinates for a alternate zone. A method SetAltZone is provided to set the alternate UPS/UTM zone.

Methods are provided to return the geographic coordinates, the input UTM or UPS coordinates (and associated meridian convergence and scale), or alternate UTM or UPS coordinates (and their associated meridian convergence and scale).

Once the input string has been parsed, you can print the result out in any of the formats, decimal degrees, degrees minutes seconds, MGRS, UTM/UPS.

Example of use:

// Example of using the GeographicLib::GeoCoords class
// $Id: 3f9c326bb5293db26a153e6f5eab165146899a9e $

#include <iostream>
#include <exception>
#include <string>
#include <GeographicLib/GeoCoords.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    // Miscellaneous conversions
    double lat = 33.3, lon = 44.4;
    GeoCoords c(lat, lon);
    cout << c.MGRSRepresentation(-3) << "\n";
    c.Reset("18TWN0050");
    cout << c.DMSRepresentation() << "\n";
    cout << c.Latitude() << " " << c.Longitude() << "\n";
    c.Reset("1d38'W 55d30'N");
    cout << c.GeoRepresentation() << "\n";
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

GeoConvert is a command-line utility providing access to the functionality of GeoCoords.


Constructor & Destructor Documentation

GeographicLib::GeoCoords::GeoCoords ( ) throw () [inline]

The default constructor is equivalent to latitude = 90o, longitude = 0o.

Definition at line 78 of file GeoCoords.hpp.

GeographicLib::GeoCoords::GeoCoords ( const std::string &  s,
bool  centerp = true,
bool  swaplatlong = false 
) [inline, explicit]

Construct from a string.

Parameters:
[in]s1-element, 2-element, or 3-element string representation of the position.
[in]centerpgoverns the interpretation of MGRS coordinates (see below).
[in]swaplatlonggoverns the interpretation of geographic coordinates (see below).

Parse as a string and interpret it as a geographic position. The input string is broken into space (or comma) separated pieces and Basic decision on which format is based on number of components

  1. MGRS
  2. "Lat Long" or "Long Lat"
  3. "Zone Easting Northing" or "Easting Northing Zone"

The following inputs are approximately the same (Ar Ramadi Bridge, Iraq)

  • Latitude and Longitude
    • 33.44 43.27
    • N33d26.4' E43d16.2'
    • 43d16'12"E 33d26'24"N
    • 43:16:12E 33:26:24
  • MGRS
    • 38SLC301
    • 38SLC391014
    • 38SLC3918701405
    • 37SHT9708
  • UTM
    • 38N 339188 3701405
    • 897039 3708229 37N

Latitude and Longitude parsing. Latitude precedes longitude, unless a N, S, E, W hemisphere designator is used on one or both coordinates. If swaplatlong = true (default is false), then longitude precedes latitude in the absence of a hemisphere designator. Thus (with swaplatlong = false)

  • 40 -75
  • N40 W75
  • -75 N40
  • 75W 40N
  • E-75 -40S

are all the same position. The coordinates may be given in decimal degrees, degrees and decimal minutes, degrees, minutes, seconds, etc. Use d, ', and " to mark off the degrees, minutes and seconds. Alternatively, use : to separate these components. Thus

  • 40d30'30"
  • 40d30'30
  • 40d30.5'
  • 40d30.5
  • 40:30:30
  • 40:30.5
  • 40.508333333

all specify the same angle. The leading sign applies to all components so -1d30 is -(1+30/60) = -1.5. Latitudes must be in the range [-90, 90] and longitudes in the range [-180, 360]. Internally longitudes are reduced to the range [-180, 180).

UTM/UPS parsing. For UTM zones (-80 <= Lat <= 84), the zone designator is made up of a zone number (for 1 to 60) and a hemisphere letter (N or S), e.g., 38N. The latitude zone designer ([C–M] in the southern hemisphere and [N–X] in the northern) should NOT be used. (This is part of the MGRS coordinate.) The zone designator for the poles (where UPS is employed) is a hemisphere letter by itself, i.e., N or S.

MGRS parsing interprets the grid references as square area at the specified precision (1m, 10m, 100m, etc.). If centerp = true (the default), the center of this square is then taken to be the precise position; thus:

  • 38SMB = 38N 450000 3650000
  • 38SMB4484 = 38N 444500 3684500
  • 38SMB44148470 = 38N 444145 3684705

Otherwise, the "south-west" corner of the square is used, i.e.,

  • 38SMB = 38N 400000 3600000
  • 38SMB4484 = 38N 444000 3684000
  • 38SMB44148470 = 38N 444140 3684700

Definition at line 169 of file GeoCoords.hpp.

GeographicLib::GeoCoords::GeoCoords ( real  latitude,
real  longitude,
int  zone = UTMUPS::STANDARD 
) [inline]

Construct from geographic coordinates.

Parameters:
[in]latitude(degrees).
[in]longitude(degrees).
[in]zoneif specified, force the UTM/UPS representation to use a specified zone using the rules given in UTMUPS::zonespec.

Definition at line 181 of file GeoCoords.hpp.

GeographicLib::GeoCoords::GeoCoords ( int  zone,
bool  northp,
real  easting,
real  northing 
) [inline]

Construct from UTM/UPS coordinates.

Parameters:
[in]zoneUTM zone (zero means UPS).
[in]northphemisphere (true means north, false means south).
[in]easting(meters).
[in]northing(meters).

Definition at line 193 of file GeoCoords.hpp.


Member Function Documentation

void GeographicLib::GeoCoords::Reset ( const std::string &  s,
bool  centerp = true,
bool  swaplatlong = false 
)

Reset the location from a string. See GeoCoords(const std::string& s, bool centerp, bool swaplatlong).

Definition at line 27 of file GeoCoords.cpp.

Referenced by main().

void GeographicLib::GeoCoords::Reset ( real  latitude,
real  longitude,
int  zone = UTMUPS::STANDARD 
) [inline]

Reset the location in terms of geographic coordinates. See GeoCoords(real latitude, real longitude, int zone).

Definition at line 208 of file GeoCoords.hpp.

References GeographicLib::UTMUPS::Forward().

void GeographicLib::GeoCoords::Reset ( int  zone,
bool  northp,
real  easting,
real  northing 
) [inline]

Reset the location in terms of UPS/UPS coordinates. See GeoCoords(int zone, bool northp, real easting, real northing).

Definition at line 223 of file GeoCoords.hpp.

References GeographicLib::UTMUPS::Reverse().

Math::real GeographicLib::GeoCoords::Latitude ( ) const throw () [inline]
Returns:
latitude (degrees)

Definition at line 241 of file GeoCoords.hpp.

Referenced by main().

Math::real GeographicLib::GeoCoords::Longitude ( ) const throw () [inline]
Returns:
longitude (degrees)

Definition at line 246 of file GeoCoords.hpp.

Referenced by main().

Math::real GeographicLib::GeoCoords::Easting ( ) const throw () [inline]
Returns:
easting (meters)

Definition at line 251 of file GeoCoords.hpp.

Math::real GeographicLib::GeoCoords::Northing ( ) const throw () [inline]
Returns:
northing (meters)

Definition at line 256 of file GeoCoords.hpp.

Math::real GeographicLib::GeoCoords::Convergence ( ) const throw () [inline]
Returns:
meridian convergence (degrees) for the UTM/UPS projection.

Definition at line 261 of file GeoCoords.hpp.

Math::real GeographicLib::GeoCoords::Scale ( ) const throw () [inline]
Returns:
scale for the UTM/UPS projection.

Definition at line 266 of file GeoCoords.hpp.

bool GeographicLib::GeoCoords::Northp ( ) const throw () [inline]
Returns:
hemisphere (false means south, true means north).

Definition at line 271 of file GeoCoords.hpp.

char GeographicLib::GeoCoords::Hemisphere ( ) const throw () [inline]
Returns:
hemisphere letter N or S.

Definition at line 276 of file GeoCoords.hpp.

int GeographicLib::GeoCoords::Zone ( ) const throw () [inline]
Returns:
the zone corresponding to the input (return 0 for UPS).

Definition at line 281 of file GeoCoords.hpp.

void GeographicLib::GeoCoords::SetAltZone ( int  zone = UTMUPS::STANDARD) const [inline]

Specify alternate zone number.

Parameters:
[in]zonezone number for the alternate representation.

See UTMUPS::zonespec for more information on the interpretation of zone. Note that zone == UTMUPS::STANDARD (the default) use the standard UPS or UTM zone, UTMUPS::MATCH does nothing retaining the existing alternate representation. Before this is called the alternate zone is the input zone.

Definition at line 299 of file GeoCoords.hpp.

References GeographicLib::UTMUPS::MATCH, GeographicLib::UTMUPS::StandardZone(), and GeographicLib::UTMUPS::Forward().

int GeographicLib::GeoCoords::AltZone ( ) const throw () [inline]
Returns:
current alternate zone (return 0 for UPS).

Definition at line 317 of file GeoCoords.hpp.

Math::real GeographicLib::GeoCoords::AltEasting ( ) const throw () [inline]
Returns:
easting (meters) for alternate zone.

Definition at line 322 of file GeoCoords.hpp.

Math::real GeographicLib::GeoCoords::AltNorthing ( ) const throw () [inline]
Returns:
northing (meters) for alternate zone.

Definition at line 327 of file GeoCoords.hpp.

Math::real GeographicLib::GeoCoords::AltConvergence ( ) const throw () [inline]
Returns:
meridian convergence (degrees) for alternate zone.

Definition at line 332 of file GeoCoords.hpp.

Math::real GeographicLib::GeoCoords::AltScale ( ) const throw () [inline]
Returns:
scale for alternate zone.

Definition at line 337 of file GeoCoords.hpp.

string GeographicLib::GeoCoords::GeoRepresentation ( int  prec = 0,
bool  swaplatlong = false 
) const

String representation with latitude and longitude as signed decimal degrees.

Parameters:
[in]precprecision (relative to about 1m).
[in]swaplatlongif true give longitude first (default = false)
Returns:
decimal latitude/longitude string representation.

Precision specifies accuracy of representation as follows:

  • prec = -5 (min), 1d
  • prec = 0, 10-5d (about 1m)
  • prec = 3, 10-8d
  • prec = 9 (max), 10-14d

Definition at line 70 of file GeoCoords.cpp.

string GeographicLib::GeoCoords::DMSRepresentation ( int  prec,
bool  swaplatlong,
char  dmssep 
) const

String representation with latitude and longitude as degrees, minutes, seconds, and hemisphere.

Parameters:
[in]precprecision (relative to about 1m)
[in]swaplatlongif true give longitude first (default = false)
[in]dmssepif non-null, use as the DMS separator character (instead of d, ', " delimiters).
Returns:
DMS latitude/longitude string representation.

Precision specifies accuracy of representation as follows:

  • prec = -5 (min), 1d
  • prec = -4, 0.1d
  • prec = -3, 1'
  • prec = -2, 0.1'
  • prec = -1, 1"
  • prec = 0, 0.1" (about 3m)
  • prec = 1, 0.01"
  • prec = 10 (max), 10-11"

Definition at line 88 of file GeoCoords.cpp.

string GeographicLib::GeoCoords::DMSRepresentation ( int  prec = 0,
bool  swaplatlong = false 
) const

String representation with latitude and longitude as degrees, minutes, seconds, and hemisphere.

Parameters:
[in]precprecision (relative to about 1m)
[in]swaplatlongif true give longitude first (default = false)
Returns:
DMS latitude/longitude string representation.

COMPATIBILITY NOTE: This function calls DMSRepresentation(int, bool, char) const with a 3rd argument of char(0). At some point, DMSRepresentation(int, bool) const and will be withdrawn and the interface to DMSRepresentation(int, bool, char) const changed so that its arguments have default values. This will preserve source-level compatibility.

Definition at line 97 of file GeoCoords.cpp.

string GeographicLib::GeoCoords::MGRSRepresentation ( int  prec = 0) const

MGRS string.

Parameters:
[in]precprecision (relative to about 1m).
Returns:
MGRS string.

This gives the coordinates of the enclosing grid square with size given by the precision. Thus 38N 444180 3684790 converted to a MGRS coordinate at precision -2 (100m) is 38SMB441847 and not 38SMB442848. prec specifies the precision of the MGRS string as follows:

  • prec = -5 (min), 100km
  • prec = -4, 10km
  • prec = -3, 1km
  • prec = -2, 100m
  • prec = -1, 10m
  • prec = 0, 1m
  • prec = 1, 0.1m
  • prec = 6 (max), 1um

Definition at line 100 of file GeoCoords.cpp.

string GeographicLib::GeoCoords::UTMUPSRepresentation ( int  prec = 0) const

UTM/UPS string.

Parameters:
[in]precprecision (relative to about 1m)
Returns:
UTM/UPS string representation: zone designator, easting, and northing.

Precision specifies accuracy of representation as follows:

  • prec = -5 (min), 100km
  • prec = -3, 1km
  • prec = 0, 1m
  • prec = 3, 1mm
  • prec = 6, 1um
  • prec = 9 (max), 1nm

Definition at line 138 of file GeoCoords.cpp.

string GeographicLib::GeoCoords::AltMGRSRepresentation ( int  prec = 0) const

MGRS string for the alternate zone. See GeoCoords::MGRSRepresentation.

Definition at line 108 of file GeoCoords.cpp.

string GeographicLib::GeoCoords::AltUTMUPSRepresentation ( int  prec = 0) const

UTM/UPS string for the alternate zone. See GeoCoords::UTMUPSRepresentation.

Definition at line 144 of file GeoCoords.cpp.

Math::real GeographicLib::GeoCoords::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the WGS84 ellipsoid (meters).

(The WGS84 value is returned because the UTM and UPS projections are based on this ellipsoid.)

Definition at line 459 of file GeoCoords.hpp.

References GeographicLib::UTMUPS::MajorRadius().

Math::real GeographicLib::GeoCoords::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the WGS84 ellipsoid.

(The WGS84 value is returned because the UTM and UPS projections are based on this ellipsoid.)

Definition at line 467 of file GeoCoords.hpp.

References GeographicLib::UTMUPS::Flattening().


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/classGeographicLib_1_1Math.html0000644000175000017500000012015311745620415023461 0ustar frankiefrankie GeographicLib: GeographicLib::Math Class Reference
GeographicLib::Math Class Reference

Mathematical functions needed by GeographicLib. More...

#include <GeographicLib/Math.hpp>

List of all members.

Public Types

typedef double extended
typedef double real

Static Public Member Functions

template<typename T >
static T pi () throw ()
static real pi () throw ()
template<typename T >
static T degree () throw ()
static real degree () throw ()
template<typename T >
static T sq (T x) throw ()
template<typename T >
static T hypot (T x, T y) throw ()
template<typename T >
static T expm1 (T x) throw ()
template<typename T >
static T log1p (T x) throw ()
template<typename T >
static T asinh (T x) throw ()
template<typename T >
static T atanh (T x) throw ()
template<typename T >
static T cbrt (T x) throw ()
template<typename T >
static bool isfinite (T x) throw ()
template<typename T >
static T NaN () throw ()
static real NaN () throw ()
template<typename T >
static bool isnan (T x) throw ()
template<typename T >
static T infinity () throw ()
static real infinity () throw ()
template<typename T >
static T swab (T x)

Static Public Attributes

static const bool bigendian = WORDS_BIGENDIAN

Detailed Description

Mathematical functions needed by GeographicLib.

Define mathematical functions in order to localize system dependencies and to provide generic versions of the functions. In addition define a real type to be used by GeographicLib.

Example of use:

// Example of using the GeographicLib::Math class
// $Id: 04519bb67e82229a86ee23002ddc27a6b5bb2939 $

#include <iostream>
#include <exception>
#include <GeographicLib/Math.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    cout << Math::pi() << " " << Math::sq(Math::pi()) << "\n";
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Member Typedef Documentation

Definition at line 77 of file Math.hpp.

typedef double GeographicLib::Math::real

The real type for GeographicLib. Nearly all the testing has been done with real = double. However, the algorithms should also work with float and long double (where available). (CAUTION: reasonable accuracy typically cannot be obtained using floats.)

Definition at line 87 of file Math.hpp.


Member Function Documentation

template<typename T >
static T GeographicLib::Math::pi ( ) throw () [inline, static]
Template Parameters:
Tthe type of the returned value.
Returns:
pi.

Definition at line 105 of file Math.hpp.

static real GeographicLib::Math::pi ( ) throw () [inline, static]

A synonym for pi<real>().

Definition at line 110 of file Math.hpp.

template<typename T >
static T GeographicLib::Math::degree ( ) throw () [inline, static]
Template Parameters:
Tthe type of the returned value.
Returns:
the number of radians in a degree.

Definition at line 116 of file Math.hpp.

static real GeographicLib::Math::degree ( ) throw () [inline, static]

A synonym for degree<real>().

Definition at line 121 of file Math.hpp.

template<typename T >
static T GeographicLib::Math::hypot ( x,
y 
) throw () [inline, static]
template<typename T >
static T GeographicLib::Math::expm1 ( x) throw () [inline, static]

exp(x) - 1 accurate near x = 0. This is taken from N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd Edition (SIAM, 2002), Sec 1.14.1, p 19.

Template Parameters:
Tthe type of the argument and the returned value.
Parameters:
[in]x
Returns:
exp(x) - 1.

Definition at line 189 of file Math.hpp.

template<typename T >
static T GeographicLib::Math::log1p ( x) throw () [inline, static]

log(1 + x) accurate near x = 0.

This is taken from D. Goldberg, What every computer scientist should know about floating-point arithmetic (1991), Theorem 4. See also, Higham (op. cit.), Answer to Problem 1.5, p 528.

Template Parameters:
Tthe type of the argument and the returned value.
Parameters:
[in]x
Returns:
log(1 + x).

Definition at line 224 of file Math.hpp.

Referenced by GeographicLib::LambertConformalConic::Reverse().

template<typename T >
static T GeographicLib::Math::asinh ( x) throw () [inline, static]

The inverse hyperbolic sine function. This is defined in terms of Math::log1p(x) in order to maintain accuracy near x = 0. In addition, the odd parity of the function is enforced.

Template Parameters:
Tthe type of the argument and the returned value.
Parameters:
[in]x
Returns:
asinh(x).

Definition at line 256 of file Math.hpp.

Referenced by GeographicLib::LambertConformalConic::Forward(), and GeographicLib::TransverseMercator::Forward().

template<typename T >
static T GeographicLib::Math::atanh ( x) throw () [inline, static]

The inverse hyperbolic tangent function. This is defined in terms of Math::log1p(x) in order to maintain accuracy near x = 0. In addition, the odd parity of the function is enforced.

Template Parameters:
Tthe type of the argument and the returned value.
Parameters:
[in]x
Returns:
atanh(x).

Definition at line 283 of file Math.hpp.

template<typename T >
static T GeographicLib::Math::cbrt ( x) throw () [inline, static]

The cube root function.

Template Parameters:
Tthe type of the argument and the returned value.
Parameters:
[in]x
Returns:
the real cube root of x.

Definition at line 308 of file Math.hpp.

template<typename T >
static T GeographicLib::Math::NaN ( ) throw () [inline, static]

The NaN (not a number)

Template Parameters:
Tthe type of the returned value.
Returns:
NaN if available, otherwise return the max real.

Definition at line 346 of file Math.hpp.

static real GeographicLib::Math::NaN ( ) throw () [inline, static]

A synonym for NaN<real>().

Definition at line 354 of file Math.hpp.

template<typename T >
static bool GeographicLib::Math::isnan ( x) throw () [inline, static]

Test for NaN.

Template Parameters:
Tthe type of the argument.
Parameters:
[in]x
Returns:
true if argument is a NaN.

Definition at line 363 of file Math.hpp.

Referenced by main().

template<typename T >
static T GeographicLib::Math::infinity ( ) throw () [inline, static]

Infinity

Template Parameters:
Tthe type of the returned value.
Returns:
infinity if available, otherwise return the max real.

Definition at line 377 of file Math.hpp.

static real GeographicLib::Math::infinity ( ) throw () [inline, static]

A synonym for infinity<real>().

Definition at line 385 of file Math.hpp.

template<typename T >
static T GeographicLib::Math::swab ( x) [inline, static]

Swap the bytes of a quantity

Template Parameters:
Tthe type of the argument and the returned value.
Parameters:
[in]x
Returns:
x with its bytes swapped.

Definition at line 394 of file Math.hpp.


Member Data Documentation

const bool GeographicLib::Math::bigendian = WORDS_BIGENDIAN [static]

true if the machine is big-endian

Definition at line 99 of file Math.hpp.

Referenced by GeographicLib::Utility::readarray(), and GeographicLib::Utility::writearray().


The documentation for this class was generated from the following file:
geographiclib-1.21/doc/html/classGeographicLib_1_1SphericalHarmonic-members.html0000644000175000017500000001327511745620415027621 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::SphericalHarmonic Member List
This is the complete list of members for GeographicLib::SphericalHarmonic, including all inherited members.
Circle(real p, real z, bool gradp) const GeographicLib::SphericalHarmonic [inline]
Coefficients() const GeographicLib::SphericalHarmonic [inline]
FULL enum valueGeographicLib::SphericalHarmonic
normalization enum nameGeographicLib::SphericalHarmonic
operator()(real x, real y, real z) const GeographicLib::SphericalHarmonic [inline]
operator()(real x, real y, real z, real &gradx, real &grady, real &gradz) const GeographicLib::SphericalHarmonic [inline]
SCHMIDT enum valueGeographicLib::SphericalHarmonic
SphericalHarmonic(const std::vector< real > &C, const std::vector< real > &S, int N, real a, unsigned norm=FULL)GeographicLib::SphericalHarmonic [inline]
SphericalHarmonic(const std::vector< real > &C, const std::vector< real > &S, int N, int nmx, int mmx, real a, unsigned norm=FULL)GeographicLib::SphericalHarmonic [inline]
SphericalHarmonic()GeographicLib::SphericalHarmonic [inline]
geographiclib-1.21/doc/html/PolygonArea_8cpp_source.html0000644000175000017500000003136711745620415023224 0ustar frankiefrankie GeographicLib: PolygonArea.cpp Source File
PolygonArea.cpp
Go to the documentation of this file.
00001 /**
00002  * \file PolygonArea.cpp
00003  * \brief Implementation for GeographicLib::PolygonArea class
00004  *
00005  * Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/PolygonArea.hpp>
00011 
00012 #define GEOGRAPHICLIB_POLYGONAREA_CPP \
00013   "$Id: ae2fce0b24653309ca8835d962b1a3e047a6768a $"
00014 
00015 RCSID_DECL(GEOGRAPHICLIB_POLYGONAREA_CPP)
00016 RCSID_DECL(GEOGRAPHICLIB_POLYGONAREA_HPP)
00017 RCSID_DECL(GEOGRAPHICLIB_ACCUMULATOR_HPP)
00018 
00019 namespace GeographicLib {
00020 
00021   using namespace std;
00022 
00023   void PolygonArea::AddPoint(real lat, real lon) throw() {
00024     if (_num == 0) {
00025       _lat0 = _lat1 = lat;
00026       _lon0 = _lon1 = lon;
00027     } else {
00028       real s12, S12, t;
00029       _earth.GenInverse(_lat1, _lon1, lat, lon, _mask, s12, t, t, t, t, t, S12);
00030       _perimetersum += s12;
00031       if (!_polyline) {
00032         _areasum += S12;
00033         _crossings += transit(_lon1, lon);
00034       }
00035       _lat1 = lat;
00036       _lon1 = lon;
00037     }
00038     ++_num;
00039   }
00040 
00041   unsigned PolygonArea::Compute(bool reverse, bool sign,
00042                                 real& perimeter, real& area) const throw() {
00043     real s12, S12, t;
00044     if (_num < 2) {
00045       perimeter = 0;
00046       if (!_polyline)
00047         area = 0;
00048       return _num;
00049     }
00050     if (_polyline) {
00051       perimeter = _perimetersum();
00052       return _num;
00053     }
00054     _earth.GenInverse(_lat1, _lon1, _lat0, _lon0, _mask,
00055                       s12, t, t, t, t, t, S12);
00056     perimeter = _perimetersum(s12);
00057     Accumulator<real> tempsum(_areasum);
00058     tempsum += S12;
00059     int crossings = _crossings + transit(_lon1, _lon0);
00060     if (crossings & 1)
00061       tempsum += (tempsum < 0 ? 1 : -1) * _area0/2;
00062     // area is with the clockwise sense.  If !reverse convert to
00063     // counter-clockwise convention.
00064     if (!reverse)
00065       tempsum *= -1;
00066     // If sign put area in (-area0/2, area0/2], else put area in [0, area0)
00067     if (sign) {
00068       if (tempsum > _area0/2)
00069         tempsum -= _area0;
00070       else if (tempsum <= -_area0/2)
00071         tempsum += _area0;
00072     } else {
00073       if (tempsum >= _area0)
00074         tempsum -= _area0;
00075       else if (tempsum < 0)
00076         tempsum += _area0;
00077     }
00078     area = 0 + tempsum();
00079     return _num;
00080   }
00081 
00082   unsigned PolygonArea::TestCompute(real lat, real lon, bool reverse, bool sign,
00083                                     real& perimeter, real& area) const throw() {
00084     if (_num == 0) {
00085       perimeter = 0;
00086       if (!_polyline)
00087         area = 0;
00088       return 1;
00089     }
00090     perimeter = _perimetersum();
00091     real tempsum = _polyline ? 0 : _areasum();
00092     int crossings = _crossings, num = _num + 1;
00093     for (int i = 0; i < (_polyline ? 1 : 2); ++i) {
00094       real s12, S12, t;
00095       _earth.GenInverse(i == 0 ? _lat1 : lat, i == 0 ? _lon1 : lon,
00096                         i != 0 ? _lat0 : lat, i != 0 ? _lon0 : lon,
00097                         _mask, s12, t, t, t, t, t, S12);
00098       perimeter += s12;
00099       if (!_polyline) {
00100         tempsum += S12;
00101         crossings += transit(i == 0 ? _lon1 : lon,
00102                              i != 0 ? _lon0 : lon);
00103       }
00104     }
00105 
00106     if (_polyline)
00107       return num;
00108 
00109     if (crossings & 1)
00110       tempsum += (tempsum < 0 ? 1 : -1) * _area0/2;
00111     // area is with the clockwise sense.  If !reverse convert to
00112     // counter-clockwise convention.
00113     if (!reverse)
00114       tempsum *= -1;
00115     // If sign put area in (-area0/2, area0/2], else put area in [0, area0)
00116     if (sign) {
00117       if (tempsum > _area0/2)
00118         tempsum -= _area0;
00119       else if (tempsum <= -_area0/2)
00120         tempsum += _area0;
00121     } else {
00122       if (tempsum >= _area0)
00123         tempsum -= _area0;
00124       else if (tempsum < 0)
00125         tempsum += _area0;
00126     }
00127     area = 0 + tempsum;
00128     return num;
00129   }
00130 
00131 } // namespace GeographicLib
geographiclib-1.21/doc/html/classGeographicLib_1_1UTMUPS.html0000644000175000017500000013350311745620414023627 0ustar frankiefrankie GeographicLib: GeographicLib::UTMUPS Class Reference
GeographicLib::UTMUPS Class Reference

Convert between Geographic coordinates and UTM/UPS. More...

#include <GeographicLib/UTMUPS.hpp>

List of all members.

Public Types

enum  zonespec {
  MINPSEUDOZONE = -4, INVALID = -4, MATCH = -3, UTM = -2,
  STANDARD = -1, MAXPSEUDOZONE = -1, MINZONE = 0, UPS = 0,
  MINUTMZONE = 1, MAXUTMZONE = 60, MAXZONE = 60
}

Static Public Member Functions

static int StandardZone (real lat, real lon, int setzone=STANDARD)
static void Forward (real lat, real lon, int &zone, bool &northp, real &x, real &y, real &gamma, real &k, int setzone=STANDARD, bool mgrslimits=false)
static void Reverse (int zone, bool northp, real x, real y, real &lat, real &lon, real &gamma, real &k, bool mgrslimits=false)
static void Forward (real lat, real lon, int &zone, bool &northp, real &x, real &y, int setzone=STANDARD, bool mgrslimits=false)
static void Reverse (int zone, bool northp, real x, real y, real &lat, real &lon, bool mgrslimits=false)
static void DecodeZone (const std::string &zonestr, int &zone, bool &northp)
static std::string EncodeZone (int zone, bool northp)
static Math::real UTMShift () throw ()
Inspector functions
static Math::real MajorRadius () throw ()
static Math::real Flattening () throw ()

Detailed Description

Convert between Geographic coordinates and UTM/UPS.

UTM and UPS are defined

Section 2-3 defines UTM and section 3-2.4 defines UPS. This document also includes approximate algorithms for the computation of the underlying transverse Mercator and polar stereographic projections. Here we substitute much more accurate algorithms given by GeographicLib:TransverseMercator and GeographicLib:PolarStereographic.

In this implementation, the conversions are closed, i.e., output from Forward is legal input for Reverse and vice versa. The error is about 5nm in each direction. However, the conversion from legal UTM/UPS coordinates to geographic coordinates and back might throw an error if the initial point is within 5nm of the edge of the allowed range for the UTM/UPS coordinates.

The simplest way to guarantee the closed property is to define allowed ranges for the eastings and northings for UTM and UPS coordinates. The UTM boundaries are the same for all zones. (The only place the exceptional nature of the zone boundaries is evident is when converting to UTM/UPS coordinates requesting the standard zone.) The MGRS lettering scheme imposes natural limits on UTM/UPS coordinates which may be converted into MGRS coordinates. For the conversion to/from geographic coordinates these ranges have been extended by 100km in order to provide a generous overlap between UTM and UPS and between UTM zones.

The NGA software package geotrans also provides conversions to and from UTM and UPS. Version 2.4.2 (and earlier) suffers from some drawbacks:

  • Inconsistent rules are used to determine the whether a particular UTM or UPS coordinate is legal. A more systematic approach is taken here.
  • The underlying projections are not very accurately implemented.

Example of use:

// Example of using the GeographicLib::UTMUPS class
// $Id: 83d5ba7eb8c9ce1963cb9499a6ee404329e74f3a $

#include <iostream>
#include <exception>
#include <string>
#include <iomanip>
#include <GeographicLib/UTMUPS.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    // See also example-GeoCoords.cpp
    {
      // Sample forward calculation
      double lat = 33.3, lon = 44.4; // Baghdad
      int zone;
      bool northp;
      double x, y;
      UTMUPS::Forward(lat, lon, zone, northp, x, y);
      string zonestr = UTMUPS::EncodeZone(zone, northp);
      cout << fixed << setprecision(2)
           << zonestr << " " << x << " " << y << "\n";
    }
    {
      // Sample reverse calculation
      string zonestr = "38N";
      int zone;
      bool northp;
      UTMUPS::DecodeZone(zonestr, zone, northp);
      double x = 444e3, y = 3688e3;
      double lat, lon;
      UTMUPS::Reverse(zone, northp, x, y, lat, lon);
      cout << lat << " " << lon << "\n";
    }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Member Enumeration Documentation

In this class we bring together the UTM and UPS coordinates systems. The UTM divides the earth between latitudes -80 and 84 into 60 zones numbered 1 thru 60. Zone assign zone number 0 to the UPS regions, covering the two poles. Within UTMUPS, non-negative zone numbers refer to one of the "physical" zones, 0 for UPS and [1, 60] for UTM. Negative "pseudo-zone" numbers are used to select one of the physical zones.

Enumerator:
MINPSEUDOZONE 

The smallest pseudo-zone number.

INVALID 

A marker for an undefined or invalid zone. Equivalent to NaN.

MATCH 

If a coordinate already include zone information (e.g., it is an MGRS coordinate), use that, otherwise apply the UTMUPS::STANDARD rules.

UTM 

Apply the standard rules for UTM zone assigment extending the UTM zone to each pole to give a zone number in [1, 60]. For example, use UTM zone 38 for longitude in [42, 48). The rules include the Norway and Svalbard exceptions.

STANDARD 

Apply the standard rules for zone assignment to give a zone number in [0, 60]. If the latitude is not in [-80, 84), then use UTMUPS::UPS = 0, otherwise apply the rules for UTMUPS::UTM. The tests on latitudes and longitudes are all closed on the lower end open on the upper. Thus for UTM zone 38, latitude is in [-80, 84) and longitude is in [42, 48).

MAXPSEUDOZONE 

The largest pseudo-zone number.

MINZONE 

The smallest physical zone number.

UPS 

The zone number used for UPS

MINUTMZONE 

The smallest UTM zone number.

MAXUTMZONE 

The largest UTM zone number.

MAXZONE 

The largest physical zone number.

Definition at line 91 of file UTMUPS.hpp.


Member Function Documentation

int GeographicLib::UTMUPS::StandardZone ( real  lat,
real  lon,
int  setzone = STANDARD 
) [static]

The standard zone.

Parameters:
[in]latlatitude (degrees).
[in]lonlongitude (degrees).
[in]setzonezone override (optional).

This is exact. If the optional argument setzone is given then use that zone if it is non-negative, otherwise apply the rules given in UTMUPS::zonespec. Throws an error if setzone is outsize the range [UTMUPS::MINPSEUDOZONE, UTMUPS::MAXZONE] = [-4, 60].

Definition at line 49 of file UTMUPS.cpp.

Referenced by GeographicLib::GeoCoords::SetAltZone().

void GeographicLib::UTMUPS::Forward ( real  lat,
real  lon,
int &  zone,
bool &  northp,
real &  x,
real &  y,
real &  gamma,
real &  k,
int  setzone = STANDARD,
bool  mgrslimits = false 
) [static]

Forward projection, from geographic to UTM/UPS.

Parameters:
[in]latlatitude of point (degrees).
[in]lonlongitude of point (degrees).
[out]zonethe UTM zone (zero means UPS).
[out]northphemisphere (true means north, false means south).
[out]xeasting of point (meters).
[out]ynorthing of point (meters).
[out]gammameridian convergence at point (degrees).
[out]kscale of projection at point.
[in]setzonezone override.
[in]mgrslimitsif true enforce the stricter MGRS limits on the coordinates (default = false).

The preferred zone for the result can be specified with setzone, see UTMUPS::StandardZone. Throw error if the resulting easting or northing is outside the allowed range (see Reverse), in which case the arguments are unchanged. This also returns meridian convergence gamma (degrees) and scale k. The accuracy of the conversion is about 5nm.

Definition at line 73 of file UTMUPS.cpp.

References GeographicLib::TransverseMercator::Forward(), and GeographicLib::PolarStereographic::Forward().

Referenced by GeographicLib::GeoCoords::Reset(), and GeographicLib::GeoCoords::SetAltZone().

void GeographicLib::UTMUPS::Reverse ( int  zone,
bool  northp,
real  x,
real  y,
real &  lat,
real &  lon,
real &  gamma,
real &  k,
bool  mgrslimits = false 
) [static]

Reverse projection, from UTM/UPS to geographic.

Parameters:
[in]zonethe UTM zone (zero means UPS).
[in]northphemisphere (true means north, false means south).
[in]xeasting of point (meters).
[in]ynorthing of point (meters).
[out]latlatitude of point (degrees).
[out]lonlongitude of point (degrees).
[out]gammameridian convergence at point (degrees).
[out]kscale of projection at point.
[in]mgrslimitsif true enforce the stricter MGRS limits on the coordinates (default = false).

Throw error if easting or northing is outside the allowed range (see below), in which case the arguments are unchanged. The accuracy of the conversion is about 5nm.

UTM eastings are allowed to be in the range [0km, 1000km], northings are allowed to be in in [0km, 9600km] for the northern hemisphere and in [900km, 10000km] for the southern hemisphere. (However UTM northings can be continued across the equator. So the actual limits on the northings are [-9100km, 9600km] for the "northern" hemisphere and [900km, 19600km] for the "southern" hemisphere.)

UPS eastings and northings are allowed to be in the range [1200km, 2800km] in the northern hemisphere and in [700km, 3100km] in the southern hemisphere.

These ranges are 100km larger than allowed for the conversions to MGRS. (100km is the maximum extra padding consistent with eastings remaining non-negative.) This allows generous overlaps between zones and UTM and UPS. If mgrslimits = true, then all the ranges are shrunk by 100km so that they agree with the stricter MGRS ranges. No checks are performed besides these (e.g., to limit the distance outside the standard zone boundaries).

Definition at line 124 of file UTMUPS.cpp.

References GeographicLib::TransverseMercator::Reverse(), and GeographicLib::PolarStereographic::Reverse().

Referenced by GeographicLib::GeoCoords::Reset().

static void GeographicLib::UTMUPS::Forward ( real  lat,
real  lon,
int &  zone,
bool &  northp,
real &  x,
real &  y,
int  setzone = STANDARD,
bool  mgrslimits = false 
) [inline, static]

UTMUPS::Forward without returning convergence and scale.

Definition at line 231 of file UTMUPS.hpp.

static void GeographicLib::UTMUPS::Reverse ( int  zone,
bool  northp,
real  x,
real  y,
real &  lat,
real &  lon,
bool  mgrslimits = false 
) [inline, static]

UTMUPS::Reverse without returning convergence and scale.

Definition at line 241 of file UTMUPS.hpp.

void GeographicLib::UTMUPS::DecodeZone ( const std::string &  zonestr,
int &  zone,
bool &  northp 
) [static]

Decode a UTM/UPS zone string.

Parameters:
[in]zonestrstring representation of zone and hemisphere.
[out]zonethe UTM zone (zero means UPS).
[out]northphemisphere (true means north, false means south).

For UTM, zonestr has the form of a zone number in the range [UTMUPS::MINUTMZONE, UTMUPS::MAXUTMZONE] = [1, 60] followed by a hemisphere letter, N or S. For UPS, it consists just of the hemisphere letter. The returned value of zone is UTMUPS::UPS = 0 for UPS. Note well that "38S" indicates the southern hemisphere of zone 38 and not latitude band S, [32, 40]. N, 01S, 2N, 38S are legal. 0N, 001S, 61N, 38P are illegal. INV is a special value for which the returned value of is UTMUPS::INVALID. Throws an error is the zone string is malformed.

Definition at line 186 of file UTMUPS.cpp.

Referenced by main().

std::string GeographicLib::UTMUPS::EncodeZone ( int  zone,
bool  northp 
) [static]

Encode a UTM/UPS zone string.

Parameters:
[out]zonethe UTM zone (zero means UPS).
[out]northphemisphere (true means north, false means south).
Returns:
string representation of zone and hemisphere.

zone must be in the range [UTMUPS::MINZONE, UTMUPS::MAXZONE] = [0, 60] with zone = UTMUPS::UPS, 0, indicating UPS (but the resulting string does not contain "0"). zone may also be UTMUPS::INVALID, in which case the returned string is "INV". This reverses UTMUPS::DecodeZone.

Definition at line 230 of file UTMUPS.cpp.

Math::real GeographicLib::UTMUPS::UTMShift ( ) throw () [static]
Returns:
shift (meters) necessary to align N and S halves of a UTM zone (107).

Definition at line 243 of file UTMUPS.cpp.

static Math::real GeographicLib::UTMUPS::MajorRadius ( ) throw () [inline, static]
Returns:
a the equatorial radius of the WGS84 ellipsoid (meters).

(The WGS84 value is returned because the UTM and UPS projections are based on this ellipsoid.)

Definition at line 295 of file UTMUPS.hpp.

Referenced by GeographicLib::GeoCoords::MajorRadius(), and GeographicLib::MGRS::MajorRadius().

static Math::real GeographicLib::UTMUPS::Flattening ( ) throw () [inline, static]
Returns:
f the flattening of the WGS84 ellipsoid.

(The WGS84 value is returned because the UTM and UPS projections are based on this ellipsoid.)

Definition at line 304 of file UTMUPS.hpp.

Referenced by GeographicLib::GeoCoords::Flattening(), and GeographicLib::MGRS::Flattening().


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/classGeographicLib_1_1Geocentric-members.html0000644000175000017500000001754111745620415026310 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::Geocentric Member List
This is the complete list of members for GeographicLib::Geocentric, including all inherited members.
Flattening() const GeographicLib::Geocentric [inline]
Forward(real lat, real lon, real h, real &X, real &Y, real &Z) const GeographicLib::Geocentric [inline]
Forward(real lat, real lon, real h, real &X, real &Y, real &Z, std::vector< real > &M) const GeographicLib::Geocentric [inline]
Geocentric(real a, real f)GeographicLib::Geocentric
Geocentric()GeographicLib::Geocentric [inline]
GravityCircle classGeographicLib::Geocentric [friend]
GravityModel classGeographicLib::Geocentric [friend]
Init() const GeographicLib::Geocentric [inline]
LocalCartesian classGeographicLib::Geocentric [friend]
MagneticCircle classGeographicLib::Geocentric [friend]
MagneticModel classGeographicLib::Geocentric [friend]
MajorRadius() const GeographicLib::Geocentric [inline]
NormalGravity classGeographicLib::Geocentric [friend]
Reverse(real X, real Y, real Z, real &lat, real &lon, real &h) const GeographicLib::Geocentric [inline]
Reverse(real X, real Y, real Z, real &lat, real &lon, real &h, std::vector< real > &M) const GeographicLib::Geocentric [inline]
SphericalHarmonic classGeographicLib::Geocentric [friend]
SphericalHarmonic1 classGeographicLib::Geocentric [friend]
SphericalHarmonic2 classGeographicLib::Geocentric [friend]
WGS84GeographicLib::Geocentric [static]
geographiclib-1.21/doc/html/AlbersEqualArea_8hpp_source.html0000644000175000017500000012437611745620414024004 0ustar frankiefrankie GeographicLib: AlbersEqualArea.hpp Source File
AlbersEqualArea.hpp
Go to the documentation of this file.
00001 /**
00002  * \file AlbersEqualArea.hpp
00003  * \brief Header for GeographicLib::AlbersEqualArea class
00004  *
00005  * Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_ALBERSEQUALAREA_HPP)
00011 #define GEOGRAPHICLIB_ALBERSEQUALAREA_HPP \
00012   "$Id: d17f37d1bec84543dc3753e882d8e95f1c1d5a1b $"
00013 
00014 #include <algorithm>
00015 #include <GeographicLib/Constants.hpp>
00016 
00017 namespace GeographicLib {
00018 
00019   /**
00020    * \brief Albers Equal Area Conic Projection
00021    *
00022    * Implementation taken from the report,
00023    * - J. P. Snyder,
00024    *   <a href="http://pubs.er.usgs.gov/usgspubs/pp/pp1395"> Map Projections: A
00025    *   Working Manual</a>, USGS Professional Paper 1395 (1987),
00026    *   pp. 101&ndash;102.
00027    *
00028    * This is a implementation of the equations in Snyder except that divided
00029    * differences will be [have been] used to transform the expressions into
00030    * ones which may be evaluated accurately.  [In this implementation, the
00031    * projection correctly becomes the cylindrical equal area or the azimuthal
00032    * equal area projection when the standard latitude is the equator or a
00033    * pole.]
00034    *
00035    * The ellipsoid parameters, the standard parallels, and the scale on the
00036    * standard parallels are set in the constructor.  Internally, the case with
00037    * two standard parallels is converted into a single standard parallel, the
00038    * latitude of minimum azimuthal scale, with an azimuthal scale specified on
00039    * this parallel.  This latitude is also used as the latitude of origin which
00040    * is returned by AlbersEqualArea::OriginLatitude.  The azimuthal scale on
00041    * the latitude of origin is given by AlbersEqualArea::CentralScale.  The
00042    * case with two standard parallels at opposite poles is singular and is
00043    * disallowed.  The central meridian (which is a trivial shift of the
00044    * longitude) is specified as the \e lon0 argument of the
00045    * AlbersEqualArea::Forward and AlbersEqualArea::Reverse functions.
00046    * AlbersEqualArea::Forward and AlbersEqualArea::Reverse also return the
00047    * meridian convergence, \e gamma, and azimuthal scale, \e k.  A small square
00048    * aligned with the cardinal directions is projected to a rectangle with
00049    * dimensions \e k (in the E-W direction) and 1/\e k (in the N-S direction).
00050    * The E-W sides of the rectangle are oriented \e gamma degrees
00051    * counter-clockwise from the \e x axis.  There is no provision in this class
00052    * for specifying a false easting or false northing or a different latitude
00053    * of origin.
00054    *
00055    * Example of use:
00056    * \include example-AlbersEqualArea.cpp
00057    *
00058    * <a href="ConicProj.1.html">ConicProj</a> is a command-line utility
00059    * providing access to the functionality of LambertConformalConic and
00060    * AlbersEqualArea.
00061    **********************************************************************/
00062   class GEOGRAPHIC_EXPORT AlbersEqualArea {
00063   private:
00064     typedef Math::real real;
00065     real _a, _f, _fm, _e2, _e, _e2m, _qZ, _qx;
00066     real _sign, _lat0, _k0;
00067     real _n0, _m02, _nrho0, _k2, _txi0, _scxi0, _sxi0;
00068     static const real eps_;
00069     static const real epsx_;
00070     static const real epsx2_;
00071     static const real tol_;
00072     static const real tol0_;
00073     static const real ahypover_;
00074     static const int numit_ = 5;   // Newton iterations in Reverse
00075     static const int numit0_ = 20; // Newton iterations in Init
00076     static inline real hyp(real x) throw() { return Math::hypot(real(1), x); }
00077     // atanh(      e   * x)/      e   if f > 0
00078     // atan (sqrt(-e2) * x)/sqrt(-e2) if f < 0
00079     // x                              if f = 0
00080     inline real atanhee(real x) const throw() {
00081       return _f > 0 ? Math::atanh(_e * x)/_e :
00082         (_f < 0 ? std::atan(_e * x)/_e : x);
00083     }
00084     // return atanh(sqrt(x))/sqrt(x) - 1, accurate for small x
00085     static real atanhxm1(real x) throw();
00086 
00087     // Divided differences
00088     // Definition: Df(x,y) = (f(x)-f(y))/(x-y)
00089     // See: W. M. Kahan and R. J. Fateman,
00090     // Symbolic computation of divided differences,
00091     // SIGSAM Bull. 33(3), 7-28 (1999)
00092     // http://doi.acm.org/10.1145/334714.334716
00093     // http://www.cs.berkeley.edu/~fateman/papers/divdiff.pdf
00094     //
00095     // General rules
00096     // h(x) = f(g(x)): Dh(x,y) = Df(g(x),g(y))*Dg(x,y)
00097     // h(x) = f(x)*g(x):
00098     //        Dh(x,y) = Df(x,y)*(g(x)+g(y))/2 + Dg(x,y)*(f(x)+f(y))/2
00099     //
00100     // sn(x) = x/sqrt(1+x^2): Dsn(x,y) = (x+y)/((sn(x)+sn(y))*(1+x^2)*(1+y^2))
00101     static inline real Dsn(real x, real y, real sx, real sy) throw() {
00102       // sx = x/hyp(x)
00103       real t = x * y;
00104       return t > 0 ? (x + y) * Math::sq( (sx * sy)/t ) / (sx + sy) :
00105         (x - y != 0 ? (sx - sy) / (x - y) : 1);
00106     }
00107     // Datanhee(x,y) = atanhee((x-y)/(1-e^2*x*y))/(x-y)
00108     inline real Datanhee(real x, real y) const throw() {
00109       real t = x - y, d = 1 - _e2 * x * y;
00110       return t != 0 ? atanhee(t / d) / t : 1 / d;
00111     }
00112     // DDatanhee(x,y) = (Datanhee(1,y) - Datanhee(1,x))/(y-x)
00113     real DDatanhee(real x, real y) const throw();
00114     void Init(real sphi1, real cphi1, real sphi2, real cphi2, real k1) throw();
00115     real txif(real tphi) const throw();
00116     real tphif(real txi) const throw();
00117   public:
00118 
00119     /**
00120      * Constructor with a single standard parallel.
00121      *
00122      * @param[in] a equatorial radius of ellipsoid (meters).
00123      * @param[in] f flattening of ellipsoid.  Setting \e f = 0 gives a sphere.
00124      *   Negative \e f gives a prolate ellipsoid.  If \e f > 1, set flattening
00125      *   to 1/\e f.
00126      * @param[in] stdlat standard parallel (degrees), the circle of tangency.
00127      * @param[in] k0 azimuthal scale on the standard parallel.
00128      *
00129      * An exception is thrown if \e a or \e k0 is not positive or if \e stdlat
00130      * is not in the range [-90, 90].
00131      **********************************************************************/
00132     AlbersEqualArea(real a, real f, real stdlat, real k0);
00133 
00134     /**
00135      * Constructor with two standard parallels.
00136      *
00137      * @param[in] a equatorial radius of ellipsoid (meters).
00138      * @param[in] f flattening of ellipsoid.  Setting \e f = 0 gives a sphere.
00139      *   Negative \e f gives a prolate ellipsoid.  If \e f > 1, set flattening
00140      *   to 1/\e f.
00141      * @param[in] stdlat1 first standard parallel (degrees).
00142      * @param[in] stdlat2 second standard parallel (degrees).
00143      * @param[in] k1 azimuthal scale on the standard parallels.
00144      *
00145      * An exception is thrown if \e a or \e k0 is not positive or if \e stdlat1
00146      * or \e stdlat2 is not in the range [-90, 90].  In addition, an exception
00147      * is thrown if \e stdlat1 and \e stdlat2 are opposite poles.
00148      **********************************************************************/
00149     AlbersEqualArea(real a, real f, real stdlat1, real stdlat2, real k1);
00150 
00151     /**
00152      * Constructor with two standard parallels specified by sines and cosines.
00153      *
00154      * @param[in] a equatorial radius of ellipsoid (meters).
00155      * @param[in] f flattening of ellipsoid.  Setting \e f = 0 gives a sphere.
00156      *   Negative \e f gives a prolate ellipsoid.  If \e f > 1, set flattening
00157      *   to 1/\e f.
00158      * @param[in] sinlat1 sine of first standard parallel.
00159      * @param[in] coslat1 cosine of first standard parallel.
00160      * @param[in] sinlat2 sine of second standard parallel.
00161      * @param[in] coslat2 cosine of second standard parallel.
00162      * @param[in] k1 azimuthal scale on the standard parallels.
00163      *
00164      * This allows parallels close to the poles to be specified accurately.
00165      * This routine computes the latitude of origin and the azimuthal scale at
00166      * this latitude.  If \e dlat = abs(\e lat2 - \e lat1) <= 160<sup>o</sup>,
00167      * then the error in the latitude of origin is less than
00168      * 4.5e-14<sup>o</sup>.
00169      **********************************************************************/
00170     AlbersEqualArea(real a, real f,
00171                     real sinlat1, real coslat1,
00172                     real sinlat2, real coslat2,
00173                     real k1);
00174 
00175     /**
00176      * Set the azimuthal scale for the projection.
00177      *
00178      * @param[in] lat (degrees).
00179      * @param[in] k azimuthal scale at latitude \e lat (default 1).
00180      *
00181      * This allows a "latitude of conformality" to be specified.  An exception
00182      * is thrown if \e k is not positive or if \e lat is not in the range (-90,
00183      * 90).
00184      **********************************************************************/
00185     void SetScale(real lat, real k = real(1));
00186 
00187     /**
00188      * Forward projection, from geographic to Lambert conformal conic.
00189      *
00190      * @param[in] lon0 central meridian longitude (degrees).
00191      * @param[in] lat latitude of point (degrees).
00192      * @param[in] lon longitude of point (degrees).
00193      * @param[out] x easting of point (meters).
00194      * @param[out] y northing of point (meters).
00195      * @param[out] gamma meridian convergence at point (degrees).
00196      * @param[out] k azimuthal scale of projection at point; the radial
00197      *   scale is the 1/\e k.
00198      *
00199      * The latitude origin is given by AlbersEqualArea::LatitudeOrigin().  No
00200      * false easting or northing is added and \e lat should be in the range
00201      * [-90, 90]; \e lon and \e lon0 should be in the range [-180, 360].  The
00202      * values of \e x and \e y returned for points which project to infinity
00203      * (i.e., one or both of the poles) will be large but finite.
00204      **********************************************************************/
00205     void Forward(real lon0, real lat, real lon,
00206                  real& x, real& y, real& gamma, real& k) const throw();
00207 
00208     /**
00209      * Reverse projection, from Lambert conformal conic to geographic.
00210      *
00211      * @param[in] lon0 central meridian longitude (degrees).
00212      * @param[in] x easting of point (meters).
00213      * @param[in] y northing of point (meters).
00214      * @param[out] lat latitude of point (degrees).
00215      * @param[out] lon longitude of point (degrees).
00216      * @param[out] gamma meridian convergence at point (degrees).
00217      * @param[out] k azimuthal scale of projection at point; the radial
00218      *   scale is the 1/\e k.
00219      *
00220      * The latitude origin is given by AlbersEqualArea::LatitudeOrigin().  No
00221      * false easting or northing is added.  \e lon0 should be in the range
00222      * [-180, 360].  The value of \e lon returned is in the range [-180, 180).
00223      * The value of \e lat returned is in the range [-90,90].  If the input
00224      * point is outside the legal projected space the nearest pole is returned.
00225      **********************************************************************/
00226     void Reverse(real lon0, real x, real y,
00227                  real& lat, real& lon, real& gamma, real& k) const throw();
00228 
00229     /**
00230      * AlbersEqualArea::Forward without returning the convergence and
00231      * scale.
00232      **********************************************************************/
00233     void Forward(real lon0, real lat, real lon,
00234                  real& x, real& y) const throw() {
00235       real gamma, k;
00236       Forward(lon0, lat, lon, x, y, gamma, k);
00237     }
00238 
00239     /**
00240      * AlbersEqualArea::Reverse without returning the convergence and
00241      * scale.
00242      **********************************************************************/
00243     void Reverse(real lon0, real x, real y,
00244                  real& lat, real& lon) const throw() {
00245       real gamma, k;
00246       Reverse(lon0, x, y, lat, lon, gamma, k);
00247     }
00248 
00249     /** \name Inspector functions
00250      **********************************************************************/
00251     ///@{
00252     /**
00253      * @return \e a the equatorial radius of the ellipsoid (meters).  This is
00254      *   the value used in the constructor.
00255      **********************************************************************/
00256     Math::real MajorRadius() const throw() { return _a; }
00257 
00258     /**
00259      * @return \e f the flattening of the ellipsoid.  This is the value used in
00260      *   the constructor.
00261      **********************************************************************/
00262     Math::real Flattening() const throw() { return _f; }
00263 
00264     /// \cond SKIP
00265     /**
00266      * <b>DEPRECATED</b>
00267      * @return \e r the inverse flattening of the ellipsoid.
00268      **********************************************************************/
00269     Math::real InverseFlattening() const throw() { return 1/_f; }
00270     /// \endcond
00271 
00272     /**
00273      * @return latitude of the origin for the projection (degrees).
00274      *
00275      * This is the latitude of minimum azimuthal scale and equals the \e stdlat
00276      * in the 1-parallel constructor and lies between \e stdlat1 and \e stdlat2
00277      * in the 2-parallel constructors.
00278      **********************************************************************/
00279     Math::real OriginLatitude() const throw() { return _lat0; }
00280 
00281     /**
00282      * @return central scale for the projection.  This is the azimuthal scale
00283      *   on the latitude of origin.
00284      **********************************************************************/
00285     Math::real CentralScale() const throw() { return _k0; }
00286     ///@}
00287 
00288     /**
00289      * A global instantiation of AlbersEqualArea with the WGS84 ellipsoid, \e
00290      * stdlat = 0, and \e k0 = 1.  This degenerates to the cylindrical equal
00291      * area projection.
00292      **********************************************************************/
00293     static const AlbersEqualArea CylindricalEqualArea;
00294 
00295     /**
00296      * A global instantiation of AlbersEqualArea with the WGS84 ellipsoid, \e
00297      * stdlat = 90<sup>o</sup>, and \e k0 = 1.  This degenerates to the
00298      * Lambert azimuthal equal area projection.
00299      **********************************************************************/
00300     static const AlbersEqualArea AzimuthalEqualAreaNorth;
00301 
00302     /**
00303      * A global instantiation of AlbersEqualArea with the WGS84 ellipsoid, \e
00304      * stdlat = -90<sup>o</sup>, and \e k0 = 1.  This degenerates to the
00305      * Lambert azimuthal equal area projection.
00306      **********************************************************************/
00307     static const AlbersEqualArea AzimuthalEqualAreaSouth;
00308   };
00309 
00310 } // namespace GeographicLib
00311 
00312 #endif  // GEOGRAPHICLIB_ALBERSEQUALAREA_HPP
geographiclib-1.21/doc/html/classGeographicLib_1_1Utility-members.html0000644000175000017500000001661711745620414025673 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::Utility Member List
This is the complete list of members for GeographicLib::Utility, including all inherited members.
date(int s, int &y, int &m, int &d)GeographicLib::Utility [inline, static]
date(const std::string &s, int &y, int &m, int &d)GeographicLib::Utility [inline, static]
day(int y, int m=1, int d=1)GeographicLib::Utility [inline, static]
day(int y, int m, int d, bool check)GeographicLib::Utility [inline, static]
dow(int y, int m, int d)GeographicLib::Utility [inline, static]
dow(int s)GeographicLib::Utility [inline, static]
fract(const std::string &s)GeographicLib::Utility [inline, static]
fractionalyear(const std::string &s)GeographicLib::Utility [inline, static]
lookup(const std::string &s, char c)GeographicLib::Utility [inline, static]
num(const std::string &s)GeographicLib::Utility [inline, static]
nummatch(const std::string &s)GeographicLib::Utility [inline, static]
ParseLine(const std::string &line, std::string &key, std::string &val)GeographicLib::Utility [static]
readarray(std::istream &str, IntT array[], size_t num)GeographicLib::Utility [inline, static]
readarray(std::istream &str, std::vector< IntT > &array)GeographicLib::Utility [inline, static]
str(T x, int p=-1)GeographicLib::Utility [inline, static]
writearray(std::ostream &str, const IntT array[], size_t num)GeographicLib::Utility [inline, static]
writearray(std::ostream &str, std::vector< IntT > &array)GeographicLib::Utility [inline, static]
geographiclib-1.21/doc/html/dirs.html0000644000175000017500000000415411745620414017424 0ustar frankiefrankie GeographicLib: Directories
Directories
This directory hierarchy is sorted roughly, but not completely, alphabetically:
geographiclib-1.21/doc/html/classGeographicLib_1_1MGRS.html0000644000175000017500000007145111745620414023345 0ustar frankiefrankie GeographicLib: GeographicLib::MGRS Class Reference
GeographicLib::MGRS Class Reference

Convert between UTM/UPS and MGRS. More...

#include <GeographicLib/MGRS.hpp>

List of all members.

Static Public Member Functions

static void Forward (int zone, bool northp, real x, real y, int prec, std::string &mgrs)
static void Forward (int zone, bool northp, real x, real y, real lat, int prec, std::string &mgrs)
static void Reverse (const std::string &mgrs, int &zone, bool &northp, real &x, real &y, int &prec, bool centerp=true)
Inspector functions
static Math::real MajorRadius () throw ()
static Math::real Flattening () throw ()

Friends

class UTMUPS

Detailed Description

Convert between UTM/UPS and MGRS.

MGRS is defined in Chapter 3 of

This implementation has the following properties:

  • The conversions are closed, i.e., output from Forward is legal input for Reverse and vice versa. Conversion in both directions preserve the UTM/UPS selection and the UTM zone.
  • Forward followed by Reverse and vice versa is approximately the identity. (This is affected in predictable ways by errors in determining the latitude band and by loss of precision in the MGRS coordinates.)
  • All MGRS coordinates truncate to legal 100 km blocks. All MGRS coordinates with a legal 100 km block prefix are legal (even though the latitude band letter may now belong to a neighboring band).
  • The range of UTM/UPS coordinates allowed for conversion to MGRS coordinates is the maximum consistent with staying within the letter ranges of the MGRS scheme.
  • All the transformations are implemented as static methods in the MGRS class.

The NGA software package geotrans also provides conversions to and from MGRS. Version 3.0 (and earlier) suffers from some drawbacks:

  • Inconsistent rules are used to determine the whether a particular MGRS coordinate is legal. A more systematic approach is taken here.
  • The underlying projections are not very accurately implemented.

Example of use:

// Example of using the GeographicLib::MGRS class
// $Id: 011e73554cd2851ef396442f1ec8392207b101c3 $

#include <iostream>
#include <exception>
#include <string>
#include <GeographicLib/UTMUPS.hpp>
#include <GeographicLib/MGRS.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    // See also example-GeoCoords.cpp
    {
      // Sample forward calculation
      double lat = 33.3, lon = 44.4; // Baghdad
      int zone;
      bool northp;
      double x, y;
      UTMUPS::Forward(lat, lon, zone, northp, x, y);
      string mgrs;
      MGRS::Forward(zone, northp, x, y, 5, mgrs);
      cout << mgrs << "\n";
    }
    {
      // Sample reverse calculation
      string mgrs = "38SMB4488";
      int zone, prec;
      bool northp;
      double x, y;
      MGRS::Reverse(mgrs, zone, northp, x, y, prec);
      double lat, lon;
      UTMUPS::Reverse(zone, northp, x, y, lat, lon);
      cout << prec << " " << lat << " " << lon << "\n";
    }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Member Function Documentation

void GeographicLib::MGRS::Forward ( int  zone,
bool  northp,
real  x,
real  y,
int  prec,
std::string &  mgrs 
) [static]

Convert UTM or UPS coordinate to an MGRS coordinate.

Parameters:
[in]zoneUTM zone (zero means UPS).
[in]northphemisphere (true means north, false means south).
[in]xeasting of point (meters).
[in]ynorthing of point (meters).
[in]precprecision relative to 100 km.
[out]mgrsMGRS string.

prec specifies the precision of the MGRS string as follows:

  • prec = 0 (min), 100 km
  • prec = 1, 10 km
  • prec = 2, 1 km
  • prec = 3, 100 m
  • prec = 4, 10 m
  • prec = 5, 1 m
  • prec = 6, 0.1 m
  • prec = 11 (max), 1 um

UTM eastings are allowed to be in the range [100 km, 900 km], northings are allowed to be in in [0 km, 9500 km] for the northern hemisphere and in [1000 km, 10000 km] for the southern hemisphere. (However UTM northings can be continued across the equator. So the actual limits on the northings are [-9000 km, 9500 km] for the "northern" hemisphere and [1000 km, 19500 km] for the "southern" hemisphere.)

UPS eastings/northings are allowed to be in the range [1300 km, 2700 km] in the northern hemisphere and in [800 km, 3200 km] in the southern hemisphere.

The ranges are 100 km more restrictive that for the conversion between geographic coordinates and UTM and UPS given by UTMUPS. These restrictions are dictated by the allowed letters in MGRS coordinates. The choice of 9500 km for the maximum northing for northern hemisphere and of 1000 km as the minimum northing for southern hemisphere provide at least 0.5 degree extension into standard UPS zones. The upper ends of the ranges for the UPS coordinates is dictated by requiring symmetry about the meridians 0E and 90E.

All allowed UTM and UPS coordinates may now be converted to legal MGRS coordinates with the proviso that eastings and northings on the upper boundaries are silently reduced by about 4 nm (4 nanometers) to place them within the allowed range. (This includes reducing a southern hemisphere northing of 10000 km by 4 nm so that it is placed in latitude band M.) The UTM or UPS coordinates are truncated to requested precision to determine the MGRS coordinate. Thus in UTM zone 38N, the square area with easting in [444 km, 445 km) and northing in [3688 km, 3689 km) maps to MGRS coordinate 38SMB4488 (at prec = 2, 1 km), Khulani Sq., Baghdad.

The UTM/UPS selection and the UTM zone is preserved in the conversion to MGRS coordinate. Thus for zone > 0, the MGRS coordinate begins with the zone number followed by one of [C–M] for the southern hemisphere and [N–X] for the northern hemisphere. For zone = 0, the MGRS coordinates begins with one of [AB] for the southern hemisphere and [XY] for the northern hemisphere.

The conversion to the MGRS is exact for prec in [0, 5] except that a neighboring latitude band letter may be given if the point is within 5nm of a band boundary. For prec in [6, 11], the conversion is accurate to roundoff.

If x or y is NaN or if zone is UTMUPS::INVALID, the returned MGRS string is "INVALID".

Return the result via a reference argument to avoid the overhead of allocating a potentially large number of small strings. If an error is thrown, then mgrs is unchanged.

Definition at line 134 of file MGRS.cpp.

void GeographicLib::MGRS::Forward ( int  zone,
bool  northp,
real  x,
real  y,
real  lat,
int  prec,
std::string &  mgrs 
) [static]

Convert UTM or UPS coordinate to an MGRS coordinate when the latitude is known.

Parameters:
[in]zoneUTM zone (zero means UPS).
[in]northphemisphere (true means north, false means south).
[in]xeasting of point (meters).
[in]ynorthing of point (meters).
[in]latlatitude (degrees).
[in]precprecision relative to 100 km.
[out]mgrsMGRS string.

The latitude is ignored for zone = 0 (UPS); otherwise the latitude is used to determine the latitude band and this is checked for consistency using the same tests as Reverse.

Definition at line 51 of file MGRS.cpp.

void GeographicLib::MGRS::Reverse ( const std::string &  mgrs,
int &  zone,
bool &  northp,
real &  x,
real &  y,
int &  prec,
bool  centerp = true 
) [static]

Convert a MGRS coordinate to UTM or UPS coordinates.

Parameters:
[in]mgrsMGRS string.
[out]zoneUTM zone (zero means UPS).
[out]northphemisphere (true means north, false means south).
[out]xeasting of point (meters).
[out]ynorthing of point (meters).
[out]precprecision relative to 100 km.
[in]centerpif true (default), return center of the MGRS square, else return SW (lower left) corner.

All conversions from MGRS to UTM/UPS are permitted provided the MGRS coordinate is a possible result of a conversion in the other direction. (The leading 0 may be dropped from an input MGRS coordinate for UTM zones 1–9.) In addition, MGRS coordinates with a neighboring latitude band letter are permitted provided that some portion of the 100 km block is within the given latitude band. Thus

  • 38VLS and 38WLS are allowed (latitude 64N intersects the square 38[VW]LS); but 38VMS is not permitted (all of 38VMS is north of 64N)
  • 38MPE and 38NPF are permitted (they straddle the equator); but 38NPE and 38MPF are not permitted (the equator does not intersect either block).
  • Similarly ZAB and YZB are permitted (they straddle the prime meridian); but YAB and ZZB are not (the prime meridian does not intersect either block).

The UTM/UPS selection and the UTM zone is preserved in the conversion from MGRS coordinate. The conversion is exact for prec in [0, 5]. With centerp = true the conversion from MGRS to geographic and back is stable. This is not assured if centerp = false.

If an error is thrown, then the arguments are unchanged.

Definition at line 145 of file MGRS.cpp.

static Math::real GeographicLib::MGRS::MajorRadius ( ) throw () [inline, static]
Returns:
a the equatorial radius of the WGS84 ellipsoid (meters).

(The WGS84 value is returned because the UTM and UPS projections are based on this ellipsoid.)

Definition at line 265 of file MGRS.hpp.

References GeographicLib::UTMUPS::MajorRadius().

static Math::real GeographicLib::MGRS::Flattening ( ) throw () [inline, static]
Returns:
f the flattening of the WGS84 ellipsoid.

(The WGS84 value is returned because the UTM and UPS projections are based on this ellipsoid.)

Definition at line 273 of file MGRS.hpp.

References GeographicLib::UTMUPS::Flattening().


Friends And Related Function Documentation

friend class UTMUPS [friend]

Definition at line 97 of file MGRS.hpp.


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/functions_0x6b.html0000644000175000017500000001130111745620414021322 0ustar frankiefrankie GeographicLib: Class Members
Here is a list of all class members with links to the classes they belong to:

- k -

geographiclib-1.21/doc/html/Accumulator_8hpp.html0000644000175000017500000001243511745620414021702 0ustar frankiefrankie GeographicLib: Accumulator.hpp File Reference
Accumulator.hpp File Reference

Header for GeographicLib::Accumulator class. More...

Go to the source code of this file.

Classes

class  GeographicLib::Accumulator
 An accumulator for sums. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_ACCUMULATOR_HPP   "$Id: 03b7f4fdb9974c822f98d5f5aab1094b5a9ac8f2 $"

Detailed Description

Header for GeographicLib::Accumulator class.

Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file Accumulator.hpp.


Define Documentation

#define GEOGRAPHICLIB_ACCUMULATOR_HPP   "$Id: 03b7f4fdb9974c822f98d5f5aab1094b5a9ac8f2 $"

Definition at line 11 of file Accumulator.hpp.

geographiclib-1.21/doc/html/EllipticFunction_8cpp_source.html0000644000175000017500000005062011745620414024247 0ustar frankiefrankie GeographicLib: EllipticFunction.cpp Source File
EllipticFunction.cpp
Go to the documentation of this file.
00001 /**
00002  * \file EllipticFunction.cpp
00003  * \brief Implementation for GeographicLib::EllipticFunction class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/EllipticFunction.hpp>
00011 
00012 #define GEOGRAPHICLIB_ELLIPTICFUNCTION_CPP \
00013   "$Id: 00b30b3d051fce1da7eb0c7e74c1c03854de6ea3 $"
00014 
00015 RCSID_DECL(GEOGRAPHICLIB_ELLIPTICFUNCTION_CPP)
00016 RCSID_DECL(GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP)
00017 
00018 namespace GeographicLib {
00019 
00020   using namespace std;
00021 
00022   const Math::real EllipticFunction::tol_ =
00023     numeric_limits<real>::epsilon() * real(0.01);
00024   const Math::real EllipticFunction::tolRF_ = pow(3 * tol_, 1/real(6));
00025   const Math::real EllipticFunction::tolRD_ =
00026     pow(real(0.25) * tol_, 1/real(6));
00027   const Math::real EllipticFunction::tolRG0_ = real(2.7) * sqrt(tol_);
00028   const Math::real EllipticFunction::tolJAC_ = sqrt(tol_);
00029   const Math::real EllipticFunction::tolJAC1_ = sqrt(6 * tol_);
00030 
00031   /*
00032    * Implementation of methods given in
00033    *
00034    *   B. C. Carlson
00035    *   Computation of elliptic integrals
00036    *   Numerical Algorithms 10, 13-26 (1995)
00037    */
00038 
00039   Math::real EllipticFunction::RF(real x, real y, real z) throw() {
00040     // Carlson, eqs 2.2 - 2.7
00041     real
00042       a0 = (x + y + z)/3,
00043       an = a0,
00044       q = max(max(abs(a0-x), abs(a0-y)), abs(a0-z)) / tolRF_,
00045       x0 = x,
00046       y0 = y,
00047       z0 = z,
00048       mul = 1;
00049     while (q >= mul * abs(an)) {
00050       // Max 6 trips
00051       real ln = sqrt(x0)*sqrt(y0) + sqrt(y0)*sqrt(z0) + sqrt(z0)*sqrt(x0);
00052       an = (an + ln)/4;
00053       x0 = (x0 + ln)/4;
00054       y0 = (y0 + ln)/4;
00055       z0 = (z0 + ln)/4;
00056       mul *= 4;
00057     }
00058     real
00059       xx = (a0 - x) / (mul * an),
00060       yy = (a0 - y) / (mul * an),
00061       zz = - xx - yy,
00062       e2 = xx * yy - zz * zz,
00063       e3 = xx * yy * zz;
00064     return (1 - e2 / 10 + e3 / 14 + e2 * e2 / 24 - 3 * e2 * e3 / 44) / sqrt(an);
00065   }
00066 
00067   Math::real EllipticFunction::RD(real x, real y, real z) throw() {
00068     // Carlson, eqs 2.28 - 2.34
00069     real
00070       a0 = (x + y + 3 * z)/5,
00071       an = a0,
00072       q = max(max(abs(a0-x), abs(a0-y)), abs(a0-z)) / tolRD_,
00073       x0 = x,
00074       y0 = y,
00075       z0 = z,
00076       mul = 1,
00077       s = 0;
00078     while (q >= mul * abs(an)) {
00079       // Max 7 trips
00080       real ln = sqrt(x0)*sqrt(y0) +
00081         sqrt(y0)*sqrt(z0) +
00082         sqrt(z0)*sqrt(x0);
00083       s += 1/(mul * sqrt(z0) * (z0 + ln ));
00084       an = (an + ln)/4;
00085       x0 = (x0 + ln)/4;
00086       y0 = (y0 + ln)/4;
00087       z0 = (z0 + ln)/4;
00088       mul *= 4;
00089     }
00090     real
00091       xx = (a0 - x) / (mul * an),
00092       yy = (a0 - y) / (mul * an),
00093       zz = -(xx + yy) / 3,
00094       e2 = xx * yy - 6 * zz * zz,
00095       e3 = (3 * xx * yy - 8 * zz * zz)*zz,
00096       e4 = 3 * (xx * yy - zz * zz) * zz * zz,
00097       e5 = xx * yy * zz * zz * zz;
00098     return (1 - 3 * e2 / 14 + e3 / 6 + 9 * e2 * e2 / 88 - 3 * e4 / 22
00099             - 9 * e2 * e3 / 52 + 3 * e5 / 26) / (mul * an * sqrt(an))
00100       + 3 * s;
00101   }
00102 
00103   Math::real EllipticFunction::RG0(real x, real y) throw() {
00104     // Carlson, eqs 2.36 - 2.39
00105     real
00106       x0 = sqrt(x),
00107       y0 = sqrt(y),
00108       xn = x0,
00109       yn = y0,
00110       s = 0,
00111       mul = real(0.25);
00112     while (abs(xn-yn) >= tolRG0_ * abs(xn)) {
00113       // Max 4 trips
00114       real t = (xn + yn) /2;
00115       yn = sqrt(xn * yn);
00116       xn = t;
00117       mul *= 2;
00118       t = xn - yn;
00119       s += mul * t * t;
00120     }
00121     x0 = (x0 + y0)/2;
00122     return (x0 * x0 - s) * Math::pi<real>() / (2 * (xn + yn));
00123   }
00124 
00125   EllipticFunction::EllipticFunction(real m) throw()
00126     : _m(m)
00127     , _m1(1 - m)
00128       // Don't initialize _kc, _ec, _kec since this constructor might be called
00129       // before the static real constants tolRF_, etc., are initialized.
00130     , _init(false)
00131   {}
00132 
00133   bool EllipticFunction::Init() const throw() {
00134     // Complete elliptic integral K(m), Carlson eq. 4.1
00135     _kc = RF(real(0), _m1, real(1));
00136     // Complete elliptic integral E(m), Carlson eq. 4.2
00137     _ec = 2 * RG0(_m1, real(1));
00138     // K - E, Carlson eq.4.3
00139     _kec = _m / 3 * RD(real(0), _m1, real(1));
00140     return _init = true;
00141   }
00142 
00143   /*
00144    * Implementation of methods given in
00145    *
00146    *   R. Bulirsch
00147    *   Numerical Calculation of Elliptic Integrals and Elliptic Functions
00148    *   Numericshe Mathematik 7, 78-90 (1965)
00149    */
00150 
00151   void EllipticFunction::sncndn(real x, real& sn, real& cn, real& dn)
00152     const throw() {
00153     // Bulirsch's sncndn routine, p 89.
00154     //
00155     // Assume _m1 is in [0, 1].  See Bulirsch article for code to treat
00156     // negative _m1.
00157     if (_m1 != 0) {
00158       real mc = _m1;
00159       real c;
00160       real m[num_], n[num_];
00161       unsigned l = 0;
00162       for (real a = 1; l < num_; ++l) {
00163         // Max 5 trips
00164         m[l] = a;
00165         n[l] = mc = sqrt(mc);
00166         c = (a + mc) / 2;
00167         if (!(abs(a - mc) > tolJAC_ * a)) {
00168           ++l;
00169           break;
00170         }
00171         mc = a * mc;
00172         a = c;
00173       }
00174       x = c * x;
00175       sn = sin(x);
00176       cn = cos(x);
00177       dn = 1;
00178       if (sn != 0) {
00179         real a = cn / sn;
00180         c = a * c;
00181         while (l--) {
00182           real b = m[l];
00183           a = c * a;
00184           c = dn * c;
00185           dn = (n[l] + a) / (b + a);
00186           a = c / b;
00187         }
00188         a = 1 / sqrt(c * c + 1);
00189         sn = sn < 0 ? -a : a;
00190         cn = c * sn;
00191       }
00192     } else {
00193       sn = tanh(x);
00194       dn = cn = 1 / cosh(x);
00195     }
00196   }
00197 
00198   Math::real EllipticFunction::E(real sn, real cn, real dn) const throw() {
00199     real
00200       cn2 = cn * cn, dn2 = dn * dn, sn2 = sn * sn,
00201       // Carlson, eq. 4.6
00202       ei = abs(sn) * (RF(cn2, dn2, real(1)) -
00203                       (_m / 3) * sn2 * RD(cn2, dn2, real(1)));
00204     // Enforce usual trig-like symmetries
00205     if (cn < 0) {
00206       ei = 2 * E() - ei;
00207     }
00208     if (sn < 0)
00209       ei = -ei;
00210     return ei;
00211   }
00212 
00213   Math::real EllipticFunction::E(real phi) const throw() {
00214     real sn = sin(phi);
00215     return E(sn, cos(phi), sqrt(1 - _m * sn * sn));
00216   }
00217 
00218 } // namespace GeographicLib
geographiclib-1.21/doc/html/functions_0x6c.html0000644000175000017500000001700311745620414021330 0ustar frankiefrankie GeographicLib: Class Members geographiclib-1.21/doc/html/functions_0x6d.html0000644000175000017500000003035111745620414021332 0ustar frankiefrankie GeographicLib: Class Members
Here is a list of all class members with links to the classes they belong to:

- m -

geographiclib-1.21/doc/html/Geographic_8doc.html0000644000175000017500000000520511745620415021447 0ustar frankiefrankie GeographicLib: Geographic.doc File Reference
Geographic.doc File Reference

Documentation for GeographicLib. More...


Detailed Description

Documentation for GeographicLib.

Written by Charles Karney <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file Geographic.doc.

geographiclib-1.21/doc/html/CircularEngine_8hpp.html0000644000175000017500000001304311745620414022311 0ustar frankiefrankie GeographicLib: CircularEngine.hpp File Reference
CircularEngine.hpp File Reference

Header for GeographicLib::CircularEngine class. More...

#include <vector>
#include <GeographicLib/Constants.hpp>
#include <GeographicLib/SphericalEngine.hpp>

Go to the source code of this file.

Classes

class  GeographicLib::CircularEngine
 Spherical Harmonic sums for a circle. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_CIRCULARENGINE_HPP   "$Id: d0528f468369dbc1b7af11e02278ad7a361d398b $"

Detailed Description

Header for GeographicLib::CircularEngine class.

Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file CircularEngine.hpp.


Define Documentation

#define GEOGRAPHICLIB_CIRCULARENGINE_HPP   "$Id: d0528f468369dbc1b7af11e02278ad7a361d398b $"

Definition at line 11 of file CircularEngine.hpp.

geographiclib-1.21/doc/html/globals_func.html0000644000175000017500000000710111745620414021114 0ustar frankiefrankie GeographicLib: File Members geographiclib-1.21/doc/html/classGeographicLib_1_1EllipticFunction-members.html0000644000175000017500000001173211745620415027475 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::EllipticFunction Member List
This is the complete list of members for GeographicLib::EllipticFunction, including all inherited members.
E() const GeographicLib::EllipticFunction [inline]
E(real phi) const GeographicLib::EllipticFunction
E(real sn, real cn, real dn) const GeographicLib::EllipticFunction
EllipticFunction(real m)GeographicLib::EllipticFunction [explicit]
K() const GeographicLib::EllipticFunction [inline]
KE() const GeographicLib::EllipticFunction [inline]
m() const GeographicLib::EllipticFunction [inline]
m1() const GeographicLib::EllipticFunction [inline]
sncndn(real x, real &sn, real &cn, real &dn) const GeographicLib::EllipticFunction
geographiclib-1.21/doc/html/classGeographicLib_1_1SphericalEngine_1_1coeff.html0000644000175000017500000010020611745620415027270 0ustar frankiefrankie GeographicLib: GeographicLib::SphericalEngine::coeff Class Reference
GeographicLib::SphericalEngine::coeff Class Reference

Package up coefficients for SphericalEngine. More...

#include <GeographicLib/SphericalEngine.hpp>

List of all members.

Public Member Functions

 coeff ()
 coeff (const std::vector< real > &C, const std::vector< real > &S, int N, int nmx, int mmx)
 coeff (const std::vector< real > &C, const std::vector< real > &S, int N)
int N () const throw ()
int nmx () const throw ()
int mmx () const throw ()
int index (int n, int m) const throw ()
Math::real Cv (int k) const
Math::real Sv (int k) const
Math::real Cv (int k, int n, int m, real f) const
Math::real Sv (int k, int n, int m, real f) const

Static Public Member Functions

static int Csize (int N, int M)
static int Ssize (int N, int M)
static void readcoeffs (std::istream &stream, int &N, int &M, std::vector< real > &C, std::vector< real > &S)

Detailed Description

Package up coefficients for SphericalEngine.

This packages up the C, S coefficients and information about how the coefficients are stored into a single structure. This allows a vector of type SphericalEngine::coeff to be passed to SphericalEngine::Value. This class also includes functions to aid indexing into C and S.

The storage layout of the coefficients is documented in SphericalHarmonic and SphericalHarmonic::SphericalHarmonic.


Constructor & Destructor Documentation

GeographicLib::SphericalEngine::coeff::coeff ( ) [inline]

A default constructor

Definition at line 101 of file SphericalEngine.hpp.

GeographicLib::SphericalEngine::coeff::coeff ( const std::vector< real > &  C,
const std::vector< real > &  S,
int  N,
int  nmx,
int  mmx 
) [inline]

The general constructor.

Parameters:
[in]Ca vector of coefficients for the cosine terms.
[in]Sa vector of coefficients for the sine terms.
[in]Nthe degree giving storage layout for C and S.
[in]nmxthe maximum degree to be used.
[in]mmxthe maximum order to be used.

This requires N >= nmx >= mmx >= -1. C and S must also be large enough to hold the coefficients. Otherwise an exception is thrown.

Definition at line 120 of file SphericalEngine.hpp.

References GeographicLib::SphericalEngine::RootTable().

GeographicLib::SphericalEngine::coeff::coeff ( const std::vector< real > &  C,
const std::vector< real > &  S,
int  N 
) [inline]

The constructor for full coefficient vectors.

Parameters:
[in]Ca vector of coefficients for the cosine terms.
[in]Sa vector of coefficients for the sine terms.
[in]Nthe maximum degree and order.

This requires N >= -1. C and S must also be large enough to hold the coefficients. Otherwise an exception is thrown.

Definition at line 146 of file SphericalEngine.hpp.

References GeographicLib::SphericalEngine::RootTable().


Member Function Documentation

int GeographicLib::SphericalEngine::coeff::N ( ) const throw () [inline]
Returns:
N the degree giving storage layout for C and S.

Definition at line 165 of file SphericalEngine.hpp.

Referenced by GeographicLib::GravityModel::GravityModel().

int GeographicLib::SphericalEngine::coeff::nmx ( ) const throw () [inline]
Returns:
nmx the maximum degree to be used.

Definition at line 169 of file SphericalEngine.hpp.

Referenced by GeographicLib::GravityModel::GravityModel(), and GeographicLib::SphericalEngine::Circle().

int GeographicLib::SphericalEngine::coeff::mmx ( ) const throw () [inline]
Returns:
mmx the maximum order to be used.

Definition at line 173 of file SphericalEngine.hpp.

Referenced by GeographicLib::GravityModel::GravityModel(), and GeographicLib::SphericalEngine::Circle().

int GeographicLib::SphericalEngine::coeff::index ( int  n,
int  m 
) const throw () [inline]

The one-dimensional index into C and S.

Parameters:
[in]nthe degree.
[in]mthe order.
Returns:
the one-dimensional index.

Definition at line 181 of file SphericalEngine.hpp.

Math::real GeographicLib::SphericalEngine::coeff::Cv ( int  k) const [inline]

An element of C.

Parameters:
[in]kthe one-dimensional index.
Returns:
the value of the C coefficient.

Definition at line 189 of file SphericalEngine.hpp.

Referenced by GeographicLib::SphericalEngine::Circle().

Math::real GeographicLib::SphericalEngine::coeff::Sv ( int  k) const [inline]

An element of S.

Parameters:
[in]kthe one-dimensional index.
Returns:
the value of the S coefficient.

Definition at line 196 of file SphericalEngine.hpp.

Referenced by GeographicLib::SphericalEngine::Circle().

Math::real GeographicLib::SphericalEngine::coeff::Cv ( int  k,
int  n,
int  m,
real  f 
) const [inline]

An element of C with checking.

Parameters:
[in]kthe one-dimensional index.
[in]nthe requested degree.
[in]mthe requested order.
[in]fa multiplier.
Returns:
the value of the C coefficient multiplied by f in n and m are in range else 0.

Definition at line 207 of file SphericalEngine.hpp.

Math::real GeographicLib::SphericalEngine::coeff::Sv ( int  k,
int  n,
int  m,
real  f 
) const [inline]

An element of S with checking.

Parameters:
[in]kthe one-dimensional index.
[in]nthe requested degree.
[in]mthe requested order.
[in]fa multiplier.
Returns:
the value of the S coefficient multiplied by f in n and m are in range else 0.

Definition at line 219 of file SphericalEngine.hpp.

static int GeographicLib::SphericalEngine::coeff::Csize ( int  N,
int  M 
) [inline, static]

The size of the coefficient vector for the cosine terms.

Parameters:
[in]Nthe maximum degree.
[in]Mthe maximum order.
Returns:
the size of the vector of cosine terms as stored in column major order.

Definition at line 230 of file SphericalEngine.hpp.

static int GeographicLib::SphericalEngine::coeff::Ssize ( int  N,
int  M 
) [inline, static]

The size of the coefficient vector for the sine terms.

Parameters:
[in]Nthe maximum degree.
[in]Mthe maximum order.
Returns:
the size of the vector of cosine terms as stored in column major order.

Definition at line 241 of file SphericalEngine.hpp.

void GeographicLib::SphericalEngine::coeff::readcoeffs ( std::istream &  stream,
int &  N,
int &  M,
std::vector< real > &  C,
std::vector< real > &  S 
) [static]

Load coefficients from a binary stream.

Parameters:
[in]streamthe input stream.
[out]NThe maximum degree of the coefficients.
[out]MThe maximum order of the coefficients.
[out]CThe vector of cosine coefficients.
[out]SThe vector of sine coefficients.

N and M are read as 4-byte ints. C and S are resized to accommodate all the coefficients (with the m = 0 coefficients for S excluded) and the data for these coefficients read as 8-byte doubles. The coefficients are stored in column major order. The bytes in the stream should use little-endian ordering. IEEE floating point is assumed for the coefficients.

Definition at line 382 of file SphericalEngine.cpp.

Referenced by GeographicLib::GravityModel::GravityModel(), and GeographicLib::MagneticModel::MagneticModel().


The documentation for this class was generated from the following files:
geographiclib-1.21/doc/html/bc_s.png0000644000175000017500000000124511745620414017207 0ustar frankiefrankie‰PNG  IHDR /ð9ÐlIDATxíÝKHTmðÿóžwfÎgæÌ¯å8ŽÓ˜—Š6ñ-BÚ´‘]d–VZMa…D}ßg¸háB¤¶*Ñýbå¥U9Š—3ƒŽFy<£‹ šaæè²í³yøÿÎóžÅóî©ýÁÇåþtðªÚ %”8Vj•LÜlø·ÅCF@mÃÿˆÞ[”ïü À7ªj¿RÀ•ûC0TâU‹Y¸øYÕú’ÿsv~Æî,Ûi)€.w €™ˆæwø\cT i Ðúÿ`¼owgÛö»âH0¤5%À¥ÿ>Äû\.°ÉÒ×*O0¬-c}BàÞûä+msË…VÑÔ5Ö:€Îß}— *l’©Çç–cÁV¸€OÅ^ÅaâìÔXxñ)µÜ0‚ãé²xrKfÚÜxx±Ššo½5Ièk±WaŒÑjºùÆà¶;ÛVá´[¨ñÆ«Í@¥ÃfnöäØ¿°ÍRÕ.‡¨¬®B¥×_C™ˆæK|.¬ý²Ÿ®½0‚3ŠTŸ¥H¡‰½†Ž¶=7‚ ßã´™8k˜œÑ_Ó‘«Ï’Ã2«Èz·:V&fôBv—Ní9iVÎY— Õµ>‰‡.Qx{¾E“³ú»Ê‡˜'‰|dj6ÚØ‡ÚÀãx?åÏsJ‚@uÓ‘hbI„Ò½‡Ö2ì“,¼F¶[bÓ‘h e'«Ïõ@;Û^d•x·‰þ›¶ôg2Fa¿G^ÿ @,é) êlß… §Të’-ãêÜRý†—UÙÜ*È•EΩ64·4lÜÄÙ #èjDßþú Ųo{”N IEND®B`‚geographiclib-1.21/doc/html/PolarStereographic_8hpp_source.html0000644000175000017500000005725211745620415024607 0ustar frankiefrankie GeographicLib: PolarStereographic.hpp Source File
PolarStereographic.hpp
Go to the documentation of this file.
00001 /**
00002  * \file PolarStereographic.hpp
00003  * \brief Header for GeographicLib::PolarStereographic class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP)
00011 #define GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP \
00012   "$Id: 07add8492c46e42012007a8738060abc902a5504 $"
00013 
00014 #include <GeographicLib/Constants.hpp>
00015 
00016 namespace GeographicLib {
00017 
00018   /**
00019    * \brief Polar Stereographic Projection
00020    *
00021    * Implementation taken from the report,
00022    * - J. P. Snyder,
00023    *   <a href="http://pubs.er.usgs.gov/usgspubs/pp/pp1395"> Map Projections: A
00024    *   Working Manual</a>, USGS Professional Paper 1395 (1987),
00025    *   pp. 160&ndash;163.
00026    *
00027    * This is a straightforward implementation of the equations in Snyder except
00028    * that Newton's method is used to invert the projection.
00029    *
00030    * Example of use:
00031    * \include example-PolarStereographic.cpp
00032    **********************************************************************/
00033   class GEOGRAPHIC_EXPORT PolarStereographic {
00034   private:
00035     typedef Math::real real;
00036     // _Cx used to be _C but g++ 3.4 has a macro of that name
00037     real _a, _f, _e2, _e, _e2m, _Cx, _c;
00038     real _k0;
00039     static const real tol_;
00040     static const real overflow_;
00041     static const int numit_ = 5;
00042     // tan(x) for x in [-pi/2, pi/2] ensuring that the sign is right
00043     static inline real tanx(real x) throw() {
00044       real t = std::tan(x);
00045       // Write the tests this way to ensure that tanx(NaN()) is NaN()
00046       return x >= 0 ? (!(t < 0) ? t : overflow_) : (!(t >= 0) ? t : -overflow_);
00047     }
00048     // Return e * atanh(e * x) for f >= 0, else return
00049     // - sqrt(-e2) * atan( sqrt(-e2) * x) for f < 0
00050     inline real eatanhe(real x) const throw() {
00051       return _f >= 0 ? _e * Math::atanh(_e * x) : - _e * std::atan(_e * x);
00052     }
00053   public:
00054 
00055     /**
00056      * Constructor for a ellipsoid with
00057      *
00058      * @param[in] a equatorial radius (meters).
00059      * @param[in] f flattening of ellipsoid.  Setting \e f = 0 gives a sphere.
00060      *   Negative \e f gives a prolate ellipsoid.  If \e f > 1, set flattening
00061      *   to 1/\e f.
00062      * @param[in] k0 central scale factor.
00063      *
00064      * An exception is thrown if either of the axes of the ellipsoid is
00065      * not positive \e a or if \e k0 is not positive.
00066      **********************************************************************/
00067     PolarStereographic(real a, real f, real k0);
00068 
00069     /**
00070      * Set the scale for the projection.
00071      *
00072      * @param[in] lat (degrees) assuming \e northp = true.
00073      * @param[in] k scale at latitude \e lat (default 1).
00074      *
00075      * This allows a "latitude of true scale" to be specified.  An exception is
00076      * thrown if \e k is not positive or if \e lat is not in the range (-90,
00077      * 90].
00078      **********************************************************************/
00079     void SetScale(real lat, real k = real(1));
00080 
00081     /**
00082      * Forward projection, from geographic to polar stereographic.
00083      *
00084      * @param[in] northp the pole which is the center of projection (true means
00085      *   north, false means south).
00086      * @param[in] lat latitude of point (degrees).
00087      * @param[in] lon longitude of point (degrees).
00088      * @param[out] x easting of point (meters).
00089      * @param[out] y northing of point (meters).
00090      * @param[out] gamma meridian convergence at point (degrees).
00091      * @param[out] k scale of projection at point.
00092      *
00093      * No false easting or northing is added.  \e lat should be in the range
00094      * (-90, 90] for \e northp = true and in the range [-90, 90) for \e northp
00095      * = false; \e lon should be in the range [-180, 360].
00096      **********************************************************************/
00097     void Forward(bool northp, real lat, real lon,
00098                  real& x, real& y, real& gamma, real& k) const throw();
00099 
00100     /**
00101      * Reverse projection, from polar stereographic to geographic.
00102      *
00103      * @param[in] northp the pole which is the center of projection (true means
00104      *   north, false means south).
00105      * @param[in] x easting of point (meters).
00106      * @param[in] y northing of point (meters).
00107      * @param[out] lat latitude of point (degrees).
00108      * @param[out] lon longitude of point (degrees).
00109      * @param[out] gamma meridian convergence at point (degrees).
00110      * @param[out] k scale of projection at point.
00111      *
00112      * No false easting or northing is added.  The value of \e lon returned is
00113      * in the range [-180, 180).
00114      **********************************************************************/
00115     void Reverse(bool northp, real x, real y,
00116                  real& lat, real& lon, real& gamma, real& k) const throw();
00117 
00118     /**
00119      * PolarStereographic::Forward without returning the convergence and scale.
00120      **********************************************************************/
00121     void Forward(bool northp, real lat, real lon,
00122                  real& x, real& y) const throw() {
00123       real gamma, k;
00124       Forward(northp, lat, lon, x, y, gamma, k);
00125     }
00126 
00127     /**
00128      * PolarStereographic::Reverse without returning the convergence and scale.
00129      **********************************************************************/
00130     void Reverse(bool northp, real x, real y,
00131                  real& lat, real& lon) const throw() {
00132       real gamma, k;
00133       Reverse(northp, x, y, lat, lon, gamma, k);
00134     }
00135 
00136     /** \name Inspector functions
00137      **********************************************************************/
00138     ///@{
00139     /**
00140      * @return \e a the equatorial radius of the ellipsoid (meters).  This is
00141      *   the value used in the constructor.
00142      **********************************************************************/
00143     Math::real MajorRadius() const throw() { return _a; }
00144 
00145     /**
00146      * @return \e f the flattening of the ellipsoid.  This is the value used in
00147      *   the constructor.
00148      **********************************************************************/
00149     Math::real Flattening() const throw() { return _f; }
00150 
00151     /// \cond SKIP
00152     /**
00153      * <b>DEPRECATED</b>
00154      * @return \e r the inverse flattening of the ellipsoid.
00155      **********************************************************************/
00156     Math::real InverseFlattening() const throw() { return 1/_f; }
00157     /// \endcond
00158 
00159     /**
00160      * The central scale for the projection.  This is the value of \e k0 used
00161      * in the constructor and is the scale at the pole unless overridden by
00162      * PolarStereographic::SetScale.
00163      **********************************************************************/
00164     Math::real CentralScale() const throw() { return _k0; }
00165     ///@}
00166 
00167     /**
00168      * A global instantiation of PolarStereographic with the WGS84 ellipsoid
00169      * and the UPS scale factor.  However, unlike UPS, no false easting or
00170      * northing is added.
00171      **********************************************************************/
00172     static const PolarStereographic UPS;
00173   };
00174 
00175 } // namespace GeographicLib
00176 
00177 #endif  // GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP
geographiclib-1.21/doc/html/functions_0x6e.html0000644000175000017500000001624111745620414021335 0ustar frankiefrankie GeographicLib: Class Members geographiclib-1.21/doc/html/TransverseMercatorExact_8hpp.html0000644000175000017500000001337711745620414024247 0ustar frankiefrankie GeographicLib: TransverseMercatorExact.hpp File Reference
TransverseMercatorExact.hpp File Reference

Header for GeographicLib::TransverseMercatorExact class. More...

Go to the source code of this file.

Classes

class  GeographicLib::TransverseMercatorExact
 An exact implementation of the Transverse Mercator Projection. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP   "$Id: bd96340b9dc3e7bfd09d4374296a75f4c6e00fc3 $"

Detailed Description

Header for GeographicLib::TransverseMercatorExact class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file TransverseMercatorExact.hpp.


Define Documentation

#define GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP   "$Id: bd96340b9dc3e7bfd09d4374296a75f4c6e00fc3 $"

Definition at line 11 of file TransverseMercatorExact.hpp.

geographiclib-1.21/doc/html/CircularEngine_8cpp.html0000644000175000017500000001146411745620414022311 0ustar frankiefrankie GeographicLib: CircularEngine.cpp File Reference
CircularEngine.cpp File Reference

Implementation for GeographicLib::CircularEngine class. More...

#include <GeographicLib/CircularEngine.hpp>
#include <limits>

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_CIRCULARENGINE_CPP   "$Id: bdd0d21aa34063706e4042410f06bb0f7844fea9 $"

Detailed Description

Implementation for GeographicLib::CircularEngine class.

Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file CircularEngine.cpp.


Define Documentation

#define GEOGRAPHICLIB_CIRCULARENGINE_CPP   "$Id: bdd0d21aa34063706e4042410f06bb0f7844fea9 $"

Definition at line 13 of file CircularEngine.cpp.

geographiclib-1.21/doc/html/functions_0x6f.html0000644000175000017500000002141011745620414021330 0ustar frankiefrankie GeographicLib: Class Members geographiclib-1.21/doc/html/GeoidEval_8cpp_source.html0000644000175000017500000011220211745620414022626 0ustar frankiefrankie GeographicLib: GeoidEval.cpp Source File
GeoidEval.cpp
Go to the documentation of this file.
00001 /**
00002  * \file GeoidEval.cpp
00003  * \brief Command line utility for evaluating geoid heights
00004  *
00005  * Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  *
00009  * Compile and link with
00010  *   g++ -g -O3 -I../include -I../man -o GeoidEval \
00011  *       GeoidEval.cpp \
00012  *       ../src/DMS.cpp \
00013  *       ../src/GeoCoords.cpp \
00014  *       ../src/Geoid.cpp \
00015  *       ../src/MGRS.cpp \
00016  *       ../src/PolarStereographic.cpp \
00017  *       ../src/TransverseMercator.cpp \
00018  *       ../src/UTMUPS.cpp
00019  *
00020  * See the <a href="GeoidEval.1.html">man page</a> for usage
00021  * information.
00022  **********************************************************************/
00023 
00024 #include <iostream>
00025 #include <string>
00026 #include <sstream>
00027 #include <fstream>
00028 #include <GeographicLib/Geoid.hpp>
00029 #include <GeographicLib/DMS.hpp>
00030 #include <GeographicLib/Utility.hpp>
00031 #include <GeographicLib/GeoCoords.hpp>
00032 
00033 #include "GeoidEval.usage"
00034 
00035 int main(int argc, char* argv[]) {
00036   try {
00037     using namespace GeographicLib;
00038     typedef Math::real real;
00039     bool cacheall = false, cachearea = false, verbose = false,
00040       cubic = true, gradp = false;
00041     real caches, cachew, cachen, cachee;
00042     std::string dir;
00043     std::string geoid = Geoid::DefaultGeoidName();
00044     Geoid::convertflag heightmult = Geoid::NONE;
00045     std::string istring, ifile, ofile, cdelim;
00046     char lsep = ';';
00047     bool northp = false;
00048     int zonenum = UTMUPS::INVALID;
00049 
00050     for (int m = 1; m < argc; ++m) {
00051       std::string arg(argv[m]);
00052       if (arg == "-a") {
00053         cacheall = true;
00054         cachearea = false;
00055       }
00056       else if (arg == "-c") {
00057         if (m + 4 >= argc) return usage(1, true);
00058         cacheall = false;
00059         cachearea = true;
00060         try {
00061           DMS::DecodeLatLon(std::string(argv[m + 1]), std::string(argv[m + 2]),
00062                             caches, cachew);
00063           DMS::DecodeLatLon(std::string(argv[m + 3]), std::string(argv[m + 4]),
00064                             cachen, cachee);
00065         }
00066         catch (const std::exception& e) {
00067           std::cerr << "Error decoding argument of -c: " << e.what() << "\n";
00068           return 1;
00069         }
00070         m += 4;
00071       } else if (arg == "--msltohae")
00072         heightmult = Geoid::GEOIDTOELLIPSOID;
00073       else if (arg == "--haetomsl")
00074         heightmult = Geoid::ELLIPSOIDTOGEOID;
00075       else if (arg == "-z") {
00076         if (++m == argc) return usage(1, true);
00077         std::string zone = argv[m];
00078         try {
00079           UTMUPS::DecodeZone(zone, zonenum, northp);
00080         }
00081         catch (const std::exception& e) {
00082           std::cerr << "Error decoding zone: " << e.what() << "\n";
00083           return 1;
00084         }
00085         if (!(zonenum >= UTMUPS::MINZONE && zonenum <= UTMUPS::MAXZONE)) {
00086           std::cerr << "Illegal zone " << zone << "\n";
00087           return 1;
00088         }
00089       } else if (arg == "-n") {
00090         if (++m == argc) return usage(1, true);
00091         geoid = argv[m];
00092       } else if (arg == "-d") {
00093         if (++m == argc) return usage(1, true);
00094         dir = argv[m];
00095       } else if (arg == "-l")
00096         cubic = false;
00097       else if (arg == "-g")
00098         gradp = true;
00099       else if (arg == "-v")
00100         verbose = true;
00101       else if (arg == "--input-string") {
00102         if (++m == argc) return usage(1, true);
00103         istring = argv[m];
00104       } else if (arg == "--input-file") {
00105         if (++m == argc) return usage(1, true);
00106         ifile = argv[m];
00107       } else if (arg == "--output-file") {
00108         if (++m == argc) return usage(1, true);
00109         ofile = argv[m];
00110       } else if (arg == "--line-separator") {
00111         if (++m == argc) return usage(1, true);
00112         if (std::string(argv[m]).size() != 1) {
00113           std::cerr << "Line separator must be a single character\n";
00114           return 1;
00115         }
00116         lsep = argv[m][0];
00117       } else if (arg == "--comment-delimiter") {
00118         if (++m == argc) return usage(1, true);
00119         cdelim = argv[m];
00120       } else if (arg == "--version") {
00121         std::cout
00122           << argv[0]
00123           << ": $Id: 6db1ff0b8309a39d0d9b0250dd73be964c5efb7c $\n"
00124           << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n";
00125         return 0;
00126       } else {
00127         int retval = usage(!(arg == "-h" || arg == "--help"), arg != "--help");
00128         if (arg == "-h")
00129           std::cout<< "\nDefault geoid path = \""   << Geoid::DefaultGeoidPath()
00130                    << "\"\nDefault geoid name = \"" << Geoid::DefaultGeoidName()
00131                    << "\"\n";
00132         return retval;
00133       }
00134     }
00135 
00136     if (!ifile.empty() && !istring.empty()) {
00137       std::cerr << "Cannot specify --input-string and --input-file together\n";
00138       return 1;
00139     }
00140     if (ifile == "-") ifile.clear();
00141     std::ifstream infile;
00142     std::istringstream instring;
00143     if (!ifile.empty()) {
00144       infile.open(ifile.c_str());
00145       if (!infile.is_open()) {
00146         std::cerr << "Cannot open " << ifile << " for reading\n";
00147         return 1;
00148       }
00149     } else if (!istring.empty()) {
00150       std::string::size_type m = 0;
00151       while (true) {
00152         m = istring.find(lsep, m);
00153         if (m == std::string::npos)
00154           break;
00155         istring[m] = '\n';
00156       }
00157       instring.str(istring);
00158     }
00159     std::istream* input = !ifile.empty() ? &infile :
00160       (!istring.empty() ? &instring : &std::cin);
00161 
00162     std::ofstream outfile;
00163     if (ofile == "-") ofile.clear();
00164     if (!ofile.empty()) {
00165       outfile.open(ofile.c_str());
00166       if (!outfile.is_open()) {
00167         std::cerr << "Cannot open " << ofile << " for writing\n";
00168         return 1;
00169       }
00170     }
00171     std::ostream* output = !ofile.empty() ? &outfile : &std::cout;
00172 
00173     int retval = 0;
00174     try {
00175       const Geoid g(geoid, dir, cubic);
00176       try {
00177         if (cacheall)
00178           g.CacheAll();
00179         else if (cachearea)
00180           g.CacheArea(caches, cachew, cachen, cachee);
00181       }
00182       catch (const std::exception& e) {
00183         std::cerr << "ERROR: " << e.what() << "\nProceeding without a cache\n";
00184       }
00185       if (verbose) {
00186         std::cerr << "Geoid file: "    << g.GeoidFile()     << "\n"
00187                   << "Description: "   << g.Description()   << "\n"
00188                   << "Interpolation: " << g.Interpolation() << "\n"
00189                   << "Date & Time: "   << g.DateTime()      << "\n"
00190                   << "Offset (m): "    << g.Offset()        << "\n"
00191                   << "Scale (m): "     << g.Scale()         << "\n"
00192                   << "Max error (m): " << g.MaxError()      << "\n"
00193                   << "RMS error (m): " << g.RMSError()      << "\n";
00194         if (g.Cache())
00195           std::cerr<< "Caching:"
00196                    << "\n SW Corner: " << g.CacheSouth() << " " << g.CacheWest()
00197                    << "\n NE Corner: " << g.CacheNorth() << " " << g.CacheEast()
00198                    << "\n";
00199       }
00200 
00201       GeoCoords p;
00202       std::string s, suff;
00203       const char* spaces = " \t\n\v\f\r,"; // Include comma as space
00204       while (std::getline(*input, s)) {
00205         try {
00206           std::string eol("\n");
00207           if (!cdelim.empty()) {
00208             std::string::size_type m = s.find(cdelim);
00209             if (m != std::string::npos) {
00210               eol = " " + s.substr(m) + "\n";
00211               std::string::size_type m1 =
00212                 m > 0 ? s.find_last_not_of(spaces, m - 1) : std::string::npos;
00213               s = s.substr(0, m1 != std::string::npos ? m1 + 1 : m);
00214             }
00215           }
00216           real height = 0;
00217           if (zonenum != UTMUPS::INVALID) {
00218             // Expect "easting northing" if heightmult == 0, or
00219             // "easting northing height" if heightmult != 0.
00220             std::string::size_type pa = 0, pb = 0;
00221             real easting = 0, northing = 0;
00222             for (int i = 0; i < (heightmult ? 3 : 2); ++i) {
00223               if (pb == std::string::npos)
00224                 throw GeographicErr("Incomplete input: " + s);
00225               // Start of i'th token
00226               pa = s.find_first_not_of(spaces, pb);
00227               if (pa == std::string::npos)
00228                 throw GeographicErr("Incomplete input: " + s);
00229               // End of i'th token
00230               pb = s.find_first_of(spaces, pa);
00231               (i == 2 ? height : (i == 0 ? easting : northing)) =
00232                 Utility::num<real>(s.substr(pa, (pb == std::string::npos ?
00233                                                  pb : pb - pa)));
00234             }
00235             p.Reset(zonenum, northp, easting, northing);
00236             if (heightmult) {
00237               suff = pb == std::string::npos ? "" : s.substr(pb);
00238               s = s.substr(0, pa);
00239             }
00240           } else {
00241             if (heightmult) {
00242               // Treat last token as height
00243               // pb = last char of last token
00244               // pa = last char preceding white space
00245               // px = last char of 2nd last token
00246               std::string::size_type pb = s.find_last_not_of(spaces);
00247               std::string::size_type pa = s.find_last_of(spaces, pb);
00248               if (pa == std::string::npos || pb == std::string::npos)
00249                 throw GeographicErr("Incomplete input: " + s);
00250               height = Utility::num<real>(s.substr(pa + 1, pb - pa));
00251               s = s.substr(0, pa + 1);
00252             }
00253             p.Reset(s);
00254           }
00255           if (heightmult) {
00256             real h = g(p.Latitude(), p.Longitude());
00257             *output << s
00258                     << Utility::str<real>(height + real(heightmult) * h, 4)
00259                     << suff << eol;
00260           } else {
00261             if (gradp) {
00262             real gradn, grade;
00263             real h = g(p.Latitude(), p.Longitude(), gradn, grade);
00264             *output << Utility::str<real>(h, 4) << " "
00265                     << Utility::str<real>(gradn * 1e6, 2)
00266                     << (Math::isnan(gradn) ? " " : "e-6 ")
00267                     << Utility::str<real>(grade * 1e6, 2)
00268                     << (Math::isnan(grade) ? "" : "e-6")
00269                     << eol;
00270             } else {
00271             real h = g(p.Latitude(), p.Longitude());
00272             *output << Utility::str<real>(h, 4) << eol;
00273             }
00274           }
00275         }
00276         catch (const std::exception& e) {
00277           *output << "ERROR: " << e.what() << "\n";
00278           retval = 1;
00279         }
00280       }
00281     }
00282     catch (const std::exception& e) {
00283       std::cerr << "Error reading " << geoid << ": " << e.what() << "\n";
00284       retval = 1;
00285     }
00286     return retval;
00287   }
00288   catch (const std::exception& e) {
00289     std::cerr << "Caught exception: " << e.what() << "\n";
00290     return 1;
00291   }
00292   catch (...) {
00293     std::cerr << "Caught unknown exception\n";
00294     return 1;
00295   }
00296 }
geographiclib-1.21/doc/html/TransverseMercatorExact_8cpp.html0000644000175000017500000001521311745620414024231 0ustar frankiefrankie GeographicLib: TransverseMercatorExact.cpp File Reference
TransverseMercatorExact.cpp File Reference

Implementation for GeographicLib::TransverseMercatorExact class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_CPP   "$Id: 125a2d11919018a84fb0c09ea2e77011a35a4a2d $"

Detailed Description

Implementation for GeographicLib::TransverseMercatorExact class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

The relevant section of Lee's paper is part V, pp 67–101, Conformal Projections Based On Jacobian Elliptic Functions.

The method entails using the Thompson Transverse Mercator as an intermediate projection. The projections from the intermediate coordinates to [phi, lam] and [x, y] are given by elliptic functions. The inverse of these projections are found by Newton's method with a suitable starting guess.

This implementation and notation closely follows Lee, with the following exceptions:

Lee here Description
x/a xi Northing (unit Earth)
y/a eta Easting (unit Earth)
s/a sigma xi + i * eta
y x Easting
x y Northing
k e eccentricity
k^2 mu elliptic function parameter
k'^2 mv elliptic function complementary parameter
m k scale
zeta zeta complex longitude = Mercator = chi in paper
s sigma complex GK = zeta in paper

Minor alterations have been made in some of Lee's expressions in an attempt to control round-off. For example atanh(sin(phi)) is replaced by asinh(tan(phi)) which maintains accuracy near phi = pi/2. Such changes are noted in the code.

Definition in file TransverseMercatorExact.cpp.


Define Documentation

#define GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_CPP   "$Id: 125a2d11919018a84fb0c09ea2e77011a35a4a2d $"

Definition at line 44 of file TransverseMercatorExact.cpp.

geographiclib-1.21/doc/html/TransverseMercatorExact_8hpp_source.html0000644000175000017500000011716011745620414025622 0ustar frankiefrankie GeographicLib: TransverseMercatorExact.hpp Source File
TransverseMercatorExact.hpp
Go to the documentation of this file.
00001 /**
00002  * \file TransverseMercatorExact.hpp
00003  * \brief Header for GeographicLib::TransverseMercatorExact class
00004  *
00005  * Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #if !defined(GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP)
00011 #define GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP \
00012   "$Id: bd96340b9dc3e7bfd09d4374296a75f4c6e00fc3 $"
00013 
00014 #include <GeographicLib/Constants.hpp>
00015 #include <GeographicLib/EllipticFunction.hpp>
00016 
00017 namespace GeographicLib {
00018 
00019   /**
00020    * \brief An exact implementation of the Transverse Mercator Projection
00021    *
00022    * Implementation of the Transverse Mercator Projection given in
00023    *  - L. P. Lee,
00024    *    <a href="http://dx.doi.org/10.3138/X687-1574-4325-WM62"> Conformal
00025    *    Projections Based On Jacobian Elliptic Functions</a>, Part V of
00026    *    Conformal Projections Based on Elliptic Functions,
00027    *    (B. V. Gutsell, Toronto, 1976), 128pp.,
00028    *    ISBN: 0919870163
00029    *    (also appeared as:
00030    *    Monograph 16, Suppl. No. 1 to Canadian Cartographer, Vol 13).
00031    *  - C. F. F. Karney,
00032    *    <a href="http://dx.doi.org/10.1007/s00190-011-0445-3">
00033    *    Transverse Mercator with an accuracy of a few nanometers,</a>
00034    *    J. Geodesy 85(8), 475-485 (Aug. 2011);
00035    *    preprint
00036    *    <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>.
00037    *
00038    * Lee gives the correct results for forward and reverse transformations
00039    * subject to the branch cut rules (see the description of the \e extendp
00040    * argument to the constructor).  The maximum error is about 8 nm (8
00041    * nanometers), ground distance, for the forward and reverse transformations.
00042    * The error in the convergence is 2e-15&quot;, the relative error in the
00043    * scale is 7e-12%%.  See Sec. 3 of
00044    * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for details.
00045    * The method is "exact" in the sense that the errors are close to the
00046    * round-off limit and that no changes are needed in the algorithms for them
00047    * to be used with reals of a higher precision.  Thus the errors using long
00048    * double (with a 64-bit fraction) are about 2000 times smaller than using
00049    * double (with a 53-bit fraction).
00050    *
00051    * This algorithm is about 4.5 times slower than the 6th-order Kr&uuml;ger
00052    * method, TransverseMercator, taking about 11 us for a combined forward and
00053    * reverse projection on a 2.66 GHz Intel machine (g++, version 4.3.0, -O3).
00054    *
00055    * The ellipsoid parameters and the central scale are set in the constructor.
00056    * The central meridian (which is a trivial shift of the longitude) is
00057    * specified as the \e lon0 argument of the TransverseMercatorExact::Forward
00058    * and TransverseMercatorExact::Reverse functions.  The latitude of origin is
00059    * taken to be the equator.  See the documentation on TransverseMercator for
00060    * how to include a false easting, false northing, or a latitude of origin.
00061    *
00062    * See <a href="http://geographiclib.sourceforge.net/tm-grid.kmz"
00063    * type="application/vnd.google-earth.kmz"> tm-grid.kmz</a>, for an
00064    * illustration of the transverse Mercator grid in Google Earth.
00065    *
00066    * See TransverseMercatorExact.cpp for more information on the
00067    * implementation.
00068    *
00069    * See \ref transversemercator for a discussion of this projection.
00070    *
00071    * Example of use:
00072    * \include example-TransverseMercatorExact.cpp
00073    *
00074    * <a href="TransverseMercatorProj.1.html">TransverseMercatorProj</a> is a
00075    * command-line utility providing access to the functionality of
00076    * TransverseMercator and TransverseMercatorExact.
00077    **********************************************************************/
00078 
00079   class GEOGRAPHIC_EXPORT TransverseMercatorExact {
00080   private:
00081     typedef Math::real real;
00082     static const real tol_;
00083     static const real tol1_;
00084     static const real tol2_;
00085     static const real taytol_;
00086     static const real overflow_;
00087     static const int numit_ = 10;
00088     real _a, _f, _k0, _mu, _mv, _e, _ep2;
00089     bool _extendp;
00090     EllipticFunction _Eu, _Ev;
00091     // tan(x) for x in [-pi/2, pi/2] ensuring that the sign is right
00092     static inline real tanx(real x) throw() {
00093       real t = std::tan(x);
00094       // Write the tests this way to ensure that tanx(NaN()) is NaN()
00095       return x >= 0 ? (!(t < 0) ? t : overflow_) : (!(t >= 0) ? t : -overflow_);
00096     }
00097 
00098     real taup(real tau) const throw();
00099     real taupinv(real taup) const throw();
00100 
00101     void zeta(real u, real snu, real cnu, real dnu,
00102               real v, real snv, real cnv, real dnv,
00103               real& taup, real& lam) const throw();
00104 
00105     void dwdzeta(real u, real snu, real cnu, real dnu,
00106                  real v, real snv, real cnv, real dnv,
00107                  real& du, real& dv) const throw();
00108 
00109     bool zetainv0(real psi, real lam, real& u, real& v) const throw();
00110     void zetainv(real taup, real lam, real& u, real& v) const throw();
00111 
00112     void sigma(real u, real snu, real cnu, real dnu,
00113                real v, real snv, real cnv, real dnv,
00114                real& xi, real& eta) const throw();
00115 
00116     void dwdsigma(real u, real snu, real cnu, real dnu,
00117                   real v, real snv, real cnv, real dnv,
00118                   real& du, real& dv) const throw();
00119 
00120     bool sigmainv0(real xi, real eta, real& u, real& v) const throw();
00121     void sigmainv(real xi, real eta, real& u, real& v) const throw();
00122 
00123     void Scale(real tau, real lam,
00124                real snu, real cnu, real dnu,
00125                real snv, real cnv, real dnv,
00126                real& gamma, real& k) const throw();
00127 
00128   public:
00129 
00130     /**
00131      * Constructor for a ellipsoid with
00132      *
00133      * @param[in] a equatorial radius (meters).
00134      * @param[in] f flattening of ellipsoid.  If \e f > 1, set flattening
00135      *   to 1/\e f.
00136      * @param[in] k0 central scale factor.
00137      * @param[in] extendp use extended domain.
00138      *
00139      * The transverse Mercator projection has a branch point singularity at \e
00140      * lat = 0 and \e lon - \e lon0 = 90 (1 - \e e) or (for
00141      * TransverseMercatorExact::UTM) x = 18381 km, y = 0m.  The \e extendp
00142      * argument governs where the branch cut is placed.  With \e extendp =
00143      * false, the "standard" convention is followed, namely the cut is placed
00144      * along x > 18381 km, y = 0m.  Forward can be called with any \e lat and
00145      * \e lon then produces the transformation shown in Lee, Fig 46.  Reverse
00146      * analytically continues this in the +/- \e x direction.  As a
00147      * consequence, Reverse may map multiple points to the same geographic
00148      * location; for example, for TransverseMercatorExact::UTM, \e x =
00149      * 22051449.037349 m, \e y = -7131237.022729 m and \e x = 29735142.378357
00150      * m, \e y = 4235043.607933 m both map to \e lat = -2 deg, \e lon = 88 deg.
00151      *
00152      * With \e extendp = true, the branch cut is moved to the lower left
00153      * quadrant.  The various symmetries of the transverse Mercator projection
00154      * can be used to explore the projection on any sheet.  In this mode the
00155      * domains of \e lat, \e lon, \e x, and \e y are restricted to
00156      * - the union of
00157      *   - \e lat in [0, 90] and \e lon - \e lon0 in [0, 90]
00158      *   - \e lat in (-90, 0] and \e lon - \e lon0 in [90 (1 - \e e), 90]
00159      * - the union of
00160      *   - <i>x</i>/(\e k0 \e a) in [0, inf) and
00161      *     <i>y</i>/(\e k0 \e a) in [0, E(<i>e</i><sup>2</sup>)]
00162      *   - <i>x</i>/(\e k0 \e a) in [K(1 - <i>e</i><sup>2</sup>) - E(1 -
00163      *     <i>e</i><sup>2</sup>), inf) and <i>y</i>/(\e k0 \e a) in (-inf, 0]
00164      * .
00165      * See Sec. 5 of
00166      * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for a full
00167      * discussion of the treatment of the branch cut.
00168      *
00169      * The method will work for all ellipsoids used in terrestrial geodesy.
00170      * The method cannot be applied directly to the case of a sphere (\e f = 0)
00171      * because some the constants characterizing this method diverge in that
00172      * limit, and in practice, \e f should be larger than about numeric_limits<
00173      * real >::%epsilon().  However, TransverseMercator treats the sphere
00174      * exactly.  An exception is thrown if either axis of the ellipsoid or \e
00175      * k0 is not positive or if \e f <= 0.
00176      **********************************************************************/
00177     TransverseMercatorExact(real a, real f, real k0, bool extendp = false);
00178 
00179     /**
00180      * Forward projection, from geographic to transverse Mercator.
00181      *
00182      * @param[in] lon0 central meridian of the projection (degrees).
00183      * @param[in] lat latitude of point (degrees).
00184      * @param[in] lon longitude of point (degrees).
00185      * @param[out] x easting of point (meters).
00186      * @param[out] y northing of point (meters).
00187      * @param[out] gamma meridian convergence at point (degrees).
00188      * @param[out] k scale of projection at point.
00189      *
00190      * No false easting or northing is added. \e lat should be in the range
00191      * [-90, 90]; \e lon and \e lon0 should be in the range [-180, 360].
00192      **********************************************************************/
00193     void Forward(real lon0, real lat, real lon,
00194                  real& x, real& y, real& gamma, real& k) const throw();
00195 
00196     /**
00197      * Reverse projection, from transverse Mercator to geographic.
00198      *
00199      * @param[in] lon0 central meridian of the projection (degrees).
00200      * @param[in] x easting of point (meters).
00201      * @param[in] y northing of point (meters).
00202      * @param[out] lat latitude of point (degrees).
00203      * @param[out] lon longitude of point (degrees).
00204      * @param[out] gamma meridian convergence at point (degrees).
00205      * @param[out] k scale of projection at point.
00206      *
00207      * No false easting or northing is added.  \e lon0 should be in the range
00208      * [-180, 360].  The value of \e lon returned is in the range [-180, 180).
00209      **********************************************************************/
00210     void Reverse(real lon0, real x, real y,
00211                  real& lat, real& lon, real& gamma, real& k) const throw();
00212 
00213     /**
00214      * TransverseMercatorExact::Forward without returning the convergence and
00215      * scale.
00216      **********************************************************************/
00217     void Forward(real lon0, real lat, real lon,
00218                  real& x, real& y) const throw() {
00219       real gamma, k;
00220       Forward(lon0, lat, lon, x, y, gamma, k);
00221     }
00222 
00223     /**
00224      * TransverseMercatorExact::Reverse without returning the convergence and
00225      * scale.
00226      **********************************************************************/
00227     void Reverse(real lon0, real x, real y,
00228                  real& lat, real& lon) const throw() {
00229       real gamma, k;
00230       Reverse(lon0, x, y, lat, lon, gamma, k);
00231     }
00232 
00233     /** \name Inspector functions
00234      **********************************************************************/
00235     ///@{
00236     /**
00237      * @return \e a the equatorial radius of the ellipsoid (meters).  This is
00238      *   the value used in the constructor.
00239      **********************************************************************/
00240     Math::real MajorRadius() const throw() { return _a; }
00241 
00242     /**
00243      * @return \e f the flattening of the ellipsoid.  This is the value used in
00244      *   the constructor.
00245      **********************************************************************/
00246     Math::real Flattening() const throw() { return _f; }
00247 
00248     /// \cond SKIP
00249     /**
00250      * <b>DEPRECATED</b>
00251      * @return \e r the inverse flattening of the ellipsoid.
00252      **********************************************************************/
00253     Math::real InverseFlattening() const throw() { return 1/_f; }
00254     /// \endcond
00255 
00256     /**
00257      * @return \e k0 central scale for the projection.  This is the value of \e
00258      *   k0 used in the constructor and is the scale on the central meridian.
00259      **********************************************************************/
00260     Math::real CentralScale() const throw() { return _k0; }
00261     ///@}
00262 
00263     /**
00264      * A global instantiation of TransverseMercatorExact with the WGS84
00265      * ellipsoid and the UTM scale factor.  However, unlike UTM, no false
00266      * easting or northing is added.
00267      **********************************************************************/
00268     static const TransverseMercatorExact UTM;
00269   };
00270 
00271 } // namespace GeographicLib
00272 
00273 #endif  // GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP
geographiclib-1.21/doc/html/TransverseMercator_8hpp.html0000644000175000017500000001500411745620414023247 0ustar frankiefrankie GeographicLib: TransverseMercator.hpp File Reference
TransverseMercator.hpp File Reference

Header for GeographicLib::TransverseMercator class. More...

Go to the source code of this file.

Classes

class  GeographicLib::TransverseMercator
 Transverse Mercator Projection. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP   "$Id: 94bb078aa13d2d7392cee5498aae7df6e9914e4a $"
#define TM_TX_MAXPOW   (GEOGRAPHICLIB_PREC == 1 ? 6 : (GEOGRAPHICLIB_PREC == 0 ? 4 : 8))

Detailed Description

Header for GeographicLib::TransverseMercator class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file TransverseMercator.hpp.


Define Documentation

#define GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP   "$Id: 94bb078aa13d2d7392cee5498aae7df6e9914e4a $"

Definition at line 11 of file TransverseMercator.hpp.

#define TM_TX_MAXPOW   (GEOGRAPHICLIB_PREC == 1 ? 6 : (GEOGRAPHICLIB_PREC == 0 ? 4 : 8))

The order of the series approximation used in TransverseMercator. TM_TX_MAXPOW can be set to any integer in [4, 8].

Definition at line 21 of file TransverseMercator.hpp.

geographiclib-1.21/doc/html/Constants_8hpp.html0000644000175000017500000002267511745620414021406 0ustar frankiefrankie GeographicLib: Constants.hpp File Reference
Constants.hpp File Reference

Header for GeographicLib::Constants class. More...

#include <GeographicLib/Config.h>
#include <stdexcept>
#include <GeographicLib/Math.hpp>

Go to the source code of this file.

Classes

class  GeographicLib::Constants
 Constants needed by GeographicLib More...
class  GeographicLib::GeographicErr
 Exception handling for GeographicLib. More...

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_CONSTANTS_HPP   "$Id: 895e4bd91979aae347436bbf6be37964f05f5b6f $"
#define STATIC_ASSERT(cond, reason)   { enum{ STATIC_ASSERT_ENUM = 1/int(cond) }; }
#define RCSID_DECL(x)   namespace { char VAR_ ## x [] = x; }
#define GEOGRAPHIC_EXPORT

Detailed Description

Header for GeographicLib::Constants class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

Definition in file Constants.hpp.


Define Documentation

#define GEOGRAPHICLIB_CONSTANTS_HPP   "$Id: 895e4bd91979aae347436bbf6be37964f05f5b6f $"

Definition at line 11 of file Constants.hpp.

#define STATIC_ASSERT (   cond,
  reason 
)    { enum{ STATIC_ASSERT_ENUM = 1/int(cond) }; }
#define RCSID_DECL (   x)    namespace { char VAR_ ## x [] = x; }

Insertion of RCS Id strings into the object file.

Definition at line 38 of file Constants.hpp.

#define GEOGRAPHIC_EXPORT

Definition at line 48 of file Constants.hpp.

geographiclib-1.21/doc/html/classGeographicLib_1_1TransverseMercator-members.html0000644000175000017500000001243211745620415030051 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::TransverseMercator Member List
This is the complete list of members for GeographicLib::TransverseMercator, including all inherited members.
CentralScale() const GeographicLib::TransverseMercator [inline]
Flattening() const GeographicLib::TransverseMercator [inline]
Forward(real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const GeographicLib::TransverseMercator
Forward(real lon0, real lat, real lon, real &x, real &y) const GeographicLib::TransverseMercator [inline]
MajorRadius() const GeographicLib::TransverseMercator [inline]
Reverse(real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const GeographicLib::TransverseMercator
Reverse(real lon0, real x, real y, real &lat, real &lon) const GeographicLib::TransverseMercator [inline]
TransverseMercator(real a, real f, real k0)GeographicLib::TransverseMercator
UTMGeographicLib::TransverseMercator [static]
geographiclib-1.21/doc/html/TransverseMercator_8cpp.html0000644000175000017500000001572411745620414023253 0ustar frankiefrankie GeographicLib: TransverseMercator.cpp File Reference
TransverseMercator.cpp File Reference

Implementation for GeographicLib::TransverseMercator class. More...

Go to the source code of this file.

Namespaces

namespace  GeographicLib
 

Namespace for GeographicLib.


Defines

#define GEOGRAPHICLIB_TRANSVERSEMERCATOR_CPP   "$Id: 7b5a1854a015da061b8fdad0a4b35be7e06fcb9a $"

Detailed Description

Implementation for GeographicLib::TransverseMercator class.

Copyright (c) Charles Karney (2008-2011) <charles@karney.com> and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/

This implementation follows closely JHS 154, ETRS89 - järjestelmään liittyvät karttaprojektiot, tasokoordinaatistot ja karttalehtijako (Map projections, plane coordinates, and map sheet index for ETRS89), published by JUHTA, Finnish Geodetic Institute, and the National Land Survey of Finland (2006).

The relevant section is available as the 2008 PDF file http://docs.jhs-suositukset.fi/jhs-suositukset/JHS154/JHS154_liite1.pdf

This is a straight transcription of the formulas in this paper with the following exceptions:

  • use of 6th order series instead of 4th order series. This reduces the error to about 5nm for the UTM range of coordinates (instead of 200nm), with a speed penalty of only 1%;
  • use Newton's method instead of plain iteration to solve for latitude in terms of isometric latitude in the Reverse method;
  • use of Horner's representation for evaluating polynomials and Clenshaw's method for summing trigonometric series;
  • several modifications of the formulas to improve the numerical accuracy;
  • evaluating the convergence and scale using the expression for the projection or its inverse.

If the preprocessor variable TM_TX_MAXPOW is set to an integer between 4 and 8, then this specifies the order of the series used for the forward and reverse transformations. The default value is 6. (The series accurate to 12th order is given in Series approximation for transverse Mercator.)

Other equivalent implementations are given in

Definition in file TransverseMercator.cpp.


Define Documentation

#define GEOGRAPHICLIB_TRANSVERSEMERCATOR_CPP   "$Id: 7b5a1854a015da061b8fdad0a4b35be7e06fcb9a $"

Definition at line 44 of file TransverseMercator.cpp.

geographiclib-1.21/doc/html/CartConvert_8cpp_source.html0000644000175000017500000005703111745620414023231 0ustar frankiefrankie GeographicLib: CartConvert.cpp Source File
CartConvert.cpp
Go to the documentation of this file.
00001 /**
00002  * \file CartConvert.cpp
00003  * \brief Command line utility for geodetic to cartesian coordinate conversions
00004  *
00005  * Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licensed
00006  * under the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  *
00009  * Compile and link with
00010  *   g++ -g -O3 -I../include -I../man -o CartConvert \
00011  *       CartConvert.cpp \
00012  *       ../src/DMS.cpp \
00013  *       ../src/Geocentric.cpp \
00014  *       ../src/LocalCartesian.cpp
00015  *
00016  * See the <a href="CartConvert.1.html">man page</a> for usage
00017  * information.
00018  **********************************************************************/
00019 
00020 #include <iostream>
00021 #include <sstream>
00022 #include <string>
00023 #include <sstream>
00024 #include <fstream>
00025 #include <GeographicLib/Geocentric.hpp>
00026 #include <GeographicLib/LocalCartesian.hpp>
00027 #include <GeographicLib/DMS.hpp>
00028 #include <GeographicLib/Utility.hpp>
00029 
00030 #include "CartConvert.usage"
00031 
00032 int main(int argc, char* argv[]) {
00033   try {
00034     using namespace GeographicLib;
00035     typedef Math::real real;
00036     bool localcartesian = false, reverse = false;
00037     real
00038       a = Constants::WGS84_a<real>(),
00039       f = Constants::WGS84_f<real>();
00040     real lat0 = 0, lon0 = 0, h0 = 0;
00041     std::string istring, ifile, ofile, cdelim;
00042     char lsep = ';';
00043 
00044     for (int m = 1; m < argc; ++m) {
00045       std::string arg(argv[m]);
00046       if (arg == "-r")
00047         reverse = true;
00048       else if (arg == "-l") {
00049         localcartesian = true;
00050         if (m + 3 >= argc) return usage(1, true);
00051         try {
00052           DMS::DecodeLatLon(std::string(argv[m + 1]), std::string(argv[m + 2]),
00053                             lat0, lon0);
00054           h0 = Utility::num<real>(std::string(argv[m + 3]));
00055         }
00056         catch (const std::exception& e) {
00057           std::cerr << "Error decoding arguments of -l: " << e.what() << "\n";
00058           return 1;
00059         }
00060         m += 3;
00061       } else if (arg == "-e") {
00062         if (m + 2 >= argc) return usage(1, true);
00063         try {
00064           a = Utility::num<real>(std::string(argv[m + 1]));
00065           f = Utility::fract<real>(std::string(argv[m + 2]));
00066         }
00067         catch (const std::exception& e) {
00068           std::cerr << "Error decoding arguments of -e: " << e.what() << "\n";
00069           return 1;
00070         }
00071         m += 2;
00072       } else if (arg == "--input-string") {
00073         if (++m == argc) return usage(1, true);
00074         istring = argv[m];
00075       } else if (arg == "--input-file") {
00076         if (++m == argc) return usage(1, true);
00077         ifile = argv[m];
00078       } else if (arg == "--output-file") {
00079         if (++m == argc) return usage(1, true);
00080         ofile = argv[m];
00081       } else if (arg == "--line-separator") {
00082         if (++m == argc) return usage(1, true);
00083         if (std::string(argv[m]).size() != 1) {
00084           std::cerr << "Line separator must be a single character\n";
00085           return 1;
00086         }
00087         lsep = argv[m][0];
00088       } else if (arg == "--comment-delimiter") {
00089         if (++m == argc) return usage(1, true);
00090         cdelim = argv[m];
00091      } else if (arg == "--version") {
00092         std::cout
00093           << argv[0]
00094           << ": $Id: b9e53a72ea7d026978678f3ab9d726a2d8485079 $\n"
00095           << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n";
00096         return 0;
00097       } else
00098         return usage(!(arg == "-h" || arg == "--help"), arg != "--help");
00099     }
00100 
00101     if (!ifile.empty() && !istring.empty()) {
00102       std::cerr << "Cannot specify --input-string and --input-file together\n";
00103       return 1;
00104     }
00105     if (ifile == "-") ifile.clear();
00106     std::ifstream infile;
00107     std::istringstream instring;
00108     if (!ifile.empty()) {
00109       infile.open(ifile.c_str());
00110       if (!infile.is_open()) {
00111         std::cerr << "Cannot open " << ifile << " for reading\n";
00112         return 1;
00113       }
00114     } else if (!istring.empty()) {
00115       std::string::size_type m = 0;
00116       while (true) {
00117         m = istring.find(lsep, m);
00118         if (m == std::string::npos)
00119           break;
00120         istring[m] = '\n';
00121       }
00122       instring.str(istring);
00123     }
00124     std::istream* input = !ifile.empty() ? &infile :
00125       (!istring.empty() ? &instring : &std::cin);
00126 
00127     std::ofstream outfile;
00128     if (ofile == "-") ofile.clear();
00129     if (!ofile.empty()) {
00130       outfile.open(ofile.c_str());
00131       if (!outfile.is_open()) {
00132         std::cerr << "Cannot open " << ofile << " for writing\n";
00133         return 1;
00134       }
00135     }
00136     std::ostream* output = !ofile.empty() ? &outfile : &std::cout;
00137 
00138     const Geocentric ec(a, f);
00139     const LocalCartesian lc(lat0, lon0, h0, ec);
00140 
00141     std::string s;
00142     int retval = 0;
00143     while (std::getline(*input, s)) {
00144       try {
00145         std::string eol("\n");
00146         if (!cdelim.empty()) {
00147           std::string::size_type m = s.find(cdelim);
00148           if (m != std::string::npos) {
00149             eol = " " + s.substr(m) + "\n";
00150             s = s.substr(0, m);
00151           }
00152         }
00153         std::istringstream str(s);
00154         real lat, lon, h, x, y, z;
00155         std::string stra, strb, strc;
00156         if (!(str >> stra >> strb >> strc))
00157           throw GeographicErr("Incomplete input: " + s);
00158         if (reverse) {
00159           x = Utility::num<real>(stra);
00160           y = Utility::num<real>(strb);
00161           z = Utility::num<real>(strc);
00162         } else {
00163           DMS::DecodeLatLon(stra, strb, lat, lon);
00164           h = Utility::num<real>(strc);
00165         }
00166         std::string strd;
00167         if (str >> strd)
00168           throw GeographicErr("Extraneous input: " + strd);
00169         if (reverse) {
00170           if (localcartesian)
00171             lc.Reverse(x, y, z, lat, lon, h);
00172           else
00173             ec.Reverse(x, y, z, lat, lon, h);
00174           *output << Utility::str<real>(lat, 15) << " "
00175                   << Utility::str<real>(lon, 15) << " "
00176                   << Utility::str<real>(h, 12) << eol;
00177         } else {
00178           if (localcartesian)
00179             lc.Forward(lat, lon, h, x, y, z);
00180           else
00181             ec.Forward(lat, lon, h, x, y, z);
00182           *output << Utility::str<real>(x, 10) << " "
00183                   << Utility::str<real>(y, 10) << " "
00184                   << Utility::str<real>(z, 10) << eol;
00185         }
00186       }
00187       catch (const std::exception& e) {
00188         *output << "ERROR: " << e.what() << "\n";
00189         retval = 1;
00190       }
00191     }
00192     return retval;
00193   }
00194   catch (const std::exception& e) {
00195     std::cerr << "Caught exception: " << e.what() << "\n";
00196     return 1;
00197   }
00198   catch (...) {
00199     std::cerr << "Caught unknown exception\n";
00200     return 1;
00201   }
00202 }
geographiclib-1.21/doc/html/MagneticModel_8cpp_source.html0000644000175000017500000010204711745620414023505 0ustar frankiefrankie GeographicLib: MagneticModel.cpp Source File
MagneticModel.cpp
Go to the documentation of this file.
00001 /**
00002  * \file MagneticModel.cpp
00003  * \brief Implementation for GeographicLib::MagneticModel class
00004  *
00005  * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed under
00006  * the MIT/X11 License.  For more information, see
00007  * http://geographiclib.sourceforge.net/
00008  **********************************************************************/
00009 
00010 #include <GeographicLib/MagneticModel.hpp>
00011 #include <fstream>
00012 #include <GeographicLib/SphericalEngine.hpp>
00013 #include <GeographicLib/MagneticCircle.hpp>
00014 #include <GeographicLib/Utility.hpp>
00015 
00016 #define GEOGRAPHICLIB_MAGNETICMODEL_CPP \
00017   "$Id: b0287ac014f10e4c6656b67f21c764432a47559a $"
00018 
00019 RCSID_DECL(GEOGRAPHICLIB_MAGNETICMODEL_CPP)
00020 RCSID_DECL(GEOGRAPHICLIB_MAGNETICMODEL_HPP)
00021 
00022 #if !defined(GEOGRAPHICLIB_DATA)
00023 #  if defined(_MSC_VER)
00024 #    define GEOGRAPHICLIB_DATA \
00025   "C:/Documents and Settings/All Users/Application Data/GeographicLib"
00026 #  else
00027 #    define GEOGRAPHICLIB_DATA "/usr/local/share/GeographicLib"
00028 #  endif
00029 #endif
00030 
00031 #if !defined(MAGNETIC_DEFAULT_NAME)
00032 #  define MAGNETIC_DEFAULT_NAME "wmm2010"
00033 #endif
00034 
00035 #if defined(_MSC_VER)
00036 // Squelch warnings about unsafe use of getenv
00037 #pragma warning (disable: 4996)
00038 #endif
00039 
00040 namespace GeographicLib {
00041 
00042   using namespace std;
00043 
00044   MagneticModel::MagneticModel(const std::string& name,const std::string& path,
00045                                const Geocentric& earth)
00046     : _name(name)
00047     , _dir(path)
00048     , _description("NONE")
00049     , _date("UNKNOWN")
00050     , _t0(Math::NaN<real>())
00051     , _dt0(1)
00052     , _tmin(Math::NaN<real>())
00053     , _tmax(Math::NaN<real>())
00054     , _a(Math::NaN<real>())
00055     , _hmin(Math::NaN<real>())
00056     , _hmax(Math::NaN<real>())
00057     , _Nmodels(1)
00058     , _norm(SphericalHarmonic::SCHMIDT)
00059     , _earth(earth)
00060   {
00061     if (_dir.empty())
00062       _dir = DefaultMagneticPath();
00063     ReadMetadata(_name);
00064     _G.resize(_Nmodels + 1);
00065     _H.resize(_Nmodels + 1);
00066     {
00067       string coeff = _filename + ".cof";
00068       ifstream coeffstr(coeff.c_str(), ios::binary);
00069       if (!coeffstr.good())
00070         throw GeographicErr("Error opening " + coeff);
00071       char id[idlength_ + 1];
00072       coeffstr.read(id, idlength_);
00073       if (!coeffstr.good())
00074         throw GeographicErr("No header in " + coeff);
00075       id[idlength_] = '\0';
00076       if (_id != string(id))
00077         throw GeographicErr("ID mismatch: " + _id + " vs " + id);
00078       for (int i = 0; i <= _Nmodels; ++i) {
00079         int N, M;
00080         SphericalEngine::coeff::readcoeffs(coeffstr, N, M, _G[i], _H[i]);
00081         if (!(M < 0 || _G[i][0] == 0))
00082           throw GeographicErr("A degree 0 term is not permitted");
00083         _harm.push_back(SphericalHarmonic(_G[i], _H[i], N, N, M, _a, _norm));
00084       }
00085       int pos = int(coeffstr.tellg());
00086       coeffstr.seekg(0, ios::end);
00087       if (pos != coeffstr.tellg())
00088         throw GeographicErr("Extra data in " + coeff);
00089     }
00090   }
00091 
00092   void MagneticModel::ReadMetadata(const std::string& name) {
00093     const char* spaces = " \t\n\v\f\r";
00094     _filename = _dir + "/" + name + ".wmm";
00095     ifstream metastr(_filename.c_str());
00096     if (!metastr.good())
00097       throw GeographicErr("Cannot open " + _filename);
00098     string line;
00099     getline(metastr, line);
00100     if (!(line.size() >= 6 && line.substr(0,5) == "WMMF-"))
00101       throw GeographicErr(_filename + " does not contain WMMF-n signature");
00102     string::size_type n = line.find_first_of(spaces, 5);
00103     if (n != string::npos)
00104       n -= 5;
00105     string version = line.substr(5, n);
00106     if (version != "1")
00107       throw GeographicErr("Unknown version in " + _filename + ": " + version);
00108     string key, val;
00109     while (getline(metastr, line)) {
00110       if (!Utility::ParseLine(line, key, val))
00111         continue;
00112       // Process key words
00113       if (key == "Name")
00114         _name = val;
00115       else if (key == "Description")
00116         _description = val;
00117       else if (key == "ReleaseDate")
00118         _date = val;
00119       else if (key == "Radius")
00120         _a = Utility::num<real>(val);
00121       else if (key == "Type") {
00122         if (!(val == "Linear" || val == "linear"))
00123           throw GeographicErr("Only linear models are supported");
00124       } else if (key == "Epoch")
00125         _t0 = Utility::num<real>(val);
00126       else if (key == "DeltaEpoch")
00127         _dt0 = Utility::num<real>(val);
00128       else if (key == "NumModels")
00129         _Nmodels = Utility::num<int>(val);
00130       else if (key == "MinTime")
00131         _tmin = Utility::num<real>(val);
00132       else if (key == "MaxTime")
00133         _tmax = Utility::num<real>(val);
00134       else if (key == "MinHeight")
00135         _hmin = Utility::num<real>(val);
00136       else if (key == "MaxHeight")
00137         _hmax = Utility::num<real>(val);
00138       else if (key == "Normalization") {
00139         if (val == "FULL" || val == "Full" || val == "full")
00140           _norm = SphericalHarmonic::FULL;
00141         else if (val == "SCHMIDT" || val == "Schmidt" || val == "schmidt")
00142           _norm = SphericalHarmonic::SCHMIDT;
00143         else
00144           throw GeographicErr("Unknown normalization " + val);
00145       } else if (key == "ByteOrder") {
00146         if (val == "Big" || val == "big")
00147           throw GeographicErr("Only little-endian ordering is supported");
00148         else if (!(val == "Little" || val == "little"))
00149           throw GeographicErr("Unknown byte ordering " + val);
00150       } else if (key == "ID")
00151         _id = val;
00152       // else unrecognized keywords are skipped
00153     }
00154     // Check values
00155     if (!(Math::isfinite(_a) && _a > 0))
00156       throw GeographicErr("Reference radius must be positive");
00157     if (!(_t0 > 0))
00158       throw GeographicErr("Epoch time not defined");
00159     if (_tmin >= _tmax)
00160       throw GeographicErr("Min time exceeds max time");
00161     if (_hmin >= _hmax)
00162       throw GeographicErr("Min height exceeds max height");
00163     if (int(_id.size()) != idlength_)
00164       throw GeographicErr("Invalid ID");
00165     if (!(_dt0 > 0)) {
00166       if (_Nmodels > 1)
00167         throw GeographicErr("DeltaEpoch must be positive");
00168       else
00169         _dt0 = 1;
00170     }
00171   }
00172 
00173   void MagneticModel::Field(real t, real lat, real lon, real h, bool diffp,
00174                             real& Bx, real& By, real& Bz,
00175                             real& Bxt, real& Byt, real& Bzt) const throw() {
00176     t -= _t0;
00177     int n = max(min(int(floor(t / _dt0)), _Nmodels - 1), 0);
00178     bool interpolate = n + 1 < _Nmodels;
00179     t -= n * _dt0;
00180     real X, Y, Z;
00181     real M[Geocentric::dim2_];
00182     _earth.IntForward(lat, lon, h, X, Y, Z, M);
00183     real BX0, BY0, BZ0, BX1, BY1, BZ1; // Components in geocentric basis
00184     _harm[n](X, Y, Z, BX0, BY0, BZ0);
00185     _harm[n + 1](X, Y, Z, BX1, BY1, BZ1);
00186     if (interpolate) {
00187       // Convert to a time derivative
00188       BX1 = (BX1 - BX0) / _dt0;
00189       BY1 = (BY1 - BY0) / _dt0;
00190       BZ1 = (BZ1 - BZ0) / _dt0;
00191     }
00192     BX0 += t * BX1;
00193     BY0 += t * BY1;
00194     BZ0 += t * BZ1;
00195     if (diffp) {
00196       Geocentric::Unrotate(M, BX1, BY1, BZ1, Bxt, Byt, Bzt);
00197       Bxt *= - _a;
00198       Byt *= - _a;
00199       Bzt *= - _a;
00200     }
00201     Geocentric::Unrotate(M, BX0, BY0, BZ0, Bx, By, Bz);
00202     Bx *= - _a;
00203     By *= - _a;
00204     Bz *= - _a;
00205   }
00206 
00207   MagneticCircle MagneticModel::Circle(real t, real lat, real h) const {
00208     real t1 = t - _t0;
00209     int n = max(min(int(floor(t1 / _dt0)), _Nmodels - 1), 0);
00210     bool interpolate = n + 1 < _Nmodels;
00211     t1 -= n * _dt0;
00212     real X, Y, Z, M[Geocentric::dim2_];
00213     _earth.IntForward(lat, 0, h, X, Y, Z, M);
00214     // Y = 0, cphi = M[7], sphi = M[8];
00215 
00216     return MagneticCircle(_a, _earth._f, lat, h, t,
00217                           M[7], M[8], t1, _dt0, interpolate,
00218                           _harm[n].Circle(X, Z, true),
00219                           _harm[n + 1].Circle(X, Z, true));
00220   }
00221 
00222   void MagneticModel::FieldComponents(real Bx, real By, real Bz,
00223                                       real Bxt, real Byt, real Bzt,
00224                                       real& H, real& F, real& D, real& I,
00225                                       real& Ht, real& Ft,
00226                                       real& Dt, real& It) throw() {
00227     H = Math::hypot(Bx, By);
00228     Ht = H ? (Bx * Bxt + By * Byt) / H : Math::hypot(Bxt, Byt);
00229     D = (0 - (H ? atan2(-Bx, By) : atan2(-Bxt, Byt))) / Math::degree<real>();
00230     Dt = (H ? (By * Bxt - Bx * Byt) / Math::sq(H) : 0) / Math::degree<real>();
00231     F = Math::hypot(H, Bz);
00232     Ft = F ? (H * Ht + Bz * Bzt) / F : Math::hypot(Ht, Bzt);
00233     I = (F ? atan2(-Bz, H) : atan2(-Bzt, Ht)) / Math::degree<real>();
00234     It = (F ? (Bz * Ht - H * Bzt) / Math::sq(F) : 0) / Math::degree<real>();
00235   }
00236 
00237   std::string MagneticModel::DefaultMagneticPath() {
00238     string path;
00239     char* magneticpath = getenv("MAGNETIC_PATH");
00240     if (magneticpath)
00241       path = string(magneticpath);
00242     if (path.length())
00243       return path;
00244     char* datapath = getenv("GEOGRAPHICLIB_DATA");
00245     if (datapath)
00246       path = string(datapath);
00247     return (path.length() ? path : string(GEOGRAPHICLIB_DATA)) + "/magnetic";
00248   }
00249 
00250   std::string MagneticModel::DefaultMagneticName() {
00251     string name;
00252     char* magneticname = getenv("MAGNETIC_NAME");
00253     if (magneticname)
00254       name = string(magneticname);
00255     return name.length() ? name : string(MAGNETIC_DEFAULT_NAME);
00256   }
00257 
00258 } // namespace GeographicLib
geographiclib-1.21/doc/html/classGeographicLib_1_1Geodesic-members.html0000644000175000017500000003713711745620414025752 0ustar frankiefrankie GeographicLib: Member List
GeographicLib::Geodesic Member List
This is the complete list of members for GeographicLib::Geodesic, including all inherited members.
ALL enum valueGeographicLib::Geodesic
ArcDirect(real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const GeographicLib::Geodesic [inline]
ArcDirect(real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2) const GeographicLib::Geodesic [inline]
ArcDirect(real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2) const GeographicLib::Geodesic [inline]
ArcDirect(real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12) const GeographicLib::Geodesic [inline]
ArcDirect(real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12) const GeographicLib::Geodesic [inline]
ArcDirect(real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &M12, real &M21) const GeographicLib::Geodesic [inline]
ArcDirect(real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21) const GeographicLib::Geodesic [inline]
AREA enum valueGeographicLib::Geodesic
AZIMUTH enum valueGeographicLib::Geodesic
Direct(real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21, real &S12) const GeographicLib::Geodesic [inline]
Direct(real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2) const GeographicLib::Geodesic [inline]
Direct(real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2) const GeographicLib::Geodesic [inline]
Direct(real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &m12) const GeographicLib::Geodesic [inline]
Direct(real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &M12, real &M21) const GeographicLib::Geodesic [inline]
Direct(real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21) const GeographicLib::Geodesic [inline]
DISTANCE enum valueGeographicLib::Geodesic
DISTANCE_IN enum valueGeographicLib::Geodesic
EllipsoidArea() const GeographicLib::Geodesic [inline]
Flattening() const GeographicLib::Geodesic [inline]
GenDirect(real lat1, real lon1, real azi1, bool arcmode, real s12_a12, unsigned outmask, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const GeographicLib::Geodesic
GenInverse(real lat1, real lon1, real lat2, real lon2, unsigned outmask, real &s12, real &azi1, real &azi2, real &m12, real &M12, real &M21, real &S12) const GeographicLib::Geodesic
Geodesic(real a, real f)GeographicLib::Geodesic
GeodesicLine classGeographicLib::Geodesic [friend]
GEODESICSCALE enum valueGeographicLib::Geodesic
Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &m12, real &M12, real &M21, real &S12) const GeographicLib::Geodesic [inline]
Inverse(real lat1, real lon1, real lat2, real lon2, real &s12) const GeographicLib::Geodesic [inline]
Inverse(real lat1, real lon1, real lat2, real lon2, real &azi1, real &azi2) const GeographicLib::Geodesic [inline]
Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2) const GeographicLib::Geodesic [inline]
Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &m12) const GeographicLib::Geodesic [inline]
Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &M12, real &M21) const GeographicLib::Geodesic [inline]
Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &m12, real &M12, real &M21) const GeographicLib::Geodesic [inline]
LATITUDE enum valueGeographicLib::Geodesic
Line(real lat1, real lon1, real azi1, unsigned caps=ALL) const GeographicLib::Geodesic
LONGITUDE enum valueGeographicLib::Geodesic
MajorRadius() const GeographicLib::Geodesic [inline]
mask enum nameGeographicLib::Geodesic
NONE enum valueGeographicLib::Geodesic
REDUCEDLENGTH enum valueGeographicLib::Geodesic
WGS84GeographicLib::Geodesic [static]
geographiclib-1.21/doc/doxyfile.in0000644000175000017500000014454611745620414017016 0ustar frankiefrankie# Doxyfile 1.5.2 # $Id: feb37f825ed10293802f164515d1004cf0c44b79 $ # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file that # follow. The default is UTF-8 which is also the encoding used for all text before # the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into # libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of # possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = GeographicLib # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = @GeographicLib_VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, # Italian, Japanese, Japanese-en (Japanese with English messages), Korean, # Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, # Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = NO # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@/ # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = @PROJECT_SOURCE_DIR@/include # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like the Qt-style comments (thus requiring an # explicit @brief command for a brief description. JAVADOC_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for Java. # For instance, namespaces will be presented as packages, qualified scopes # will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to # include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = NO # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from the # version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @PROJECT_SOURCE_DIR@/src @PROJECT_SOURCE_DIR@/include/GeographicLib @PROJECT_SOURCE_DIR@/tools @PROJECT_SOURCE_DIR@/doc/Geographic.doc # This tag can be used to specify the character encoding of the source files that # doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default # input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. # See http://www.gnu.org/software/libiconv for the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py FILE_PATTERNS = *.cpp *.hpp # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the output. # The symbol name can be a fully qualified name, a word, or if the wildcard * is used, # a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = @PROJECT_SOURCE_DIR@/examples # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = NO # If the REFERENCED_BY_RELATION tag is set to YES (the default) # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES (the default) # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. Otherwise they will link to the documentstion. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compressed HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # If the GENERATE_TREEVIEW tag is set to YES, a side panel will be # generated containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = DOXYGEN # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = html/Geographic.tag # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to # produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to # specify the directory where the mscgen tool resides. If left empty the tool is assumed to # be found in the default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will # generate a call dependency graph for every global function or class method. # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable call graphs for selected # functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will # generate a caller dependency graph for every global function or class method. # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable caller graphs for selected # functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen will always # show the root nodes and its direct children regardless of this setting. DOT_GRAPH_MAX_NODES = 50 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, which results in a white background. # Warning: Depending on the platform used, enabling this option may lead to # badly anti-aliased labels on the edges of a graph (i.e. they become hard to # read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO geographiclib-1.21/doc/scripts/0002755000175000017500000000000011757437425016331 5ustar frankiefrankiegeographiclib-1.21/doc/scripts/geod-google.html0000644000175000017500000001545111745620414021400 0ustar frankiefrankie Geodesic lines, circles, envelopes in Google Maps

 Direct:  

 Inverse:

 lat1 lon1 azi1:

 lat2 lon2 azi2:

 s12:    status:    INSTRUCTIONS HERE

geographiclib-1.21/doc/scripts/geod-google-instructions.html0000644000175000017500000001131511745620414024135 0ustar frankiefrankie Geodesic lines, circles, envelopes in Google Maps (instructions)

Geodesic lines, circles, envelopes in Google Maps (instructions)

The page allows you to draw accurate ellipsoidal geodesics on Google Maps. You can specify the geodesic in one of two forms:

  • The direct problem: specify a starting point, an azimuth and a distance as lat1 lon1 azi1 s12 as degrees and meters.
  • The inverse problem: specify the two end points as lat1 lon1 lat2 lon2 as degrees; this finds the shortest path between the two points.
(Angles may be entered as decimal degrees or as degrees, minutes, and seconds, e.g. -20.51125, 20°30′40.5″S, S20d30'40.5", or -20:30:40.5.) Click on the corresponding "compute" button. The display then shows
  • The requested geodesic as a blue line; the WGS84 ellipsoid model is used.
  • The geodesic circle as a green curve; this shows the locus of points a distance s12 from lat1, lon1.
  • The geodesic envelopes as red curves; all the geodesics emanating from lat1, lon1 are tangent to the envelopes (providing they are extended far enough). The number of solutions to the inverse problem changes depending on whether lat2, lon2 lies inside the envelopes. For example, there are four (resp. two) approximately hemispheroidal geodesics if this point lies inside (resp. outside) the inner envelope (only one of which is a shortest path).

The sample data has lat1, lon1 in Wellington, New Zealand, lat2, lon2 in Salamanca, Spain, and s12 about 1.5 times the earth's circumference. Try clicking on the "compute" button next to the "Direct:" input box when the page first loads. You can navigate around the map using the normal Google Map controls.

The precision of output for the geodesic is 0.1" or 1 m. A text-only geodesic calculator based on the same Javascript library is also available; this calculator solves the inverse and direct geodesic problems, computes intermediate points on a geodesic, and finds the area of a geodesic polygon; it allows you to specify the precision of the output and choose between decimal degrees and degress, minutes, and seconds.

The Javascipt code for computing the geodesic lines, circles, and envelopes is part of GeographicLib. The algorithms are derived in

Charles F. F. Karney, Geodesics on an ellipsoid of revolution,
Feb. 2011, arXiv:1102.1215 (pdf), errata.
Charles F. F. Karney, Algorithms for geodesics,
Sept. 2011, arXiv:1109.4448 (pdf).
In putting together this Google Maps demonstration, I started with the sample code geometry-headings.html.


Charles Karney <charles@karney.com> (2011-08-02)

SourceForge.net geographiclib-1.21/doc/scripts/GeographicLib/0002755000175000017500000000000011757437425021030 5ustar frankiefrankiegeographiclib-1.21/doc/scripts/GeographicLib/DMS.js0000644000175000017500000002667711745620414022016 0ustar frankiefrankie/** * DMS.js * Transcription of DMS.[ch]pp into javascript. * * See the documentation for the C++ class. The conversion is a literal * conversion from C++. * * Copyright (c) Charles Karney (2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * $Id: 520532eb8c214268d66f3a9d3fa0640e10dcce94 $ **********************************************************************/ GeographicLib.DMS = {}; (function() { var d = GeographicLib.DMS; d.lookup = function(s, c) { return s.indexOf(c.toUpperCase()); } d.zerofill = function(s, n) { return String("0000").substr(0, Math.max(0, Math.min(4, n-s.length))) + s; } d.hemispheres_ = "SNWE"; d.signs_ = "-+"; d.digits_ = "0123456789"; d.dmsindicators_ = "D'\":"; // d.dmsindicatorsu_ = "\u00b0\u2032\u2033"; // Unicode variants d.dmsindicatorsu_ = "\u00b0'\""; // Use degree symbol d.components_ = ["degrees", "minutes", "seconds"]; d.NONE = 0; d.LATITUDE = 1; d.LONGITUDE = 2; d.AZIMUTH = 3; d.NUMBER = 4; d.DEGREE = 0; d.MINUTE = 1; d.SECOND = 2; // return val, ind d.Decode = function(dms) { var vals = {}; var errormsg = new String(""); var dmsa = dms; dmsa = dmsa.replace(/\u00b0/g, 'd'); dmsa = dmsa.replace(/\u00ba/g, 'd'); dmsa = dmsa.replace(/\u2070/g, 'd'); dmsa = dmsa.replace(/\u2032/g, '\''); dmsa = dmsa.replace(/\u00b4/g, '\''); dmsa = dmsa.replace(/\u2033/g, '"'); dmsa = dmsa.replace(/''/g, '"'); dmsa = dmsa.replace(/^\s+/, ""); dmsa = dmsa.replace(/\s+$/, ""); do { // Executed once (provides the ability to break) var sign = 1; var beg = 0, end = dmsa.length; var ind1 = d.NONE; var k = -1; if (end > beg && (k = d.lookup(d.hemispheres_, dmsa.charAt(beg))) >= 0) { ind1 = (k & 2) ? d.LONGITUDE : d.LATITUDE; sign = (k & 1) ? 1 : -1; ++beg; } if (end > beg && (k = d.lookup(d.hemispheres_, dmsa.charAt(end-1))) >= 0) { if (k >= 0) { if (ind1 != d.NONE) { if (dmsa.charAt(beg - 1).toUpperCase() == dmsa.charAt(end - 1).toUpperCase()) errormsg = "Repeated hemisphere indicators " + dmsa.charAt(beg - 1) + " in " + dmsa.substr(beg - 1, end - beg + 1); else errormsg = "Contradictory hemisphere indicators " + dmsa.charAt(beg - 1) + " and " + dmsa.charAt(end - 1) + " in " + dmsa.substr(beg - 1, end - beg + 1); break; } ind1 = (k & 2) ? d.LONGITUDE : d.LATITUDE; sign = (k & 1) ? 1 : -1; --end; } } if (end > beg && (k = d.lookup(d.signs_, dmsa.charAt(beg))) >= 0) { if (k >= 0) { sign *= k ? 1 : -1; ++beg; } } if (end == beg) { errormsg = "Empty or incomplete DMS string " + dmsa; break; } var ipieces = [0, 0, 0]; var fpieces = [0, 0, 0]; var npiece = 0; var icurrent = 0; var fcurrent = 0; var ncurrent = 0, p = beg; var pointseen = false; var digcount = 0; while (p < end) { var x = dmsa.charAt(p++); if ((k = d.lookup(d.digits_, x)) >= 0) { ++ncurrent; if (digcount > 0) ++digcount; // Count of decimal digits else icurrent = 10 * icurrent + k; } else if (x == '.') { if (pointseen) { errormsg = "Multiple decimal points in " + dmsa.substr(beg, end - beg); break; } pointseen = true; digcount = 1; } else if ((k = d.lookup(d.dmsindicators_, x)) >= 0) { if (k >= 3) { if (p == end) { errormsg = "Illegal for : to appear at the end of " + dmsa.substr(beg, end - beg); break; } k = npiece; } if (k == npiece - 1) { errormsg = "Repeated " + d.components_[k] + " component in " + dmsa.substr(beg, end - beg); break; } else if (k < npiece) { errormsg = d.components_[k] + " component follows " + d.components_[npiece - 1] + " component in " + dmsa.substr(beg, end - beg); break; } if (ncurrent == 0) { errormsg = "Missing numbers in " + d.components_[k] + " component of " + dmsa.substr(beg, end - beg); break; } if (digcount > 1) { fcurrent = parseFloat(dmsa.substr(p - digcount - 1, digcount)); } ipieces[k] = icurrent; fpieces[k] = icurrent + fcurrent; if (p < end) { npiece = k + 1; icurrent = fcurrent = 0; ncurrent = digcount = 0; } } else if (d.lookup(d.signs_, x) >= 0) { errormsg = "Internal sign in DMS string " + dmsa.substr(beg, end - beg); break; } else { errormsg = "Illegal character " + x + " in DMS string " + dmsa.substr(beg, end - beg); break; } } if (errormsg.length) break; if (d.lookup(d.dmsindicators_, dmsa.charAt(p - 1)) < 0) { if (npiece >= 3) { errormsg = "Extra text following seconds in DMS string " + dmsa.substr(beg, end - beg); break; } if (ncurrent == 0) { errormsg = "Missing numbers in trailing component of " + dmsa.substr(beg, end - beg); break; } if (digcount > 1) { fcurrent = parseFloat(dmsa.substr(p - digcount, digcount)); } ipieces[npiece] = icurrent; fpieces[npiece] = icurrent + fcurrent; } if (pointseen && digcount == 0) { errormsg = "Decimal point in non-terminal component of " + dmsa.substr(beg, end - beg); break; } // Note that we accept 59.999999... even though it rounds to 60. if (ipieces[1] >= 60) { errormsg = "Minutes " + fpieces[1] + " not in range [0, 60)"; break; } if (ipieces[2] >= 60) { errormsg = "Seconds " + fpieces[2] + " not in range [0, 60)"; break; } vals.ind = ind1; // Assume check on range of result is made by calling routine (which // might be able to offer a better diagnostic). vals.val = sign * (fpieces[0] + (fpieces[1] + fpieces[2] / 60) / 60); return vals; } while (false); vals.val = d.NumMatch(dmsa); if (vals.val == 0) throw new Error(errormsg); else vals.ind = d.NONE; return vals; } d.NumMatch = function(s) { if (s.length < 3) return 0; var t = s.toUpperCase().replace(/0+$/,""); var sign = t.charAt(0) == '-' ? -1 : 1; var p0 = t.charAt(0) == '-' || t.charAt(0) == '+' ? 1 : 0; var p1 = t.length - 1; if (p1 + 1 < p0 + 3) return 0; // Strip off sign and trailing 0s t = t.substr(p0, p1 + 1 - p0); // Length at least 3 if (t == "NAN" || t == "1.#QNAN" || t == "1.#SNAN" || t == "1.#IND" || t == "1.#R") return sign * Number.NaN; else if (t == "INF" || t == "1.#INF") return sign * Number.POSITIVE_INFINITY; return 0; } // return lat, lon d.DecodeLatLon = function(stra, strb, swaplatlong) { var vals = {}; if (!swaplatlong) swaplatlong = false; var valsa = d.Decode(stra); var valsb = d.Decode(strb); var a = valsa.val, ia = valsa.ind; var b = valsb.val, ib = valsb.ind; if (ia == d.NONE && ib == d.NONE) { // Default to lat, long unless swaplatlong ia = swaplatlong ? d.LONGITUDE : d.LATITUDE; ib = swaplatlong ? d.LATITUDE : d.LONGITUDE; } else if (ia == d.NONE) ia = d.LATITUDE + d.LONGITUDE - ib; else if (ib == d.NONE) ib = d.LATITUDE + d.LONGITUDE - ia; if (ia == ib) throw new Error("Both " + stra + " and " + strb + " interpreted as " + (ia == d.LATITUDE ? "latitudes" : "longitudes")); var lat = ia == d.LATITUDE ? a : b, lon = ia == d.LATITUDE ? b : a; if (lat < -90 || lat > 90) throw new Error("Latitude " + lat + "d not in [-90d, 90d]"); if (lon < -180 || lon > 360) throw new Error("Latitude " + lon + "d not in [-180d, 360d]"); if (lon >= 180) lon -= 360; vals.lat = lat; vals.lon = lon; return vals; } d.DecodeAngle = function(angstr) { var vals = d.Decode(angstr); var ang = vals.val, ind = vals.ind; if (ind != d.NONE) throw new Error("Arc angle " + angstr + " includes a hemisphere, N/E/W/S"); return ang; } d.DecodeAzimuth = function(azistr) { var vals = d.Decode(azistr); var azi = vals.val, ind = vals.ind; if (ind == d.LATITUDE) throw new Error("Azimuth " + azistr + " has a latitude hemisphere, N/S"); if (azi < -180 || azi > 360) throw new Error("Azimuth " + azistr + " not in range [-180d, 360d]"); if (azi >= 180) azi -= 360; return azi; } d.Encode = function(angle, trailing, prec, ind) { // Assume check on range of input angle has been made by calling // routine (which might be able to offer a better diagnostic). if (!ind) ind = d.NONE; if (!isFinite(angle)) return angle < 0 ? String("-inf") : (angle > 0 ? String("inf") : String("nan")); // 15 - 2 * trailing = ceiling(log10(2^53/90/60^trailing)). // This suffices to give full real precision for numbers in [-90,90] prec = Math.min(15 - 2 * trailing, prec); var scale = 1, i; for (i = 0; i < trailing; ++i) scale *= 60; for (i = 0; i < prec; ++i) scale *= 10; if (ind == d.AZIMUTH) angle -= Math.floor(angle/360) * 360; var sign = angle < 0 ? -1 : 1; angle *= sign; // Break off integer part to preserve precision in manipulation of // fractional part. var idegree = Math.floor(angle), fdegree = Math.floor((angle - idegree) * scale + 0.5) / scale; if (fdegree >= 1) { idegree += 1; fdegree -= 1; } var pieces = [fdegree, 0, 0]; for (i = 1; i <= trailing; ++i) { var ip = Math.floor(pieces[i - 1]), fp = pieces[i - 1] - ip; pieces[i] = fp * 60; pieces[i - 1] = ip; } pieces[0] += idegree; var s = new String(""); if (ind == d.NONE && sign < 0) s += '-'; switch (trailing) { case d.DEGREE: s += d.zerofill(pieces[0].toFixed(prec), ind == d.NONE ? 0 : 1 + Math.min(ind, 2) + prec + (prec ? 1 : 0)) + d.dmsindicatorsu_.charAt(0); break; default: s += d.zerofill(pieces[0].toFixed(0), ind == d.NONE ? 0 : 1 + Math.min(ind, 2)) + d.dmsindicatorsu_.charAt(0); switch (trailing) { case d.MINUTE: s += d.zerofill(pieces[1].toFixed(prec), 2 + prec + (prec ? 1 : 0)) + d.dmsindicatorsu_.charAt(1); break; case d.SECOND: s += d.zerofill(pieces[1].toFixed(0), 2) + d.dmsindicatorsu_.charAt(1); s += d.zerofill(pieces[2].toFixed(prec), 2 + prec + (prec ? 1 : 0)) + d.dmsindicatorsu_.charAt(2); break; default: break; } } if (ind != d.NONE && ind != d.AZIMUTH) s += d.hemispheres_.charAt((ind == d.LATITUDE ? 0 : 2) + (sign < 0 ? 0 : 1)); return s; } })(); geographiclib-1.21/doc/scripts/GeographicLib/GeodesicLine.js0000644000175000017500000002505711745620414023714 0ustar frankiefrankie/** * GeodesicLine.js * Transcription of GeodesicLine.[ch]pp into javascript. * * See the documentation for the C++ class. The conversion is a literal * conversion from C++. * * Copyright (c) Charles Karney (2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * $Id: fd75e359445d86b9e2c8b27708e1ad35687a92d0 $ **********************************************************************/ // Load AFTER GeographicLib/Math.js and GeographicLib/Geodesic.js (function() { var g = GeographicLib.Geodesic; var l = GeographicLib.GeodesicLine; var m = GeographicLib.Math; l.GeodesicLine = function(geod, lat1, lon1, azi1, caps) { this._a = geod._a; this._f = geod._f; this._b = geod._b; this._c2 = geod._c2; this._f1 = geod._f1; this._caps = !caps ? g.ALL : (caps | g.LATITUDE | g.AZIMUTH); azi1 = g.AngNormalize(azi1); // Guard against underflow in salp0 azi1 = g.AngRound(azi1); lon1 = g.AngNormalize(lon1); this._lat1 = lat1; this._lon1 = lon1; this._azi1 = azi1; // alp1 is in [0, pi] var alp1 = azi1 * m.degree; // Enforce sin(pi) == 0 and cos(pi/2) == 0. Better to face the ensuing // problems directly than to skirt them. this._salp1 = azi1 == -180 ? 0 : Math.sin(alp1); this._calp1 = Math.abs(azi1) == 90 ? 0 : Math.cos(alp1); var cbet1, sbet1, phi; phi = lat1 * m.degree; // Ensure cbet1 = +epsilon at poles sbet1 = this._f1 * Math.sin(phi); cbet1 = Math.abs(lat1) == 90 ? g.tiny_ : Math.cos(phi); // SinCosNorm(sbet1, cbet1); var t = m.hypot(sbet1, cbet1); sbet1 /= t; cbet1 /= t; // Evaluate alp0 from sin(alp1) * cos(bet1) = sin(alp0), this._salp0 = this._salp1 * cbet1; // alp0 in [0, pi/2 - |bet1|] // Alt: calp0 = hypot(sbet1, calp1 * cbet1). The following // is slightly better (consider the case salp1 = 0). this._calp0 = m.hypot(this._calp1, this._salp1 * sbet1); // Evaluate sig with tan(bet1) = tan(sig1) * cos(alp1). // sig = 0 is nearest northward crossing of equator. // With bet1 = 0, alp1 = pi/2, we have sig1 = 0 (equatorial line). // With bet1 = pi/2, alp1 = -pi, sig1 = pi/2 // With bet1 = -pi/2, alp1 = 0 , sig1 = -pi/2 // Evaluate omg1 with tan(omg1) = sin(alp0) * tan(sig1). // With alp0 in (0, pi/2], quadrants for sig and omg coincide. // No atan2(0,0) ambiguity at poles since cbet1 = +epsilon. // With alp0 = 0, omg1 = 0 for alp1 = 0, omg1 = pi for alp1 = pi. this._ssig1 = sbet1; this._somg1 = this._salp0 * sbet1; this._csig1 = this._comg1 = sbet1 != 0 || this._calp1 != 0 ? cbet1 * this._calp1 : 1; // SinCosNorm(this._ssig1, this._csig1); // sig1 in (-pi, pi] var t = m.hypot(this._ssig1, this._csig1); this._ssig1 /= t; this._csig1 /= t; // SinCosNorm(this._somg1, this._comg1); var t = m.hypot(this._somg1, this._comg1); this._somg1 /= t; this._comg1 /= t; this._k2 = m.sq(this._calp0) * geod._ep2; var eps = this._k2 / (2 * (1 + Math.sqrt(1 + this._k2)) + this._k2); if (this._caps & g.CAP_C1) { this._A1m1 = g.A1m1f(eps); this._C1a = new Array(g.nC1_ + 1); g.C1f(eps, this._C1a); this._B11 = g.SinCosSeries(true, this._ssig1, this._csig1, this._C1a, g.nC1_); var s = Math.sin(this._B11), c = Math.cos(this._B11); // tau1 = sig1 + B11 this._stau1 = this._ssig1 * c + this._csig1 * s; this._ctau1 = this._csig1 * c - this._ssig1 * s; // Not necessary because C1pa reverts C1a // _B11 = -SinCosSeries(true, _stau1, _ctau1, _C1pa, nC1p_); } if (this._caps & g.CAP_C1p) { this._C1pa = new Array(g.nC1p_ + 1), g.C1pf(eps, this._C1pa); } if (this._caps & g.CAP_C2) { this._A2m1 = g.A2m1f(eps); this._C2a = new Array(g.nC2_ + 1); g.C2f(eps, this._C2a); this._B21 = g.SinCosSeries(true, this._ssig1, this._csig1, this._C2a, g.nC2_); } if (this._caps & g.CAP_C3) { this._C3a = new Array(g.nC3_); geod.C3f(eps, this._C3a); this._A3c = -this._f * this._salp0 * geod.A3f(eps); this._B31 = g.SinCosSeries(true, this._ssig1, this._csig1, this._C3a, g.nC3_-1); } if (this._caps & g.CAP_C4) { this._C4a = new Array(g.nC4_); // all the elements of _C4a are used geod.C4f(this._k2, this._C4a); // Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0) this._A4 = m.sq(this._a) * this._calp0 * this._salp0 * geod._e2; this._B41 = g.SinCosSeries(false, this._ssig1, this._csig1, this._C4a, g.nC4_); } } // return a12, lat2, lon2, azi2, s12, m12, M12, M21, S12 l.GeodesicLine.prototype.GenPosition = function(arcmode, s12_a12, outmask) { var vals = {}; outmask &= this._caps & g.OUT_ALL; if (!( arcmode || (this._caps & g.DISTANCE_IN & g.OUT_ALL) )) { // Uninitialized or impossible distance calculation requested vals.a12 = Number.NaN(); return vals; } // Avoid warning about uninitialized B12. var sig12, ssig12, csig12, B12 = 0, AB1 = 0; if (arcmode) { // Interpret s12_a12 as spherical arc length sig12 = s12_a12 * m.degree; var s12a = Math.abs(s12_a12); s12a -= 180 * Math.floor(s12a / 180); ssig12 = s12a == 0 ? 0 : Math.sin(sig12); csig12 = s12a == 90 ? 0 : Math.cos(sig12); } else { // Interpret s12_a12 as distance var tau12 = s12_a12 / (this._b * (1 + this._A1m1)), s = Math.sin(tau12), c = Math.cos(tau12); // tau2 = tau1 + tau12 B12 = - g.SinCosSeries(true, this._stau1 * c + this._ctau1 * s, this._ctau1 * c - this._stau1 * s, this._C1pa, g.nC1p_); sig12 = tau12 - (B12 - this._B11); ssig12 = Math.sin(sig12); csig12 = Math.cos(sig12); } var omg12, lam12, lon12; var ssig2, csig2, sbet2, cbet2, somg2, comg2, salp2, calp2; // sig2 = sig1 + sig12 ssig2 = this._ssig1 * csig12 + this._csig1 * ssig12; csig2 = this._csig1 * csig12 - this._ssig1 * ssig12; if (outmask & (g.DISTANCE | g.REDUCEDLENGTH | g.GEODESICSCALE)) { if (arcmode) B12 = g.SinCosSeries(true, ssig2, csig2, this._C1a, g.nC1_); AB1 = (1 + this._A1m1) * (B12 - this._B11); } // sin(bet2) = cos(alp0) * sin(sig2) sbet2 = this._calp0 * ssig2; // Alt: cbet2 = hypot(csig2, salp0 * ssig2); cbet2 = m.hypot(this._salp0, this._calp0 * csig2); if (cbet2 == 0) // I.e., salp0 = 0, csig2 = 0. Break the degeneracy in this case cbet2 = csig2 = g.tiny_; // tan(omg2) = sin(alp0) * tan(sig2) somg2 = this._salp0 * ssig2; comg2 = csig2; // No need to normalize // tan(alp0) = cos(sig2)*tan(alp2) salp2 = this._salp0; calp2 = this._calp0 * csig2; // No need to normalize // omg12 = omg2 - omg1 omg12 = Math.atan2(somg2 * this._comg1 - comg2 * this._somg1, comg2 * this._comg1 + somg2 * this._somg1); if (outmask & g.DISTANCE) vals.s12 = arcmode ? this._b * ((1 + this._A1m1) * sig12 + AB1) : s12_a12; if (outmask & g.LONGITUDE) { lam12 = omg12 + this._A3c * ( sig12 + (g.SinCosSeries(true, ssig2, csig2, this._C3a, g.nC3_-1) - this._B31)); lon12 = lam12 / m.degree; // Can't use AngNormalize because longitude might have wrapped multiple // times. lon12 = lon12 - 360 * Math.floor(lon12/360 + 0.5); vals.lon2 = g.AngNormalize(this._lon1 + lon12); } if (outmask & g.LATITUDE) vals.lat2 = Math.atan2(sbet2, this._f1 * cbet2) / m.degree; if (outmask & g.AZIMUTH) // minus signs give range [-180, 180). 0- converts -0 to +0. vals.azi2 = 0 - Math.atan2(-salp2, calp2) / m.degree; if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) { var ssig1sq = m.sq(this._ssig1), ssig2sq = m.sq( ssig2), w1 = Math.sqrt(1 + this._k2 * ssig1sq), w2 = Math.sqrt(1 + this._k2 * ssig2sq), B22 = g.SinCosSeries(true, ssig2, csig2, this._C2a, g.nC2_), AB2 = (1 + this._A2m1) * (B22 - this._B21), J12 = (this._A1m1 - this._A2m1) * sig12 + (AB1 - AB2); if (outmask & g.REDUCEDLENGTH) // Add parens around (_csig1 * ssig2) and (_ssig1 * csig2) to ensure // accurate cancellation in the case of coincident points. vals.m12 = this._b * ((w2 * (this._csig1 * ssig2) - w1 * (this._ssig1 * csig2)) - this._csig1 * csig2 * J12); if (outmask & g.GEODESICSCALE) { vals.M12 = csig12 + (this._k2 * (ssig2sq - ssig1sq) * ssig2 / (w1 + w2) - csig2 * J12) * this._ssig1 / w1; vals.M21 = csig12 - (this._k2 * (ssig2sq - ssig1sq) * this._ssig1 / (w1 + w2) - this._csig1 * J12) * ssig2 / w2; } } if (outmask & g.AREA) { var B42 = g.SinCosSeries(false, ssig2, csig2, this._C4a, g.nC4_); var salp12, calp12; if (this._calp0 == 0 || this._salp0 == 0) { // alp12 = alp2 - alp1, used in atan2 so no need to normalized salp12 = salp2 * this._calp1 - calp2 * this._salp1; calp12 = calp2 * this._calp1 + salp2 * this._salp1; // The right thing appears to happen if alp1 = +/-180 and alp2 = 0, viz // salp12 = -0 and alp12 = -180. However this depends on the sign being // attached to 0 correctly. The following ensures the correct behavior. if (salp12 == 0 && calp12 < 0) { salp12 = g.tiny_ * this._calp1; calp12 = -1; } } else { // tan(alp) = tan(alp0) * sec(sig) // tan(alp2-alp1) = (tan(alp2) -tan(alp1)) / (tan(alp2)*tan(alp1)+1) // = calp0 * salp0 * (csig1-csig2) / (salp0^2 + calp0^2 * csig1*csig2) // If csig12 > 0, write // csig1 - csig2 = ssig12 * (csig1 * ssig12 / (1 + csig12) + ssig1) // else // csig1 - csig2 = csig1 * (1 - csig12) + ssig12 * ssig1 // No need to normalize salp12 = this._calp0 * this._salp0 * (csig12 <= 0 ? this._csig1 * (1 - csig12) + ssig12 * this._ssig1 : ssig12 * (this._csig1 * ssig12 / (1 + csig12) + this._ssig1)); calp12 = m.sq(this._salp0) + m.sq(this._calp0) * this._csig1 * csig2; } vals.S12 = this._c2 * Math.atan2(salp12, calp12) + this._A4 * (B42 - this._B41); } vals.a12 = arcmode ? s12_a12 : sig12 / m.degree; return vals; } })(); geographiclib-1.21/doc/scripts/GeographicLib/Math.js0000644000175000017500000001043211745620414022242 0ustar frankiefrankie/** * Math.js * Transcription of Math.hpp, Constants.hpp, and Accumulator.hpp into * javascript. * * Copyright (c) Charles Karney (2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * $Id: d8f72fdee7b661e6ba3f08bb7ecfe9f0673e8132 $ **********************************************************************/ var GeographicLib; if (!GeographicLib) GeographicLib = {}; GeographicLib.Math = {}; GeographicLib.Math.sq = function(x) { return x * x; } GeographicLib.Math.hypot = function(x, y) { x = Math.abs(x); y = Math.abs(y); var a = Math.max(x, y), b = Math.min(x, y) / (a ? a : 1); return a * Math.sqrt(1 + b * b); } GeographicLib.Math.cbrt = function(x) { var y = Math.pow(Math.abs(x), 1/3); return x < 0 ? -y : y; } GeographicLib.Math.log1p = function(x) { var y = 1 + x, z = y - 1; // Here's the explanation for this magic: y = 1 + z, exactly, and z // approx x, thus log(y)/z (which is nearly constant near z = 0) returns // a good approximation to the true log(1 + x)/x. The multiplication x * // (log(y)/z) introduces little additional error. return z == 0 ? x : x * Math.log(y) / z; } GeographicLib.Math.atanh = function(x) { var y = Math.abs(x); // Enforce odd parity y = GeographicLib.Math.log1p(2 * y/(1 - y))/2; return x < 0 ? -y : y; } GeographicLib.Math.epsilon = Math.pow(0.5, 52); GeographicLib.Math.degree = Math.PI/180; GeographicLib.Constants = {}; GeographicLib.Constants.WGS84 = { a: 6378137, f: 1/298.257223563 }; GeographicLib.Accumulator = {}; (function() { a = GeographicLib.Accumulator; a.Accumulator = function(y) { this.Set(y); } a.Accumulator.prototype.Set = function(y) { if (!y) y = 0; if (y.constructor == a.Accumulator) { this._s = y._s; this._t = y._t; } else { this._s = y; this._t = 0; } } // Error free transformation of a sum. Note that t can be the same as one // of the first two arguments. a.sum = function(u, v) { var s = u + v, up = s - v, vpp = s - up; up -= u; vpp -= v; var t = -(up + vpp); return {s: s, t: t}; } a.Accumulator.prototype.Add = function(y) { // Here's Shewchuk's solution... // Accumulate starting at least significant end var u = a.sum(y, this._t); var v = a.sum(u.s, this._s); u = u.t; this._s = v.s; this._t = v.t; // Start is _s, _t decreasing and non-adjacent. Sum is now (s + t + u) // exactly with s, t, u non-adjacent and in decreasing order (except // for possible zeros). The following code tries to normalize the // result. Ideally, we want _s = round(s+t+u) and _u = round(s+t+u - // _s). The follow does an approximate job (and maintains the // decreasing non-adjacent property). Here are two "failures" using // 3-bit floats: // // Case 1: _s is not equal to round(s+t+u) -- off by 1 ulp // [12, -1] - 8 -> [4, 0, -1] -> [4, -1] = 3 should be [3, 0] = 3 // // Case 2: _s+_t is not as close to s+t+u as it shold be // [64, 5] + 4 -> [64, 8, 1] -> [64, 8] = 72 (off by 1) // should be [80, -7] = 73 (exact) // // "Fixing" these problems is probably not worth the expense. The // representation inevitably leads to small errors in the accumulated // values. The additional errors illustrated here amount to 1 ulp of // the less significant word during each addition to the Accumulator // and an additional possible error of 1 ulp in the reported sum. // // Incidentally, the "ideal" representation described above is not // canonical, because _s = round(_s + _t) may not be true. For // example, with 3-bit floats: // // [128, 16] + 1 -> [160, -16] -- 160 = round(145). // But [160, 0] - 16 -> [128, 16] -- 128 = round(144). // if (this._s == 0) // This implies t == 0, this._s = u; // so result is u else this._t += u; // otherwise just accumulate u to t. } a.Accumulator.prototype.Sum = function(y) { if (!y) return this._s; else { var b = new a.Accumulator(this); b.Add(y); return b._s; } } a.Accumulator.prototype.Negate = function() { this._s *= -1; this._t *= -1; } })(); geographiclib-1.21/doc/scripts/GeographicLib/PolygonArea.js0000644000175000017500000001256211745620414023577 0ustar frankiefrankie/** * PolygonArea.js * Transcription of PolygonArea.[ch]pp into javascript. * * See the documentation for the C++ class. The conversion is a literal * conversion from C++. * * Copyright (c) Charles Karney (2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * $Id: cefb3a6e48907fbda0f01e8ee7d549447f46e29a $ **********************************************************************/ // Load AFTER GeographicLib/Math.js and GeographicLib/Geodesic.js GeographicLib.PolygonArea = {}; (function() { var m = GeographicLib.Math; var a = GeographicLib.Accumulator; var g = GeographicLib.Geodesic; var p = GeographicLib.PolygonArea; p.transit = function(lon1, lon2) { // Return 1 or -1 if crossing prime meridian in east or west direction. // Otherwise return zero. lon1 = g.AngNormalize(lon1); lon2 = g.AngNormalize(lon2); // treat lon12 = -180 as an eastward geodesic, so convert to 180. var lon12 = -g.AngNormalize(lon1 - lon2); // In (-180, 180] var cross = lon1 < 0 && lon2 >= 0 && lon12 > 0 ? 1 : (lon2 < 0 && lon1 >= 0 && lon12 < 0 ? -1 : 0); return cross; } p.PolygonArea = function(earth, polyline) { this._earth = earth; this._area0 = 4 * Math.PI * earth._c2; this._polyline = !polyline ? false : polyline; this._mask = g.DISTANCE | (this._polyline ? 0 : g.AREA); if (!this._polyline) this._areasum = new a.Accumulator(0); this._perimetersum = new a.Accumulator(0); this.Clear(); } p.PolygonArea.prototype.Clear = function() { this._num = 0; this._crossings = 0; if (!this._polyline) this._areasum.Set(0); this._perimetersum.Set(0); this._lat0 = this._lon0 = this._lat1 = this._lon1 = 0; } p.PolygonArea.prototype.AddPoint = function(lat, lon) { if (this._num == 0) { this._lat0 = this._lat1 = lat; this._lon0 = this._lon1 = lon; } else { var t = this._earth.Inverse(this._lat1, this._lon1, lat, lon, this._mask); this._perimetersum.Add(t.s12); if (!this._polyline) { this._areasum.Add(t.S12); this._crossings += p.transit(this._lon1, lon); } this._lat1 = lat; this._lon1 = lon; } ++this._num; } // return number, perimeter, area p.PolygonArea.prototype.Compute = function(reverse, sign) { var vals = {number: this._num}; if (this._num < 2) { vals.perimeter = 0; if (!this._polyline) vals.area = 0; return vals; } if (this._polyline) { vals.perimeter = this._perimetersum.Sum(); return vals; } var t = this._earth.Inverse(this._lat1, this._lon1, this._lat0, this._lon0, this._mask); vals.perimeter = this._perimetersum.Sum(t.s12); var tempsum = new a.Accumulator(this._areasum); tempsum.Add(t.S12); var crossings = this._crossings + p.transit(this._lon1, this._lon0); if (crossings & 1) tempsum.Add( (tempsum.Sum() < 0 ? 1 : -1) * this._area0/2 ); // area is with the clockwise sense. If !reverse convert to // counter-clockwise convention. if (!reverse) tempsum.Negate(); // If sign put area in (-area0/2, area0/2], else put area in [0, area0) if (sign) { if (tempsum.Sum() > this._area0/2) tempsum.Add( -this._area0 ); else if (tempsum.Sum() <= -this._area0/2) tempsum.Add( +this._area0 ); } else { if (tempsum.Sum() >= this._area0) tempsum.Add( -this._area0 ); else if (tempsum < 0) tempsum.Add( -this._area0 ); } vals.area = tempsum.Sum(); return vals; } // return number, perimeter, area p.TestCompute = function(lat, lon, reverse, sign) { var vals = {number: this._num + 1}; if (this._num == 0) { vals.perimeter = 0; if (!this._polyline) vals.area = 0; return vals; } vals.perimeter = this._perimetersum.Sum(); var tempsum = this._polyline ? 0 : this._areasum.Sum(); var crossings = this._crossings; var t; for (var i = 0; i < (this._polyline ? 1 : 2); ++i) { t = this._earth.Inverse (i == 0 ? this._lat1 : lat, i == 0 ? this._lon1 : lon, i != 0 ? this._lat0 : lat, i != 0 ? this._lon0 : lon, this._mask); vals.perimeter += t.s12; if (!this._polyline) { tempsum += t.S12; crossings += p.transit(i == 0 ? this._lon1 : lon, i != 0 ? this._lon0 : lon); } } if (this._polyline) return vals; if (crossings & 1) tempsum += (tempsum < 0 ? 1 : -1) * this._area0/2; // area is with the clockwise sense. If !reverse convert to // counter-clockwise convention. if (!reverse) tempsum *= -1; // If sign put area in (-area0/2, area0/2], else put area in [0, area0) if (sign) { if (tempsum > this._area0/2) tempsum -= this._area0; else if (tempsum <= -this._area0/2) tempsum += this._area0; } else { if (tempsum >= this._area0) tempsum -= this._area0; else if (tempsum < 0) tempsum += this._area0; } vals.area = tempsum; return vals; } p.Area = function(earth, points, polyline) { var poly = new p.PolygonArea(earth, polyline); for (var i = 0; i < points.length; ++i) poly.AddPoint(points[i].lat, points[i].lon); return poly.Compute(false, true); } })(); geographiclib-1.21/doc/scripts/GeographicLib/Geodesic.js0000644000175000017500000010455111745620414023101 0ustar frankiefrankie/** * Geodesic.js * Transcription of Geodesic.[ch]pp into javascript. * * See the documentation for the C++ class. The conversion is a literal * conversion from C++. * * Copyright (c) Charles Karney (2011, 2012) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * $Id: d9a7879a3ff27db0b34f6c9fe3d8eaf8f90d1e29 $ **********************************************************************/ // Load AFTER Math.js GeographicLib.Geodesic = {}; GeographicLib.GeodesicLine = {}; (function() { var m = GeographicLib.Math; var g = GeographicLib.Geodesic; var l = GeographicLib.GeodesicLine; g.GEOD_ORD = 6; g.nA1_ = g.GEOD_ORD; g.nC1_ = g.GEOD_ORD; g.nC1p_ = g.GEOD_ORD; g.nA2_ = g.GEOD_ORD; g.nC2_ = g.GEOD_ORD; g.nA3_ = g.GEOD_ORD; g.nA3x_ = g.nA3_; g.nC3_ = g.GEOD_ORD; g.nC3x_ = (g.nC3_ * (g.nC3_ - 1)) / 2; g.nC4_ = g.GEOD_ORD; g.nC4x_ = (g.nC4_ * (g.nC4_ + 1)) / 2; g.maxit_ = 50; g.tiny_ = Math.sqrt(Number.MIN_VALUE); g.tol0_ = m.epsilon; g.tol1_ = 200 * g.tol0_; g.tol2_ = Math.sqrt(m.epsilon); g.xthresh_ = 1000 * g.tol2_; g.CAP_NONE = 0; g.CAP_C1 = 1<<0; g.CAP_C1p = 1<<1; g.CAP_C2 = 1<<2; g.CAP_C3 = 1<<3; g.CAP_C4 = 1<<4; g.CAP_ALL = 0x1F; g.OUT_ALL = 0x7F80; g.NONE = 0; g.LATITUDE = 1<<7 | g.CAP_NONE; g.LONGITUDE = 1<<8 | g.CAP_C3; g.AZIMUTH = 1<<9 | g.CAP_NONE; g.DISTANCE = 1<<10 | g.CAP_C1; g.DISTANCE_IN = 1<<11 | g.CAP_C1 | g.CAP_C1p; g.REDUCEDLENGTH = 1<<12 | g.CAP_C1 | g.CAP_C2; g.GEODESICSCALE = 1<<13 | g.CAP_C1 | g.CAP_C2; g.AREA = 1<<14 | g.CAP_C4; g.ALL = g.OUT_ALL| g.CAP_ALL; g.SinCosSeries = function(sinp, sinx, cosx, c, n) { // Evaluate // y = sinp ? sum(c[i] * sin( 2*i * x), i, 1, n) : // sum(c[i] * cos((2*i+1) * x), i, 0, n-1) : // using Clenshaw summation. N.B. c[0] is unused for sin series // Approx operation count = (n + 5) mult and (2 * n + 2) add var k = n + (sinp ? 1 : 0); // Point to one beyond last element var ar = 2 * (cosx - sinx) * (cosx + sinx), // 2 * cos(2 * x) y0 = n & 1 ? c[--k] : 0, y1 = 0; // accumulators for sum // Now n is even n = Math.floor(n/2); while (n--) { // Unroll loop x 2, so accumulators return to their original role y1 = ar * y0 - y1 + c[--k]; y0 = ar * y1 - y0 + c[--k]; } return (sinp ? 2 * sinx * cosx * y0 // sin(2 * x) * y0 : cosx * (y0 - y1)); // cos(x) * (y0 - y1) } g.AngNormalize = function(x) { // Place angle in [-180, 180). Assumes x is in [-540, 540). return x >= 180 ? x - 360 : (x < -180 ? x + 360 : x); } g.AngRound = function(x) { // The makes the smallest gap in x = 1/16 - nextafter(1/16, 0) = 1/2^57 // for reals = 0.7 pm on the earth if x is an angle in degrees. (This // is about 1000 times more resolution than we get with angles around 90 // degrees.) We use this to avoid having to deal with near singular // cases when x is non-zero but tiny (e.g., 1.0e-200). var z = 1/16; var y = Math.abs(x); // The compiler mustn't "simplify" z - (z - y) to y y = y < z ? z - (z - y) : y; return x < 0 ? -y : y; } g.Astroid = function(x, y) { // Solve k^4+2*k^3-(x^2+y^2-1)*k^2-2*y^2*k-y^2 = 0 for positive // root k. This solution is adapted from Geocentric::Reverse. var k; var p = m.sq(x), q = m.sq(y), r = (p + q - 1) / 6; if ( !(q == 0 && r <= 0) ) { var // Avoid possible division by zero when r = 0 by multiplying // equations for s and t by r^3 and r, resp. S = p * q / 4, // S = r^3 * s r2 = m.sq(r), r3 = r * r2, // The discrimant of the quadratic equation for T3. This is // zero on the evolute curve p^(1/3)+q^(1/3) = 1 disc = S * (S + 2 * r3); var u = r; if (disc >= 0) { var T3 = S + r3; // Pick the sign on the sqrt to maximize abs(T3). This // minimizes loss of precision due to cancellation. The // result is unchanged because of the way the T is used // in definition of u. T3 += T3 < 0 ? -Math.sqrt(disc) : Math.sqrt(disc); // T3 = (r * t)^3 // N.B. cbrt always returns the real root. cbrt(-8) = -2. var T = m.cbrt(T3); // T = r * t // T can be zero; but then r2 / T -> 0. u += T + (T != 0 ? r2 / T : 0); } else { // T is complex, but the way u is defined the result is real. var ang = Math.atan2(Math.sqrt(-disc), -(S + r3)); // There are three possible cube roots. We choose the // root which avoids cancellation. Note that disc < 0 // implies that r < 0. u += 2 * r * Math.cos(ang / 3); } var v = Math.sqrt(m.sq(u) + q), // guaranteed positive // Avoid loss of accuracy when u < 0. uv = u < 0 ? q / (v - u) : u + v, // u+v, guaranteed positive w = (uv - q) / (2 * v); // positive? // Rearrange expression for k to avoid loss of accuracy due to // subtraction. Division by 0 not possible because uv > 0, w >= 0. k = uv / (Math.sqrt(uv + m.sq(w)) + w); // guaranteed positive } else { // q == 0 && r <= 0 // y = 0 with |x| <= 1. Handle this case directly. // for y small, positive root is k = abs(y)/sqrt(1-x^2) k = 0; } return k; } g.A1m1f = function(eps) { var eps2 = m.sq(eps), t = eps2*(eps2*(eps2+4)+64)/256; return (t + eps) / (1 - eps); } g.C1f = function(eps, c) { var eps2 = m.sq(eps), d = eps; c[1] = d*((6-eps2)*eps2-16)/32; d *= eps; c[2] = d*((64-9*eps2)*eps2-128)/2048; d *= eps; c[3] = d*(9*eps2-16)/768; d *= eps; c[4] = d*(3*eps2-5)/512; d *= eps; c[5] = -7*d/1280; d *= eps; c[6] = -7*d/2048; } g.C1pf = function(eps, c) { var eps2 = m.sq(eps), d = eps; c[1] = d*(eps2*(205*eps2-432)+768)/1536; d *= eps; c[2] = d*(eps2*(4005*eps2-4736)+3840)/12288; d *= eps; c[3] = d*(116-225*eps2)/384; d *= eps; c[4] = d*(2695-7173*eps2)/7680; d *= eps; c[5] = 3467*d/7680; d *= eps; c[6] = 38081*d/61440; } g.A2m1f = function(eps) { var eps2 = m.sq(eps), t = eps2*(eps2*(25*eps2+36)+64)/256; return t * (1 - eps) - eps; } g.C2f = function(eps, c) { var eps2 = m.sq(eps), d = eps; c[1] = d*(eps2*(eps2+2)+16)/32; d *= eps; c[2] = d*(eps2*(35*eps2+64)+384)/2048; d *= eps; c[3] = d*(15*eps2+80)/768; d *= eps; c[4] = d*(7*eps2+35)/512; d *= eps; c[5] = 63*d/1280; d *= eps; c[6] = 77*d/2048; } g.Geodesic = function(a, f) { this._a = a; this._f = f <= 1 ? f : 1/f; this._f1 = 1 - this._f; this._e2 = this._f * (2 - this._f); this._ep2 = this._e2 / m.sq(this._f1); // e2 / (1 - e2) this._n = this._f / ( 2 - this._f); this._b = this._a * this._f1; // authalic radius squared this._c2 = (m.sq(this._a) + m.sq(this._b) * (this._e2 == 0 ? 1 : (this._e2 > 0 ? m.atanh(Math.sqrt(this._e2)) : Math.atan(Math.sqrt(-this._e2))) / Math.sqrt(Math.abs(this._e2))))/2; // The sig12 threshold for "really short" this._etol2 = 10 * g.tol2_ / Math.max(0.1, Math.sqrt(Math.abs(this._e2))); if (!(isFinite(this._a) && this._a > 0)) throw new Error("Major radius is not positive"); if (!(isFinite(this._b) && this._b > 0)) throw new Error("Minor radius is not positive"); this._A3x = new Array(g.nA3x_); this._C3x = new Array(g.nC3x_); this._C4x = new Array(g.nC4x_); this.A3coeff(); this.C3coeff(); this.C4coeff(); } g.Geodesic.prototype.A3coeff = function() { var _n = this._n; this._A3x[0] = 1; this._A3x[1] = (_n-1)/2; this._A3x[2] = (_n*(3*_n-1)-2)/8; this._A3x[3] = ((-_n-3)*_n-1)/16; this._A3x[4] = (-2*_n-3)/64; this._A3x[5] = -3/128; } g.Geodesic.prototype.C3coeff = function() { var _n = this._n; this._C3x[0] = (1-_n)/4; this._C3x[1] = (1-_n*_n)/8; this._C3x[2] = ((3-_n)*_n+3)/64; this._C3x[3] = (2*_n+5)/128; this._C3x[4] = 3/128; this._C3x[5] = ((_n-3)*_n+2)/32; this._C3x[6] = ((-3*_n-2)*_n+3)/64; this._C3x[7] = (_n+3)/128; this._C3x[8] = 5/256; this._C3x[9] = (_n*(5*_n-9)+5)/192; this._C3x[10] = (9-10*_n)/384; this._C3x[11] = 7/512; this._C3x[12] = (7-14*_n)/512; this._C3x[13] = 7/512; this._C3x[14] = 21/2560; } g.Geodesic.prototype.C4coeff = function() { var _ep2 = this._ep2; this._C4x[0] = (_ep2*(_ep2*(_ep2*((832-640*_ep2)*_ep2-1144)+1716)-3003)+ 30030)/45045; this._C4x[1] = (_ep2*(_ep2*((832-640*_ep2)*_ep2-1144)+1716)-3003)/60060; this._C4x[2] = (_ep2*((208-160*_ep2)*_ep2-286)+429)/18018; this._C4x[3] = ((104-80*_ep2)*_ep2-143)/10296; this._C4x[4] = (13-10*_ep2)/1430; this._C4x[5] = -1/156; this._C4x[6] = (_ep2*(_ep2*(_ep2*(640*_ep2-832)+1144)-1716)+3003)/540540; this._C4x[7] = (_ep2*(_ep2*(160*_ep2-208)+286)-429)/108108; this._C4x[8] = (_ep2*(80*_ep2-104)+143)/51480; this._C4x[9] = (10*_ep2-13)/6435; this._C4x[10] = 5/3276; this._C4x[11] = (_ep2*((208-160*_ep2)*_ep2-286)+429)/900900; this._C4x[12] = ((104-80*_ep2)*_ep2-143)/257400; this._C4x[13] = (13-10*_ep2)/25025; this._C4x[14] = -1/2184; this._C4x[15] = (_ep2*(80*_ep2-104)+143)/2522520; this._C4x[16] = (10*_ep2-13)/140140; this._C4x[17] = 5/45864; this._C4x[18] = (13-10*_ep2)/1621620; this._C4x[19] = -1/58968; this._C4x[20] = 1/792792; } g.Geodesic.prototype.A3f = function(eps) { // Evaluation sum(_A3c[k] * eps^k, k, 0, nA3x_-1) by Horner's method var v = 0; for (var i = g.nA3x_; i; ) v = eps * v + this._A3x[--i]; return v; } g.Geodesic.prototype.C3f = function(eps, c) { // Evaluation C3 coeffs by Horner's method // Elements c[1] thru c[nC3_ - 1] are set for (var j = g.nC3x_, k = g.nC3_ - 1; k; ) { var t = 0; for (var i = g.nC3_ - k; i; --i) t = eps * t + this._C3x[--j]; c[k--] = t; } var mult = 1; for (var k = 1; k < g.nC3_; ) { mult *= eps; c[k++] *= mult; } } g.Geodesic.prototype.C4f = function(k2, c) { // Evaluation C4 coeffs by Horner's method // Elements c[0] thru c[nC4_ - 1] are set for (var j = g.nC4x_, k = g.nC4_; k; ) { var t = 0; for (var i = g.nC4_ - k + 1; i; --i) t = k2 * t + this._C4x[--j]; c[--k] = t; } var mult = 1; for (var k = 1; k < g.nC4_; ) { mult *= k2; c[k++] *= mult; } } // return s12b, m12a, m0, M12, M21 g.Geodesic.prototype.Lengths = function(eps, sig12, ssig1, csig1, ssig2, csig2, cbet1, cbet2, scalep, C1a, C2a) { var vals = {}; // Return m12a = (reduced length)/_a; also calculate s12b = // distance/_b, and m0 = coefficient of secular term in // expression for reduced length. g.C1f(eps, C1a); g.C2f(eps, C2a); var A1m1 = g.A1m1f(eps), AB1 = (1 + A1m1) * (g.SinCosSeries(true, ssig2, csig2, C1a, g.nC1_) - g.SinCosSeries(true, ssig1, csig1, C1a, g.nC1_)), A2m1 = g.A2m1f(eps), AB2 = (1 + A2m1) * (g.SinCosSeries(true, ssig2, csig2, C2a, g.nC2_) - g.SinCosSeries(true, ssig1, csig1, C2a, g.nC2_)), cbet1sq = m.sq(cbet1), cbet2sq = m.sq(cbet2), w1 = Math.sqrt(1 - this._e2 * cbet1sq), w2 = Math.sqrt(1 - this._e2 * cbet2sq), // Make sure it's OK to have repeated dummy arguments m0x = A1m1 - A2m1, J12 = m0x * sig12 + (AB1 - AB2); vals.m0 = m0x; // Missing a factor of _a. // Add parens around (csig1 * ssig2) and (ssig1 * csig2) to // ensure accurate cancellation in the case of coincident // points. vals.m12a = (w2 * (csig1 * ssig2) - w1 * (ssig1 * csig2)) - this._f1 * csig1 * csig2 * J12; // Missing a factor of _b vals.s12b = (1 + A1m1) * sig12 + AB1; if (scalep) { var csig12 = csig1 * csig2 + ssig1 * ssig2; J12 *= this._f1; vals.M12 = csig12 + (this._e2 * (cbet1sq - cbet2sq) * ssig2 / (w1 + w2) - csig2 * J12) * ssig1 / w1; vals.M21 = csig12 - (this._e2 * (cbet1sq - cbet2sq) * ssig1 / (w1 + w2) - csig1 * J12) * ssig2 / w2; } return vals; } // return sig12, salp1, calp1, salp2, calp2 g.Geodesic.prototype.InverseStart = function(sbet1, cbet1, sbet2, cbet2, lam12, C1a, C2a) { // Return a starting point for Newton's method in salp1 and calp1 // (function value is -1). If Newton's method doesn't need to be // used, return also salp2 and calp2 and function value is sig12. // salp2, calp2 only updated if return val >= 0. var vals = {}, // bet12 = bet2 - bet1 in [0, pi); bet12a = bet2 + bet1 in (-pi, 0] sbet12 = sbet2 * cbet1 - cbet2 * sbet1, cbet12 = cbet2 * cbet1 + sbet2 * sbet1; vals.sig12 = -1; // Return value // Volatile declaration needed to fix inverse cases // 88.202499451857 0 -88.202499451857 179.981022032992859592 // 89.262080389218 0 -89.262080389218 179.992207982775375662 // 89.333123580033 0 -89.333123580032997687 179.99295812360148422 // which otherwise fail with g++ 4.4.4 x86 -O3 var sbet12a = sbet2 * cbet1; sbet12a += cbet2 * sbet1; var shortline = cbet12 >= 0 && sbet12 < 0.5 && lam12 <= Math.PI / 6; var omg12 = (!shortline ? lam12 : lam12 / Math.sqrt(1 - this._e2 * m.sq((cbet1 + cbet2) / 2))), somg12 = Math.sin(omg12), comg12 = Math.cos(omg12); vals.salp1 = cbet2 * somg12; vals.calp1 = comg12 >= 0 ? sbet12 + cbet2 * sbet1 * m.sq(somg12) / (1 + comg12) : sbet12a - cbet2 * sbet1 * m.sq(somg12) / (1 - comg12); var ssig12 = m.hypot(vals.salp1, vals.calp1), csig12 = sbet1 * sbet2 + cbet1 * cbet2 * comg12; if (shortline && ssig12 < this._etol2) { // really short lines vals.salp2 = cbet1 * somg12; vals.calp2 = sbet12 - cbet1 * sbet2 * m.sq(somg12) / (1 + comg12); // SinCosNorm(vals.salp2, vals.calp2); var t = m.hypot(vals.salp2, vals.calp2); vals.salp2 /= t; vals.calp2 /= t; // Set return value vals.sig12 = Math.atan2(ssig12, csig12); } else if (csig12 >= 0 || ssig12 >= 3 * Math.abs(this._f) * Math.PI * m.sq(cbet1)) { // Nothing to do, zeroth order spherical approximation is OK } else { // Scale lam12 and bet2 to x, y coordinate system where antipodal // point is at origin and singular point is at y = 0, x = -1. var y, lamscale, betscale; // Volatile declaration needed to fix inverse case // 56.320923501171 0 -56.320923501171 179.664747671772880215 // which otherwise fails with g++ 4.4.4 x86 -O3 var x; if (this._f >= 0) { // In fact f == 0 does not get here // x = dlong, y = dlat { var k2 = m.sq(sbet1) * this._ep2, eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2); lamscale = this._f * cbet1 * this.A3f(eps) * Math.PI; } betscale = lamscale * cbet1; x = (lam12 - Math.PI) / lamscale; y = sbet12a / betscale; } else { // _f < 0 // x = dlat, y = dlong var cbet12a = cbet2 * cbet1 - sbet2 * sbet1, bet12a = Math.atan2(sbet12a, cbet12a); var m12a, m0; // In the case of lon12 = 180, this repeats a calculation made // in Inverse. var nvals = this.Lengths(this._n, Math.PI + bet12a, sbet1, -cbet1, sbet2, cbet2, cbet1, cbet2, false, C1a, C2a); m12a = nvals.m12a; m0 = nvals.m0; x = -1 + m12a/(this._f1 * cbet1 * cbet2 * m0 * Math.PI); betscale = x < -0.01 ? sbet12a / x : -this._f * m.sq(cbet1) * Math.PI; lamscale = betscale / cbet1; y = (lam12 - Math.PI) / lamscale; } if (y > -g.tol1_ && x > -1 - g.xthresh_) { // strip near cut if (this._f >= 0) { vals.salp1 = Math.min(1, -x); vals.calp1 = - Math.sqrt(1 - m.sq(vals.salp1)); } else { vals.calp1 = Math.max(x > -g.tol1_ ? 0 : -1, x); vals.salp1 = Math.sqrt(1 - m.sq(vals.calp1)); } } else { // Estimate alp1, by solving the astroid problem. // // Could estimate alpha1 = theta + pi/2, directly, i.e., // calp1 = y/k; salp1 = -x/(1+k); for _f >= 0 // calp1 = x/(1+k); salp1 = -y/k; for _f < 0 (need to check) // // However, it's better to estimate omg12 from astroid and use // spherical formula to compute alp1. This reduces the mean number of // Newton iterations for astroid cases from 2.24 (min 0, max 6) to 2.12 // (min 0 max 5). The changes in the number of iterations are as // follows: // // change percent // 1 5 // 0 78 // -1 16 // -2 0.6 // -3 0.04 // -4 0.002 // // The histogram of iterations is (m = number of iterations estimating // alp1 directly, n = number of iterations estimating via omg12, total // number of trials = 148605): // // iter m n // 0 148 186 // 1 13046 13845 // 2 93315 102225 // 3 36189 32341 // 4 5396 7 // 5 455 1 // 6 56 0 // // Because omg12 is near pi, estimate work with omg12a = pi - omg12 var k = g.Astroid(x, y); var omg12a = lamscale * ( this._f >= 0 ? -x * k/(1 + k) : -y * (1 + k)/k ), somg12 = Math.sin(omg12a), comg12 = -Math.cos(omg12a); // Update spherical estimate of alp1 using omg12 instead of // lam12 vals.salp1 = cbet2 * somg12; vals.calp1 = sbet12a - cbet2 * sbet1 * m.sq(somg12) / (1 - comg12); } } // SinCosNorm(vals.salp1, vals.calp1); var t = m.hypot(vals.salp1, vals.calp1); vals.salp1 /= t; vals.calp1 /= t; return vals; } // return lam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, eps, // domg12, dlam12, g.Geodesic.prototype.Lambda12 = function(sbet1, cbet1, sbet2, cbet2, salp1, calp1, diffp, C1a, C2a, C3a) { var vals = {}; if (sbet1 == 0 && calp1 == 0) // Break degeneracy of equatorial line. This case has already been // handled. calp1 = -g.tiny_; var // sin(alp1) * cos(bet1) = sin(alp0) salp0 = salp1 * cbet1, calp0 = m.hypot(calp1, salp1 * sbet1); // calp0 > 0 var somg1, comg1, somg2, comg2, omg12; // tan(bet1) = tan(sig1) * cos(alp1) // tan(omg1) = sin(alp0) * tan(sig1) = tan(omg1)=tan(alp1)*sin(bet1) vals.ssig1 = sbet1; somg1 = salp0 * sbet1; vals.csig1 = comg1 = calp1 * cbet1; // SinCosNorm(vals.ssig1, vals.csig1); var t = m.hypot(vals.ssig1, vals.csig1); vals.ssig1 /= t; vals.csig1 /= t; // SinCosNorm(somg1, comg1); -- don't need to normalize! // Enforce symmetries in the case abs(bet2) = -bet1. Need to be careful // about this case, since this can yield singularities in the Newton // iteration. // sin(alp2) * cos(bet2) = sin(alp0) vals.salp2 = cbet2 != cbet1 ? salp0 / cbet2 : salp1; // calp2 = sqrt(1 - sq(salp2)) // = sqrt(sq(calp0) - sq(sbet2)) / cbet2 // and subst for calp0 and rearrange to give (choose positive sqrt // to give alp2 in [0, pi/2]). vals.calp2 = cbet2 != cbet1 || Math.abs(sbet2) != -sbet1 ? Math.sqrt(m.sq(calp1 * cbet1) + (cbet1 < -sbet1 ? (cbet2 - cbet1) * (cbet1 + cbet2) : (sbet1 - sbet2) * (sbet1 + sbet2))) / cbet2 : Math.abs(calp1); // tan(bet2) = tan(sig2) * cos(alp2) // tan(omg2) = sin(alp0) * tan(sig2). vals.ssig2 = sbet2; somg2 = salp0 * sbet2; vals.csig2 = comg2 = vals.calp2 * cbet2; // SinCosNorm(vals.ssig2, vals.csig2); var t = m.hypot(vals.ssig2, vals.csig2); vals.ssig2 /= t; vals.csig2 /= t; // SinCosNorm(somg2, comg2); -- don't need to normalize! // sig12 = sig2 - sig1, limit to [0, pi] vals.sig12 = Math.atan2(Math.max(vals.csig1 * vals.ssig2 - vals.ssig1 * vals.csig2, 0), vals.csig1 * vals.csig2 + vals.ssig1 * vals.ssig2); // omg12 = omg2 - omg1, limit to [0, pi] omg12 = Math.atan2(Math.max(comg1 * somg2 - somg1 * comg2, 0), comg1 * comg2 + somg1 * somg2); var B312, h0; var k2 = m.sq(calp0) * this._ep2; vals.eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2); this.C3f(vals.eps, C3a); B312 = (g.SinCosSeries(true, vals.ssig2, vals.csig2, C3a, g.nC3_-1) - g.SinCosSeries(true, vals.ssig1, vals.csig1, C3a, g.nC3_-1)); h0 = -this._f * this.A3f(vals.eps); vals.domg12 = salp0 * h0 * (vals.sig12 + B312); vals.lam12 = omg12 + vals.domg12; if (diffp) { if (vals.calp2 == 0) vals.dlam12 = - 2 * Math.sqrt(1 - this._e2 * m.sq(cbet1)) / sbet1; else { var nvals = this.Lengths(vals.eps, vals.sig12, vals.ssig1, vals.csig1, vals.ssig2, vals.csig2, cbet1, cbet2, false, C1a, C2a); vals.dlam12 = nvals.m12a; vals.dlam12 /= vals.calp2 * cbet2; } } return vals; } // return a12, s12, azi1, azi2, m12, M12, M21, S12 g.Geodesic.prototype.GenInverse = function(lat1, lon1, lat2, lon2, outmask) { var vals = {}; outmask &= g.OUT_ALL; lon1 = g.AngNormalize(lon1); var lon12 = g.AngNormalize(g.AngNormalize(lon2) - lon1); // If very close to being on the same meridian, then make it so. // Not sure this is necessary... lon12 = g.AngRound(lon12); // Make longitude difference positive. var lonsign = lon12 >= 0 ? 1 : -1; lon12 *= lonsign; if (lon12 == 180) lonsign = 1; // If really close to the equator, treat as on equator. lat1 = g.AngRound(lat1); lat2 = g.AngRound(lat2); // Swap points so that point with higher (abs) latitude is point 1 var swapp = Math.abs(lat1) >= Math.abs(lat2) ? 1 : -1; if (swapp < 0) { lonsign *= -1; var t = lat1; lat1 = lat2; lat2 = t; // swap(lat1, lat2); } // Make lat1 <= 0 var latsign = lat1 < 0 ? 1 : -1; lat1 *= latsign; lat2 *= latsign; // Now we have // // 0 <= lon12 <= 180 // -90 <= lat1 <= 0 // lat1 <= lat2 <= -lat1 // // longsign, swapp, latsign register the transformation to bring the // coordinates to this canonical form. In all cases, 1 means no // change was made. We make these transformations so that there are // few cases to check, e.g., on verifying quadrants in atan2. In // addition, this enforces some symmetries in the results returned. var phi, sbet1, cbet1, sbet2, cbet2, s12x, m12x; phi = lat1 * m.degree; // Ensure cbet1 = +epsilon at poles sbet1 = this._f1 * Math.sin(phi); cbet1 = lat1 == -90 ? g.tiny_ : Math.cos(phi); // SinCosNorm(sbet1, cbet1); var t = m.hypot(sbet1, cbet1); sbet1 /= t; cbet1 /= t; phi = lat2 * m.degree; // Ensure cbet2 = +epsilon at poles sbet2 = this._f1 * Math.sin(phi); cbet2 = Math.abs(lat2) == 90 ? g.tiny_ : Math.cos(phi); // SinCosNorm(sbet2, cbet2); var t = m.hypot(sbet2, cbet2); sbet2 /= t; cbet2 /= t; // If cbet1 < -sbet1, then cbet2 - cbet1 is a sensitive measure of // the |bet1| - |bet2|. Alternatively (cbet1 >= -sbet1), abs(sbet2) // + sbet1 is a better measure. This logic is used in assigning // calp2 in Lambda12. Sometimes these quantities vanish and in that // case we force bet2 = +/- bet1 exactly. An example where is is // necessary is the inverse problem // 48.522876735459 0 -48.52287673545898293 179.599720456223079643 // which failed with Visual Studio 10 (Release and Debug) if (cbet1 < -sbet1) { if (cbet2 == cbet1) sbet2 = sbet2 < 0 ? sbet1 : -sbet1; } else { if (Math.abs(sbet2) == -sbet1) cbet2 = cbet1; } var lam12 = lon12 * m.degree, slam12 = lon12 == 180 ? 0 : Math.sin(lam12), clam12 = Math.cos(lam12); // lon12 == 90 isn't interesting var sig12, calp1, salp1, calp2, salp2; // index zero elements of these arrays are unused var C1a = new Array(g.nC1_ + 1), C2a = new Array(g.nC2_ + 1), C3a = new Array(g.nC3_); var meridian = lat1 == -90 || slam12 == 0; if (meridian) { // Endpoints are on a single full meridian, so the geodesic might // lie on a meridian. calp1 = clam12; salp1 = slam12; // Head to the target longitude calp2 = 1; salp2 = 0; // At the target we're heading north var // tan(bet) = tan(sig) * cos(alp) ssig1 = sbet1, csig1 = calp1 * cbet1, ssig2 = sbet2, csig2 = calp2 * cbet2; // sig12 = sig2 - sig1 sig12 = Math.atan2(Math.max(csig1 * ssig2 - ssig1 * csig2, 0), csig1 * csig2 + ssig1 * ssig2); { var nvals = this.Lengths(this._n, sig12, ssig1, csig1, ssig2, csig2, cbet1, cbet2, (outmask & g.GEODESICSCALE) != 0, C1a, C2a); s12x = nvals.s12b; m12x = nvals.m12a; // Ignore m0 if ((outmask & g.GEODESICSCALE) != 0) { vals.M12 = nvals.M12; vals.M21 = nvals.M21; } } // Add the check for sig12 since zero length geodesics might yield // m12 < 0. Test case was // // echo 20.001 0 20.001 0 | Geod -i // // In fact, we will have sig12 > pi/2 for meridional geodesic // which is not a shortest path. if (sig12 < 1 || m12x >= 0) { m12x *= this._a; s12x *= this._b; vals.a12 = sig12 / m.degree; } else // m12 < 0, i.e., prolate and too close to anti-podal meridian = false; } var omg12; if (!meridian && sbet1 == 0 && // and sbet2 == 0 // Mimic the way Lambda12 works with calp1 = 0 (this._f <= 0 || lam12 <= Math.PI - this._f * Math.PI)) { // Geodesic runs along equator calp1 = calp2 = 0; salp1 = salp2 = 1; s12x = this._a * lam12; m12x = this._b * Math.sin(lam12 / this._f1); if (outmask & g.GEODESICSCALE) vals.M12 = vals.M21 = Math.cos(lam12 / this._f1); vals.a12 = lon12 / this._f1; sig12 = omg12 = lam12 / this._f1; } else if (!meridian) { // Now point1 and point2 belong within a hemisphere bounded by a // meridian and geodesic is neither meridional or equatorial. // Figure a starting point for Newton's method var nvals = this.InverseStart(sbet1, cbet1, sbet2, cbet2, lam12, C1a, C2a); sig12 = nvals.sig12; salp1 = nvals.salp1; calp1 = nvals.calp1; if (sig12 >= 0) { salp2 = nvals.salp2; calp2 = nvals.calp2; // Short lines (InverseStart sets salp2, calp2) var wm = Math.sqrt(1 - this._e2 * m.sq((cbet1 + cbet2) / 2)); s12x = sig12 * this._a * wm; m12x = m.sq(wm) * this._a / this._f1 * Math.sin(sig12 * this._f1 / wm); if (outmask & g.GEODESICSCALE) vals.M12 = vals.M21 = Math.cos(sig12 * this._f1 / wm); vals.a12 = sig12 / m.degree; omg12 = lam12 / wm; } else { // Newton's method var ssig1, csig1, ssig2, csig2, eps; var ov = 0; var numit = 0; for (var trip = 0; numit < g.maxit_; ++numit) { var dv; var nvals = this.Lambda12(sbet1, cbet1, sbet2, cbet2, salp1, calp1, trip < 1, C1a, C2a, C3a); var v = nvals.lam12 - lam12; salp2 = nvals.salp2; calp2 = nvals.calp2; sig12 = nvals.sig12; ssig1 = nvals.ssig1; csig1 = nvals.csig1; ssig2 = nvals.ssig2; csig2 = nvals.csig2; eps = nvals.eps; omg12 = nvals.domg12; if (trip < 1) dv = nvals.dlam12; if (!(Math.abs(v) > g.tiny_) || !(trip < 1)) { if (!(Math.abs(v) <= Math.max(g.tol1_, ov))) numit = g.maxit_; break; } var dalp1 = -v/dv; var sdalp1 = Math.sin(dalp1), cdalp1 = Math.cos(dalp1), nsalp1 = salp1 * cdalp1 + calp1 * sdalp1; calp1 = calp1 * cdalp1 - salp1 * sdalp1; salp1 = Math.max(0, nsalp1); // SinCosNorm(salp1, calp1); var t = m.hypot(salp1, calp1); salp1 /= t; calp1 /= t; // In some regimes we don't get quadratic convergence because // slope -> 0. So use convergence conditions based on epsilon // instead of sqrt(epsilon). The first criterion is a test on // abs(v) against 100 * epsilon. The second takes credit for // an anticipated reduction in abs(v) by v/ov (due to the // latest update in alp1) and checks this against epsilon. if (!(Math.abs(v) >= g.tol1_ && m.sq(v) >= ov * g.tol0_)) ++trip; ov = Math.abs(v); } if (numit >= g.maxit_) { // Signal failure. if (outmask & g.DISTANCE) vals.s12 = Number.NaN; if (outmask & g.AZIMUTH) vals.azi1 = vals.azi2 = Number.NaN; if (outmask & g.REDUCEDLENGTH) vals.m12 = Number.NaN; if (outmask & g.GEODESICSCALE) vals.M12 = vals.M21 = Number.NaN; if (outmask & g.AREA) vals.S12 = Number.NaN; vals.a12 = Number.NaN; return vals; } { var nvals = this.Lengths(eps, sig12, ssig1, csig1, ssig2, csig2, cbet1, cbet2, (outmask & g.GEODESICSCALE) != 0, C1a, C2a); s12x = nvals.s12b; m12x = nvals.m12a; // Ignore m0 if ((outmask & g.GEODESICSCALE) != 0) { vals.M12 = nvals.M12; vals.M21 = nvals.M21; } } m12x *= this._a; s12x *= this._b; vals.a12 = sig12 / m.degree; omg12 = lam12 - omg12; } } if (outmask & g.DISTANCE) vals.s12 = 0 + s12x; // Convert -0 to 0 if (outmask & g.REDUCEDLENGTH) vals.m12 = 0 + m12x; // Convert -0 to 0 if (outmask & g.AREA) { var // From Lambda12: sin(alp1) * cos(bet1) = sin(alp0) salp0 = salp1 * cbet1, calp0 = m.hypot(calp1, salp1 * sbet1); // calp0 > 0 var alp12; if (calp0 != 0 && salp0 != 0) { var // From Lambda12: tan(bet) = tan(sig) * cos(alp) ssig1 = sbet1, csig1 = calp1 * cbet1, ssig2 = sbet2, csig2 = calp2 * cbet2, k2 = m.sq(calp0) * this._ep2, // Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0). A4 = m.sq(this._a) * calp0 * salp0 * this._e2; // SinCosNorm(ssig1, csig1); var t = m.hypot(ssig1, csig1); ssig1 /= t; csig1 /= t; // SinCosNorm(ssig2, csig2); var t = m.hypot(ssig2, csig2); ssig2 /= t; csig2 /= t; var C4a = new Array(g.nC4_); this.C4f(k2, C4a); var B41 = g.SinCosSeries(false, ssig1, csig1, C4a, g.nC4_), B42 = g.SinCosSeries(false, ssig2, csig2, C4a, g.nC4_); vals.S12 = A4 * (B42 - B41); } else // Avoid problems with indeterminate sig1, sig2 on equator vals.S12 = 0; if (!meridian && omg12 < 0.75 * Math.PI && // Long difference too big sbet2 - sbet1 < 1.75) { // Lat difference too big // Use tan(Gamma/2) = tan(omg12/2) // * (tan(bet1/2)+tan(bet2/2))/(1+tan(bet1/2)*tan(bet2/2)) // with tan(x/2) = sin(x)/(1+cos(x)) var somg12 = Math.sin(omg12), domg12 = 1 + Math.cos(omg12), dbet1 = 1 + cbet1, dbet2 = 1 + cbet2; alp12 = 2 * Math.atan2( somg12 * (sbet1*dbet2 + sbet2*dbet1), domg12 * (sbet1*sbet2 + dbet1*dbet2) ); } else { // alp12 = alp2 - alp1, used in atan2 so no need to normalize var salp12 = salp2 * calp1 - calp2 * salp1, calp12 = calp2 * calp1 + salp2 * salp1; // The right thing appears to happen if alp1 = +/-180 and alp2 = // 0, viz salp12 = -0 and alp12 = -180. However this depends on // the sign being attached to 0 correctly. The following // ensures the correct behavior. if (salp12 == 0 && calp12 < 0) { salp12 = g.tiny_ * calp1; calp12 = -1; } alp12 = Math.atan2(salp12, calp12); } vals.S12 += this._c2 * alp12; vals.S12 *= swapp * lonsign * latsign; // Convert -0 to 0 vals.S12 += 0; } // Convert calp, salp to azimuth accounting for lonsign, swapp, latsign. if (swapp < 0) { var t = salp1; salp1 = salp2; salp2 = t; // swap(salp1, salp2); var t = calp1; calp1 = calp2; calp2 = t; // swap(calp1, calp2); if (outmask & g.GEODESICSCALE) { var t = vals.M12; vals.M12 = vals.M21; vals.M21 = t; // swap(vals.M12, vals.M21); } } salp1 *= swapp * lonsign; calp1 *= swapp * latsign; salp2 *= swapp * lonsign; calp2 *= swapp * latsign; if (outmask & g.AZIMUTH) { // minus signs give range [-180, 180). 0- converts -0 to +0. vals.azi1 = 0 - Math.atan2(-salp1, calp1) / m.degree; vals.azi2 = 0 - Math.atan2(-salp2, calp2) / m.degree; } // Returned value in [0, 180] return vals; } // return a12, lat2, lon2, azi2, s12, m12, M12, M21, S12 g.Geodesic.prototype.GenDirect = function (lat1, lon1, azi1, arcmode, s12_a12, outmask) { var line = new l.GeodesicLine (this, lat1, lon1, azi1, // Automatically supply DISTANCE_IN if necessary outmask | (arcmode ? g.NONE : g.DISTANCE_IN)); return line.GenPosition(arcmode, s12_a12, outmask); } g.WGS84 = new g.Geodesic(GeographicLib.Constants.WGS84.a, GeographicLib.Constants.WGS84.f); })(); geographiclib-1.21/doc/scripts/GeographicLib/Interface.js0000644000175000017500000002346711745620414023265 0ustar frankiefrankie/** * Interface.js * Javascript interface routines for the geodesic routines GeographicLib. * * This provides javascript-style interfaces to Math.js, Geodesic.js, * GeodesicLine.js, and PolygonArea.js which, in turn, are rather * literal translations of the following classes from GeographicLib: * Math, Accumulator, Geodesic, GeodesicLib, PolygonArea. See the * documentation for the C++ class for more information at * * http://geographiclib.sourceforge.net/html/annotated.html * * The algorithms are derived in * * Charles F. F. Karney, * Geodesics on an ellipsoid of revolution, Feb. 2011, * http://arxiv.org/abs/1102.1215 * errata: http://geographiclib.sourceforge.net/geod-errata.html * * Charles F. F. Karney, * Algorithms for geodesics, Sept. 2011, * http://arxiv.org/abs/1109.4448 * * Copyright (c) Charles Karney (2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ ********************************************************************** * GeographicLib.Geodesic.WGS84.Inverse(lat1, lon1, lat2, lon2, outmask); * GeographicLib.Geodesic.WGS84.Direct(lat1, lon1, azi1, s12, outmask); * * perform the basic geodesic calculations. These return an object with * (some) of the following fields: * * lat1 latitude of point 1 * lon1 longitude of point 1 * azi1 azimuth of line at point 1 * lat2 latitude of point 2 * lon2 longitude of point 2 * azi2 azimuth of line at point 2 * s12 distance from 1 to 2 * a12 arc length on auxiliary sphere from 1 to 2 * m12 reduced length of geodesic * M12 geodesic scale 2 relative to 1 * M21 geodesic scale 1 relative to 2 * S12 area between geodesic and equator * * outmask determines which fields get included and if outmask is * omitted, then only the basic geodesic fields are computed. The mask * is an or'ed combination of the following values * * GeographicLib.Geodesic.LATITUDE * GeographicLib.Geodesic.LONGITUDE * GeographicLib.Geodesic.AZIMUTH * GeographicLib.Geodesic.DISTANCE * GeographicLib.Geodesic.REDUCEDLENGTH * GeographicLib.Geodesic.GEODESICSCALE * GeographicLib.Geodesic.AREA * GeographicLib.Geodesic.ALL * ********************************************************************** * GeographicLib.Geodesic.WGS84.InversePath(lat1, lon1, lat2, lon2, ds12, maxk); * GeographicLib.Geodesic.WGS84.DirectPath(lat1, lon1, azi1, s12, ds12, maxk); * * splits a geodesic line into k equal pieces which are no longer than * about ds12 (but k cannot exceed maxk, default 20), and returns an * array of length k + 1 of objects with fields * * lat, lon, azi * ********************************************************************** * GeographicLib.Geodesic.Envelope(lat1, lon1, azi1, s12, k) * * return the geodesic circle of radius s12 centered on the point lat1, * lon1. k equally spaced azimuths starting at azi1 are computed. This * returns an array of k + 1 points with fields lat and lon (with the * first and last points matching). * ********************************************************************** * GeographicLib.Geodesic.Envelope(lat1, lon1, k, ord); * * returns the ord'th order envelope for geodesics emanating from lat1, * lon1. This is located approximately circumference * ord/2 from the * point. Thus odd numbered envelopes are centered at the antipodal * point and even number envelopes are centered on the point itself. * This returns an array of k + 1 points with fields lat and lon (with * the first and last points matching). * ********************************************************************** * GeographicLib.Geodesic.WGS84.Area(points, polyline); * * computes the area of a polygon with vertices given by an array * points, each of whose elements contains lat and lon fields. The * function returns an object with fields. * * number, perimeter, area * * There is no need to "close" the polygon. If polyline (default = * false) is true, then the points denote a polyline and its length is * returned as the perimeter (and the area is not calculated). * * $Id: 4fd0ab19a40a653c3e232cb9eddfb0a117dcfbde $ **********************************************************************/ (function() { var m = GeographicLib.Math; var g = GeographicLib.Geodesic; var l = GeographicLib.GeodesicLine; g.Geodesic.CheckPosition = function(lat, lon) { if (!(Math.abs(lat) <= 90)) throw new Error("latitude " + lat + " not in [-90, 90]"); if (!(lon >= -180 && lon <= 360)) throw new Error("longitude " + lon + " not in [-180, 360]"); return g.AngNormalize(lon); } g.Geodesic.CheckAzimuth = function(azi) { if (!(azi >= -180 && azi <= 360)) throw new Error("longitude " + azi + " not in [-180, 360]"); return g.AngNormalize(azi); } g.Geodesic.CheckDistance = function(s) { if (!(isFinite(s))) throw new Error("distance " + s + " not a finite number"); } g.Geodesic.prototype.Inverse = function(lat1, lon1, lat2, lon2, outmask) { if (!outmask) outmask = g.DISTANCE | g.AZIMUTH; lon1 = g.Geodesic.CheckPosition(lat1, lon1); lon2 = g.Geodesic.CheckPosition(lat2, lon2); var result = this.GenInverse(lat1, lon1, lat2, lon2, outmask); result.lat1 = lat1; result.lon1 = lon1; result.lat2 = lat2; result.lon2 = lon2; return result; } g.Geodesic.prototype.Direct = function(lat1, lon1, azi1, s12, outmask) { if (!outmask) outmask = g.LATITUDE | g.LONGITUDE | g.AZIMUTH; lon1 = g.Geodesic.CheckPosition(lat1, lon1); azi1 = g.Geodesic.CheckAzimuth(azi1); g.Geodesic.CheckDistance(s12); var result = this.GenDirect(lat1, lon1, azi1, false, s12, outmask); result.lat1 = lat1; result.lon1 = lon1; result.azi1 = azi1; result.s12 = s12; return result; } g.Geodesic.prototype.InversePath = function(lat1, lon1, lat2, lon2, ds12, maxk) { var t = this.Inverse(lat1, lon1, lat2, lon2); if (!maxk) maxk = 20; if (!(ds12 > 0)) throw new Error("ds12 must be a positive number") var k = Math.max(1, Math.min(maxk, Math.ceil(t.s12/ds12))), points = new Array(k + 1); points[0] = {lat: t.lat1, lon: t.lon1, azi: t.azi1}; points[k] = {lat: t.lat2, lon: t.lon2, azi: t.azi2}; if (k > 1) { var line = new l.GeodesicLine(this, t.lat1, t.lon1, t.azi1, g.LATITUDE | g.LONGITUDE | g.AZIMUTH), da12 = t.a12/k; var vals; for (var i = 1; i < k; ++i) { vals = line.GenPosition(true, i * da12, g.LATITUDE | g.LONGITUDE | g.AZIMUTH); points[i] = {lat: vals.lat2, lon: vals.lon2, azi: vals.azi2}; } } return points; } g.Geodesic.prototype.DirectPath = function(lat1, lon1, azi1, s12, ds12, maxk) { var t = this.Direct(lat1, lon1, azi1, s12); if (!maxk) maxk = 20; if (!(ds12 > 0)) throw new Error("ds12 must be a positive number") var k = Math.max(1, Math.min(maxk, Math.ceil(Math.abs(t.s12)/ds12))), points = new Array(k + 1); points[0] = {lat: t.lat1, lon: t.lon1, azi: t.azi1}; points[k] = {lat: t.lat2, lon: t.lon2, azi: t.azi2}; if (k > 1) { var line = new l.GeodesicLine(this, t.lat1, t.lon1, t.azi1, g.LATITUDE | g.LONGITUDE | g.AZIMUTH), da12 = t.a12/k; var vals; for (var i = 1; i < k; ++i) { vals = line.GenPosition(true, i * da12, g.LATITUDE | g.LONGITUDE | g.AZIMUTH); points[i] = {lat: vals.lat2, lon: vals.lon2, azi: vals.azi2}; } } return points; } g.Geodesic.prototype.Circle = function(lat1, lon1, azi1, s12, k) { if (!(Math.abs(lat1) <= 90)) throw new Error("lat1 must be in [-90, 90]"); if (!(lon1 >= -180 && lon1 <= 360)) throw new Error("lon1 must be in [-180, 360]"); if (!(azi1 >= -180 && azi1 <= 360)) throw new Error("azi1 must be in [-180, 360]"); if (!(isFinite(s12))) throw new Error("s12 must be a finite number"); if (lon1 >= 180) lon1 -= 360; if (azi1 >= 180) azi1 -= 360; if (!k || k < 4) k = 24; var points = new Array(k + 1); var vals; for (var i = 0; i <= k; ++i) { var azi1a = azi1 + (k - i) * 360 / k; // Traverse circle counter-clocwise if (azi1a >= 180) azi1a -= 360; vals = this.GenDirect(lat1, lon1, azi1a, false, s12, g.LATITUDE | g.LONGITUDE); points[i] = {lat: vals.lat2, lon: vals.lon2}; } return points; } g.Geodesic.prototype.Envelope = function(lat1, lon1, k, ord) { if (!(Math.abs(lat1) <= 90)) throw new Error("lat1 must be in [-90, 90]"); if (!(lon1 >= -180 && lon1 <= 360)) throw new Error("lon1 must be in [-180, 360]"); if (lon1 >= 180) lon1 -= 360; if (!k || k < 4) k = 24; if (!ord) ord = 1; var points = new Array(k + 1); var vals, line, s12, j; for (var i = 0; i <= k; ++i) { var azi1 = -180 + i * 360 / k; line = new l.GeodesicLine(this, lat1, lon1, azi1, g.LATITUDE | g.LONGITUDE | g.DISTANCE_IN | g.DISTANCE | g.REDUCEDLENGTH | g.GEODESICSCALE); vals = line.GenPosition(true, 180 * ord, g.DISTANCE | g.REDUCEDLENGTH | g.GEODESICSCALE); j = 0; while (true) { // Solve m12(s12) = 0 by Newton's method using dm12/ds12 = M21 s12 = vals.s12 - vals.m12/vals.M21; if (Math.abs(vals.m12) < line._a * g.tol2_ * 0.1 || ++j > 10) break; vals = line.GenPosition(false, s12, g.DISTANCE | g.REDUCEDLENGTH | g.GEODESICSCALE); } vals = line.GenPosition(false, s12, g.LATITUDE | g.LONGITUDE); points[i] = {lat: vals.lat2, lon: vals.lon2}; } return points; } g.Geodesic.prototype.Area = function(points, polyline) { return GeographicLib.PolygonArea.Area(this, points, polyline); } })(); geographiclib-1.21/doc/scripts/geod-calc.html0000644000175000017500000003760311745620414021031 0ustar frankiefrankie Geodesic calculations for an ellipsoid done right

Geodesic calculations for an ellipsoid done right

This page illustrates the geodesic routines available in GeographicLib. The C++ code has been converted to Javascript so the calculations are carried out on the client. The algorithms are considerably more accurate than Vincenty's method, and offer more functionality (an inverse method which never fails to converge, differential properties of the geodesic, and the area under a geodesic). The algorithms are derived in

Charles F. F. Karney, Geodesics on an ellipsoid of revolution,
Feb. 2011, arXiv:1102.1215 (pdf), errata.
Charles F. F. Karney, Algorithms for geodesics,
Sept. 2011, arXiv:1109.4448 (pdf).
This page just provides a basic interface. Enter latitudes, longitudes, and azimuths as degrees and distances as meters using spaces or commas as separators. (Angles may be entered as decimal degrees or as degrees, minutes, and seconds, e.g. -20.51125, 20°30′40.5″S, S20d30'40.5", or -20:30:40.5.) The results are accurate to about 15 nanometers (or 0.1 m2 per vertex for areas). A slicker page where the geodesics are incorporated into Google Maps is given here.

Jump to:


Inverse problem

Find the shortest path between two points on the earth. The path is characterized by its length s12 and its azimuth at the two ends azi1 and azi2. The sample calculation finds the shortest path between Wellington, New Zealand, and Salamanca, Spain. (For this example, the NGS inverse geodesic calculator returns a result which is 1.2 km too long with an azimuth which is off by 3 degrees.) To perform the calculation, press the “COMPUTE” button.

Enter “lat1 lon1 lat2 lon2”:

input:

Output format:   
Output precision:  

status:

lat1 lon1 azi1:

lat2 lon2 azi2:

s12:


Direct problem

Find the destination traveling a given distance along a geodesic with a given azimuth at the starting point. The destination is characterized by its position lat2, lon2 and its azimuth at the destination azi2. The sample calculation shows the result of travelling 10000 km NE from JFK airport. To perform the calculation, press the “COMPUTE” button.

Enter “lat1 lon1 azi1 s12”:

input:

Output format:   
Output precision:  

status:

lat1 lon1 azi1:

lat2 lon2 azi2:

s12:


Geodesic path

Find intermediate points along a geodesic. In addition to specifying the endpoints, give ds12, the maximum distance between the intermediate points and maxk, the maximum number of intervals the geodesic is broken into. The output gives a sequence of positions lat, lon together with the corresponding azimuths azi. The sample shows the path from JFK to Singapore's Changi Airport at about 1000 km intervals. (In this example, the path taken by Google Earth deviates from the shortest path by about 2.9 km.) To perform the calculation, press the “COMPUTE” button.

Enter “lat1 lon1 lat2 lon2 ds12 maxk”:

input:

Output format:   
Output precision:  

status:

points (lat lon azi):


Polygon area

Find the perimeter and area of a polygon whose sides are geodesics. The polygon must be simple (i.e., must not intersect itself). (There's no need to ensure that the polygon is closed.) Counter-clockwise traversal of the polygon results in a positive area. The polygon can encircle one or both poles. The sample gives the approximate perimeter (in m) and area (in m2) of Antarctica. (For this example, Google Earth Pro returns an area which is 30 times too large! However this is a little unfair, since Google Earth has no concept of polygons which encircle a pole.) If the polyline option is selected then just the length of the line joining the points is is returned. To perform the calculation, press the “COMPUTE” button.

Enter points, one per line, as “lat lon”:

points (lat lon):

Treat points as:   

status:

number perimeter area:


Charles Karney <charles@karney.com> (2011-08-04)

SourceForge.net geographiclib-1.21/doc/CMakeLists.txt0000644000175000017500000000503111745620414017364 0ustar frankiefrankie# $Id: a9ac6876ce9b9276e0b6add11f6d77a9c8f7c75b $ # Where the html versions of the man pages (extension .1.html) are # found. if (MAINTAINER) set (MANDIR ${PROJECT_BINARY_DIR}/man) else () set (MANDIR ${PROJECT_SOURCE_DIR}/man) endif () # BUILD UP A LIST OF THE .1.HTML FILES. set (HTMLMAN) foreach (TOOL ${TOOLS}) set (HTMLMAN ${HTMLMAN} ${MANDIR}/${TOOL}.1.html) endforeach () # Run doxygen, if available # First assemble a list of all the files the documentation uses. Add a # dependency on htmlman (from man/CMakeLists.txt). Use doxygen.log as # the make target. To make this target, copy the non-doxygen generated # files into html/. Run doxfile.in cmake's config process so that # absolute path names are used and so that the pathnames are properly # stripped by doxygen (via STRIP_FROM_PATH). The distrib-doc target # copies the html directory into the source tree. # If doxygen is not available, only the install step (from the source # tree) is done. if (DOXYGEN_FOUND) configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/doxyfile.in" "${CMAKE_CURRENT_BINARY_DIR}/doxyfile" ) file (GLOB SOURCES ../src/*.cpp ../include/GeographicLib/*.hpp ../tools/*.cpp ../examples/*.cpp) file (GLOB EXTRA_FILES ../maxima/*.mac tmseries30.html geodseries30.html ../LICENSE.txt) add_custom_target (doc ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/doxygen.log) add_dependencies (doc htmlman) add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/doxygen.log DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/doxyfile Geographic.doc ${SOURCES} ${EXTRA_FILES} ${HTMLMAN} COMMAND rm -rf html && mkdir html COMMAND cp -p ${EXTRA_FILES} ${HTMLMAN} html/ COMMAND ${DOXYGEN_EXECUTABLE} doxyfile > doxygen.log COMMENT "Generating html documentation tree") install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc/GeographicLib) add_custom_target (distrib-doc) add_dependencies (distrib-doc doc) add_custom_command (TARGET distrib-doc COMMAND rsync -a --delete html/ ${CMAKE_CURRENT_SOURCE_DIR}/html/ COMMAND touch ${CMAKE_CURRENT_SOURCE_DIR}/html/index.html COMMENT "Installing html documentation tree in source tree") else () install (DIRECTORY html DESTINATION share/doc/GeographicLib) endif () # Finally install the Javascript files file (GLOB SCRIPTDRIVERS scripts/*.html) file (GLOB JSSCRIPTS scripts/GeographicLib/*.js) install (FILES ${SCRIPTDRIVERS} DESTINATION share/doc/GeographicLib/scripts) install (FILES ${JSSCRIPTS} DESTINATION share/doc/GeographicLib/scripts/GeographicLib) geographiclib-1.21/doc/Makefile.am0000644000175000017500000000764211745620414016672 0ustar frankiefrankie# $Id: a22d824c2a60646aff275d080be5c805c2c924eb $ EXTRAFILES = $(srcdir)/tmseries30.html $(srcdir)/geodseries30.html SCRIPTDRIVERS = \ $(srcdir)/scripts/geod-calc.html \ $(srcdir)/scripts/geod-google.html \ $(srcdir)/scripts/geod-google-instructions.html JSSCRIPTS = \ $(srcdir)/scripts/GeographicLib/Math.js \ $(srcdir)/scripts/GeographicLib/Geodesic.js \ $(srcdir)/scripts/GeographicLib/GeodesicLine.js \ $(srcdir)/scripts/GeographicLib/PolygonArea.js \ $(srcdir)/scripts/GeographicLib/DMS.js \ $(srcdir)/scripts/GeographicLib/Interface.js HPPFILES = \ $(top_srcdir)/include/GeographicLib/Accumulator.hpp \ $(top_srcdir)/include/GeographicLib/AlbersEqualArea.hpp \ $(top_srcdir)/include/GeographicLib/AzimuthalEquidistant.hpp \ $(top_srcdir)/include/GeographicLib/CassiniSoldner.hpp \ $(top_srcdir)/include/GeographicLib/Constants.hpp \ $(top_srcdir)/include/GeographicLib/DMS.hpp \ $(top_srcdir)/include/GeographicLib/EllipticFunction.hpp \ $(top_srcdir)/include/GeographicLib/Geocentric.hpp \ $(top_srcdir)/include/GeographicLib/GeoCoords.hpp \ $(top_srcdir)/include/GeographicLib/Geodesic.hpp \ $(top_srcdir)/include/GeographicLib/GeodesicLine.hpp \ $(top_srcdir)/include/GeographicLib/Geoid.hpp \ $(top_srcdir)/include/GeographicLib/Gnomonic.hpp \ $(top_srcdir)/include/GeographicLib/LambertConformalConic.hpp \ $(top_srcdir)/include/GeographicLib/LocalCartesian.hpp \ $(top_srcdir)/include/GeographicLib/Math.hpp \ $(top_srcdir)/include/GeographicLib/MGRS.hpp \ $(top_srcdir)/include/GeographicLib/OSGB.hpp \ $(top_srcdir)/include/GeographicLib/PolarStereographic.hpp \ $(top_srcdir)/include/GeographicLib/PolygonArea.hpp \ $(top_srcdir)/include/GeographicLib/TransverseMercatorExact.hpp \ $(top_srcdir)/include/GeographicLib/TransverseMercator.hpp \ $(top_srcdir)/include/GeographicLib/UTMUPS.hpp ALLSOURCES = \ $(top_srcdir)/src/AlbersEqualArea.cpp \ $(top_srcdir)/src/AzimuthalEquidistant.cpp \ $(top_srcdir)/src/CassiniSoldner.cpp \ $(top_srcdir)/src/DMS.cpp \ $(top_srcdir)/src/EllipticFunction.cpp \ $(top_srcdir)/src/Geocentric.cpp \ $(top_srcdir)/src/GeoCoords.cpp \ $(top_srcdir)/src/Geodesic.cpp \ $(top_srcdir)/src/GeodesicLine.cpp \ $(top_srcdir)/src/Geoid.cpp \ $(top_srcdir)/src/Gnomonic.cpp \ $(top_srcdir)/src/LambertConformalConic.cpp \ $(top_srcdir)/src/LocalCartesian.cpp \ $(top_srcdir)/src/MGRS.cpp \ $(top_srcdir)/src/OSGB.cpp \ $(top_srcdir)/src/PolarStereographic.cpp \ $(top_srcdir)/src/PolygonArea.cpp \ $(top_srcdir)/src/TransverseMercator.cpp \ $(top_srcdir)/src/TransverseMercatorExact.cpp \ $(top_srcdir)/src/UTMUPS.cpp \ $(top_srcdir)/tools/CartConvert.cpp \ $(top_srcdir)/tools/ConicProj.cpp \ $(top_srcdir)/tools/GeodesicProj.cpp \ $(top_srcdir)/tools/GeoConvert.cpp \ $(top_srcdir)/tools/Geod.cpp \ $(top_srcdir)/tools/GeoidEval.cpp \ $(top_srcdir)/tools/Gravity.cpp \ $(top_srcdir)/tools/Planimeter.cpp \ $(top_srcdir)/tools/TransverseMercatorProj.cpp MANPAGES = \ ../man/CartConvert.1.html \ ../man/ConicProj.1.html \ ../man/GeodesicProj.1.html \ ../man/GeoConvert.1.html \ ../man/Geod.1.html \ ../man/GeoidEval.1.html \ ../man/Gravity.1.html \ ../man/MagneticField.1.html \ ../man/Planimeter.1.html \ ../man/TransverseMercatorProj.1.html doc: html/index.html html/index.html: doxyfile.in Geographic.doc \ $(HPPFILES) $(ALLSOURCES) $(EXTRAFILES) $(MANPAGES) if test -d html; then rm -rf html/*; else mkdir html; fi cp -p $(EXTRAFILES) $(MANPAGES) $(top_srcdir)/maxima/*.mac \ $(top_srcdir)/LICENSE.txt html/ sed -e "s%@PROJECT_SOURCE_DIR@%$(top_srcdir)%g" \ -e "s%@GeographicLib_VERSION@%$(VERSION)%g" \ $(srcdir)/doxyfile.in | doxygen - maintainer-clean-local: rm -rf html install-doc: html/index.html $(INSTALL) -d $(DESTDIR)$(docdir)/html $(INSTALL) -m 644 `dirname $<`/* $(DESTDIR)$(docdir)/html $(INSTALL) -d $(DESTDIR)$(docdir)/scripts $(INSTALL) -m 644 $(SCRIPTDRIVERS) $(DESTDIR)$(docdir)/scripts $(INSTALL) -d $(DESTDIR)$(docdir)/scripts/GeographicLib $(INSTALL) -m 644 $(JSSCRIPTS) $(DESTDIR)$(docdir)/scripts/GeographicLib geographiclib-1.21/doc/Makefile.in0000644000175000017500000003317111745620414016677 0ustar frankiefrankie# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # $Id: a22d824c2a60646aff275d080be5c805c2c924eb $ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = doc DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POW_LIB = @POW_LIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRAFILES = $(srcdir)/tmseries30.html $(srcdir)/geodseries30.html SCRIPTDRIVERS = \ $(srcdir)/scripts/geod-calc.html \ $(srcdir)/scripts/geod-google.html \ $(srcdir)/scripts/geod-google-instructions.html JSSCRIPTS = \ $(srcdir)/scripts/GeographicLib/Math.js \ $(srcdir)/scripts/GeographicLib/Geodesic.js \ $(srcdir)/scripts/GeographicLib/GeodesicLine.js \ $(srcdir)/scripts/GeographicLib/PolygonArea.js \ $(srcdir)/scripts/GeographicLib/DMS.js \ $(srcdir)/scripts/GeographicLib/Interface.js HPPFILES = \ $(top_srcdir)/include/GeographicLib/Accumulator.hpp \ $(top_srcdir)/include/GeographicLib/AlbersEqualArea.hpp \ $(top_srcdir)/include/GeographicLib/AzimuthalEquidistant.hpp \ $(top_srcdir)/include/GeographicLib/CassiniSoldner.hpp \ $(top_srcdir)/include/GeographicLib/Constants.hpp \ $(top_srcdir)/include/GeographicLib/DMS.hpp \ $(top_srcdir)/include/GeographicLib/EllipticFunction.hpp \ $(top_srcdir)/include/GeographicLib/Geocentric.hpp \ $(top_srcdir)/include/GeographicLib/GeoCoords.hpp \ $(top_srcdir)/include/GeographicLib/Geodesic.hpp \ $(top_srcdir)/include/GeographicLib/GeodesicLine.hpp \ $(top_srcdir)/include/GeographicLib/Geoid.hpp \ $(top_srcdir)/include/GeographicLib/Gnomonic.hpp \ $(top_srcdir)/include/GeographicLib/LambertConformalConic.hpp \ $(top_srcdir)/include/GeographicLib/LocalCartesian.hpp \ $(top_srcdir)/include/GeographicLib/Math.hpp \ $(top_srcdir)/include/GeographicLib/MGRS.hpp \ $(top_srcdir)/include/GeographicLib/OSGB.hpp \ $(top_srcdir)/include/GeographicLib/PolarStereographic.hpp \ $(top_srcdir)/include/GeographicLib/PolygonArea.hpp \ $(top_srcdir)/include/GeographicLib/TransverseMercatorExact.hpp \ $(top_srcdir)/include/GeographicLib/TransverseMercator.hpp \ $(top_srcdir)/include/GeographicLib/UTMUPS.hpp ALLSOURCES = \ $(top_srcdir)/src/AlbersEqualArea.cpp \ $(top_srcdir)/src/AzimuthalEquidistant.cpp \ $(top_srcdir)/src/CassiniSoldner.cpp \ $(top_srcdir)/src/DMS.cpp \ $(top_srcdir)/src/EllipticFunction.cpp \ $(top_srcdir)/src/Geocentric.cpp \ $(top_srcdir)/src/GeoCoords.cpp \ $(top_srcdir)/src/Geodesic.cpp \ $(top_srcdir)/src/GeodesicLine.cpp \ $(top_srcdir)/src/Geoid.cpp \ $(top_srcdir)/src/Gnomonic.cpp \ $(top_srcdir)/src/LambertConformalConic.cpp \ $(top_srcdir)/src/LocalCartesian.cpp \ $(top_srcdir)/src/MGRS.cpp \ $(top_srcdir)/src/OSGB.cpp \ $(top_srcdir)/src/PolarStereographic.cpp \ $(top_srcdir)/src/PolygonArea.cpp \ $(top_srcdir)/src/TransverseMercator.cpp \ $(top_srcdir)/src/TransverseMercatorExact.cpp \ $(top_srcdir)/src/UTMUPS.cpp \ $(top_srcdir)/tools/CartConvert.cpp \ $(top_srcdir)/tools/ConicProj.cpp \ $(top_srcdir)/tools/GeodesicProj.cpp \ $(top_srcdir)/tools/GeoConvert.cpp \ $(top_srcdir)/tools/Geod.cpp \ $(top_srcdir)/tools/GeoidEval.cpp \ $(top_srcdir)/tools/Gravity.cpp \ $(top_srcdir)/tools/Planimeter.cpp \ $(top_srcdir)/tools/TransverseMercatorProj.cpp MANPAGES = \ ../man/CartConvert.1.html \ ../man/ConicProj.1.html \ ../man/GeodesicProj.1.html \ ../man/GeoConvert.1.html \ ../man/Geod.1.html \ ../man/GeoidEval.1.html \ ../man/Gravity.1.html \ ../man/MagneticField.1.html \ ../man/Planimeter.1.html \ ../man/TransverseMercatorProj.1.html all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic \ maintainer-clean-local mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic maintainer-clean-local mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am doc: html/index.html html/index.html: doxyfile.in Geographic.doc \ $(HPPFILES) $(ALLSOURCES) $(EXTRAFILES) $(MANPAGES) if test -d html; then rm -rf html/*; else mkdir html; fi cp -p $(EXTRAFILES) $(MANPAGES) $(top_srcdir)/maxima/*.mac \ $(top_srcdir)/LICENSE.txt html/ sed -e "s%@PROJECT_SOURCE_DIR@%$(top_srcdir)%g" \ -e "s%@GeographicLib_VERSION@%$(VERSION)%g" \ $(srcdir)/doxyfile.in | doxygen - maintainer-clean-local: rm -rf html install-doc: html/index.html $(INSTALL) -d $(DESTDIR)$(docdir)/html $(INSTALL) -m 644 `dirname $<`/* $(DESTDIR)$(docdir)/html $(INSTALL) -d $(DESTDIR)$(docdir)/scripts $(INSTALL) -m 644 $(SCRIPTDRIVERS) $(DESTDIR)$(docdir)/scripts $(INSTALL) -d $(DESTDIR)$(docdir)/scripts/GeographicLib $(INSTALL) -m 644 $(JSSCRIPTS) $(DESTDIR)$(docdir)/scripts/GeographicLib # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: geographiclib-1.21/doc/Makefile.mk0000644000175000017500000000340411745620414016674 0ustar frankiefrankie# $Id: 0decae99c6f1f56173f01e0cfadc59032805d104 $ MODULES = DMS EllipticFunction GeoCoords MGRS PolarStereographic \ TransverseMercator TransverseMercatorExact UTMUPS Geocentric \ LocalCartesian Geodesic GeodesicLine PolygonArea \ AzimuthalEquidistant CassiniSoldner \ Geoid Gnomonic OSGB AlbersEqualArea PROGRAMS = GeoConvert TransverseMercatorProj CartConvert Geod GeodesicProj \ GeoidEval Gravity MagneticField Planimeter ConicProj HEADERS = $(patsubst %,../include/GeographicLib/%.hpp,Constants $(MODULES)) SOURCES = $(patsubst %,../src/%.cpp,$(MODULES)) \ $(patsubst %,../tools/%.cpp,$(PROGRAMS)) EXTRAFILES = tmseries30.html geodseries30.html HTMLMANPAGES = $(patsubst %,../man/%.1.html,$(PROGRAMS)) SCRIPTDRIVERS = $(wildcard scripts/*.html) JSSCRIPTS = $(wildcard scripts/GeographicLib/*.js) MAXIMA = tm ellint tmseries geod MAXIMASOURCES = $(patsubst %,../maxima/%.mac,$(MAXIMA)) doc: html/index.html html/index.html: doxyfile.in Geographic.doc \ $(HEADERS) $(ALLSOURCES) $(MAXIMASOURCES) $(EXTRAFILES) \ $(HTMLMANPAGES) if test -d html; then rm -rf html/*; else mkdir html; fi cp -p $(MAXIMASOURCES) $(EXTRAFILES) $(HTMLMANPAGES) \ ../LICENSE.txt html/ sed -e "s%@PROJECT_SOURCE_DIR@%..%g" \ -e "s%@GeographicLib_VERSION@%$(VERSION)%g" \ $(srcdir)/doxyfile.in | doxygen - PREFIX = /usr/local DEST = $(PREFIX)/share/doc/GeographicLib DOCDEST = $(DEST)/html SCRIPTDEST = $(DEST)/scripts INSTALL = install -b install: html/index.html test -d $(DOCDEST) || mkdir -p $(DOCDEST) $(INSTALL) -m 644 html/* $(DOCDEST)/ test -d $(SCRIPTDEST)/GeographicLib || \ mkdir -p $(SCRIPTDEST)/GeographicLib $(INSTALL) -m 644 $(SCRIPTDRIVERS) $(SCRIPTDEST)/ $(INSTALL) -m 644 $(JSSCRIPTS) $(SCRIPTDEST)/GeographicLib/ maintainer-clean: rm -rf html .PHONY: doc install clean geographiclib-1.21/doc/geodseries30.html0000644000175000017500000104227511745620414020022 0ustar frankiefrankie Series for geodesic calculations

Series for geodesic calculations

This extends the series given here to 30th order in the flattening. See
Charles F. F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011; preprint arxiv:1102.1215; resource page geod.html.
// Generated by Maxima on 2010-05-01 06:36:46-04:00

A1 = (1 + 1/4 * eps^2
        + 1/64 * eps^4
        + 1/256 * eps^6
        + 25/16384 * eps^8
        + 49/65536 * eps^10
        + 441/1048576 * eps^12
        + 1089/4194304 * eps^14
        + 184041/1073741824 * eps^16
        + 511225/4294967296 * eps^18
        + 5909761/68719476736 * eps^20
        + 17631601/274877906944 * eps^22
        + 863948449/17592186044416 * eps^24
        + 2704312009/70368744177664 * eps^26
        + 34493775625/1125899906842624 * eps^28
        + 111759833025/4503599627370496 * eps^30) / (1 - eps);

C1[1] = - 1/2 * eps
        + 3/16 * eps^3
        - 1/32 * eps^5
        + 19/2048 * eps^7
        - 3/4096 * eps^9
        + 53/65536 * eps^11
        + 29/131072 * eps^13
        + 13827/67108864 * eps^15
        + 17321/134217728 * eps^17
        + 205579/2147483648 * eps^19
        + 302847/4294967296 * eps^21
        + 29656189/549755813888 * eps^23
        + 46250107/1099511627776 * eps^25
        + 588536103/17592186044416 * eps^27
        + 951224759/35184372088832 * eps^29;
C1[2] = - 1/16 * eps^2
        + 1/32 * eps^4
        - 9/2048 * eps^6
        + 7/4096 * eps^8
        + 1/65536 * eps^10
        + 27/131072 * eps^12
        + 5735/67108864 * eps^14
        + 8995/134217728 * eps^16
        + 96543/2147483648 * eps^18
        + 142801/4294967296 * eps^20
        + 13684121/549755813888 * eps^22
        + 21112497/1099511627776 * eps^24
        + 265707563/17592186044416 * eps^26
        + 425659393/35184372088832 * eps^28
        + 1417935787335/144115188075855872 * eps^30;
C1[3] = - 1/48 * eps^3
        + 3/256 * eps^5
        - 3/2048 * eps^7
        + 17/24576 * eps^9
        + 3/65536 * eps^11
        + 843/8388608 * eps^13
        + 9719/201326592 * eps^15
        + 9801/268435456 * eps^17
        + 54189/2147483648 * eps^19
        + 3873871/206158430208 * eps^21
        + 7822227/549755813888 * eps^23
        + 24333681/2199023255552 * eps^25
        + 462823139/52776558133248 * eps^27
        + 127352837355/18014398509481984 * eps^29;
C1[4] = - 5/512 * eps^4
        + 3/512 * eps^6
        - 11/16384 * eps^8
        + 3/8192 * eps^10
        + 651/16777216 * eps^12
        + 1009/16777216 * eps^14
        + 16763/536870912 * eps^16
        + 1569/67108864 * eps^18
        + 2263733/137438953472 * eps^20
        + 1698897/137438953472 * eps^22
        + 41547591/4398046511104 * eps^24
        + 16273415/2199023255552 * eps^26
        + 212683932395/36028797018963968 * eps^28
        + 172435304205/36028797018963968 * eps^30;
C1[5] = - 7/1280 * eps^5
        + 7/2048 * eps^7
        - 3/8192 * eps^9
        + 117/524288 * eps^11
        + 253/8388608 * eps^13
        + 13419/335544320 * eps^15
        + 5855/268435456 * eps^17
        + 70025/4294967296 * eps^19
        + 800595/68719476736 * eps^21
        + 4842105/549755813888 * eps^23
        + 74591411/10995116277760 * eps^25
        + 6021893805/1125899906842624 * eps^27
        + 77302095005/18014398509481984 * eps^29;
C1[6] = - 7/2048 * eps^6
        + 9/4096 * eps^8
        - 117/524288 * eps^10
        + 467/3145728 * eps^12
        + 1569/67108864 * eps^14
        + 3813/134217728 * eps^16
        + 206677/12884901888 * eps^18
        + 103137/8589934592 * eps^20
        + 4770087/549755813888 * eps^22
        + 21782093/3298534883328 * eps^24
        + 5765474835/1125899906842624 * eps^26
        + 9142699905/2251799813685248 * eps^28
        + 1415580640915/432345564227567616 * eps^30;
C1[7] = - 33/14336 * eps^7
        + 99/65536 * eps^9
        - 77/524288 * eps^11
        + 55/524288 * eps^13
        + 1233/67108864 * eps^15
        + 11345/536870912 * eps^17
        + 52591/4294967296 * eps^19
        + 552591/60129542144 * eps^21
        + 3685111/549755813888 * eps^23
        + 722278195/140737488355328 * eps^25
        + 4507296795/1125899906842624 * eps^27
        + 1795935355/562949953421312 * eps^29;
C1[8] = - 429/262144 * eps^8
        + 143/131072 * eps^10
        - 429/4194304 * eps^12
        + 325/4194304 * eps^14
        + 31525/2147483648 * eps^16
        + 8733/536870912 * eps^18
        + 165251/17179869184 * eps^20
        + 124411/17179869184 * eps^22
        + 2996969235/562949953421312 * eps^24
        + 1153418845/281474976710656 * eps^26
        + 28941724625/9007199254740992 * eps^28
        + 23168297355/9007199254740992 * eps^30;
C1[9] = - 715/589824 * eps^9
        + 429/524288 * eps^11
        - 39/524288 * eps^13
        + 11921/201326592 * eps^15
        + 6399/536870912 * eps^17
        + 55233/4294967296 * eps^19
        + 199205/25769803776 * eps^21
        + 25677825/4398046511104 * eps^23
        + 608155005/140737488355328 * eps^25
        + 33866001805/10133099161583616 * eps^27
        + 1482164085/562949953421312 * eps^29;
C1[10] = - 2431/2621440 * eps^10
        + 663/1048576 * eps^12
        - 3757/67108864 * eps^14
        + 6239/134217728 * eps^16
        + 42177/4294967296 * eps^18
        + 446131/42949672960 * eps^20
        + 27835817/4398046511104 * eps^22
        + 42180321/8796093022208 * eps^24
        + 4019599397/1125899906842624 * eps^26
        + 6244603111/2251799813685248 * eps^28
        + 316153750539/144115188075855872 * eps^30;
C1[11] = - 4199/5767168 * eps^11
        + 4199/8388608 * eps^13
        - 2907/67108864 * eps^15
        + 10013/268435456 * eps^17
        + 35207/4294967296 * eps^19
        + 4694805/549755813888 * eps^21
        + 23148175/4398046511104 * eps^23
        + 70365265/17592186044416 * eps^25
        + 3370190355/1125899906842624 * eps^27
        + 42049539055/18014398509481984 * eps^29;
C1[12] = - 29393/50331648 * eps^12
        + 6783/16777216 * eps^14
        - 18411/536870912 * eps^16
        + 6137/201326592 * eps^18
        + 7611495/1099511627776 * eps^20
        + 7835163/1099511627776 * eps^22
        + 468146111/105553116266496 * eps^24
        + 59462469/17592186044416 * eps^26
        + 91557125181/36028797018963968 * eps^28
        + 214950398465/108086391056891904 * eps^30;
C1[13] = - 52003/109051904 * eps^13
        + 22287/67108864 * eps^15
        - 7429/268435456 * eps^17
        + 869193/34359738368 * eps^19
        + 3247347/549755813888 * eps^21
        + 26486133/4398046511104 * eps^23
        + 66500935/17592186044416 * eps^25
        + 12703797/4398046511104 * eps^27
        + 39283195529/18014398509481984 * eps^29;
C1[14] = - 185725/469762048 * eps^14
        + 37145/134217728 * eps^16
        - 780045/34359738368 * eps^18
        + 1461765/68719476736 * eps^20
        + 22372215/4398046511104 * eps^22
        + 45260895/8796093022208 * eps^24
        + 57244355/17592186044416 * eps^26
        + 306953515/123145302310912 * eps^28
        + 272204273085/144115188075855872 * eps^30;
C1[15] = - 22287/67108864 * eps^15
        + 1002915/4294967296 * eps^17
        - 648945/34359738368 * eps^19
        + 1243265/68719476736 * eps^21
        + 19425915/4398046511104 * eps^23
        + 78089301/17592186044416 * eps^25
        + 12427015/4398046511104 * eps^27
        + 610648965/281474976710656 * eps^29;
C1[16] = - 9694845/34359738368 * eps^16
        + 1710855/8589934592 * eps^18
        - 4372185/274877906944 * eps^20
        + 4272135/274877906944 * eps^22
        + 543781755/140737488355328 * eps^24
        + 271745805/70368744177664 * eps^26
        + 5567912565/2251799813685248 * eps^28
        + 4284219735/2251799813685248 * eps^30;
C1[17] = - 17678835/73014444032 * eps^17
        + 5892945/34359738368 * eps^19
        - 930465/68719476736 * eps^21
        + 59239605/4398046511104 * eps^23
        + 59859915/17592186044416 * eps^25
        + 930465/274877906944 * eps^27
        + 613284315/281474976710656 * eps^29;
C1[18] = - 21607465/103079215104 * eps^18
        + 10235115/68719476736 * eps^20
        - 51175575/4398046511104 * eps^22
        + 103488385/8796093022208 * eps^24
        + 53036505/17592186044416 * eps^26
        + 52551045/17592186044416 * eps^28
        + 278415054335/144115188075855872 * eps^30;
C1[19] = - 119409675/652835028992 * eps^19
        + 71645805/549755813888 * eps^21
        - 44352165/4398046511104 * eps^23
        + 182060985/17592186044416 * eps^25
        + 2953215/1099511627776 * eps^27
        + 47776802115/18014398509481984 * eps^29;
C1[20] = - 176726319/1099511627776 * eps^20
        + 126233085/1099511627776 * eps^22
        - 309844845/35184372088832 * eps^24
        + 161159235/17592186044416 * eps^26
        + 86652277095/36028797018963968 * eps^28
        + 426519840213/180143985094819840 * eps^30;
C1[21] = - 547010035/3848290697216 * eps^21
        + 447553665/4398046511104 * eps^23
        - 136211985/17592186044416 * eps^25
        + 9182417465/1125899906842624 * eps^27
        + 38976086565/18014398509481984 * eps^29;
C1[22] = - 6116566755/48378511622144 * eps^22
        + 797813055/8796093022208 * eps^24
        - 7712192865/1125899906842624 * eps^26
        + 16434948933/2251799813685248 * eps^28
        + 281701652697/144115188075855872 * eps^30;
C1[23] = - 11435320455/101155069755392 * eps^23
        + 11435320455/140737488355328 * eps^25
        - 6861192273/1125899906842624 * eps^27
        + 3694488147/562949953421312 * eps^29;
C1[24] = - 57176602275/562949953421312 * eps^24
        + 20583576819/281474976710656 * eps^26
        - 49083913953/9007199254740992 * eps^28
        + 160153129039/27021597764222976 * eps^30;
C1[25] = - 322476036831/3518437208883200 * eps^25
        + 74417546961/1125899906842624 * eps^27
        - 2756205443/562949953421312 * eps^29;
C1[26] = - 1215486600363/14636698788954112 * eps^26
        + 135054066707/2251799813685248 * eps^28
        - 636683457333/144115188075855872 * eps^30;
C1[27] = - 2295919134019/30399297484750848 * eps^27
        + 983965343151/18014398509481984 * eps^29;
C1[28] = - 2483341104143/36028797018963968 * eps^28
        + 1798281489207/36028797018963968 * eps^30;
C1[29] = - 32968493968795/522417556774977536 * eps^29;
C1[30] = - 125280277081421/2161727821137838080 * eps^30;

C1'[1] = + 1/2 * eps
         - 9/32 * eps^3
         + 205/1536 * eps^5
         - 4879/73728 * eps^7
         + 9039/327680 * eps^9
         - 1050467/88473600 * eps^11
         + 512031157/118908518400 * eps^13
         - 1086005273/591900180480 * eps^15
         + 4075676109451/7671026339020800 * eps^17
         - 794840669327713/2761569482047488000 * eps^19
         + 2239087029841367/77148607752437760000 * eps^21
         - 40730402540905726093/641567822069272412160000 * eps^23
         - 97668067278655185143/4927240873492012125388800 * eps^25
         - 741941887011669089199917/28784819522671853552271360000 * eps^27
         - 68324470839108426239947872773/3917038240645185831393086668800000 * eps^29;
C1'[2] = + 5/16 * eps^2
         - 37/96 * eps^4
         + 1335/4096 * eps^6
         - 86171/368640 * eps^8
         + 4119073/28311552 * eps^10
         - 18357853/220200960 * eps^12
         + 167645485631/3805072588800 * eps^14
         - 2133468723257/95887829237760 * eps^16
         + 59947666093201/5682241732608000 * eps^18
         - 29889474712770151/6075452860504473600 * eps^20
         + 3112904386445139443/1458108686521073664000 * eps^22
         - 4531132450329984761/4728107532256542720000 * eps^24
         + 1671560053825711640749861/4483789194877731034103808000 * eps^26
         - 1539092646053487110737563637/8743388930011575516502425600000 * eps^28
         + 3620358411657954539738131669/69636235389247748113654874112000 * eps^30;
C1'[3] = + 29/96 * eps^3
         - 75/128 * eps^5
         + 2901/4096 * eps^7
         - 443327/655360 * eps^9
         + 1152507/2097152 * eps^11
         - 1170339447/2936012800 * eps^13
         + 14896648073/56371445760 * eps^15
         - 1719099273321/10522669875200 * eps^17
         + 440255022166233/4629974745088000 * eps^19
         - 4689329894241941/88895515105689600 * eps^21
         + 4309464445273351209/154085559516528640000 * eps^23
         - 77740899024366984327/5423811694981808128000 * eps^25
         + 4025440507207669842667/569500227973089853440000 * eps^27
         - 10783702637849849812840017/3158827931157405053747200000 * eps^29;
C1'[4] = + 539/1536 * eps^4
         - 2391/2560 * eps^6
         + 1082857/737280 * eps^8
         - 2722891/1548288 * eps^10
         + 6190623251/3523215360 * eps^12
         - 2198240553463/1426902220800 * eps^14
         + 835898387989583/684913065984000 * eps^16
         - 62186045114429/69759664128000 * eps^18
         + 39435262997832698047/64804830512047718400 * eps^20
         - 14876456230497799912553/37910825849547915264000 * eps^22
         + 1136134446936925800945877/4717791661277073899520000 * eps^24
         - 45093458223482404762480843/318450937136202488217600000 * eps^26
         + 3448586228525796468187820868401/43044376270826217927396556800000 * eps^28
         - 9267292123878690223760617403717/211395714574502092487880867840000 * eps^30;
C1'[5] = + 3467/7680 * eps^5
         - 28223/18432 * eps^7
         + 1361343/458752 * eps^9
         - 211942939/49545216 * eps^11
         + 289319933243/57076088832 * eps^13
         - 2641923029237/507343011840 * eps^15
         + 164922300524827/34441342746624 * eps^17
         - 326226244879987219/81006038140059648 * eps^19
         + 905728657830831557/288021468942434304 * eps^21
         - 78322584746542259177147/33968099961194932076544 * eps^23
         + 13053248693785337495272007/8152343990686783698370560 * eps^25
         - 1878086576945897568602243/1771373509087498680139776 * eps^27
         + 39401408426156638969274880529/58540351728323656381259317248 * eps^29;
C1'[6] = + 38081/61440 * eps^6
         - 733437/286720 * eps^8
         + 10820079/1835008 * eps^10
         - 547525831/55050240 * eps^12
         + 45741465549/3355443200 * eps^14
         - 41464506827097/2583691264000 * eps^16
         + 33307900611667019/1984274890752000 * eps^18
         - 29549592050928009/1851989898035200 * eps^20
         + 1510642276897435153959/107859891661570048000 * eps^22
         - 3379725045215031439859/294163340895191040000 * eps^24
         + 3068085809843886425921127/345151653317024153600000 * eps^26
         - 120481724276440955567319861/18440959762938147635200000 * eps^28
         + 5351579260607165516870592929/1166336466888888019845120000 * eps^30;
C1'[7] = + 459485/516096 * eps^7
         - 709743/163840 * eps^9
         + 983638957/84934656 * eps^11
         - 570327360331/25480396800 * eps^13
         + 2524677004673/72477573120 * eps^15
         - 3979901788209089/86103356866560 * eps^17
         + 145501072048061969477/2686424734236672000 * eps^19
         - 767257565495432565461/13372425343755878400 * eps^21
         + 576429350583276368332877/10315870979468820480000 * eps^23
         - 15049813241233902040230469/297097084208702029824000 * eps^25
         + 1656087831553847819569877/38371513250126757888000 * eps^27
         - 222870544090985685701249717628901/6400184226857542607280537600000 * eps^29;
C1'[8] = + 109167851/82575360 * eps^8
         - 550835669/74317824 * eps^10
         + 29797006823/1321205760 * eps^12
         - 13775344174277/280284364800 * eps^14
         + 51602655250575029/602723498065920 * eps^16
         - 229269121915303969/1813751267328000 * eps^18
         + 83019178881141641377/506287738375372800 * eps^20
         - 132324024533588768532907/691082762882383872000 * eps^22
         + 396326201752354956063673999/1935504271293158522880000 * eps^24
         - 703889408095319694872984797279/3464746196041883071807488000 * eps^26
         + 673066976958864232412288090929279/3563738944500222588144844800000 * eps^28
         - 3842435239091994304467908471778509/23172222559128113984248479744000 * eps^30;
C1'[9] = + 83141299/41287680 * eps^9
         - 1172993649/91750400 * eps^11
         + 1409193884757/32296140800 * eps^13
         - 8205463797521/77510737920 * eps^15
         + 6267340235329209/30709016166400 * eps^17
         - 9985904736500570067/30094835843072000 * eps^19
         + 6818098564242858298663/14445521204674560000 * eps^21
         - 81179814711559538793297/134824864576962560000 * eps^23
         + 8228623619106009640781583/11735156212778821222400 * eps^25
         - 10637423815896802535794719059/14082187455334585466880000 * eps^27
         + 2713138463299280056775410984179/3567487488684761651609600000 * eps^29;
C1'[10] = + 9303339907/2972712960 * eps^10
         - 32258337779/1453326336 * eps^12
         + 105458791111591/1255673954304 * eps^14
         - 21991423000897853/97942568435712 * eps^16
         + 440758100714976799/928640648871936 * eps^18
         - 4436414286264685342183/5265392479103877120 * eps^20
         + 11983230751430888047165/9190503236254040064 * eps^22
         - 438407397616490706337835/243037752247606837248 * eps^24
         + 503750725100748248754169576435/221743756546680516595679232 * eps^26
         - 200204949675864221817037957885535/75836364738964736675722297344 * eps^28
         + 15426622123776978643737455613179549/5392808159215270163606918922240 * eps^30;
C1'[11] = + 230944143253/46714060800 * eps^11
         - 13820996202863/356725555200 * eps^13
         + 530891275077073/3297729576960 * eps^15
         - 5861919724284516433/12465417800908800 * eps^17
         + 25885301781901909490837/23933602177744896000 * eps^19
         - 110706057667150724184229/53185782617210880000 * eps^21
         + 2719521302806552306469953613/781192775081593405440000 * eps^23
         - 233567275961905041708130573/44996703844699780153344 * eps^25
         + 798884301221118236917664805229/113666887205034582343680000 * eps^27
         - 9934805882969858378831722690837171/1133916936886434459864268800000 * eps^29;
C1'[12] = + 306777964441/38755368960 * eps^12
         - 57044595387963/839699660800 * eps^14
         + 11568981229047951/37618544803840 * eps^16
         - 687397289384966383/705347715072000 * eps^18
         + 233327560280127272763/96303474697830400 * eps^20
         - 3739229605202668172763/744163213574144000 * eps^22
         + 65835782650063594518691/7289762092154880000 * eps^24
         - 14792936433071373028889379/1024668970784915456000 * eps^26
         + 74599042152248060866262559758871/3567487488684761651609600000 * eps^28
         - 16680060316657855648846944446971/599337898099039957470412800 * eps^30;
C1'[13] = + 2615671472444983/204047017574400 * eps^13
         - 1167820427927323/9766352977920 * eps^15
         + 24715664579918728243/42190644864614400 * eps^17
         - 5067175041833532570683/2531438691876864000 * eps^19
         + 93543614041472271515281/17487017757219225600 * eps^21
         - 11792083140833533278156043493/991513906834330091520000 * eps^23
         + 8268814159710166088320187726251/361704273213163617386496000 * eps^25
         - 24380431693719066689532645995167/625167879627690202890240000 * eps^27
         + 40946727771183021563590563999653687303/680582760477888662474430873600000 * eps^29;
C1'[14] = + 34216519493594561/1632376140595200 * eps^14
         - 1477329715340046517/6995897745408000 * eps^16
         + 9229913663063228233/8291434364928000 * eps^18
         - 18633370679636805385039/4566922048202342400 * eps^20
         + 613651924549596407462456317/52610941995290984448000 * eps^22
         - 30737516008559329681484121827/1110675442122809671680000 * eps^24
         + 271813271604582464710892651024459/4798117909970537781657600000 * eps^26
         - 20699812425639174189936631117519897/201520952218762586829619200000 * eps^28
         + 1211662551734777607545609062337329843/7206133351721085009678827520000 * eps^30;
C1'[15] = + 177298287500753/5129801564160 * eps^15
         - 5627790514610829/15047417921536 * eps^17
         + 17279798906736629091/8185795349315584 * eps^19
         - 115931060832532759571/14032792027398144 * eps^21
         + 2003356613292569725398363/79631417158142001152 * eps^23
         - 101051987173195622011224471/1592628343162840023040 * eps^25
         + 756303360522076489366917931/5488442290284248694784 * eps^27
         - 5815559636408944974046175630559/21975722930298131773915136 * eps^29;
C1'[16] = + 1259425185539653127243/21939135329599488000 * eps^16
         - 2293308899647899314723/3453382412992512000 * eps^18
         + 21460336637287899464532611/5370700328685954662400 * eps^20
         - 25456489696915892609916529129/1530649593675497078784000 * eps^22
         + 2553846684009183021840672953/47515526935735173120000 * eps^24
         - 29538537350054556934382434071434011/205719305389986807388569600000 * eps^26
         + 3770295466320560881269963263089000511/11433662446938214136964710400000 * eps^28
         - 519676261197496743489350631148600190213/777234965004088823221667758080000 * eps^30;
C1'[17] = + 1789450487559418666447/18648265030159564800 * eps^17
         - 233343808292218091539949/197452217966395392000 * eps^19
         + 20146628393835035886855197/2667798856079297740800 * eps^21
         - 239929099187527215432793286501/7203056911414103900160000 * eps^23
         + 62988069927933679012075753421807/553194770796603179532288000 * eps^25
         - 3378232317776013495553552510617097/10517530210207023413329920000 * eps^27
         + 7314657081705017862640836634319879174339/9405196215175528617136147660800000 * eps^29;
C1'[18] = + 212221079284639273481/1315574252568576000 * eps^18
         - 1260552943986821598063/598192737065369600 * eps^20
         + 3546697789798651658576181/248848178619193753600 * eps^22
         - 78517248057208956823851421/1182310350905671680000 * eps^24
         + 1067601202019151639052958889147/4459359360855952064512000 * eps^26
         - 40116098461444544658667493570308857/56410895914827793616076800000 * eps^28
         + 392210563613343460551402383435826349/216617840312938727485734912000 * eps^30;
C1'[19] = + 69532546869173713149501223/255108265612582846464000 * eps^19
         - 112316728120020126447652781/29837224048255303680000 * eps^21
         + 4848022300045341835150543297447/180455531043848076656640000 * eps^23
         - 125642956497967669586988251237879/952805203911517844747059200 * eps^25
         + 33298130071722823747096176158055463/66596830966654998455255040000 * eps^27
         - 6563632449843987460043036353052098320209/4207587780473262802403013427200000 * eps^29;
C1'[20] = + 5810177473683430838091097/12559176153234847825920 * eps^20
         - 4618600293785993240609142923/685731017966622691295232 * eps^22
         + 1356670146516048832626691899799/26819702036027909703991296 * eps^24
         - 2172503519024023685991761815076867/8327517482186665963089297408 * eps^26
         + 3793117143067735304052463936462682647/3654590529325348262658617376768 * eps^28
         - 48227737126007159325773215007655970673/14212296502931909910339067576320 * eps^30;
C1'[21] = + 80853671585727628548617/102547326354063360000 * eps^21
         - 33710670766735229663452761/2793193841644011520000 * eps^23
         + 7824467166805891507557010233/82231626697999699148800 * eps^25
         - 12690496274820158383049352282653/24669488009399909744640000 * eps^27
         + 56382836432185917384773311978295199/26314120543359903727616000000 * eps^29;
C1'[22] = + 924898009889615635728755915083/685731017966622691295232000 * eps^22
         - 34498885534979583771510062454227/1593112465983062818160640000 * eps^24
         + 579153806014612787074377437506223/3238703930845567705625395200 * eps^26
         - 1569950058036065954085485531335819511/1552386282642142415290368000000 * eps^28
         + 13441093380769154612428393473490856259941/3053881893191980641891039313920000 * eps^30;
C1'[23] = + 4016551943902862119978017069801911/1734899475455555408976936960000 * eps^23
         - 7042743315770579684284446742015447/181032988743188390501941248000 * eps^25
         + 600397969311873169056555916083822001/1787980135735193980266086400000 * eps^27
         - 223977408534083722217209433995298286356287/112964584975749555673211338752000000 * eps^29;
C1'[24] = + 33730424938117851020161782371647/8461634387224169042411520000 * eps^24
         - 2466848731962947446637554898208789/35256809946767371010048000000 * eps^26
         + 9241553981242966860439405699656735351/14666832937855226340179968000000 * eps^28
         - 34121931746328650162120952716097657509/8800099762713135804107980800000 * eps^30;
C1'[25] = + 251959060076566669691445659637541/36604472449172158079513395200 * eps^25
         - 10775075917257378388661547627353189/85536969693571680015929573376 * eps^27
         + 7072923673224417550895367212096744699801/5986219287034920454234815263145984 * eps^29;
C1'[26] = + 18043464502912016496703680586663352917/1514094087670302902379872256000000 * eps^26
         - 15705330809648579467084357186039173723679/69182452928935378770280316928000000 * eps^28
         + 762509129435444486126998095414252687404107/344374876801811663212062022041600000 * eps^30;
C1'[27] = + 819021838914972651233426418104059459/39600448932209111118485913600000 * eps^27
         - 4425211305648392775905209005851207973/10807140059472272040132608000000 * eps^29;
C1'[28] = + 137344334847260471742767128830849077140799/3817741892241658452955877081088000000 * eps^28
         - 3056545074816755404384556140143837530441/4134995887021777596105338388480000 * eps^30;
C1'[29] = + 2381352350093111938327626556685002210278872879/37975078602127776631552109325582336000000 * eps^29;
C1'[30] = + 20034557328168749612075941075238883149/182929433787470496587153418485760 * eps^30;

A2 = (1 + 1/4 * eps^2
        + 9/64 * eps^4
        + 25/256 * eps^6
        + 1225/16384 * eps^8
        + 3969/65536 * eps^10
        + 53361/1048576 * eps^12
        + 184041/4194304 * eps^14
        + 41409225/1073741824 * eps^16
        + 147744025/4294967296 * eps^18
        + 2133423721/68719476736 * eps^20
        + 7775536041/274877906944 * eps^22
        + 457028729521/17592186044416 * eps^24
        + 1690195005625/70368744177664 * eps^26
        + 25145962430625/1125899906842624 * eps^28
        + 93990019574025/4503599627370496 * eps^30) * (1 - eps);

C2[1] = + 1/2 * eps
        + 1/16 * eps^3
        + 1/32 * eps^5
        + 41/2048 * eps^7
        + 59/4096 * eps^9
        + 727/65536 * eps^11
        + 1171/131072 * eps^13
        + 498409/67108864 * eps^15
        + 848479/134217728 * eps^17
        + 11768921/2147483648 * eps^19
        + 20705249/4294967296 * eps^21
        + 2359256231/549755813888 * eps^23
        + 4242171053/1099511627776 * eps^25
        + 61534748221/17592186044416 * eps^27
        + 112374407161/35184372088832 * eps^29;
C2[2] = + 3/16 * eps^2
        + 1/32 * eps^4
        + 35/2048 * eps^6
        + 47/4096 * eps^8
        + 557/65536 * eps^10
        + 875/131072 * eps^12
        + 365987/67108864 * eps^14
        + 615099/134217728 * eps^16
        + 8448195/2147483648 * eps^18
        + 14747697/4294967296 * eps^20
        + 1669842701/549755813888 * eps^22
        + 2986894505/1099511627776 * eps^24
        + 43136495023/17592186044416 * eps^26
        + 78481301201/35184372088832 * eps^28
        + 294392827406755/144115188075855872 * eps^30;
C2[3] = + 5/48 * eps^3
        + 5/256 * eps^5
        + 23/2048 * eps^7
        + 191/24576 * eps^9
        + 385/65536 * eps^11
        + 39277/8388608 * eps^13
        + 778613/201326592 * eps^15
        + 879927/268435456 * eps^17
        + 6084639/2147483648 * eps^19
        + 512739193/206158430208 * eps^21
        + 1215236729/549755813888 * eps^23
        + 4364918719/2199023255552 * eps^25
        + 94882584065/52776558133248 * eps^27
        + 29549676515117/18014398509481984 * eps^29;
C2[4] = + 35/512 * eps^4
        + 7/512 * eps^6
        + 133/16384 * eps^8
        + 47/8192 * eps^10
        + 73859/16777216 * eps^12
        + 59533/16777216 * eps^14
        + 1587387/536870912 * eps^16
        + 169365/67108864 * eps^18
        + 301539693/137438953472 * eps^20
        + 265958173/137438953472 * eps^22
        + 7594835095/4398046511104 * eps^24
        + 3421780579/2199023255552 * eps^26
        + 50930607972739/36028797018963968 * eps^28
        + 46591933629593/36028797018963968 * eps^30;
C2[5] = + 63/1280 * eps^5
        + 21/2048 * eps^7
        + 51/8192 * eps^9
        + 2343/524288 * eps^11
        + 29099/8388608 * eps^13
        + 946609/335544320 * eps^15
        + 635521/268435456 * eps^17
        + 8729875/4294967296 * eps^19
        + 122017589/68719476736 * eps^21
        + 864489227/549755813888 * eps^23
        + 15483449661/10995116277760 * eps^25
        + 1433014740399/1125899906842624 * eps^27
        + 20884832418219/18014398509481984 * eps^29;
C2[6] = + 77/2048 * eps^6
        + 33/4096 * eps^8
        + 2607/524288 * eps^10
        + 11363/3145728 * eps^12
        + 189893/67108864 * eps^14
        + 311117/134217728 * eps^16
        + 25213345/12884901888 * eps^18
        + 14502017/8589934592 * eps^20
        + 814144243/549755813888 * eps^22
        + 4341484325/3298534883328 * eps^24
        + 1331147570487/1125899906842624 * eps^26
        + 2412694071441/2251799813685248 * eps^28
        + 422949801695839/432345564227567616 * eps^30;
C2[7] = + 429/14336 * eps^7
        + 429/65536 * eps^9
        + 2145/524288 * eps^11
        + 1573/524288 * eps^13
        + 158899/67108864 * eps^15
        + 1047631/536870912 * eps^17
        + 7110437/4294967296 * eps^19
        + 86245121/60129542144 * eps^21
        + 694168021/549755813888 * eps^23
        + 158428784829/140737488355328 * eps^25
        + 1141580229945/1125899906842624 * eps^27
        + 518508038199/562949953421312 * eps^29;
C2[8] = + 6435/262144 * eps^8
        + 715/131072 * eps^10
        + 14443/4194304 * eps^12
        + 10673/4194304 * eps^14
        + 4339205/2147483648 * eps^16
        + 898561/536870912 * eps^18
        + 24498667/17179869184 * eps^20
        + 21302303/17179869184 * eps^22
        + 616428279683/562949953421312 * eps^24
        + 275528165297/281474976710656 * eps^26
        + 7960491282361/9007199254740992 * eps^28
        + 7246735300607/9007199254740992 * eps^30;
C2[9] = + 12155/589824 * eps^9
        + 2431/524288 * eps^11
        + 1547/524288 * eps^13
        + 441779/201326592 * eps^15
        + 940321/536870912 * eps^17
        + 6258091/4294967296 * eps^19
        + 32109515/25769803776 * eps^21
        + 4780137299/4398046511104 * eps^23
        + 135454151123/140737488355328 * eps^25
        + 8739550412095/10133099161583616 * eps^27
        + 439310252633/562949953421312 * eps^29;
C2[10] = + 46189/2621440 * eps^10
        + 4199/1048576 * eps^12
        + 172159/67108864 * eps^14
        + 257431/134217728 * eps^16
        + 6604381/4294967296 * eps^18
        + 55148051/42949672960 * eps^20
        + 4844658589/4398046511104 * eps^22
        + 8475408793/8796093022208 * eps^24
        + 963016659745/1125899906842624 * eps^26
        + 1729685026007/2251799813685248 * eps^28
        + 100354915132471/144115188075855872 * eps^30;
C2[11] = + 88179/5767168 * eps^11
        + 29393/8388608 * eps^13
        + 151487/67108864 * eps^15
        + 455107/268435456 * eps^17
        + 5860189/4294967296 * eps^19
        + 628398115/549755813888 * eps^21
        + 4324974541/4398046511104 * eps^23
        + 15169948479/17592186044416 * eps^25
        + 863724574545/1125899906842624 * eps^27
        + 12434905703529/18014398509481984 * eps^29;
C2[12] = + 676039/50331648 * eps^12
        + 52003/16777216 * eps^14
        + 1077205/536870912 * eps^16
        + 304589/201326592 * eps^18
        + 1343185487/1099511627776 * eps^20
        + 1128482143/1099511627776 * eps^22
        + 93435460751/105553116266496 * eps^24
        + 13685462553/17592186044416 * eps^26
        + 24983462965221/36028797018963968 * eps^28
        + 67559103579581/108086391056891904 * eps^30;
C2[13] = + 1300075/109051904 * eps^13
        + 185725/67108864 * eps^15
        + 482885/268435456 * eps^17
        + 46765555/34359738368 * eps^19
        + 605955125/549755813888 * eps^21
        + 4083133535/4398046511104 * eps^23
        + 14117902665/17592186044416 * eps^25
        + 776981055/1099511627776 * eps^27
        + 11367459987135/18014398509481984 * eps^29;
C2[14] = + 5014575/469762048 * eps^14
        + 334305/134217728 * eps^16
        + 55828935/34359738368 * eps^18
        + 84736485/68719476736 * eps^20
        + 4403236035/4398046511104 * eps^22
        + 7434490215/8796093022208 * eps^24
        + 12878639895/17592186044416 * eps^26
        + 79525490115/123145302310912 * eps^28
        + 83239672976625/144115188075855872 * eps^30;
C2[15] = + 646323/67108864 * eps^15
        + 9694845/4294967296 * eps^17
        + 50755365/34359738368 * eps^19
        + 77241935/68719476736 * eps^21
        + 4023100545/4398046511104 * eps^23
        + 13613065131/17592186044416 * eps^25
        + 738265615/1099511627776 * eps^27
        + 166992644595/281474976710656 * eps^29;
C2[16] = + 300540195/34359738368 * eps^16
        + 17678835/8589934592 * eps^18
        + 371255535/274877906944 * eps^20
        + 283171515/274877906944 * eps^22
        + 118236358635/140737488355328 * eps^24
        + 50102128545/70368744177664 * eps^26
        + 1393471517565/2251799813685248 * eps^28
        + 1233068062875/2251799813685248 * eps^30;
C2[17] = + 583401555/73014444032 * eps^17
        + 64822395/34359738368 * eps^19
        + 85292625/68719476736 * eps^21
        + 4172515215/4398046511104 * eps^23
        + 13636584885/17592186044416 * eps^25
        + 2894056305/4398046511104 * eps^27
        + 161224515885/281474976710656 * eps^29;
C2[18] = + 756261275/103079215104 * eps^18
        + 119409675/68719476736 * eps^20
        + 5039088285/4398046511104 * eps^22
        + 7718413945/8796093022208 * eps^24
        + 12634163925/17592186044416 * eps^26
        + 10741625085/17592186044416 * eps^28
        + 76701028811195/144115188075855872 * eps^30;
C2[19] = + 4418157975/652835028992 * eps^19
        + 883631595/549755813888 * eps^21
        + 4670624145/4398046511104 * eps^23
        + 14333193015/17592186044416 * eps^25
        + 2937289215/4398046511104 * eps^27
        + 10243215614805/18014398509481984 * eps^29;
C2[20] = + 6892326441/1099511627776 * eps^20
        + 1641030105/1099511627776 * eps^22
        + 34760001315/35184372088832 * eps^24
        + 13355260815/17592186044416 * eps^26
        + 22452476602335/36028797018963968 * eps^28
        + 95701981543233/180143985094819840 * eps^30;
C2[21] = + 22427411435/3848290697216 * eps^21
        + 6116566755/4398046511104 * eps^23
        + 16222198785/17592186044416 * eps^25
        + 798965451635/1125899906842624 * eps^27
        + 10507463872035/18014398509481984 * eps^29;
C2[22] = + 263012370465/48378511622144 * eps^22
        + 11435320455/8796093022208 * eps^24
        + 972002238675/1125899906842624 * eps^26
        + 1498026979605/2251799813685248 * eps^28
        + 78899312939325/144115188075855872 * eps^30;
C2[23] = + 514589420475/101155069755392 * eps^23
        + 171529806825/140737488355328 * eps^25
        + 912538572309/1125899906842624 * eps^27
        + 352031942007/562949953421312 * eps^29;
C2[24] = + 2687300306925/562949953421312 * eps^24
        + 322476036831/281474976710656 * eps^26
        + 6871220169399/9007199254740992 * eps^28
        + 15922598844211/27021597764222976 * eps^30;
C2[25] = + 15801325804719/3518437208883200 * eps^25
        + 1215486600363/1125899906842624 * eps^27
        + 405162200121/562949953421312 * eps^29;
C2[26] = + 61989816618513/14636698788954112 * eps^26
        + 2295919134019/2251799813685248 * eps^28
        + 98068545867383/144115188075855872 * eps^30;
C2[27] = + 121683714103007/30399297484750848 * eps^27
        + 17383387729001/18014398509481984 * eps^29;
C2[28] = + 136583760727865/36028797018963968 * eps^28
        + 32968493968795/36028797018963968 * eps^30;
C2[29] = + 1879204156221315/522417556774977536 * eps^29;
C2[30] = + 7391536347803839/2161727821137838080 * eps^30;

A3 = 1 - (1/2 - 1/2*n) * eps
       - (1/4 + 1/8*n - 3/8*n^2) * eps^2
       - (1/16 + 3/16*n + 1/16*n^2 - 5/16*n^3) * eps^3
       - (3/64 + 1/32*n + 5/32*n^2 + 5/128*n^3 - 35/128*n^4) * eps^4
       - (3/128 + 5/128*n + 5/256*n^2 + 35/256*n^3 + 7/256*n^4 - 63/256*n^5) * eps^5
       - (5/256 + 15/1024*n + 35/1024*n^2 + 7/512*n^3 + 63/512*n^4 + 21/1024*n^5 - 231/1024*n^6) * eps^6
       - (25/2048 + 35/2048*n + 21/2048*n^2 + 63/2048*n^3 + 21/2048*n^4 + 231/2048*n^5 + 33/2048*n^6 - 429/2048*n^7) * eps^7
       - (175/16384 + 35/4096*n + 63/4096*n^2 + 63/8192*n^3 + 231/8192*n^4 + 33/4096*n^5 + 429/4096*n^6 + 429/32768*n^7 - 6435/32768*n^8) * eps^8
       - (245/32768 + 315/32768*n + 105/16384*n^2 + 231/16384*n^3 + 99/16384*n^4 + 429/16384*n^5 + 429/65536*n^6 + 6435/65536*n^7 + 715/65536*n^8 - 12155/65536*n^9) * eps^9
       - (441/65536 + 735/131072*n + 1155/131072*n^2 + 165/32768*n^3 + 429/32768*n^4 + 1287/262144*n^5 + 6435/262144*n^6 + 715/131072*n^7 + 12155/131072*n^8 + 2431/262144*n^9 - 46189/262144*n^10) * eps^10
       - (1323/262144 + 1617/262144*n + 1155/262144*n^2 + 2145/262144*n^3 + 2145/524288*n^4 + 6435/524288*n^5 + 2145/524288*n^6 + 12155/524288*n^7 + 2431/524288*n^8 + 46189/524288*n^9 + 4199/524288*n^10 - 88179/524288*n^11) * eps^11
       - (4851/1048576 + 2079/524288*n + 3003/524288*n^2 + 15015/4194304*n^3 + 32175/4194304*n^4 + 3575/1048576*n^5 + 12155/1048576*n^6 + 7293/2097152*n^7 + 46189/2097152*n^8 + 4199/1048576*n^9 + 88179/1048576*n^10 + 29393/4194304*n^11 - 676039/4194304*n^12) * eps^12
       - (7623/2097152 + 9009/2097152*n + 27027/8388608*n^2 + 45045/8388608*n^3 + 25025/8388608*n^4 + 60775/8388608*n^5 + 12155/4194304*n^6 + 46189/4194304*n^7 + 12597/4194304*n^8 + 88179/4194304*n^9 + 29393/8388608*n^10 + 676039/8388608*n^11 + 52003/8388608*n^12 - 1300075/8388608*n^13) * eps^13
       - (14157/4194304 + 99099/33554432*n + 135135/33554432*n^2 + 45045/16777216*n^3 + 85085/16777216*n^4 + 85085/33554432*n^5 + 230945/33554432*n^6 + 20995/8388608*n^7 + 88179/8388608*n^8 + 88179/33554432*n^9 + 676039/33554432*n^10 + 52003/16777216*n^11 + 1300075/16777216*n^12 + 185725/33554432*n^13 - 5014575/33554432*n^14) * eps^14
       - (184041/67108864 + 212355/67108864*n + 165165/67108864*n^2 + 255255/67108864*n^3 + 153153/67108864*n^4 + 323323/67108864*n^5 + 146965/67108864*n^6 + 440895/67108864*n^7 + 146965/67108864*n^8 + 676039/67108864*n^9 + 156009/67108864*n^10 + 1300075/67108864*n^11 + 185725/67108864*n^12 + 5014575/67108864*n^13 + 334305/67108864*n^14) * eps^15
       - (2760615/1073741824 + 306735/134217728*n + 401115/134217728*n^2 + 561561/268435456*n^3 + 969969/268435456*n^4 + 264537/134217728*n^5 + 617253/134217728*n^6 + 1028755/536870912*n^7 + 3380195/536870912*n^8 + 260015/134217728*n^9 + 1300075/134217728*n^10 + 557175/268435456*n^11 + 5014575/268435456*n^12 + 334305/134217728*n^13) * eps^16
       - (4601025/2147483648 + 5214495/2147483648*n + 1042899/536870912*n^2 + 1524237/536870912*n^3 + 969969/536870912*n^4 + 1851759/536870912*n^5 + 1851759/1073741824*n^6 + 4732273/1073741824*n^7 + 1820105/1073741824*n^8 + 6500375/1073741824*n^9 + 928625/536870912*n^10 + 5014575/536870912*n^11 + 1002915/536870912*n^12) * eps^17
       - (8690825/4294967296 + 15643485/8589934592*n + 19815081/8589934592*n^2 + 1801371/1073741824*n^3 + 2909907/1073741824*n^4 + 6789783/4294967296*n^5 + 14196819/4294967296*n^6 + 3276189/2147483648*n^7 + 9100525/2147483648*n^8 + 6500375/4294967296*n^9 + 25072875/4294967296*n^10 + 1671525/1073741824*n^11) * eps^18
       - (29548805/17179869184 + 33025135/17179869184*n + 27020565/17179869184*n^2 + 37828791/17179869184*n^3 + 12609597/8589934592*n^4 + 22309287/8589934592*n^5 + 12012693/8589934592*n^6 + 27301575/8589934592*n^7 + 11700675/8589934592*n^8 + 35102025/8589934592*n^9 + 11700675/8589934592*n^10) * eps^19
       - (112285459/68719476736 + 51038845/34359738368*n + 63047985/34359738368*n^2 + 189143955/137438953472*n^3 + 290020731/137438953472*n^4 + 22309287/17179869184*n^5 + 42902475/17179869184*n^6 + 42902475/34359738368*n^7 + 105306075/34359738368*n^8 + 21061215/17179869184*n^9) * eps^20
       - (193947611/137438953472 + 214363149/137438953472*n + 357271915/274877906944*n^2 + 483367885/274877906944*n^3 + 334639305/274877906944*n^4 + 557732175/274877906944*n^5 + 79676025/68719476736*n^6 + 165480975/68719476736*n^7 + 77224455/68719476736*n^8) * eps^21
       - (370263621/274877906944 + 1357633277/1099511627776*n + 1643450809/1099511627776*n^2 + 632096465/549755813888*n^3 + 929553625/549755813888*n^4 + 1195140375/1099511627776*n^5 + 2151252675/1099511627776*n^6 + 143416845/137438953472*n^7) * eps^22
       - (2591845347/2199023255552 + 2838687761/2199023255552*n + 2401966567/2199023255552*n^2 + 3160482325/2199023255552*n^3 + 2257487375/2199023255552*n^4 + 3585421125/2199023255552*n^5 + 2151252675/2199023255552*n^6) * eps^23
       - (19870814327/17592186044416 + 4585572537/4398046511104*n + 5459014925/4398046511104*n^2 + 8578452025/8796093022208*n^3 + 12190431825/8796093022208*n^4 + 4063477275/4398046511104*n^5) * eps^24
       - (35156056117/35184372088832 + 38213104475/35184372088832*n + 16377044775/17592186044416*n^2 + 21056200425/17592186044416*n^3 + 15441213645/17592186044416*n^4) * eps^25
       - (67607800225/70368744177664 + 125557343275/140737488355328*n + 147393402975/140737488355328*n^2 + 29478680595/35184372088832*n^3) * eps^26
       - (241456429375/281474976710656 + 260772943725/281474976710656*n + 226003217895/281474976710656*n^2) * eps^27
       - (931331941875/1125899906842624 + 434621572875/562949953421312*n) * eps^28
       - 1676397495375/2251799813685248 * eps^29;

C3[1] = + (1/4 - 1/4*n) * eps
        + (1/8 - 1/8*n^2) * eps^2
        + (3/64 + 3/64*n - 1/64*n^2 - 5/64*n^3) * eps^3
        + (5/128 + 1/64*n + 1/64*n^2 - 1/64*n^3 - 7/128*n^4) * eps^4
        + (3/128 + 11/512*n + 3/512*n^2 + 1/256*n^3 - 7/512*n^4 - 21/512*n^5) * eps^5
        + (21/1024 + 5/512*n + 13/1024*n^2 + 1/512*n^3 - 1/1024*n^4 - 3/256*n^5 - 33/1024*n^6) * eps^6
        + (243/16384 + 189/16384*n + 83/16384*n^2 + 127/16384*n^3 + 3/16384*n^4 - 51/16384*n^5 - 165/16384*n^6 - 429/16384*n^7) * eps^7
        + (435/32768 + 109/16384*n + 1/128*n^2 + 45/16384*n^3 + 39/8192*n^4 - 11/16384*n^5 - 33/8192*n^6 - 143/16384*n^7 - 715/32768*n^8) * eps^8
        + (345/32768 + 953/131072*n + 259/65536*n^2 + 365/65536*n^3 + 95/65536*n^4 + 47/16384*n^5 - 143/131072*n^6 - 143/32768*n^7 - 1001/131072*n^8 - 2431/131072*n^9) * eps^9
        + (2511/262144 + 317/65536*n + 1355/262144*n^2 + 165/65536*n^3 + 531/131072*n^4 + 89/131072*n^5 + 107/65536*n^6 - 169/131072*n^7 - 1157/262144*n^8 - 221/32768*n^9 - 4199/262144*n^10) * eps^10
        + (8401/1048576 + 5327/1048576*n + 807/262144*n^2 + 8243/2097152*n^3 + 3415/2097152*n^4 + 6235/2097152*n^5 + 429/2097152*n^6 + 845/1048576*n^7 - 2873/2097152*n^8 - 9061/2097152*n^9 - 12597/2097152*n^10 - 29393/2097152*n^11) * eps^11
        + (15477/2097152 + 969/262144*n + 15445/4194304*n^2 + 2237/1048576*n^3 + 6429/2097152*n^4 + 2183/2097152*n^5 + 9169/4194304*n^6 - 197/2097152*n^7 + 1019/4194304*n^8 - 2907/2097152*n^9 - 8721/2097152*n^10 - 11305/2097152*n^11 - 52003/4194304*n^12) * eps^12
        + (26789/4194304 + 63733/16777216*n + 40995/16777216*n^2 + 1517/524288*n^3 + 25475/16777216*n^4 + 40625/16777216*n^5 + 5365/8388608*n^6 + 839/524288*n^7 - 595/2097152*n^8 - 2431/16777216*n^9 - 22933/16777216*n^10 - 33269/8388608*n^11 - 81719/16777216*n^12 - 185725/16777216*n^13) * eps^13
        + (199327/33554432 + 49237/16777216*n + 93101/33554432*n^2 + 29853/16777216*n^3 + 78579/33554432*n^4 + 285/262144*n^5 + 64637/33554432*n^6 + 3015/8388608*n^7 + 38843/33554432*n^8 - 6783/16777216*n^9 - 13889/33554432*n^10 - 22287/16777216*n^11 - 126293/33554432*n^12 - 37145/8388608*n^13 - 334305/33554432*n^14) * eps^14
        + (5651931/1073741824 + 3197305/1073741824*n + 2129255/1073741824*n^2 + 2385073/1073741824*n^3 + 1438067/1073741824*n^4 + 2065081/1073741824*n^5 + 830627/1073741824*n^6 + 1651687/1073741824*n^7 + 172907/1073741824*n^8 + 879393/1073741824*n^9 - 515185/1073741824*n^10 - 645031/1073741824*n^11 - 1374365/1073741824*n^12 - 3825935/1073741824*n^13 - 4345965/1073741824*n^14) * eps^15
        + (10594535/2147483648 + 2577049/1073741824*n + 2340339/1073741824*n^2 + 1599809/1073741824*n^3 + 1974139/1073741824*n^4 + 1095805/1073741824*n^5 + 855347/536870912*n^6 + 580477/1073741824*n^7 + 330109/268435456*n^8 + 20577/1073741824*n^9 + 598443/1073741824*n^10 - 564167/1073741824*n^11 - 783541/1073741824*n^12 - 1317555/1073741824*n^13) * eps^16
        + (9550675/2147483648 + 20752127/8589934592*n + 7056899/4294967296*n^2 + 7580255/4294967296*n^3 + 4992507/4294967296*n^4 + 3321125/2147483648*n^5 + 3349163/4294967296*n^6 + 5700229/4294967296*n^7 + 1567945/4294967296*n^8 + 263547/268435456*n^9 - 355965/4294967296*n^10 + 1518119/4294967296*n^11 - 2366355/4294967296*n^12) * eps^17
        + (72058593/17179869184 + 8629549/4294967296*n + 30360645/17179869184*n^2 + 5413229/4294967296*n^3 + 12734831/8589934592*n^4 + 3957093/4294967296*n^5 + 11280727/8589934592*n^6 + 2549757/4294967296*n^7 + 9531415/8589934592*n^8 + 993989/4294967296*n^9 + 6705875/8589934592*n^10 - 671807/4294967296*n^11) * eps^18
        + (263253385/68719476736 + 138258975/68719476736*n + 23816915/17179869184*n^2 + 198093717/137438953472*n^3 + 69240987/68719476736*n^4 + 87088843/68719476736*n^5 + 50514007/68719476736*n^6 + 77115649/68719476736*n^7 + 30761115/68719476736*n^8 + 63886991/68719476736*n^9 + 8860067/68719476736*n^10) * eps^19
        + (499116509/137438953472 + 29445517/17179869184*n + 403691887/274877906944*n^2 + 37063307/34359738368*n^3 + 336216217/274877906944*n^4 + 56373745/68719476736*n^5 + 9400419/8589934592*n^6 + 40361177/68719476736*n^7 + 4136725/4294967296*n^8 + 22806365/68719476736*n^9) * eps^20
        + (921106197/274877906944 + 1880398291/1099511627776*n + 326574877/274877906944*n^2 + 661516723/549755813888*n^3 + 482354011/549755813888*n^4 + 1162954687/1099511627776*n^5 + 185209863/274877906944*n^6 + 261495221/274877906944*n^7 + 64353371/137438953472*n^8) * eps^21
        + (7015755337/2199023255552 + 408123935/274877906944*n + 2737209361/2199023255552*n^2 + 128335869/137438953472*n^3 + 2262026963/2199023255552*n^4 + 100083329/137438953472*n^5 + 2032983351/2199023255552*n^6 + 152722157/274877906944*n^7) * eps^22
        + (52217815849/17592186044416 + 25998927035/17592186044416*n + 18152051013/17592186044416*n^2 + 17993187773/17592186044416*n^3 + 13531950573/17592186044416*n^4 + 15783055573/17592186044416*n^5 + 1342789487/2199023255552*n^6) * eps^23
        + (99797592861/35184372088832 + 22918110427/17592186044416*n + 9429859753/8796093022208*n^2 + 14370219019/17592186044416*n^3 + 15464224607/17592186044416*n^4 + 5696035625/8796093022208*n^5) * eps^24
        + (93477766213/35184372088832 + 182178015931/140737488355328*n + 63784112813/70368744177664*n^2 + 15523581719/17592186044416*n^3 + 47802611279/70368744177664*n^4) * eps^25
        + (716876091533/281474976710656 + 81306684531/70368744177664*n + 263375014467/281474976710656*n^2 + 50762313771/70368744177664*n^3) * eps^26
        + (2701098070323/1125899906842624 + 1291014428313/1125899906842624*n + 905405918351/1125899906842624*n^2) * eps^27
        + (5192918413211/2251799813685248 + 1164465998161/1125899906842624*n) * eps^28
        + 4914956648311/2251799813685248 * eps^29;
C3[2] = + (1/16 - 3/32*n + 1/32*n^2) * eps^2
        + (3/64 - 1/32*n - 3/64*n^2 + 1/32*n^3) * eps^3
        + (3/128 + 1/128*n - 9/256*n^2 - 3/128*n^3 + 7/256*n^4) * eps^4
        + (5/256 + 1/256*n - 1/128*n^2 - 7/256*n^3 - 3/256*n^4 + 3/128*n^5) * eps^5
        + (27/2048 + 69/8192*n - 39/8192*n^2 - 47/4096*n^3 - 41/2048*n^4 - 45/8192*n^5 + 165/8192*n^6) * eps^6
        + (187/16384 + 39/8192*n + 31/16384*n^2 - 63/8192*n^3 - 185/16384*n^4 - 119/8192*n^5 - 33/16384*n^6 + 143/8192*n^7) * eps^7
        + (287/32768 + 47/8192*n + 31/65536*n^2 - 3/2048*n^3 - 537/65536*n^4 - 41/4096*n^5 - 693/65536*n^6 + 1001/65536*n^8) * eps^8
        + (255/32768 + 249/65536*n + 43/16384*n^2 - 119/65536*n^3 - 25/8192*n^4 - 507/65536*n^5 - 35/4096*n^6 - 507/65536*n^7 + 39/32768*n^8 + 221/16384*n^9) * eps^9
        + (1675/262144 + 2127/524288*n + 753/524288*n^2 + 357/524288*n^3 - 3109/1048576*n^4 - 3873/1048576*n^5 - 1821/262144*n^6 - 1885/262144*n^7 - 2977/524288*n^8 + 1989/1048576*n^9 + 12597/1048576*n^10) * eps^10
        + (6065/1048576 + 1551/524288*n + 75/32768*n^2 - 5/262144*n^3 - 1085/2097152*n^4 - 1815/524288*n^5 - 8057/2097152*n^6 - 1597/262144*n^7 - 12633/2097152*n^8 - 4369/1048576*n^9 + 4845/2097152*n^10 + 11305/1048576*n^11) * eps^11
        + (10377/2097152 + 1585/524288*n + 12521/8388608*n^2 + 73/65536*n^3 - 7799/8388608*n^4 - 645/524288*n^5 - 1883/524288*n^6 - 7843/2097152*n^7 - 2769/524288*n^8 - 21165/4194304*n^9 - 25517/8388608*n^10 + 10659/4194304*n^11 + 81719/8388608*n^12) * eps^12
        + (2381/524288 + 19679/8388608*n + 3951/2097152*n^2 + 4591/8388608*n^3 + 1267/4194304*n^4 - 6211/4194304*n^5 - 6839/4194304*n^6 - 3691/1048576*n^7 - 29513/8388608*n^8 - 38199/8388608*n^9 - 17765/4194304*n^10 - 18411/8388608*n^11 + 22287/8388608*n^12 + 37145/4194304*n^13) * eps^13
        + (267955/67108864 + 1262293/536870912*n + 723929/536870912*n^2 + 300995/268435456*n^3 - 28407/268435456*n^4 - 136037/536870912*n^5 - 962677/536870912*n^6 - 122923/67108864*n^7 - 897497/268435456*n^8 - 1743367/536870912*n^9 - 2103053/536870912*n^10 - 957049/268435456*n^11 - 52003/33554432*n^12 + 1448655/536870912*n^13 + 4345965/536870912*n^14) * eps^14
        + (3976491/1073741824 + 1022503/536870912*n + 1663043/1073741824*n^2 + 377461/536870912*n^3 + 604683/1073741824*n^4 - 298493/536870912*n^5 - 671633/1073741824*n^6 - 1045847/536870912*n^7 - 2047913/1073741824*n^8 - 1673607/536870912*n^9 - 3182937/1073741824*n^10 - 1808097/536870912*n^11 - 3232489/1073741824*n^12 - 565915/536870912*n^13 + 2890755/1073741824*n^14) * eps^15
        + (7129743/2147483648 + 1015025/536870912*n + 5052845/4294967296*n^2 + 1096857/1073741824*n^3 + 1006901/4294967296*n^4 + 10157/67108864*n^5 - 3691453/4294967296*n^6 - 232785/268435456*n^7 - 8591613/4294967296*n^8 - 2045245/1073741824*n^9 - 12341583/4294967296*n^10 - 1443525/536870912*n^11 - 12440079/4294967296*n^12 - 2737805/1073741824*n^13) * eps^16
        + (6667727/2147483648 + 6786587/4294967296*n + 2765703/2147483648*n^2 + 3065499/4294967296*n^3 + 1341327/2147483648*n^4 - 481047/4294967296*n^5 - 80463/536870912*n^6 - 4538443/4294967296*n^7 - 2183311/2147483648*n^8 - 8533921/4294967296*n^9 - 3983383/2147483648*n^10 - 11294905/4294967296*n^11 - 5218401/2147483648*n^12) * eps^17
        + (48519273/17179869184 + 53624999/34359738368*n + 35043145/34359738368*n^2 + 31055675/34359738368*n^3 + 25399201/68719476736*n^4 + 10932099/34359738368*n^5 - 25183979/68719476736*n^6 - 12612269/34359738368*n^7 - 80897803/68719476736*n^8 - 37844017/34359738368*n^9 - 132790935/68719476736*n^10 - 61071857/34359738368*n^11) * eps^18
        + (182709161/68719476736 + 45893303/34359738368*n + 37309115/34359738368*n^2 + 2893075/4294967296*n^3 + 21013705/34359738368*n^4 + 7175491/68719476736*n^5 + 2804597/34359738368*n^6 - 37828469/68719476736*n^7 - 17888297/34359738368*n^8 - 85404217/68719476736*n^9 - 39202063/34359738368*n^10) * eps^19
        + (336130837/137438953472 + 180823959/137438953472*n + 487608355/549755813888*n^2 + 218243165/274877906944*n^3 + 227499107/549755813888*n^4 + 104333133/274877906944*n^5 - 13837431/137438953472*n^6 - 27388031/274877906944*n^7 - 93516413/137438953472*n^8 - 172126779/274877906944*n^9) * eps^20
        + (636339537/274877906944 + 630601557/549755813888*n + 510119863/549755813888*n^2 + 339882125/549755813888*n^3 + 157181907/274877906944*n^4 + 57322697/274877906944*n^5 + 53319741/274877906944*n^6 - 35494201/137438953472*n^7 - 65167699/274877906944*n^8) * eps^21
        + (4724647749/2199023255552 + 9924101863/8796093022208*n + 6828890391/8796093022208*n^2 + 3070661829/4398046511104*n^3 + 229152657/549755813888*n^4 + 3452592737/8796093022208*n^5 + 390195853/8796093022208*n^6 + 403726013/8796093022208*n^7) * eps^22
        + (35940468233/17592186044416 + 8781999081/8796093022208*n + 14121810537/17592186044416*n^2 + 4938417863/8796093022208*n^3 + 9227803497/17592186044416*n^4 + 2245716697/8796093022208*n^5 + 2160045085/8796093022208*n^6) * eps^23
        + (67197451821/35184372088832 + 8631642763/8796093022208*n + 48175476253/70368744177664*n^2 + 5424112681/8796093022208*n^3 + 28247205103/70368744177664*n^4 + 421237869/1099511627776*n^5) * eps^24
        + (64142976365/35184372088832 + 61855152171/70368744177664*n + 385976459/549755813888*n^2 + 35768834103/70368744177664*n^3 + 16801928753/35184372088832*n^4) * eps^25
        + (482598495517/281474976710656 + 486224128685/562949953421312*n + 342398306855/562949953421312*n^2 + 2408805385/4398046511104*n^3) * eps^26
        + (1848743160243/1125899906842624 + 439979250473/562949953421312*n + 698099481901/1125899906842624*n^2) * eps^27
        + (3494999262339/2251799813685248 + 1729207092437/2251799813685248*n) * eps^28
        + 6713540223121/4503599627370496 * eps^29;
C3[3] = + (5/192 - 3/64*n + 5/192*n^2 - 1/192*n^3) * eps^3
        + (3/128 - 5/192*n - 1/64*n^2 + 5/192*n^3 - 1/128*n^4) * eps^4
        + (7/512 - 1/384*n - 77/3072*n^2 + 5/3072*n^3 + 65/3072*n^4 - 9/1024*n^5) * eps^5
        + (3/256 - 1/1024*n - 71/6144*n^2 - 47/3072*n^3 + 9/1024*n^4 + 25/1536*n^5 - 55/6144*n^6) * eps^6
        + (139/16384 + 143/49152*n - 383/49152*n^2 - 179/16384*n^3 - 121/16384*n^4 + 547/49152*n^5 + 605/49152*n^6 - 143/16384*n^7) * eps^7
        + (243/32768 + 95/49152*n - 41/16384*n^2 - 147/16384*n^3 - 389/49152*n^4 - 109/49152*n^5 + 557/49152*n^6 + 455/49152*n^7 - 273/32768*n^8) * eps^8
        + (581/98304 + 377/131072*n - 33/16384*n^2 - 907/196608*n^3 - 515/65536*n^4 - 1937/393216*n^5 + 89/98304*n^6 + 2093/196608*n^7 + 455/65536*n^8 - 1547/196608*n^9) * eps^9
        + (1383/262144 + 103/49152*n - 17/262144*n^2 - 127/32768*n^3 - 3853/786432*n^4 - 25/4096*n^5 - 2011/786432*n^6 + 265/98304*n^7 + 1895/196608*n^8 + 85/16384*n^9 - 969/131072*n^10) * eps^10
        + (4649/1048576 + 7447/3145728*n - 77/393216*n^2 - 3663/2097152*n^3 - 9285/2097152*n^4 - 27433/6291456*n^5 - 27545/6291456*n^6 - 2627/3145728*n^7 + 22993/6291456*n^8 + 17969/2097152*n^9 + 8075/2097152*n^10 - 14535/2097152*n^11) * eps^11
        + (8439/2097152 + 241/131072*n + 7829/12582912*n^2 - 1667/1048576*n^3 - 5295/2097152*n^4 - 26867/6291456*n^5 - 14817/4194304*n^6 - 18287/6291456*n^7 + 1505/4194304*n^8 + 25823/6291456*n^9 + 15827/2097152*n^10 + 17765/6291456*n^11 - 81719/12582912*n^12) * eps^12
        + (58663/16777216 + 48239/25165824*n + 81155/201326592*n^2 - 108067/201326592*n^3 - 467735/201326592*n^4 - 550477/201326592*n^5 - 380633/100663296*n^6 - 269125/100663296*n^7 - 174181/100663296*n^8 + 9707/8388608*n^9 + 854981/201326592*n^10 + 444125/67108864*n^11 + 408595/201326592*n^12 - 408595/67108864*n^13) * eps^13
        + (53929/16777216 + 313117/201326592*n + 317377/402653184*n^2 - 114511/201326592*n^3 - 62369/50331648*n^4 - 21877/8388608*n^5 - 1055003/402653184*n^6 - 106461/33554432*n^7 - 381119/201326592*n^8 - 55243/67108864*n^9 + 672619/402653184*n^10 + 846887/201326592*n^11 + 1166353/201326592*n^12 + 142025/100663296*n^13 - 766935/134217728*n^14) * eps^14
        + (9205697/3221225472 + 1685361/1073741824*n + 631247/1073741824*n^2 - 12349/1073741824*n^3 - 1279425/1073741824*n^4 - 1722535/1073741824*n^5 - 8411347/3221225472*n^6 - 7543081/3221225472*n^7 - 2745069/1073741824*n^8 - 1319223/1073741824*n^9 - 150233/1073741824*n^10 + 6386185/3221225472*n^11 + 4360823/1073741824*n^12 + 16332875/3221225472*n^13 + 994175/1073741824*n^14) * eps^15
        + (5698375/2147483648 + 1411153/1073741824*n + 633185/805306368*n^2 - 312125/3221225472*n^3 - 906475/1610612736*n^4 - 4985293/3221225472*n^5 - 1865903/1073741824*n^6 - 2632335/1073741824*n^7 - 2142387/1073741824*n^8 - 2132439/1073741824*n^9 - 137693/201326592*n^10 + 1176251/3221225472*n^11 + 3469849/1610612736*n^12 + 12431155/3221225472*n^13) * eps^16
        + (5151335/2147483648 + 11221815/8589934592*n + 4004635/6442450944*n^2 + 352181/1610612736*n^3 - 7504877/12884901888*n^4 - 23563667/25769803776*n^5 - 7348445/4294967296*n^6 - 924507/536870912*n^7 - 4740015/2147483648*n^8 - 14053273/8589934592*n^9 - 2388169/1610612736*n^10 - 1600145/6442450944*n^11 + 9427907/12884901888*n^12) * eps^17
        + (38568657/17179869184 + 2405303/2147483648*n + 12559943/17179869184*n^2 + 101021/805306368*n^3 - 3473571/17179869184*n^4 - 11685365/12884901888*n^5 - 57369983/51539607552*n^6 - 22445501/12884901888*n^7 - 27767351/17179869184*n^8 - 776185/402653184*n^9 - 22223933/17179869184*n^10 - 6776669/6442450944*n^11) * eps^18
        + (141238745/68719476736 + 227781229/206158430208*n + 15439981/25769803776*n^2 + 129846877/412316860416*n^3 - 17007629/68719476736*n^4 - 34417161/68719476736*n^5 - 227700493/206158430208*n^6 - 82496459/68719476736*n^7 - 347760895/206158430208*n^8 - 100402157/68719476736*n^9 - 338650721/206158430208*n^10) * eps^19
        + (266070741/137438953472 + 24865997/25769803776*n + 546610979/824633720832*n^2 + 23564155/103079215104*n^3 - 1988681/274877906944*n^4 - 35689789/68719476736*n^5 - 18022529/25769803776*n^6 - 82884377/68719476736*n^7 - 62369083/51539607552*n^8 - 108501709/68719476736*n^9) * eps^20
        + (1476084109/824633720832 + 1042422451/1099511627776*n + 1838348957/3298534883328*n^2 + 1148287217/3298534883328*n^3 - 65602265/1099511627776*n^4 - 25911799/103079215104*n^5 - 1166561623/1649267441664*n^6 - 450241025/549755813888*n^7 - 4082983123/3298534883328*n^8) * eps^21
        + (3727307793/2199023255552 + 2771727475/3298534883328*n + 1965618587/3298534883328*n^2 + 299691921/1099511627776*n^3 + 648655007/6597069766656*n^4 - 232283647/824633720832*n^5 - 1414792807/3298534883328*n^6 - 1364945647/1649267441664*n^7) * eps^22
        + (27791243081/17592186044416 + 43484270377/52776558133248*n + 8988365213/17592186044416*n^2 + 6177195751/17592186044416*n^3 + 821647265/17592186044416*n^4 - 5244741905/52776558133248*n^5 - 5898760729/13194139533312*n^6) * eps^23
        + (52866931869/35184372088832 + 13002628835/17592186044416*n + 28235801693/52776558133248*n^2 + 15115493921/52776558133248*n^3 + 1357399595/8796093022208*n^4 - 1176448685/8796093022208*n^5) * eps^24
        + (49596004877/35184372088832 + 101897209187/140737488355328*n + 16392942713/35184372088832*n^2 + 35874509113/105553116266496*n^3 + 11256301655/105553116266496*n^4) * eps^25
        + (378812456237/281474976710656 + 23082024431/35184372088832*n + 406385867693/844424930131968*n^2 + 30062357575/105553116266496*n^3) * eps^26
        + (4287844495145/3377699720527872 + 723291681375/1125899906842624*n + 477936436199/1125899906842624*n^2) * eps^27
        + (2738088177221/2251799813685248 + 1982787518731/3377699720527872*n) * eps^28
        + 41515375436483/36028797018963968 * eps^29;
C3[4] = + (7/512 - 7/256*n + 5/256*n^2 - 7/1024*n^3 + 1/1024*n^4) * eps^4
        + (7/512 - 5/256*n - 7/2048*n^2 + 9/512*n^3 - 21/2048*n^4 + 1/512*n^5) * eps^5
        + (9/1024 - 43/8192*n - 129/8192*n^2 + 39/4096*n^3 + 91/8192*n^4 - 91/8192*n^5 + 11/4096*n^6) * eps^6
        + (127/16384 - 23/8192*n - 165/16384*n^2 - 47/8192*n^3 + 213/16384*n^4 + 11/2048*n^5 - 175/16384*n^6 + 13/4096*n^7) * eps^7
        + (193/32768 + 3/8192*n - 505/65536*n^2 - 227/32768*n^3 + 75/65536*n^4 + 801/65536*n^5 + 165/131072*n^6 - 637/65536*n^7 + 455/131072*n^8) * eps^8
        + (171/32768 + 25/65536*n - 259/65536*n^2 - 471/65536*n^3 - 351/131072*n^4 + 605/131072*n^5 + 41/4096*n^6 - 189/131072*n^7 - 1127/131072*n^8 + 119/32768*n^9) * eps^9
        + (1121/262144 + 339/262144*n - 801/262144*n^2 - 2525/524288*n^3 - 2519/524288*n^4 + 73/131072*n^5 + 1539/262144*n^6 + 1989/262144*n^7 - 1633/524288*n^8 - 3927/524288*n^9 + 969/262144*n^10) * eps^10
        + (2017/524288 + 273/262144*n - 1467/1048576*n^2 - 277/65536*n^3 - 4123/1048576*n^4 - 153/65536*n^5 + 1331/524288*n^6 + 1549/262144*n^7 + 5677/1048576*n^8 - 1071/262144*n^9 - 6783/1048576*n^10 + 969/262144*n^11) * eps^11
        + (55215/16777216 + 11307/8388608*n - 2363/2097152*n^2 - 177843/67108864*n^3 - 268499/67108864*n^4 - 41907/16777216*n^5 - 6403/16777216*n^6 + 118801/33554432*n^7 + 179785/33554432*n^8 + 30345/8388608*n^9 - 154071/33554432*n^10 - 373065/67108864*n^11 + 245157/67108864*n^12) * eps^12
        + (50365/16777216 + 2327/2097152*n - 47759/134217728*n^2 - 76829/33554432*n^3 - 383837/134217728*n^4 - 105473/33554432*n^5 - 74037/67108864*n^6 + 16197/16777216*n^7 + 260819/67108864*n^8 + 153431/33554432*n^9 + 294443/134217728*n^10 - 80465/16777216*n^11 - 639331/134217728*n^12 + 120175/33554432*n^13) * eps^13
        + (2769/1048576 + 654529/536870912*n - 163129/536870912*n^2 - 372645/268435456*n^3 - 1430285/536870912*n^4 - 1335009/536870912*n^5 - 284489/134217728*n^6 + 987/33554432*n^7 + 482449/268435456*n^8 + 2057345/536870912*n^9 + 2007901/536870912*n^10 + 293645/268435456*n^11 - 2581359/536870912*n^12 - 2187185/536870912*n^13 + 937365/268435456*n^14) * eps^14
        + (2615571/1073741824 + 552353/536870912*n + 90895/1073741824*n^2 - 652503/536870912*n^3 - 1983405/1073741824*n^4 - 680875/268435456*n^5 - 2001037/1073741824*n^6 - 156103/134217728*n^7 + 920027/1073741824*n^8 + 1204095/536870912*n^9 + 3815723/1073741824*n^10 + 1584867/536870912*n^11 + 278231/1073741824*n^12 - 315445/67108864*n^13 - 3736005/1073741824*n^14) * eps^15
        + (4692619/2147483648 + 572057/536870912*n + 260179/4294967296*n^2 - 2984769/4294967296*n^3 - 3625809/2147483648*n^4 - 8162427/4294967296*n^5 - 18409849/8589934592*n^6 - 639067/536870912*n^7 - 3156661/8589934592*n^8 + 3027631/2147483648*n^9 + 162319/67108864*n^10 + 13593091/4294967296*n^11 + 9656343/4294967296*n^12 - 1568255/4294967296*n^13) * eps^16
        + (4367867/2147483648 + 3942989/4294967296*n + 2323595/8589934592*n^2 - 2679169/4294967296*n^3 - 2473899/2147483648*n^4 - 15712829/8589934592*n^5 - 14665951/8589934592*n^6 - 14129447/8589934592*n^7 - 2450171/4294967296*n^8 + 529403/2147483648*n^9 + 14965037/8589934592*n^10 + 5189391/2147483648*n^11 + 5874821/2147483648*n^12) * eps^17
        + (31803789/17179869184 + 31805471/34359738368*n + 7655783/34359738368*n^2 - 10716843/34359738368*n^3 - 18130187/17179869184*n^4 - 23156361/17179869184*n^5 - 60088211/34359738368*n^6 - 11928127/8589934592*n^7 - 9775259/8589934592*n^8 - 1657343/34359738368*n^9 + 23786693/34359738368*n^10 + 65561705/34359738368*n^11) * eps^18
        + (119278493/68719476736 + 27869745/34359738368*n + 2944971/8589934592*n^2 - 10021441/34359738368*n^3 - 48412679/68719476736*n^4 - 43782451/34359738368*n^5 - 46594423/34359738368*n^6 - 52867989/34359738368*n^7 - 70453029/68719476736*n^8 - 23159185/34359738368*n^9 + 12551255/34359738368*n^10) * eps^19
        + (109782837/68719476736 + 110884309/137438953472*n + 159981789/549755813888*n^2 - 106745493/1099511627776*n^3 - 717924527/1099511627776*n^4 - 15979315/17179869184*n^5 - 732221291/549755813888*n^6 - 21353761/17179869184*n^7 - 347832177/274877906944*n^8 - 732828227/1099511627776*n^9) * eps^20
        + (414212295/274877906944 + 394066451/549755813888*n + 797767751/2199023255552*n^2 - 13938969/137438953472*n^3 - 922185663/2199023255552*n^4 - 241117663/274877906944*n^5 - 70260475/68719476736*n^6 - 702480169/549755813888*n^7 - 2332298309/2199023255552*n^8) * eps^21
        + (3077054969/2199023255552 + 6225526419/8796093022208*n + 2760680993/8796093022208*n^2 + 107993597/4398046511104*n^3 - 3483012103/8796093022208*n^4 - 5569520181/8796093022208*n^5 - 4345994585/4398046511104*n^6 - 8944055483/8796093022208*n^7) * eps^22
        + (23336011385/17592186044416 + 5594946455/8796093022208*n + 6303559381/17592186044416*n^2 + 78999975/8796093022208*n^3 - 4164504717/17592186044416*n^4 - 330002595/549755813888*n^5 - 3315820133/4398046511104*n^6) * eps^23
        + (43652141925/35184372088832 + 5501899769/8796093022208*n + 22131275675/70368744177664*n^2 + 820267293/8796093022208*n^3 - 16179701905/70368744177664*n^4 - 1872775091/4398046511104*n^5) * eps^24
        + (41556934973/35184372088832 + 39939504101/70368744177664*n + 753834291/2199023255552*n^2 + 5148539461/70368744177664*n^3 - 4176807933/35184372088832*n^4) * eps^25
        + (312802619769/281474976710656 + 78374027619/140737488355328*n + 42845064993/140737488355328*n^2 + 18460662479/140737488355328*n^3) * eps^26
        + (298867963845/281474976710656 + 71700391575/140737488355328*n + 45431388475/140737488355328*n^2) * eps^27
        + (36174484487935/36028797018963968 + 8994085968251/18014398509481984*n) * eps^28
        + 34671257326469/36028797018963968 * eps^29;
C3[5] = + (21/2560 - 9/512*n + 15/1024*n^2 - 7/1024*n^3 + 9/5120*n^4 - 1/5120*n^5) * eps^5
        + (9/1024 - 15/1024*n + 3/2048*n^2 + 57/5120*n^3 - 5/512*n^4 + 9/2560*n^5 - 1/2048*n^6) * eps^6
        + (99/16384 - 91/16384*n - 781/81920*n^2 + 883/81920*n^3 + 319/81920*n^4 - 783/81920*n^5 + 387/81920*n^6 - 13/16384*n^7) * eps^7
        + (179/32768 - 55/16384*n - 79/10240*n^2 - 27/81920*n^3 + 461/40960*n^4 - 139/81920*n^5 - 65/8192*n^6 + 441/81920*n^7 - 35/32768*n^8) * eps^8
        + (141/32768 - 109/131072*n - 217/32768*n^2 - 219/65536*n^3 + 1559/327680*n^4 + 5431/655360*n^5 - 203/40960*n^6 - 1943/327680*n^7 + 369/65536*n^8 - 85/65536*n^9) * eps^9
        + (1013/262144 - 15/32768*n - 5399/1310720*n^2 - 199/40960*n^3 + 1267/1310720*n^4 + 1007/163840*n^5 + 6277/1310720*n^6 - 527/81920*n^7 - 659/163840*n^8 + 459/81920*n^9 - 969/655360*n^10) * eps^10
        + (6787/2097152 + 797/2097152*n - 34683/10485760*n^2 - 257/65536*n^3 - 7753/4194304*n^4 + 72641/20971520*n^5 + 115867/20971520*n^6 + 38817/20971520*n^7 - 142119/20971520*n^8 - 50133/20971520*n^9 + 113373/20971520*n^10 - 6783/4194304*n^11) * eps^11
        + (12315/4194304 + 799/2097152*n - 41519/20971520*n^2 - 19671/5242880*n^3 - 93317/41943040*n^4 + 12949/20971520*n^5 + 18211/4194304*n^6 + 86317/20971520*n^7 - 2971/10485760*n^8 - 135789/20971520*n^9 - 11229/10485760*n^10 + 107217/20971520*n^11 - 14421/8388608*n^12) * eps^12
        + (42753/16777216 + 11749/16777216*n - 534457/335544320*n^2 - 914519/335544320*n^3 - 953267/335544320*n^4 - 128591/335544320*n^5 + 354589/167772160*n^6 + 703457/167772160*n^7 + 433157/167772160*n^8 - 17697/10485760*n^9 - 1961579/335544320*n^10 - 2717/67108864*n^11 + 1600731/335544320*n^12 - 120175/67108864*n^13) * eps^13
        + (78439/33554432 + 41589/67108864*n - 606887/671088640*n^2 - 813811/335544320*n^3 - 795669/335544320*n^4 - 126481/83886080*n^5 + 693943/671088640*n^6 + 92775/33554432*n^7 + 1181311/335544320*n^8 + 409551/335544320*n^9 - 1692661/671088640*n^10 - 1705561/335544320*n^11 + 124729/167772160*n^12 + 148005/33554432*n^13 - 246675/134217728*n^14) * eps^14
        + (11153319/5368709120 + 806753/1073741824*n - 3945181/5368709120*n^2 - 9244317/5368709120*n^3 - 12780537/5368709120*n^4 - 8161927/5368709120*n^5 - 291353/1073741824*n^6 + 10250183/5368709120*n^7 + 15202259/5368709120*n^8 + 14255529/5368709120*n^9 + 710823/5368709120*n^10 - 3162357/1073741824*n^11 - 23067781/5368709120*n^12 + 1424137/1073741824*n^13 + 4351347/1073741824*n^14) * eps^15
        + (4132007/2147483648 + 710105/1073741824*n - 969349/2684354560*n^2 - 1619999/1073741824*n^3 - 5011741/2684354560*n^4 - 9930299/5368709120*n^5 - 1564801/2684354560*n^6 + 3561709/5368709120*n^7 + 1553999/671088640*n^8 + 13695849/5368709120*n^9 + 4792721/2684354560*n^10 - 3635919/5368709120*n^11 - 8283611/2684354560*n^12 - 3808363/1073741824*n^13) * eps^16
        + (3734859/2147483648 + 6155471/8589934592*n - 789297/2684354560*n^2 - 11355613/10737418240*n^3 - 37704683/21474836480*n^4 - 67981809/42949672960*n^5 - 4910633/4294967296*n^6 + 122353/536870912*n^7 + 13584809/10737418240*n^8 + 102204983/42949672960*n^9 + 22521571/10737418240*n^10 + 5393991/5368709120*n^11 - 26677631/21474836480*n^12) * eps^17
        + (27894537/17179869184 + 341135/536870912*n - 6919577/85899345920*n^2 - 9962193/10737418240*n^3 - 116140263/85899345920*n^4 - 35024383/21474836480*n^5 - 93895333/85899345920*n^6 - 9724319/21474836480*n^7 + 71547201/85899345920*n^8 + 16957261/10737418240*n^9 + 38167643/17179869184*n^10 + 4254817/2684354560*n^11) * eps^18
        + (102149077/68719476736 + 45149747/68719476736*n - 5268353/85899345920*n^2 - 438238873/687194767360*n^3 - 21374577/17179869184*n^4 - 229885771/171798691840*n^5 - 111314271/85899345920*n^6 - 190649511/343597383680*n^7 + 21780193/171798691840*n^8 + 42150359/34359738368*n^9 + 575291951/343597383680*n^10) * eps^19
        + (191992897/137438953472 + 10102641/17179869184*n + 91038377/1374389534720*n^2 - 48406631/85899345920*n^3 - 1306192047/1374389534720*n^4 - 111829633/85899345920*n^5 - 775578061/687194767360*n^6 - 75280887/85899345920*n^7 - 41514599/687194767360*n^8 + 38659177/68719476736*n^9) * eps^20
        + (355055163/274877906944 + 653193131/1099511627776*n + 347941049/5497558138880*n^2 - 2051760759/5497558138880*n^3 - 4780409067/5497558138880*n^4 - 2891926301/2748779069440*n^5 - 3246633917/2748779069440*n^6 - 2255299589/2748779069440*n^7 - 500938259/1099511627776*n^8) * eps^21
        + (2684106857/2199023255552 + 589926107/1099511627776*n + 391603487/2748779069440*n^2 - 1831096049/5497558138880*n^3 - 7250179399/10995116277760*n^4 - 687030501/687194767360*n^5 - 2742957537/2748779069440*n^6 - 2629744457/2748779069440*n^7) * eps^22
        + (20014266089/17592186044416 + 9415408371/17592186044416*n + 2280678869/17592186044416*n^2 - 18044662719/87960930222080*n^3 - 10627395203/17592186044416*n^4 - 70583370027/87960930222080*n^5 - 10917838539/10995116277760*n^6) * eps^23
        + (38001723933/35184372088832 + 8573148395/17592186044416*n + 7931117147/43980465111040*n^2 - 16302072297/87960930222080*n^3 - 39871150043/87960930222080*n^4 - 33222569643/43980465111040*n^5) * eps^24
        + (178265154501/175921860444160 + 67917412749/140737488355328*n + 7195977601/43980465111040*n^2 - 17107988587/175921860444160*n^3 - 73408496063/175921860444160*n^4) * eps^25
        + (271858418651/281474976710656 + 3893205391/8796093022208*n + 277112865109/1407374883553280*n^2 - 1966777807/21990232555520*n^3) * eps^26
        + (4103246283741/4503599627370496 + 1965390008631/4503599627370496*n + 4035517048233/22517998136852480*n^2) * eps^27
        + (7848710341433/9007199254740992 + 1814136297259/4503599627370496*n) * eps^28
        + 29752988542989/36028797018963968 * eps^29;
C3[6] = + (11/2048 - 99/8192*n + 275/24576*n^2 - 77/12288*n^3 + 9/4096*n^4 - 11/24576*n^5 + 1/24576*n^6) * eps^6
        + (99/16384 - 275/24576*n + 55/16384*n^2 + 167/24576*n^3 - 407/49152*n^4 + 35/8192*n^5 - 55/49152*n^6 + 1/8192*n^7) * eps^7
        + (143/32768 - 253/49152*n - 1105/196608*n^2 + 481/49152*n^3 - 73/196608*n^4 - 169/24576*n^5 + 1067/196608*n^6 - 11/6144*n^7 + 15/65536*n^8) * eps^8
        + (33/8192 - 221/65536*n - 23/4096*n^2 + 457/196608*n^3 + 267/32768*n^4 - 329/65536*n^5 - 69/16384*n^6 + 375/65536*n^7 - 77/32768*n^8 + 17/49152*n^9) * eps^9
        + (1711/524288 - 4333/3145728*n - 16885/3145728*n^2 - 1343/1572864*n^3 + 17381/3145728*n^4 + 8519/2097152*n^5 - 42985/6291456*n^6 - 4885/3145728*n^7 + 8549/1572864*n^8 - 5797/2097152*n^9 + 969/2097152*n^10) * eps^10
        + (6223/2097152 - 2827/3145728*n - 23731/6291456*n^2 - 8959/3145728*n^3 + 11937/4194304*n^4 + 32207/6291456*n^5 + 5071/12582912*n^6 - 42571/6291456*n^7 + 7489/12582912*n^8 + 10115/2097152*n^9 - 12749/4194304*n^10 + 1197/2097152*n^11) * eps^11
        + (31829/12582912 - 647/4194304*n - 13305/4194304*n^2 - 23369/8388608*n^3 + 981/4194304*n^4 + 53003/12582912*n^5 + 161989/50331648*n^6 - 25313/12582912*n^7 - 288887/50331648*n^8 + 8937/4194304*n^9 + 204725/50331648*n^10 - 80465/25165824*n^11 + 33649/50331648*n^12) * eps^12
        + (19409/8388608 - 143/4194304*n - 108221/50331648*n^2 - 37559/12582912*n^3 - 11319/16777216*n^4 + 110569/50331648*n^5 + 49103/12582912*n^6 + 19233/16777216*n^7 - 6811/2097152*n^8 - 73151/16777216*n^9 + 156973/50331648*n^10 + 165187/50331648*n^11 - 164197/50331648*n^12 + 6325/8388608*n^13) * eps^13
        + (136403/67108864 + 149829/536870912*n - 951655/536870912*n^2 - 1940579/805306368*n^3 - 1290821/805306368*n^4 + 1817813/1610612736*n^5 + 4654573/1610612736*n^6 + 374953/134217728*n^7 - 210217/402653184*n^8 - 1945219/536870912*n^9 - 1593647/536870912*n^10 + 2958659/805306368*n^11 + 2038421/805306368*n^12 - 5245955/1610612736*n^13 + 444015/536870912*n^14) * eps^14
        + (2013531/1073741824 + 153447/536870912*n - 3812959/3221225472*n^2 - 3623809/1610612736*n^3 - 1720969/1073741824*n^4 - 155419/1610612736*n^5 + 2321319/1073741824*n^6 + 1446653/536870912*n^7 + 4820965/3221225472*n^8 - 881605/536870912*n^9 - 11135251/3221225472*n^10 - 927839/536870912*n^11 + 12596617/3221225472*n^12 + 2976545/1610612736*n^13 - 3437005/1073741824*n^14) * eps^15
        + (3610319/2147483648 + 689891/1610612736*n - 4192091/4294967296*n^2 - 5626007/3221225472*n^3 - 23482225/12884901888*n^4 - 63477/134217728*n^5 + 13148195/12884901888*n^6 + 2657655/1073741824*n^7 + 8738873/4294967296*n^8 + 89999/268435456*n^9 - 9718455/4294967296*n^10 - 9643399/3221225472*n^11 - 9027109/12884901888*n^12 + 1580215/402653184*n^13) * eps^16
        + (3357815/2147483648 + 5140585/12884901888*n - 1357887/2147483648*n^2 - 20205383/12884901888*n^3 - 10165433/6442450944*n^4 - 12859795/12884901888*n^5 + 3376837/6442450944*n^6 + 20985541/12884901888*n^7 + 14739271/6442450944*n^8 + 5247007/4294967296*n^9 - 3621415/6442450944*n^10 - 32175059/12884901888*n^11 - 15465929/6442450944*n^12) * eps^17
        + (73325191/51539607552 + 16029851/34359738368*n - 17954851/34359738368*n^2 - 124000031/103079215104*n^3 - 107691583/68719476736*n^4 - 26099447/25769803776*n^5 - 10228585/68719476736*n^6 + 124145675/103079215104*n^7 + 371070857/206158430208*n^8 + 11745371/6442450944*n^9 + 91139599/206158430208*n^10 - 30320905/25769803776*n^11) * eps^18
        + (91563605/68719476736 + 44091817/103079215104*n - 10830499/34359738368*n^2 - 27517235/25769803776*n^3 - 268855985/206158430208*n^4 - 82123075/68719476736*n^5 - 69647705/206158430208*n^6 + 109205227/206158430208*n^7 + 319534237/206158430208*n^8 + 114455667/68719476736*n^9 + 64469791/51539607552*n^10) * eps^19
        + (168518401/137438953472 + 189582913/412316860416*n - 142520949/549755813888*n^2 - 671006539/824633720832*n^3 - 2036680639/1649267441664*n^4 - 888938183/824633720832*n^5 - 275851423/412316860416*n^6 + 73762303/274877906944*n^7 + 200547467/206158430208*n^8 + 445330347/274877906944*n^9) * eps^20
        + (317520693/274877906944 + 231509165/549755813888*n - 214107557/1649267441664*n^2 - 396525643/549755813888*n^3 - 278406799/274877906944*n^4 - 920067617/824633720832*n^5 - 564306103/824633720832*n^6 - 58960025/412316860416*n^7 + 595823299/824633720832*n^8) * eps^21
        + (2358489413/2199023255552 + 11489787637/26388279066624*n - 908814505/8796093022208*n^2 - 2396614237/4398046511104*n^3 - 12411634453/13194139533312*n^4 - 8522185111/8796093022208*n^5 - 21849837611/26388279066624*n^6 - 2193761283/8796093022208*n^7) * eps^22
        + (17864718441/17592186044416 + 10555835899/26388279066624*n - 1055263841/52776558133248*n^2 - 4259460285/8796093022208*n^3 - 40456260929/52776558133248*n^4 - 25125823283/26388279066624*n^5 - 20228133965/26388279066624*n^6) * eps^23
        + (100244499991/105553116266496 + 7127188931/17592186044416*n - 2047769071/211106232532992*n^2 - 19029851431/52776558133248*n^3 - 49723762631/70368744177664*n^4 - 21473509045/26388279066624*n^5) * eps^24
        + (7943510175/8796093022208 + 78919576567/211106232532992*n + 2396202703/52776558133248*n^2 - 67906408573/211106232532992*n^3 - 30263574227/52776558133248*n^4) * eps^25
        + (956603287889/1125899906842624 + 2527332335909/6755399441055744*n + 105375782699/2251799813685248*n^2 - 394588464167/1688849860263936*n^3) * eps^26
        + (3651975781065/4503599627370496 + 780981164949/2251799813685248*n + 378631414483/4503599627370496*n^2) * eps^27
        + (6906351178529/9007199254740992 + 9311073056275/27021597764222976*n) * eps^28
        + 13225333818489/18014398509481984 * eps^29;
C3[7] = + (429/114688 - 143/16384*n + 143/16384*n^2 - 91/16384*n^3 + 39/16384*n^4 - 11/16384*n^5 + 13/114688*n^6 - 1/114688*n^7) * eps^7
        + (143/32768 - 143/16384*n + 65/16384*n^2 + 65/16384*n^3 - 109/16384*n^4 + 507/114688*n^5 - 27/16384*n^6 + 39/114688*n^7 - 1/32768*n^8) * eps^8
        + (429/131072 - 299/65536*n - 13/4096*n^2 + 269/32768*n^3 - 601/229376*n^4 - 989/229376*n^5 + 9475/1835008*n^6 - 4667/1835008*n^7 + 1157/1835008*n^8 - 17/262144*n^9) * eps^9
        + (403/131072 - 13/4096*n - 521/131072*n^2 + 393/114688*n^3 + 1209/229376*n^4 - 11001/1835008*n^5 - 3979/3670016*n^6 + 8821/1835008*n^7 - 833/262144*n^8 + 429/458752*n^9 - 57/524288*n^10) * eps^10
        + (5343/2097152 - 3345/2097152*n - 8863/2097152*n^2 + 2511/3670016*n^3 + 146613/29360128*n^4 + 27159/29360128*n^5 - 185267/29360128*n^6 + 47549/29360128*n^7 + 112179/29360128*n^8 - 103371/29360128*n^9 + 35815/29360128*n^10 - 665/4194304*n^11) * eps^11
        + (9825/4194304 - 2337/2097152*n - 13661/4194304*n^2 - 1405/1048576*n^3 + 205965/58720256*n^4 + 98019/29360128*n^5 - 15733/7340032*n^6 - 145237/29360128*n^7 + 99087/29360128*n^8 + 76233/29360128*n^9 - 106087/29360128*n^10 + 6149/4194304*n^11 - 1771/8388608*n^12) * eps^12
        + (2125/1048576 - 3903/8388608*n - 96259/33554432*n^2 - 410489/234881024*n^3 + 341577/234881024*n^4 + 441667/117440512*n^5 + 102545/117440512*n^6 - 411905/117440512*n^7 - 44531/14680064*n^8 + 996015/234881024*n^9 + 324603/234881024*n^10 - 118019/33554432*n^11 + 55913/33554432*n^12 - 8855/33554432*n^13) * eps^13
        + (31337/16777216 - 9845/33554432*n - 141287/67108864*n^2 - 514903/234881024*n^3 + 213351/469762048*n^4 + 158209/58720256*n^5 + 299101/117440512*n^6 - 132045/117440512*n^7 - 1686973/469762048*n^8 - 284559/234881024*n^9 + 1041819/234881024*n^10 + 72061/234881024*n^11 - 773421/234881024*n^12 + 213785/117440512*n^13 - 148005/469762048*n^14) * eps^14
        + (1780203/1073741824 + 2521/1073741824*n - 1916449/1073741824*n^2 - 14648021/7516192768*n^3 - 606289/1073741824*n^4 + 2068453/1073741824*n^5 + 19266365/7516192768*n^6 + 1015577/1073741824*n^7 - 17180199/7516192768*n^8 - 22143117/7516192768*n^9 + 1831549/7516192768*n^10 + 4498521/1073741824*n^11 - 4339571/7516192768*n^12 - 22471345/7516192768*n^13 + 14517945/7516192768*n^14) * eps^15
        + (3302903/2147483648 + 61025/1073741824*n - 1392303/1073741824*n^2 - 14509913/7516192768*n^3 - 6298927/7516192768*n^4 + 6457051/7516192768*n^5 + 17971091/7516192768*n^6 + 12735795/7516192768*n^7 - 3219137/7516192768*n^8 - 20216205/7516192768*n^9 - 15046077/7516192768*n^10 + 9532867/7516192768*n^11 + 3961599/1073741824*n^12 - 9497345/7516192768*n^13) * eps^16
        + (2983837/2147483648 + 1733855/8589934592*n - 4685403/4294967296*n^2 - 48201865/30064771072*n^3 - 36259515/30064771072*n^4 + 5527869/15032385536*n^5 + 1536743/939524096*n^6 + 63232859/30064771072*n^7 + 73671/117440512*n^8 - 1449355/1073741824*n^9 - 76937885/30064771072*n^10 - 30946235/30064771072*n^11 + 3570999/1879048192*n^12) * eps^17
        + (22292529/17179869184 + 899355/4294967296*n - 13492583/17179869184*n^2 - 44700791/30064771072*n^3 - 70120189/60129542144*n^4 - 3471339/15032385536*n^5 + 72969301/60129542144*n^6 + 478067/268435456*n^7 + 85725937/60129542144*n^8 - 9546319/30064771072*n^9 - 109115611/60129542144*n^10 - 63656897/30064771072*n^11) * eps^18
        + (81611253/68719476736 + 19508379/68719476736*n - 2837849/4294967296*n^2 - 1163707393/962072674304*n^3 - 75492929/60129542144*n^4 - 25075777/60129542144*n^5 + 141589169/240518168576*n^6 + 109200085/68719476736*n^7 + 51248003/34359738368*n^8 + 19485265/30064771072*n^9 - 68932559/68719476736*n^10) * eps^19
        + (153351409/137438953472 + 1171063/4294967296*n - 128254133/274877906944*n^2 - 32936875/30064771072*n^3 - 2152615067/1924145348608*n^4 - 167428859/240518168576*n^5 + 297094515/962072674304*n^6 + 261663431/240518168576*n^7 + 1509210613/962072674304*n^8 + 472288869/481036337152*n^9) * eps^20
        + (1984807995/1924145348608 + 342786907/1099511627776*n - 215809073/549755813888*n^2 - 3403522219/3848290697216*n^3 - 2125818367/1924145348608*n^4 - 5503162739/7696581394432*n^5 - 36779903/481036337152*n^6 + 1607563715/1924145348608*n^7 + 4856829545/3848290697216*n^8) * eps^21
        + (2142375089/2199023255552 + 161430897/549755813888*n - 585488823/2199023255552*n^2 - 3056980555/3848290697216*n^3 - 14718114487/15393162788864*n^4 - 793901309/962072674304*n^5 - 3165663579/15393162788864*n^6 + 420223757/962072674304*n^7) * eps^22
        + (15972732585/17592186044416 + 5524675807/17592186044416*n - 3921720195/17592186044416*n^2 - 78636170271/123145302310912*n^3 - 112176079097/123145302310912*n^4 - 94959230613/123145302310912*n^5 - 12796244065/30786325577728*n^6) * eps^23
        + (30308424633/35184372088832 + 5175108963/17592186044416*n - 2441010467/17592186044416*n^2 - 70491037987/123145302310912*n^3 - 47936493201/61572651155456*n^4 - 49286431235/61572651155456*n^5) * eps^24
        + (227458182793/281474976710656 + 85653158665/281474976710656*n - 16050121299/140737488355328*n^2 - 451259285829/985162418487296*n^3 - 718664673347/985162418487296*n^4) * eps^25
        + (433302064951/562949953421312 + 40095993459/140737488355328*n - 31913675941/562949953421312*n^2 - 57834268753/140737488355328*n^3) * eps^26
        + (3269693185065/4503599627370496 + 1302630681669/4503599627370496*n - 195127280595/4503599627370496*n^2) * eps^27
        + (6249998138435/9007199254740992 + 1221397131411/4503599627370496*n) * eps^28
        + 5922672166091/9007199254740992 * eps^29;
C3[8] = + (715/262144 - 429/65536*n + 455/65536*n^2 - 637/131072*n^3 + 315/131072*n^4 - 55/65536*n^5 + 13/65536*n^6 - 15/524288*n^7 + 1/524288*n^8) * eps^8
        + (429/131072 - 455/65536*n + 1053/262144*n^2 + 35/16384*n^3 - 1361/262144*n^4 + 69/16384*n^5 - 2095/1048576*n^6 + 77/131072*n^7 - 105/1048576*n^8 + 1/131072*n^9) * eps^9
        + (663/262144 - 4173/1048576*n - 1717/1048576*n^2 + 3485/524288*n^3 - 3825/1048576*n^4 - 9469/4194304*n^5 + 18469/4194304*n^6 - 6137/2097152*n^7 + 4455/4194304*n^8 - 885/4194304*n^9 + 19/1048576*n^10) * eps^10
        + (5057/2097152 - 3043/1048576*n - 5771/2097152*n^2 + 3893/1048576*n^3 + 25381/8388608*n^4 - 24103/4194304*n^5 + 8933/8388608*n^6 + 14179/4194304*n^7 - 28533/8388608*n^8 + 399/262144*n^9 - 2925/8388608*n^10 + 35/1048576*n^11) * eps^11
        + (4269/2097152 - 3449/2097152*n - 27455/8388608*n^2 + 104101/67108864*n^3 + 268897/67108864*n^4 - 17303/16777216*n^5 - 162199/33554432*n^6 + 27987/8388608*n^7 + 61363/33554432*n^8 - 115233/33554432*n^9 + 127809/67108864*n^10 - 33495/67108864*n^11 + 1771/33554432*n^12) * eps^12
        + (991/524288 - 10081/8388608*n - 365791/134217728*n^2 - 9717/33554432*n^3 + 465795/134217728*n^4 + 27547/16777216*n^5 - 106205/33554432*n^6 - 89529/33554432*n^7 + 289573/67108864*n^8 + 17427/67108864*n^9 - 420741/134217728*n^10 + 146465/67108864*n^11 - 87285/134217728*n^12 + 1265/16777216*n^13) * eps^13
        + (55563/33554432 - 344251/536870912*n - 1348101/536870912*n^2 - 244277/268435456*n^3 + 1091783/536870912*n^4 + 1517573/536870912*n^5 - 219671/268435456*n^6 - 915171/268435456*n^7 - 65579/134217728*n^8 + 2300175/536870912*n^9 - 565193/536870912*n^10 - 705799/268435456*n^11 + 1263413/536870912*n^12 - 426075/536870912*n^13 + 13455/134217728*n^14) * eps^14
        + (1650255/1073741824 - 242867/536870912*n - 2099405/1073741824*n^2 - 798587/536870912*n^3 + 1248445/1073741824*n^4 + 85085/33554432*n^5 + 1183963/1073741824*n^6 - 612017/268435456*n^7 - 2724453/1073741824*n^8 + 612213/536870912*n^9 + 3906577/1073741824*n^10 - 1079195/536870912*n^11 - 2173807/1073741824*n^12 + 651625/268435456*n^13 - 991575/1073741824*n^14) * eps^15
        + (92379/67108864 - 96367/536870912*n - 7319885/4294967296*n^2 - 6313853/4294967296*n^3 + 429327/2147483648*n^4 + 9301893/4294967296*n^5 + 15031227/8589934592*n^6 - 2278773/4294967296*n^7 - 22903967/8589934592*n^8 - 2725917/2147483648*n^9 + 4500833/2147483648*n^10 + 11631693/4294967296*n^11 - 5617393/2147483648*n^12 - 12008165/8589934592*n^13) * eps^16
        + (2756519/2147483648 - 430227/4294967296*n - 11245169/8589934592*n^2 - 6724689/4294967296*n^3 - 53143/268435456*n^4 + 11801191/8589934592*n^5 + 4420815/2147483648*n^6 + 4422845/8589934592*n^7 - 13431985/8589934592*n^8 - 1236311/536870912*n^9 - 519961/8589934592*n^10 + 5300279/2147483648*n^11 + 29579711/17179869184*n^12) * eps^17
        + (20057037/17179869184 + 1437191/34359738368*n - 38619865/34359738368*n^2 - 47458715/34359738368*n^3 - 11051395/17179869184*n^4 + 31753819/34359738368*n^5 + 923369/536870912*n^6 + 22435517/17179869184*n^7 - 20287619/34359738368*n^8 - 16694191/8589934592*n^9 - 53676765/34359738368*n^10 + 60038145/68719476736*n^11) * eps^18
        + (75219653/68719476736 + 2460657/34359738368*n - 3690307/4294967296*n^2 - 45693585/34359738368*n^3 - 12731745/17179869184*n^4 + 3014801/8589934592*n^5 + 102479649/68719476736*n^6 + 95223/67108864*n^7 + 12997523/34359738368*n^8 - 45081435/34359738368*n^9 - 250602523/137438953472*n^10) * eps^19
        + (138411809/137438953472 + 20479031/137438953472*n - 404248825/549755813888*n^2 - 623123853/549755813888*n^3 - 249636485/274877906944*n^4 + 24599285/274877906944*n^5 + 278247109/274877906944*n^6 + 206754789/137438953472*n^7 + 433813329/549755813888*n^8 - 463032277/1099511627776*n^9) * eps^20
        + (260886645/274877906944 + 85615081/549755813888*n - 614045309/1099511627776*n^2 - 577943525/549755813888*n^3 - 959520737/1099511627776*n^4 - 65018321/274877906944*n^5 + 412167595/549755813888*n^6 + 341178333/274877906944*n^7 + 2517056589/2199023255552*n^8) * eps^21
        + (1937599123/2199023255552 + 875827069/4398046511104*n - 2101908333/4398046511104*n^2 - 1944837617/2199023255552*n^3 - 4013825043/4398046511104*n^4 - 1514642649/4398046511104*n^5 + 52220173/137438953472*n^6 + 9631735815/8796093022208*n^7) * eps^22
        + (7338112607/8796093022208 + 858111205/4398046511104*n - 3151357309/8796093022208*n^2 - 3552063895/4398046511104*n^3 - 7304761733/8796093022208*n^4 - 1117242591/2199023255552*n^5 + 3576385429/17592186044416*n^6) * eps^23
        + (439177896603/562949953421312 + 30926258881/140737488355328*n - 43123141703/140737488355328*n^2 - 190181338763/281474976710656*n^3 - 230252313827/281474976710656*n^4 - 74140886391/140737488355328*n^5) * eps^24
        + (208758190031/281474976710656 + 29681117575/140737488355328*n - 126131044829/562949953421312*n^2 - 21573269697/35184372088832*n^3 - 409510620075/562949953421312*n^4) * eps^25
        + (392781497985/562949953421312 + 506107726005/2251799813685248*n - 429816687963/2251799813685248*n^2 - 575742720763/1125899906842624*n^3) * eps^26
        + (2997989980695/4503599627370496 + 481944654003/2251799813685248*n - 599801259897/4503599627370496*n^2) * eps^27
        + (2834595204413/4503599627370496 + 997668129067/4503599627370496*n) * eps^28
        + 2712992943545/4503599627370496 * eps^29;
C3[9] = + (2431/1179648 - 663/131072*n + 1105/196608*n^2 - 833/196608*n^3 + 153/65536*n^4 - 187/196608*n^5 + 221/786432*n^6 - 15/262144*n^7 + 17/2359296*n^8 - 1/2359296*n^9) * eps^9
        + (663/262144 - 1105/196608*n + 1003/262144*n^2 + 187/196608*n^3 - 391/98304*n^4 + 1003/262144*n^5 - 3425/1572864*n^6 + 1921/2359296*n^7 - 13/65536*n^8 + 17/589824*n^9 - 1/524288*n^10) * eps^10
        + (4199/2097152 - 21743/6291456*n - 4199/6291456*n^2 + 33269/6291456*n^3 - 50065/12582912*n^4 - 9443/12582912*n^5 + 14573/4194304*n^6 - 112667/37748736*n^7 + 53599/37748736*n^8 - 15487/37748736*n^9 + 2567/37748736*n^10 - 21/4194304*n^11) * eps^11
        + (8109/4194304 - 5491/2097152*n - 3893/2097152*n^2 + 11305/3145728*n^3 + 11799/8388608*n^4 - 187397/37748736*n^5 + 2753/1179648*n^6 + 24241/12582912*n^7 - 118771/37748736*n^8 + 73177/37748736*n^9 - 693/1048576*n^10 + 4675/37748736*n^11 - 253/25165824*n^12) * eps^12
        + (6953/4194304 - 80971/50331648*n - 252263/100663296*n^2 + 199465/100663296*n^3 + 895717/301989888*n^4 - 52205/25165824*n^5 - 482759/150994944*n^6 + 591815/150994944*n^7 + 2911/37748736*n^8 - 277705/100663296*n^9 + 689963/301989888*n^10 - 276985/301989888*n^11 + 58259/301989888*n^12 - 575/33554432*n^13) * eps^13
        + (52105/33554432 - 122417/100663296*n - 450521/201326592*n^2 + 40603/100663296*n^3 + 1865333/603979776*n^4 + 23971/75497472*n^5 - 972811/301989888*n^6 - 36503/50331648*n^7 + 811127/201326592*n^8 - 149813/100663296*n^9 - 153359/75497472*n^10 + 81805/33554432*n^11 - 43547/37748736*n^12 + 40885/150994944*n^13 - 1755/67108864*n^14) * eps^14
        + (4429673/3221225472 - 788207/1073741824*n - 6941611/3221225472*n^2 - 897577/3221225472*n^3 + 2356975/1073741824*n^4 + 17574277/9663676416*n^5 - 17208913/9663676416*n^6 - 8196295/3221225472*n^7 + 3937649/3221225472*n^8 + 10299955/3221225472*n^9 - 2716857/1073741824*n^10 - 3753553/3221225472*n^11 + 23362279/9663676416*n^12 - 13084435/9663676416*n^13 + 379015/1073741824*n^14) * eps^15
        + (2758463/2147483648 - 1758869/3221225472*n - 5672105/3221225472*n^2 - 973687/1073741824*n^3 + 14858035/9663676416*n^4 + 19887425/9663676416*n^5 - 32501/536870912*n^6 - 24418015/9663676416*n^7 - 5340461/4831838208*n^8 + 2428553/1073741824*n^9 + 19060745/9663676416*n^10 - 29342159/9663676416*n^11 - 2979365/9663676416*n^12 + 21844849/9663676416*n^13) * eps^16
        + (2490257/2147483648 - 7674811/25769803776*n - 20315813/12884901888*n^2 - 4435023/4294967296*n^3 + 27370555/38654705664*n^4 + 26375911/12884901888*n^5 + 1831967/2147483648*n^6 - 54254453/38654705664*n^7 - 10497871/4831838208*n^8 + 3956369/12884901888*n^9 + 32001391/12884901888*n^10 + 28530035/38654705664*n^11 - 59974063/19327352832*n^12) * eps^17
        + (18666393/17179869184 - 889513/4294967296*n - 21696367/17179869184*n^2 - 15580247/12884901888*n^3 + 3662981/12884901888*n^4 + 14977259/9663676416*n^5 + 9479491/6442450944*n^6 - 2887897/6442450944*n^7 - 73237177/38654705664*n^8 - 16269899/12884901888*n^9 + 50631997/38654705664*n^10 + 83059381/38654705664*n^11) * eps^18
        + (68321333/68719476736 - 14723375/206158430208*n - 56990675/51539607552*n^2 - 155817437/137438953472*n^3 - 18588719/103079215104*n^4 + 41892585/34359738368*n^5 + 57054647/38654705664*n^6 + 283540243/618475290624*n^7 - 22561439/17179869184*n^8 - 174386747/103079215104*n^9 - 158151485/618475290624*n^10) * eps^19
        + (128591121/137438953472 - 1479029/51539607552*n - 726294569/824633720832*n^2 - 305943/268435456*n^3 - 295907705/824633720832*n^4 + 113271359/154618822656*n^5 + 1807217413/1236950581248*n^6 + 32409209/38654705664*n^7 - 581666617/1236950581248*n^8 - 111277655/68719476736*n^9) * eps^20
        + (713238475/824633720832 + 53664037/1099511627776*n - 1263187013/1649267441664*n^2 - 1670261267/1649267441664*n^3 - 474955129/824633720832*n^4 + 4600090009/9895604649984*n^5 + 1438755463/1236950581248*n^6 + 314620739/274877906944*n^7 + 247598477/4947802324992*n^8) * eps^21
        + (1797792591/2199023255552 + 110680117/1649267441664*n - 4012013791/6597069766656*n^2 - 1590584081/1649267441664*n^3 - 1351592063/2199023255552*n^4 + 41953639/309237645312*n^5 + 19375684513/19791209299968*n^6 + 85456501/77309411328*n^7) * eps^22
        + (26806607255/35184372088832 + 11900807335/105553116266496*n - 55739761391/105553116266496*n^2 - 88591049429/105553116266496*n^3 - 24583779341/35184372088832*n^4 - 1960568177/105553116266496*n^5 + 212797419253/316659348799488*n^6) * eps^23
        + (50883408771/70368744177664 + 4164850661/35184372088832*n - 14681082863/35184372088832*n^2 - 82400553121/105553116266496*n^3 - 70910402069/105553116266496*n^4 - 67176278281/316659348799488*n^5) * eps^24
        + (190930903235/281474976710656 + 15383945467/105553116266496*n - 38240500283/105553116266496*n^2 - 35530344527/52776558133248*n^3 - 437558257621/633318697598976*n^4) * eps^25
        + (45468475229/70368744177664 + 15280317955/105553116266496*n - 19959778025/70368744177664*n^2 - 32689473503/52776558133248*n^3) * eps^26
        + (24702973639945/40532396646334464 + 726357235713/4503599627370496*n - 3324932711075/13510798882111488*n^2) * eps^27
        + (5246222852159/9007199254740992 + 706735196961/4503599627370496*n) * eps^28
        + 310707493777/562949953421312 * eps^29;
C3[10] = + (4199/2621440 - 4199/1048576*n + 4845/1048576*n^2 - 969/262144*n^3 + 2907/1310720*n^4 - 10659/10485760*n^5 + 741/2097152*n^6 - 95/1048576*n^7 + 17/1048576*n^8 - 19/10485760*n^9 + 1/10485760*n^10) * eps^10
        + (4199/2097152 - 4845/1048576*n + 7429/2097152*n^2 + 969/5242880*n^3 - 12597/4194304*n^4 + 35397/10485760*n^5 - 9329/4194304*n^6 + 2087/2097152*n^7 - 6479/20971520*n^8 + 135/2097152*n^9 - 171/20971520*n^10 + 1/2097152*n^11) * eps^11
        + (6783/4194304 - 12597/4194304*n - 2261/41943040*n^2 + 174743/41943040*n^3 - 164901/41943040*n^4 + 1539/5242880*n^5 + 214809/83886080*n^6 - 29519/10485760*n^7 + 139141/83886080*n^8 - 1631/2621440*n^9 + 12559/83886080*n^10 - 893/41943040*n^11 + 23/16777216*n^12) * eps^12
        + (13243/8388608 - 19703/8388608*n - 101099/83886080*n^2 + 138073/41943040*n^3 + 24719/83886080*n^4 - 337423/83886080*n^5 + 12363/4194304*n^6 + 57103/83886080*n^7 - 27323/10485760*n^8 + 178529/83886080*n^9 - 81173/83886080*n^10 + 4485/16777216*n^11 - 3553/83886080*n^12 + 25/8388608*n^13) * eps^13
        + (92055/67108864 - 822035/536870912*n - 1020015/536870912*n^2 + 574655/268435456*n^3 + 2734037/1342177280*n^4 - 6716637/2684354560*n^5 - 4712349/2684354560*n^6 + 158653/41943040*n^7 - 320995/268435456*n^8 - 4870931/2684354560*n^9 + 6209363/2684354560*n^10 - 1727177/1342177280*n^11 + 272823/671088640*n^12 - 38285/536870912*n^13 + 2925/536870912*n^14) * eps^14
        + (1390515/1073741824 - 638609/536870912*n - 9739457/5368709120*n^2 + 2244193/2684354560*n^3 + 2762359/1073741824*n^4 - 1609109/2684354560*n^5 - 14885329/5368709120*n^6 + 1720321/2684354560*n^7 + 3362447/1073741824*n^8 - 6643351/2684354560*n^9 - 4107621/5368709120*n^10 + 5967063/2684354560*n^11 - 8268441/5368709120*n^12 + 1490177/2684354560*n^13 - 575757/5368709120*n^14) * eps^15
        + (2486055/2147483648 - 416271/536870912*n - 39210607/21474836480*n^2 + 939667/5368709120*n^3 + 9060325/4294967296*n^4 + 2491453/2684354560*n^5 - 46473241/21474836480*n^6 - 3953531/2684354560*n^7 + 44317207/21474836480*n^8 + 9488381/5368709120*n^9 - 64785587/21474836480*n^10 + 739973/2684354560*n^11 + 41224629/21474836480*n^12 - 9171349/5368709120*n^13) * eps^16
        + (2335727/2147483648 - 2563477/4294967296*n - 16701111/10737418240*n^2 - 9668041/21474836480*n^3 + 17992927/10737418240*n^4 + 31720101/21474836480*n^5 - 2271699/2684354560*n^6 - 47531759/21474836480*n^7 + 1536949/10737418240*n^8 + 10243175/4294967296*n^9 + 3586031/10737418240*n^10 - 63134341/21474836480*n^11 + 12279279/10737418240*n^12) * eps^17
        + (16987677/17179869184 - 12817701/34359738368*n - 245571871/171798691840*n^2 - 113240313/171798691840*n^3 + 346569259/343597383680*n^4 + 74555269/42949672960*n^5 + 27207641/343597383680*n^6 - 297892471/171798691840*n^7 - 90518711/68719476736*n^8 + 56969301/42949672960*n^9 + 132544051/68719476736*n^10 - 17233729/21474836480*n^11) * eps^18
        + (63952469/68719476736 - 9581357/34359738368*n - 203499591/171798691840*n^2 - 76181293/85899345920*n^3 + 212001921/343597383680*n^4 + 103062223/68719476736*n^5 + 287585989/343597383680*n^6 - 73169205/68719476736*n^7 - 114638241/68719476736*n^8 - 59443911/343597383680*n^9 + 159059379/85899345920*n^10) * eps^19
        + (588367381/687194767360 - 20787795/137438953472*n - 2904705599/2748779069440*n^2 - 1224194119/1374389534720*n^3 + 476022861/2748779069440*n^4 + 1802954677/1374389534720*n^5 + 739674421/687194767360*n^6 - 326887271/1374389534720*n^7 - 530422339/343597383680*n^8 - 279426503/274877906944*n^9) * eps^20
        + (222258195/274877906944 - 55829477/549755813888*n - 477453485/549755813888*n^2 - 2590977593/2748779069440*n^3 - 58684921/1374389534720*n^4 + 1291134563/1374389534720*n^5 + 1706006381/1374389534720*n^6 + 33790047/137438953472*n^7 - 1348338613/1374389534720*n^8) * eps^21
        + (3301594169/4398046511104 - 453528367/17592186044416*n - 67434894591/87960930222080*n^2 - 38367823899/43980465111040*n^3 - 2503383779/8796093022208*n^4 + 62281465759/87960930222080*n^5 + 98226145519/87960930222080*n^6 + 5981539941/8796093022208*n^7) * eps^22
        + (25036620431/35184372088832 - 3706957/17592186044416*n - 110515260937/175921860444160*n^2 - 75242715363/87960930222080*n^3 - 13113832313/35184372088832*n^4 + 35799902519/87960930222080*n^5 + 181849615997/175921860444160*n^6) * eps^23
        + (46828608507/70368744177664 + 1623985719/35184372088832*n - 77781379687/140737488355328*n^2 - 135023615257/175921860444160*n^3 - 343735176087/703687441776640*n^4 + 21076200917/87960930222080*n^5) * eps^24
        + (22273557181/35184372088832 + 8209167567/140737488355328*n - 79486039261/175921860444160*n^2 - 512388782813/703687441776640*n^3 - 35491170583/70368744177664*n^4) * eps^25
        + (670564680061/1125899906842624 + 196582254575/2251799813685248*n - 4472224828261/11258999068426240*n^2 - 3626987174247/5629499534213120*n^3) * eps^26
        + (2559941004369/4503599627370496 + 206983074593/2251799813685248*n - 7284964906539/22517998136852480*n^2) * eps^27
        + (4841011900185/9007199254740992 + 992966911831/9007199254740992*n) * eps^28
        + 9267877312991/18014398509481984 * eps^29;
C3[11] = + (29393/23068672 - 6783/2097152*n + 8075/2097152*n^2 - 6783/2097152*n^3 + 8721/4194304*n^4 - 4389/4194304*n^5 + 1729/4194304*n^6 - 525/4194304*n^7 + 119/4194304*n^8 - 19/4194304*n^9 + 21/46137344*n^10 - 1/46137344*n^11) * eps^11
        + (6783/4194304 - 8075/2097152*n + 6783/2097152*n^2 - 323/1048576*n^3 - 18753/8388608*n^4 + 12255/4194304*n^5 - 9135/4194304*n^6 + 4711/4194304*n^7 - 219/524288*n^8 + 5131/46137344*n^9 - 85/4194304*n^10 + 105/46137344*n^11 - 1/8388608*n^12) * eps^12
        + (22287/16777216 - 5491/2097152*n + 22287/67108864*n^2 + 218937/67108864*n^3 - 247779/67108864*n^4 + 65849/67108864*n^5 + 58673/33554432*n^6 - 84249/33554432*n^7 + 655201/369098752*n^8 - 300367/369098752*n^9 + 187059/738197504*n^10 - 38619/738197504*n^11 + 4809/738197504*n^12 - 25/67108864*n^13) * eps^13
        + (5491/4194304 - 141151/67108864*n - 98363/134217728*n^2 + 196213/67108864*n^3 - 29417/67108864*n^4 - 52095/16777216*n^5 + 419083/134217728*n^6 - 103155/369098752*n^7 - 718191/369098752*n^8 + 1557273/738197504*n^9 - 1788277/1476395008*n^10 + 325161/738197504*n^11 - 6875/67108864*n^12 + 5187/369098752*n^13 - 117/134217728*n^14) * eps^14
        + (1235475/1073741824 - 1541223/1073741824*n - 1529937/1073741824*n^2 + 2296199/1073741824*n^3 + 1365211/1073741824*n^4 - 2738587/1073741824*n^5 - 7375295/11811160064*n^6 + 38530187/11811160064*n^7 - 23317551/11811160064*n^8 - 10011949/11811160064*n^9 + 24284837/11811160064*n^10 - 18010915/11811160064*n^11 + 7660305/11811160064*n^12 - 1998361/11811160064*n^13 + 300321/11811160064*n^14) * eps^15
        + (2349103/2147483648 - 1224911/1073741824*n - 781795/536870912*n^2 + 1166537/1073741824*n^3 + 1094423/536870912*n^4 - 13807153/11811160064*n^5 - 25077685/11811160064*n^6 + 17157263/11811160064*n^7 + 24268865/11811160064*n^8 - 33106325/11811160064*n^9 + 2076575/5905580032*n^10 + 19838275/11811160064*n^11 - 10084007/5905580032*n^12 + 10078335/11811160064*n^13) * eps^16
        + (2117379/2147483648 - 6739785/8589934592*n - 1646453/1073741824*n^2 + 261625/536870912*n^3 + 8131213/4294967296*n^4 + 20997261/94489280512*n^5 - 101979543/47244640256*n^6 - 530353/1073741824*n^7 + 828023/369098752*n^8 + 43716997/94489280512*n^9 - 65673747/23622320128*n^10 + 31841459/23622320128*n^11 + 52076665/47244640256*n^12) * eps^17
        + (15999297/17179869184 - 665231/1073741824*n - 23300153/17179869184*n^2 - 221463/2147483648*n^3 + 28505205/17179869184*n^4 + 3924281/4294967296*n^5 - 243226535/188978561024*n^6 - 77376389/47244640256*n^7 + 188744355/188978561024*n^8 + 45186567/23622320128*n^9 - 160724471/188978561024*n^10 - 25713125/11811160064*n^11) * eps^18
        + (58546741/68719476736 - 28776169/68719476736*n - 10980371/8589934592*n^2 - 48605103/137438953472*n^3 + 39670397/34359738368*n^4 + 31828611/23622320128*n^5 - 187541869/377957122048*n^6 - 115448809/68719476736*n^7 - 42158467/94489280512*n^8 + 82411933/47244640256*n^9 + 753396595/755914244096*n^10) * eps^19
        + (110659725/137438953472 - 2797611/8589934592*n - 299770405/274877906944*n^2 - 10459603/17179869184*n^3 + 226651699/274877906944*n^4 + 497934925/377957122048*n^5 + 409147909/1511828488192*n^6 - 510313799/377957122048*n^7 - 1751353333/1511828488192*n^8 + 493141905/755914244096*n^9) * eps^20
        + (818467293/1099511627776 - 56886273/274877906944*n - 2178023121/2199023255552*n^2 - 1468259459/2199023255552*n^3 + 936005777/2199023255552*n^4 + 30592744379/24189255811072*n^5 + 483964345/755914244096*n^6 - 2151235101/3023656976384*n^7 - 17107054983/12094627905536*n^8) * eps^21
        + (96937173/137438953472 - 338878191/2199023255552*n - 3672830975/4398046511104*n^2 - 1657202547/2199023255552*n^3 + 445677205/2199023255552*n^4 + 12225739435/12094627905536*n^5 + 45022865775/48378511622144*n^6 - 743433509/3023656976384*n^7) * eps^22
        + (23130670543/35184372088832 - 2857753463/35184372088832*n - 26305948157/35184372088832*n^2 - 25618373853/35184372088832*n^3 - 1549180705/35184372088832*n^4 + 324075281367/387028092977152*n^5 + 367058948627/387028092977152*n^6) * eps^23
        + (43968565791/70368744177664 - 1805535203/35184372088832*n - 2760991455/4398046511104*n^2 - 25963357003/35184372088832*n^3 - 177189123/1099511627776*n^4 + 225673037041/387028092977152*n^5) * eps^24
        + (41252640009/70368744177664 - 1485684057/281474976710656*n - 39333792359/70368744177664*n^2 - 95968855991/140737488355328*n^3 - 41727255371/140737488355328*n^4) * eps^25
        + (314637345025/562949953421312 + 791327487/70368744177664*n - 263720191503/562949953421312*n^2 - 5813138145/8796093022208*n^3) * eps^26
        + (2374498758045/4503599627370496 + 184441277827/4503599627370496*n - 1875159093121/4503599627370496*n^2) * eps^27
        + (4540838699861/9007199254740992 + 223044732129/4503599627370496*n) * eps^28
        + 17213216597955/36028797018963968 * eps^29;
C3[12] = + (52003/50331648 - 22287/8388608*n + 81719/25165824*n^2 - 572033/201326592*n^3 + 129789/67108864*n^4 - 52877/50331648*n^5 + 23023/50331648*n^6 - 5313/33554432*n^7 + 4301/100663296*n^8 - 437/50331648*n^9 + 21/16777216*n^10 - 23/201326592*n^11 + 1/201326592*n^12) * eps^12
        + (22287/16777216 - 81719/25165824*n + 393737/134217728*n^2 - 62491/100663296*n^3 - 658559/402653184*n^4 + 83743/33554432*n^5 - 417197/201326592*n^6 + 60467/50331648*n^7 - 34569/67108864*n^8 + 8287/50331648*n^9 - 15479/402653184*n^10 + 209/33554432*n^11 - 253/402653184*n^12 + 1/33554432*n^13) * eps^13
        + (37145/33554432 - 3692213/1610612736*n + 919885/1610612736*n^2 + 2047345/805306368*n^3 - 1807685/536870912*n^4 + 2268145/1610612736*n^5 + 107525/100663296*n^6 - 287615/134217728*n^7 + 1439165/805306368*n^8 - 1554985/1610612736*n^9 + 196337/536870912*n^10 - 78625/805306368*n^11 + 28451/1610612736*n^12 - 3151/1610612736*n^13 + 27/268435456*n^14) * eps^14
        + (1181211/1073741824 - 1011655/536870912*n - 1258123/3221225472*n^2 + 1368385/536870912*n^3 - 966345/1073741824*n^4 - 1845635/805306368*n^5 + 3249555/1073741824*n^6 - 32195/33554432*n^7 - 4125455/3221225472*n^8 + 1038315/536870912*n^9 - 1464041/1073741824*n^10 + 330167/536870912*n^11 - 602911/3221225472*n^12 + 5049/134217728*n^13 - 14651/3221225472*n^14) * eps^15
        + (2097163/2147483648 - 716243/536870912*n - 13577935/12884901888*n^2 + 26345695/12884901888*n^3 + 539465/805306368*n^4 - 30721445/12884901888*n^5 + 1671665/8589934592*n^6 + 16667215/6442450944*n^7 - 60325345/25769803776*n^8 - 7435/2147483648*n^9 + 3478199/2147483648*n^10 - 20654597/12884901888*n^11 + 11205989/12884901888*n^12 - 1294237/4294967296*n^13) * eps^16
        + (2006267/2147483648 - 4643355/4294967296*n - 29853701/25769803776*n^2 + 15623785/12884901888*n^3 + 19883891/12884901888*n^4 - 37991705/25769803776*n^5 - 12448665/8589934592*n^6 + 47094413/25769803776*n^7 + 6739069/6442450944*n^8 - 2864351/1073741824*n^9 + 30201445/25769803776*n^10 + 1058057/1073741824*n^11 - 10580051/6442450944*n^12) * eps^17
        + (43720079/51539607552 - 26598603/34359738368*n - 43949251/34359738368*n^2 + 71325415/103079215104*n^3 + 6957895/4294967296*n^4 - 2536467/8589934592*n^5 - 198525719/103079215104*n^6 + 13878817/51539607552*n^7 + 34508611/17179869184*n^8 - 52928069/103079215104*n^9 - 220720771/103079215104*n^10 + 66852739/34359738368*n^11) * eps^18
        + (55326431/68719476736 - 64299007/103079215104*n - 120784247/103079215104*n^2 + 15781747/103079215104*n^3 + 106472291/68719476736*n^4 + 14611239/34359738368*n^5 - 150547861/103079215104*n^6 - 103209593/103079215104*n^7 + 99804641/68719476736*n^8 + 123227375/103079215104*n^9 - 12788579/8589934592*n^10) * eps^19
        + (814404171/1099511627776 - 732481345/1649267441664*n - 466819643/412316860416*n^2 - 734752241/6597069766656*n^3 + 2621301201/2199023255552*n^4 + 785792285/824633720832*n^5 - 1433859853/1649267441664*n^6 - 770153889/549755813888*n^7 + 432049963/1649267441664*n^8 + 5608251079/3298534883328*n^9) * eps^20
        + (772604523/1099511627776 - 48760475/137438953472*n - 13077992689/13194139533312*n^2 - 1241891819/3298534883328*n^3 + 4110854519/4398046511104*n^4 + 3534181601/3298534883328*n^5 - 586500377/3298534883328*n^6 - 2275702691/1649267441664*n^7 - 3789336937/6597069766656*n^8) * eps^21
        + (358745439/549755813888 - 12934264661/52776558133248*n - 48333688039/52776558133248*n^2 - 4146286613/8796093022208*n^3 + 31281974437/52776558133248*n^4 + 59718172567/52776558133248*n^5 + 2095950701/8796093022208*n^6 - 25516746833/26388279066624*n^7) * eps^22
        + (21821485195/35184372088832 - 10108238849/52776558133248*n - 27769272537/35184372088832*n^2 - 10217136851/17592186044416*n^3 + 13447296309/35184372088832*n^4 + 2169033311/2199023255552*n^5 + 21069180867/35184372088832*n^6) * eps^23
        + (122479921063/211106232532992 - 2150084801/17592186044416*n - 302356197395/422212465065984*n^2 - 62203620647/105553116266496*n^3 + 20409605765/140737488355328*n^4 + 370492702933/422212465065984*n^5) * eps^24
        + (38901506935/70368744177664 - 12663469807/140737488355328*n - 43169763871/70368744177664*n^2 - 262080088265/422212465065984*n^3 + 4124183297/281474976710656*n^4) * eps^25
        + (292863078097/562949953421312 - 1583046845/35184372088832*n - 29152993591/52776558133248*n^2 - 1996652856445/3377699720527872*n^3) * eps^26
        + (69950118165/140737488355328 - 1807466357/70368744177664*n - 1063027613707/2251799813685248*n^2) * eps^27
        + (16935196336601/36028797018963968 + 223223833507/54043195528445952*n) * eps^28
        + 16221720992423/36028797018963968 * eps^29;
C3[13] = + (185725/218103808 - 37145/16777216*n + 185725/67108864*n^2 - 168245/67108864*n^3 + 120175/67108864*n^4 - 69575/67108864*n^5 + 16445/33554432*n^6 - 6325/33554432*n^7 + 1955/33554432*n^8 - 475/33554432*n^9 + 175/67108864*n^10 - 23/67108864*n^11 + 25/872415232*n^12 - 1/872415232*n^13) * eps^13
        + (37145/33554432 - 185725/67108864*n + 356155/134217728*n^2 - 54625/67108864*n^3 - 39215/33554432*n^4 + 8855/4194304*n^5 - 259325/134217728*n^6 + 41515/33554432*n^7 - 625/1048576*n^8 + 14765/67108864*n^9 - 8297/134217728*n^10 + 11225/872415232*n^11 - 63/33554432*n^12 + 75/436207616*n^13 - 1/134217728*n^14) * eps^14
        + (1002915/1073741824 - 2165335/1073741824*n + 766935/1073741824*n^2 + 2116575/1073741824*n^3 - 3237825/1073741824*n^4 + 1772265/1073741824*n^5 + 558555/1073741824*n^6 - 1889505/1073741824*n^7 + 1846575/1073741824*n^8 - 1148355/1073741824*n^9 + 6621687/13958643712*n^10 - 2147433/13958643712*n^11 + 502623/13958643712*n^12 - 80975/13958643712*n^13 + 8075/13958643712*n^14) * eps^15
        + (2008015/2147483648 - 1815735/1073741824*n - 76705/536870912*n^2 + 2357385/1073741824*n^3 - 19665/16777216*n^4 - 1726035/1073741824*n^5 + 1491465/536870912*n^6 - 1503195/1073741824*n^7 - 363375/536870912*n^8 + 23156505/13958643712*n^9 - 9914347/6979321856*n^10 + 10709897/13958643712*n^11 - 501361/1744830464*n^12 + 1052013/13958643712*n^13) * eps^16
        + (1798255/2147483648 - 10601045/8589934592*n - 1641165/2147483648*n^2 + 4086755/2147483648*n^3 + 913905/4294967296*n^4 - 18130905/8589934592*n^5 + 3204135/4294967296*n^6 + 1017741/536870912*n^7 - 33577953/13958643712*n^8 + 73063651/111669149696*n^9 + 1928075/1744830464*n^10 - 10703707/6979321856*n^11 + 57707979/55834574848*n^12) * eps^17
        + (13840365/17179869184 - 2184195/2147483648*n - 15684505/17179869184*n^2 + 1348605/1073741824*n^3 + 19080865/17179869184*n^4 - 6839475/4294967296*n^5 - 14431629/17179869184*n^6 + 105895953/55834574848*n^7 + 48950133/223338299392*n^8 - 7886043/3489660928*n^9 + 372503147/223338299392*n^10 + 8024167/27917287424*n^11) * eps^18
        + (101195745/137438953472 - 103316805/137438953472*n - 145814825/137438953472*n^2 + 56137605/68719476736*n^3 + 45844365/34359738368*n^4 - 11127843/17179869184*n^5 - 176827545/111669149696*n^6 + 177367791/223338299392*n^7 + 43666839/27917287424*n^8 - 502109665/446676598784*n^9 - 608048583/446676598784*n^10) * eps^19
        + (192942285/274877906944 - 84667255/137438953472*n - 276352515/274877906944*n^2 + 46276975/137438953472*n^3 + 190922955/137438953472*n^4 + 544527/17179869184*n^5 - 80867391/55834574848*n^6 - 46739031/111669149696*n^7 + 1413025611/893353197568*n^8 + 208444667/446676598784*n^9) * eps^20
        + (713651475/1099511627776 - 500804215/1099511627776*n - 2189663055/2199023255552*n^2 + 166841355/2199023255552*n^3 + 2545633095/2199023255552*n^4 + 1301305233/2199023255552*n^5 - 73499007/68719476736*n^6 - 3649124073/3573412790272*n^7 + 10673011569/14293651161088*n^8) * eps^21
        + (1358850675/2199023255552 - 816309985/2199023255552*n - 3925550751/4398046511104*n^2 - 411093181/2199023255552*n^3 + 1069809697/1099511627776*n^4 + 887786559/1099511627776*n^5 - 28489507799/57174604644352*n^6 - 4430888365/3573412790272*n^7) * eps^22
        + (20273133015/35184372088832 - 9511268919/35184372088832*n - 29503243001/35184372088832*n^2 - 10679084579/35184372088832*n^3 + 24333880611/35184372088832*n^4 + 33531947513/35184372088832*n^5 - 43359239675/457396837154816*n^6) * eps^23
        + (38647569279/70368744177664 - 7657024935/35184372088832*n - 25922041023/35184372088832*n^2 - 15045539631/35184372088832*n^3 + 17766942325/35184372088832*n^4 + 31659609403/35184372088832*n^5) * eps^24
        + (36274342699/70368744177664 - 42850331919/281474976710656*n - 11911257957/17592186044416*n^2 - 64900868793/140737488355328*n^3 + 40343787423/140737488355328*n^4) * eps^25
        + (277172296351/562949953421312 - 2094012549/17592186044416*n - 332189237881/562949953421312*n^2 - 35829993671/70368744177664*n^3) * eps^26
        + (1046221099377/2251799813685248 - 170172833119/2251799813685248*n - 604554123131/1125899906842624*n^2) * eps^27
        + (2003125009747/4503599627370496 - 61476552589/1125899906842624*n) * eps^28
        + 15190705138949/36028797018963968 * eps^29;
C3[14] = + (334305/469762048 - 1002915/536870912*n + 1278225/536870912*n^2 - 596505/268435456*n^3 + 444015/268435456*n^4 - 542685/536870912*n^5 + 1924065/3758096384*n^6 - 201825/939524096*n^7 + 9945/134217728*n^8 - 11115/536870912*n^9 + 2457/536870912*n^10 - 207/268435456*n^11 + 25/268435456*n^12 - 27/3758096384*n^13 + 1/3758096384*n^14) * eps^14
        + (1002915/1073741824 - 1278225/536870912*n + 2576115/1073741824*n^2 - 497835/536870912*n^3 - 865605/1073741824*n^4 + 6660225/3758096384*n^5 - 1906125/1073741824*n^6 + 4658355/3758096384*n^7 - 707265/1073741824*n^8 + 146835/536870912*n^9 - 95481/1073741824*n^10 + 11985/536870912*n^11 - 31527/7516192768*n^12 + 299/536870912*n^13 - 351/7516192768*n^14) * eps^15
        + (1710855/2147483648 - 478515/268435456*n + 3411705/4294967296*n^2 + 1630815/1073741824*n^3 - 80250105/30064771072*n^4 + 6633315/3758096384*n^5 + 2765295/30064771072*n^6 - 10456095/7516192768*n^7 + 48041487/30064771072*n^8 - 604737/536870912*n^9 + 2449717/4294967296*n^10 - 1624435/7516192768*n^11 + 1847371/30064771072*n^12 - 48169/3758096384*n^13) * eps^16
        + (1723965/2147483648 - 6533265/4294967296*n + 76935/2147483648*n^2 + 56398185/30064771072*n^3 - 19759875/15032385536*n^4 - 31583175/30064771072*n^5 + 36921495/15032385536*n^6 - 49642983/30064771072*n^7 - 355569/2147483648*n^8 + 40109813/30064771072*n^9 - 20948701/15032385536*n^10 + 26526277/30064771072*n^11 - 5886663/15032385536*n^12) * eps^17
        + (24894855/34359738368 - 78264285/68719476736*n - 36988485/68719476736*n^2 + 418581945/240518168576*n^3 - 60094815/481036337152*n^4 - 107991795/60129542144*n^5 + 522459795/481036337152*n^6 + 303630087/240518168576*n^7 - 1091940219/481036337152*n^8 + 33522753/30064771072*n^9 + 40499933/68719476736*n^10 - 324917351/240518168576*n^11) * eps^18
        + (96292605/137438953472 - 65462715/68719476736*n - 97786455/137438953472*n^2 + 85607565/68719476736*n^3 + 359327175/481036337152*n^4 - 762768759/481036337152*n^5 - 159920877/481036337152*n^6 + 852547365/481036337152*n^7 - 189618327/481036337152*n^8 - 831922211/481036337152*n^9 + 903295221/481036337152*n^10) * eps^19
        + (177052965/274877906944 - 198593385/274877906944*n - 120299805/137438953472*n^2 + 850632495/962072674304*n^3 + 255130545/240518168576*n^4 - 1668127191/1924145348608*n^5 - 2324152365/1924145348608*n^6 + 2128566621/1924145348608*n^7 + 2025323859/1924145348608*n^8 - 2724276899/1924145348608*n^9) * eps^20
        + (338946975/549755813888 - 82552875/137438953472*n - 471549795/549755813888*n^2 + 446058513/962072674304*n^3 + 4645483323/3848290697216*n^4 - 514236729/1924145348608*n^5 - 2539636863/1924145348608*n^6 + 110256645/1924145348608*n^7 + 2860511727/1924145348608*n^8) * eps^21
        + (2519012745/4398046511104 - 8042808615/17592186044416*n - 15323258283/17592186044416*n^2 + 13365078339/61572651155456*n^3 + 2371903421/2199023255552*n^4 + 34764704609/123145302310912*n^5 - 139920418129/123145302310912*n^6 - 38482766489/61572651155456*n^7) * eps^22
        + (19248770055/35184372088832 - 6660671445/17592186044416*n - 28084233477/35184372088832*n^2 - 4351178653/123145302310912*n^3 + 236611923917/246290604621824*n^4 + 68150566051/123145302310912*n^5 - 172847147773/246290604621824*n^6) * eps^23
        + (36031799979/70368744177664 - 5033314047/17592186044416*n - 107266336785/140737488355328*n^2 - 20083658499/123145302310912*n^3 + 727351416229/985162418487296*n^4 + 46669684549/61572651155456*n^5) * eps^24
        + (34437446319/70368744177664 - 33102303575/140737488355328*n - 187327049/274877906944*n^2 - 290583351929/985162418487296*n^3 + 10224940189/17592186044416*n^4) * eps^25
        + (259380435671/562949953421312 - 195750751369/1125899906842624*n - 713851834615/1125899906842624*n^2 - 2727777187263/7881299347898368*n^3) * eps^26
        + (993200127657/2251799813685248 - 158323530281/1125899906842624*n - 631656315671/1125899906842624*n^2) * eps^27
        + (13155294584639/31525197391593472 - 13930847115/140737488355328*n) * eps^28
        + 112658685443/281474976710656 * eps^29;
C3[15] = + (646323/1073741824 - 1710855/1073741824*n + 2217775/1073741824*n^2 - 2124395/1073741824*n^3 + 1638819/1073741824*n^4 - 1049191/1073741824*n^5 + 563615/1073741824*n^6 - 254475/1073741824*n^7 + 96135/1073741824*n^8 - 150423/5368709120*n^9 + 38367/5368709120*n^10 - 4669/3221225472*n^11 + 725/3221225472*n^12 - 27/1073741824*n^13 + 29/16106127360*n^14) * eps^15
        + (1710855/2147483648 - 2217775/1073741824*n + 2331165/1073741824*n^2 - 1059863/1073741824*n^3 - 563615/1073741824*n^4 + 1586793/1073741824*n^5 - 1732315/1073741824*n^6 + 1306305/1073741824*n^7 - 3776409/5368709120*n^8 + 346173/1073741824*n^9 - 1902313/16106127360*n^10 + 36917/1073741824*n^11 - 25153/3221225472*n^12 + 21547/16106127360*n^13) * eps^16
        + (5892945/8589934592 - 6800065/4294967296*n + 3577121/4294967296*n^2 + 4983157/4294967296*n^3 - 10069699/4294967296*n^4 + 7701733/4294967296*n^5 - 502541/2147483648*n^6 - 1414127/1342177280*n^7 + 968223/671088640*n^8 - 6128483/5368709120*n^9 + 41761247/64424509440*n^10 - 18009853/64424509440*n^11 + 5979931/64424509440*n^12) * eps^17
        + (5972985/8589934592 - 5892945/4294967296*n + 22011/134217728*n^2 + 6844087/4294967296*n^3 - 5882157/4294967296*n^4 - 326337/536870912*n^5 + 18126537/8589934592*n^6 - 18908667/10737418240*n^7 + 2622383/10737418240*n^8 + 21415079/21474836480*n^9 - 55870711/42949672960*n^10 + 4095751/4294967296*n^11) * eps^18
        + (86853405/137438953472 - 144315455/137438953472*n - 49728185/137438953472*n^2 + 108068645/68719476736*n^3 - 12628253/34359738368*n^4 - 25408437/17179869184*n^5 + 43573631/34359738368*n^6 + 24761157/34359738368*n^7 - 17319235/8589934592*n^8 + 240067131/171798691840*n^9 + 31601183/257698037760*n^10) * eps^19
        + (168754335/274877906944 - 122304455/137438953472*n - 150252509/274877906944*n^2 + 165190351/137438953472*n^3 + 308731767/687194767360*n^4 - 257790947/171798691840*n^5 + 4546243/68719476736*n^6 + 264538841/171798691840*n^7 - 69252419/85899345920*n^8 - 101279697/85899345920*n^9) * eps^20
        + (9748205/17179869184 - 2961915/4294967296*n - 789535179/1099511627776*n^2 + 2502565179/2748779069440*n^3 + 892979397/1099511627776*n^4 - 4058500961/4123168604160*n^5 - 348426329/412316860416*n^6 + 858120331/687194767360*n^7 + 2315189833/4123168604160*n^8) * eps^21
        + (299705865/549755813888 - 638342925/1099511627776*n - 4003125229/5497558138880*n^2 + 3007831367/5497558138880*n^3 + 16848959603/16492674416640*n^4 - 1323821551/2748779069440*n^5 - 9300135223/8246337208320*n^6 + 169736315/412316860416*n^7) * eps^22
        + (17894468415/35184372088832 - 15913542447/35184372088832*n - 133457144181/175921860444160*n^2 + 56414449099/175921860444160*n^3 + 514339794913/527765581332480*n^4 + 15799330939/527765581332480*n^5 - 116951809217/105553116266496*n^6) * eps^23
        + (34289203599/70368744177664 - 13355533647/35184372088832*n - 37471080293/52776558133248*n^2 + 8836479539/105553116266496*n^3 + 80449237869/87960930222080*n^4 + 171417192913/527765581332480*n^5) * eps^24
        + (32203691103/70368744177664 - 249040377061/844424930131968*n - 484768709513/703687441776640*n^2 - 100719650663/2111062325329920*n^3 + 525315006811/703687441776640*n^4) * eps^25
        + (246854172911/562949953421312 - 104020069985/422212465065984*n - 5286374681359/8444249301319680*n^2 - 384367611317/2111062325329920*n^3) * eps^26
        + (932306372777/2251799813685248 - 425703913753/2251799813685248*n - 3317960448433/5629499534213120*n^2) * eps^27
        + (1788762256877/4503599627370496 - 528241493161/3377699720527872*n) * eps^28
        + 3392857970671/9007199254740992 * eps^29;
C3[16] = + (17678835/34359738368 - 5892945/4294967296*n + 7753875/4294967296*n^2 - 15197595/8589934592*n^3 + 12096045/8589934592*n^4 - 4032015/4294967296*n^5 + 2278965/4294967296*n^6 - 4382625/17179869184*n^7 + 1788111/17179869184*n^8 - 153729/4294967296*n^9 + 44051/4294967296*n^10 - 20677/8589934592*n^11 + 3875/8589934592*n^12 - 279/4294967296*n^13) * eps^16
        + (5892945/8589934592 - 7753875/4294967296*n + 33806895/17179869184*n^2 - 2171085/2147483648*n^3 - 5272635/17179869184*n^4 + 2629575/2147483648*n^5 - 49961925/34359738368*n^6 + 315549/268435456*n^7 - 25144131/34359738368*n^8 + 97991/268435456*n^9 - 2539675/17179869184*n^10 + 104315/2147483648*n^11 - 220193/17179869184*n^12) * eps^17
        + (10235115/17179869184 - 97078515/68719476736*n + 57998985/68719476736*n^2 + 30085035/34359738368*n^3 - 140769915/68719476736*n^4 + 242500755/137438953472*n^5 - 65388765/137438953472*n^6 - 51866007/68719476736*n^7 + 174649629/137438953472*n^8 - 154238733/137438953472*n^9 + 48486449/68719476736*n^10 - 11678227/34359738368*n^11) * eps^18
        + (83431695/137438953472 - 85292625/68719476736*n + 35047515/137438953472*n^2 + 92601495/68719476736*n^3 - 375786495/274877906944*n^4 - 36110133/137438953472*n^5 + 486541497/274877906944*n^6 - 243255915/137438953472*n^7 + 153035871/274877906944*n^8 + 46310869/68719476736*n^9 - 319425953/274877906944*n^10) * eps^19
        + (38149065/68719476736 - 133056495/137438953472*n - 123158505/549755813888*n^2 + 3098731635/2199023255552*n^3 - 1178980065/2199023255552*n^4 - 324619011/274877906944*n^5 + 183751105/137438953472*n^6 + 76834833/274877906944*n^7 - 937074355/549755813888*n^8 + 1685222465/1099511627776*n^9) * eps^20
        + (4652325/8589934592 - 456372855/549755813888*n - 1811480505/4398046511104*n^2 + 1251405303/1099511627776*n^3 + 925958313/4398046511104*n^4 - 1506611625/1099511627776*n^5 + 99867213/274877906944*n^6 + 172997329/137438953472*n^7 - 2305540773/2199023255552*n^8) * eps^21
        + (1106107125/2199023255552 - 11527530885/17592186044416*n - 10297013847/17592186044416*n^2 + 7988241603/8796093022208*n^3 + 10444117217/17592186044416*n^4 - 18068838281/17592186044416*n^5 - 4569806627/8796093022208*n^6 + 11141677047/8796093022208*n^7) * eps^22
        + (17062152465/35184372088832 - 9812616465/17592186044416*n - 21645687783/35184372088832*n^2 + 10515729759/17592186044416*n^3 + 29676530299/35184372088832*n^4 - 2748637785/4398046511104*n^5 - 31988983111/35184372088832*n^6) * eps^23
        + (63917467893/140737488355328 - 15585334599/35184372088832*n - 92640075585/140737488355328*n^2 + 55477610943/140737488355328*n^3 + 60444721971/70368744177664*n^4 - 23535121849/140737488355328*n^5) * eps^24
        + (15353322477/35184372088832 - 52919675455/140737488355328*n - 176994259657/281474976710656*n^2 + 24691209499/140737488355328*n^3 + 119255343701/140737488355328*n^4) * eps^25
        + (231447333341/562949953421312 - 336197745329/1125899906842624*n - 697975437421/1125899906842624*n^2 + 51290363939/1125899906842624*n^3) * eps^26
        + (889178086077/2251799813685248 - 284507373851/1125899906842624*n - 644017953049/1125899906842624*n^2) * eps^27
        + (1683573628847/4503599627370496 - 897506094655/4503599627370496*n) * eps^28
        + 3236675038231/9007199254740992 * eps^29;
C3[17] = + (64822395/146028888064 - 10235115/8589934592*n + 3411705/2147483648*n^2 - 3411705/2147483648*n^3 + 2791395/2147483648*n^4 - 1928355/2147483648*n^5 + 2278965/4294967296*n^6 - 1157013/4294967296*n^7 + 504339/4294967296*n^8 - 187891/4294967296*n^9 + 29667/2147483648*n^10 - 7843/2147483648*n^11 + 1705/2147483648*n^12) * eps^17
        + (10235115/17179869184 - 3411705/2147483648*n + 30705345/17179869184*n^2 - 2171085/2147483648*n^3 - 148335/1073741824*n^4 + 4328685/4294967296*n^5 - 11184459/8589934592*n^6 + 4819539/4294967296*n^7 - 801009/1073741824*n^8 + 860343/2147483648*n^9 - 1518473/8589934592*n^10 + 138105/2147483648*n^11) * eps^18
        + (71645805/137438953472 - 173996955/137438953472*n + 115067505/137438953472*n^2 + 89230245/137438953472*n^3 - 122538195/68719476736*n^4 + 116788191/68719476736*n^5 - 44648835/68719476736*n^6 - 34126939/68719476736*n^7 + 75175279/68719476736*n^8 - 73970743/68719476736*n^9 + 51014623/68719476736*n^10) * eps^19
        + (146703315/274877906944 - 154767345/137438953472*n + 43785795/137438953472*n^2 + 156007965/137438953472*n^3 - 364998495/274877906944*n^4 + 115971/68719476736*n^5 + 24948149/17179869184*n^6 - 117523573/68719476736*n^7 + 53786953/68719476736*n^8 + 26103457/68719476736*n^9) * eps^20
        + (134917425/274877906944 - 982018155/1099511627776*n - 128013105/1099511627776*n^2 + 172486635/137438953472*n^3 - 712641795/1099511627776*n^4 - 1003151847/1099511627776*n^5 + 365003889/274877906944*n^6 - 17906623/274877906944*n^7 - 94572227/68719476736*n^8) * eps^21
        + (1057102635/2199023255552 - 850997895/1099511627776*n - 663815307/2199023255552*n^2 + 1169497413/1099511627776*n^3 + 49560971/2199023255552*n^4 - 669423269/549755813888*n^5 + 1259901225/2199023255552*n^6 + 266092003/274877906944*n^7) * eps^22
        + (15777490455/35184372088832 - 21840324879/35184372088832*n - 16655962689/35184372088832*n^2 + 31191967407/35184372088832*n^3 + 14292320879/35184372088832*n^4 - 35796602007/35184372088832*n^5 - 8516465049/35184372088832*n^6) * eps^23
        + (30518839359/70368744177664 - 18775799295/35184372088832*n - 9098510199/17592186044416*n^2 + 21950540481/35184372088832*n^3 + 93296577/137438953472*n^4 - 25028086871/35184372088832*n^5) * eps^24
        + (28684124199/70368744177664 - 121237396839/281474976710656*n - 80108249325/140737488355328*n^2 + 62476546353/140737488355328*n^3 + 104269770907/140737488355328*n^4) * eps^25
        + (221067686111/562949953421312 - 51971219667/140737488355328*n - 312369078125/562949953421312*n^2 + 34424571581/140737488355328*n^3) * eps^26
        + (835594467657/2251799813685248 - 672205282129/2251799813685248*n - 9778893735/17592186044416*n^2) * eps^27
        + (1608685463477/4503599627370496 - 1123143299/4398046511104*n) * eps^28
        + 3053457067201/9007199254740992 * eps^29;
C3[18] = + (39803225/103079215104 - 71645805/68719476736*n + 96664975/68719476736*n^2 - 12302815/8589934592*n^3 + 10316025/8589934592*n^4 - 29419775/34359738368*n^5 + 18079789/34359738368*n^6 - 4814145/17179869184*n^7 + 20005447/154618822656*n^8 - 15970735/309237645312*n^9 + 608685/34359738368*n^10 - 133331/25769803776*n^11) * eps^18
        + (71645805/137438953472 - 96664975/68719476736*n + 223621755/137438953472*n^2 - 68391425/68719476736*n^3 - 534905/68719476736*n^4 + 28288833/34359738368*n^5 - 79700845/68719476736*n^6 + 328110727/309237645312*n^7 - 51427295/68719476736*n^8 + 132652751/309237645312*n^9 - 42045641/206158430208*n^10) * eps^19
        + (126233085/274877906944 - 313153165/274877906944*n + 450214705/549755813888*n^2 + 128894125/274877906944*n^3 - 851033855/549755813888*n^4 + 27708079/17179869184*n^5 - 635023933/824633720832*n^6 - 10743949/38654705664*n^7 + 2277775685/2473901162496*n^8 - 39095495/38654705664*n^9) * eps^20
        + (259599735/549755813888 - 563308905/549755813888*n + 6216585/17179869184*n^2 + 523725935/549755813888*n^3 - 696028275/549755813888*n^4 + 248241769/1236950581248*n^5 + 360205027/309237645312*n^6 - 1324703563/824633720832*n^7 + 578515831/618475290624*n^8) * eps^21
        + (1919738085/4398046511104 - 14510296015/17592186044416*n - 571757707/17592186044416*n^2 + 9787185553/8796093022208*n^3 - 14198943547/19791209299968*n^4 - 35731280915/52776558133248*n^5 + 200707555277/158329674399744*n^6 - 1602798301/4947802324992*n^7) * eps^22
        + (15095149455/35184372088832 - 12695123317/17592186044416*n - 7461993973/35184372088832*n^2 + 17320543045/17592186044416*n^3 - 38933502733/316659348799488*n^4 - 167508491351/158329674399744*n^5 + 225029316355/316659348799488*n^6) * eps^23
        + (28276211939/70368744177664 - 10324749795/17592186044416*n - 160063685731/422212465065984*n^2 + 44977263973/52776558133248*n^3 + 34943975527/140737488355328*n^4 - 76982106281/79164837199872*n^5) * eps^24
        + (27428616759/70368744177664 - 214928208341/422212465065984*n - 1901680771/4398046511104*n^2 + 266821592123/422212465065984*n^3 + 168025657159/316659348799488*n^4) * eps^25
        + (206917174391/562949953421312 - 1407328813243/3377699720527872*n - 1656940587997/3377699720527872*n^2 + 1604700872215/3377699720527872*n^3) * eps^26
        + (799328663817/2251799813685248 - 405743161697/1125899906842624*n - 17171897611/35184372088832*n^2) * eps^27
        + (1514801868617/4503599627370496 - 1997506016729/6755399441055744*n) * eps^28
        + 1461210130553/4503599627370496 * eps^29;
C3[19] = + (883631595/2611340115968 - 126233085/137438953472*n + 172136025/137438953472*n^2 - 178123365/137438953472*n^3 + 76338585/68719476736*n^4 - 55981629/68719476736*n^5 + 35624673/68719476736*n^6 - 19791485/68719476736*n^7 + 9613007/68719476736*n^8 - 4075291/68719476736*n^9 + 1501423/68719476736*n^10) * eps^19
        + (126233085/274877906944 - 172136025/137438953472*n + 204068505/137438953472*n^2 - 133218315/137438953472*n^3 + 25446195/274877906944*n^4 + 45803151/68719476736*n^5 - 70683875/68719476736*n^6 + 68421991/68719476736*n^7 - 12732847/17179869184*n^8 + 30944913/68719476736*n^9) * eps^20
        + (447553665/1099511627776 - 282901815/274877906944*n + 1744810665/2199023255552*n^2 + 714788607/2199023255552*n^3 - 2949064317/2199023255552*n^4 + 3330058719/2199023255552*n^5 - 466513575/549755813888*n^6 - 52627801/549755813888*n^7 + 415894171/549755813888*n^8) * eps^21
        + (231011535/549755813888 - 2056152345/2199023255552*n + 1715472699/4398046511104*n^2 + 1751396739/2199023255552*n^3 - 2620093247/2199023255552*n^4 + 381959029/1099511627776*n^5 + 4006284039/4398046511104*n^6 - 811840865/549755813888*n^7) * eps^22
        + (13730467455/35184372088832 - 26834758935/35184372088832*n + 1154658519/35184372088832*n^2 + 34587765501/35184372088832*n^3 - 26560472237/35184372088832*n^4 - 16713828219/35184372088832*n^5 + 41375557803/35184372088832*n^6) * eps^23
        + (27079840719/70368744177664 - 23683023159/35184372088832*n - 4885170495/35184372088832*n^2 + 31837181505/35184372088832*n^3 - 8213174937/35184372088832*n^4 - 31695410011/35184372088832*n^5) * eps^24
        + (25457271579/70368744177664 - 156005632095/281474976710656*n - 10545202575/35184372088832*n^2 + 114004448877/140737488355328*n^3 + 16505168273/140737488355328*n^4) * eps^25
        + (198096366191/562949953421312 - 17051245797/35184372088832*n - 202196269517/562949953421312*n^2 + 44120523793/70368744177664*n^3) * eps^26
        + (749484543777/2251799813685248 - 904154339527/2251799813685248*n - 237166138569/562949953421312*n^2) * eps^27
        + (1451001339947/4503599627370496 - 197052059395/562949953421312*n) * eps^28
        + 11027253546199/36028797018963968 * eps^29;
C3[20] = + (328206021/1099511627776 - 447553665/549755813888*n + 616197075/549755813888*n^2 - 2588027715/2199023255552*n^3 + 11313378297/10995116277760*n^4 - 1063650951/1374389534720*n^5 + 139671337/274877906944*n^6 - 161159235/549755813888*n^7 + 81876301/549755813888*n^8 - 91508807/1374389534720*n^9) * eps^20
        + (447553665/1099511627776 - 616197075/549755813888*n + 5973868485/4398046511104*n^2 - 5151407547/5497558138880*n^3 + 745124463/4398046511104*n^4 + 2933098077/5497558138880*n^5 - 999187257/1099511627776*n^6 + 255261409/274877906944*n^7 - 3993414699/5497558138880*n^8) * eps^21
        + (797813055/2199023255552 - 16416787335/17592186044416*n + 67175859231/87960930222080*n^2 + 9242357391/43980465111040*n^3 - 102015059749/87960930222080*n^4 + 124091978953/87960930222080*n^5 - 39356567111/43980465111040*n^6 + 592399119/10995116277760*n^7) * eps^22
        + (13225535115/35184372088832 - 15052072971/17592186044416*n + 71611679859/175921860444160*n^2 + 58313997297/87960930222080*n^3 - 195393281759/175921860444160*n^4 + 4977760923/10995116277760*n^5 + 24290150905/35184372088832*n^6) * eps^23
        + (24669936369/70368744177664 - 12424628601/17592186044416*n + 11746262979/140737488355328*n^2 + 30472467141/35184372088832*n^3 - 541082739303/703687441776640*n^4 - 214208596351/703687441776640*n^5) * eps^24
        + (24401503959/70368744177664 - 88423598371/140737488355328*n - 27848548649/351843720888320*n^2 + 582032816309/703687441776640*n^3 - 443970412913/1407374883553280*n^4) * eps^25
        + (184144866101/562949953421312 - 73617505285/140737488355328*n - 163863036307/703687441776640*n^2 + 4297898591023/5629499534213120*n^3) * eps^26
        + (89787248319/281474976710656 - 64845907663/140737488355328*n - 3332997588781/11258999068426240*n^2) * eps^27
        + (10901346434011/36028797018963968 - 6951464328397/18014398509481984*n) * eps^28
        + 10575447871909/36028797018963968 * eps^29;
C3[21] = + (2038855585/7696581394432 - 797813055/1099511627776*n + 2216147375/2199023255552*n^2 - 2357980807/2199023255552*n^3 + 2098862037/2199023255552*n^4 - 4845520999/6597069766656*n^5 + 5726524817/11544872091648*n^6 - 1139229075/3848290697216*n^7 + 258225257/1649267441664*n^8) * eps^21
        + (797813055/2199023255552 - 2216147375/2199023255552*n + 5478316311/4398046511104*n^2 - 1981576699/2199023255552*n^3 + 751444433/3298534883328*n^4 + 3238984625/7696581394432*n^5 - 10556856095/13194139533312*n^6 + 9949267255/11544872091648*n^7) * eps^22
        + (11435320455/35184372088832 - 29873666615/35184372088832*n + 25744131691/35184372088832*n^2 + 4163629499/35184372088832*n^3 - 739894554773/738871813865472*n^4 + 965405949493/738871813865472*n^5 - 677248006993/738871813865472*n^6) * eps^23
        + (23774829039/70368744177664 - 27620697099/35184372088832*n + 10971634235/26388279066624*n^2 + 405631341473/738871813865472*n^3 - 126601433727/123145302310912*n^4 + 129456725059/246290604621824*n^5) * eps^24
        + (22261029909/70368744177664 - 553102652395/844424930131968*n + 8620472343/70368744177664*n^2 + 2249783201615/2955487255461888*n^3 - 2263819350305/2955487255461888*n^4) * eps^25
        + (176646720641/562949953421312 - 123911959597/211106232532992*n - 51597036833/1688849860263936*n^2 + 39733441489/52776558133248*n^3) * eps^26
        + (1337288787659/4503599627370496 - 2222831651699/4503599627370496*n - 795233577023/4503599627370496*n^2) * eps^27
        + (2614429242859/9007199254740992 - 5913700976995/13510798882111488*n) * eps^28
        + 9945743757025/36028797018963968 * eps^29;
C3[22] = + (11435320455/48378511622144 - 11435320455/17592186044416*n + 16009448637/17592186044416*n^2 - 8620472343/8796093022208*n^3 + 7799474977/8796093022208*n^4 - 12256317821/17592186044416*n^5 + 8491054039/17592186044416*n^6 - 653158003/2199023255552*n^7) * eps^22
        + (11435320455/35184372088832 - 16009448637/17592186044416*n + 40287513603/35184372088832*n^2 - 15188451271/17592186044416*n^3 + 9558755047/35184372088832*n^4 + 5724737791/17592186044416*n^5 - 24704740937/35184372088832*n^6) * eps^23
        + (20583576819/70368744177664 - 27268841085/35184372088832*n + 98343755913/140737488355328*n^2 + 1583352063/35184372088832*n^3 - 121489410719/140737488355328*n^4 + 21194269441/17592186044416*n^5) * eps^24
        + (10731608427/35184372088832 - 101627745377/140737488355328*n + 14719309919/35184372088832*n^2 + 63574719679/140737488355328*n^3 - 66603916857/70368744177664*n^4) * eps^25
        + (322710607507/1125899906842624 - 1370068675847/2251799813685248*n + 343057591489/2251799813685248*n^2 + 751691842047/1125899906842624*n^3) * eps^26
        + (1283746667079/4503599627370496 - 1236043889089/2251799813685248*n + 40279424959/4503599627370496*n^2) * eps^27
        + (2436782869279/9007199254740992 - 4195124656575/9007199254740992*n) * eps^28
        + 4774615334345/18014398509481984 * eps^29;
C3[23] = + (171529806825/809240558043136 - 20583576819/35184372088832*n + 29028121155/35184372088832*n^2 - 31608398591/35184372088832*n^3 + 29028121155/35184372088832*n^4 - 23244740695/35184372088832*n^5 + 16482634311/35184372088832*n^6) * eps^23
        + (20583576819/70368744177664 - 29028121155/35184372088832*n + 37120809477/35184372088832*n^2 - 29028121155/35184372088832*n^3 + 10699253851/35184372088832*n^4 + 8608339377/35184372088832*n^5) * eps^24
        + (74417546961/281474976710656 - 99868465307/140737488355328*n + 46855492531/70368744177664*n^2 - 475207835/35184372088832*n^3 - 26136430925/35184372088832*n^4) * eps^25
        + (77818821763/281474976710656 - 46855492531/70368744177664*n + 117206473721/281474976710656*n^2 + 25946347791/70368744177664*n^3) * eps^26
        + (1173967590711/4503599627370496 - 2549380838081/4503599627370496*n + 787609465729/4503599627370496*n^2) * eps^27
        + (2340726177457/9007199254740992 - 2314357198017/4503599627370496*n) * eps^28
        + 556913250205/2251799813685248 * eps^29;
C3[24] = + (107492012277/562949953421312 - 74417546961/140737488355328*n + 316963625945/422212465065984*n^2 - 697319977079/844424930131968*n^3 + 216409648059/281474976710656*n^4 - 264500680961/422212465065984*n^5) * eps^24
        + (74417546961/281474976710656 - 316963625945/422212465065984*n + 548484883157/562949953421312*n^2 - 41533164779/52776558133248*n^3 + 553046878373/1688849860263936*n^4) * eps^25
        + (135054066707/562949953421312 - 4401660092471/6755399441055744*n + 4279816803577/6755399441055744*n^2 - 202913745545/3377699720527872*n^3) * eps^26
        + (1132800437073/4503599627370496 - 1385801088427/2251799813685248*n + 1851694849861/4503599627370496*n^2) * eps^27
        + (1071403584791/4503599627370496 - 7127072067763/13510798882111488*n) * eps^28
        + 1045457237/4398046511104 * eps^29;
C3[25] = + (1215486600363/7036874417766400 - 135054066707/281474976710656*n + 96467190505/140737488355328*n^2 - 107111846009/140737488355328*n^3 + 504955845471/703687441776640*n^4) * eps^25
        + (135054066707/562949953421312 - 96467190505/140737488355328*n + 507617009347/562949953421312*n^2 - 527575738417/703687441776640*n^3) * eps^26
        + (983965343151/4503599627370496 - 2701746625109/4503599627370496*n + 13560625821127/22517998136852480*n^2) * eps^27
        + (2068389622621/9007199254740992 - 2567357849371/4503599627370496*n) * eps^28
        + 1961943067581/9007199254740992 * eps^29;
C3[26] = + (2295919134019/14636698788954112 - 983965343151/2251799813685248*n + 1413743309125/2251799813685248*n^2 - 395848126555/562949953421312*n^3) * eps^26
        + (983965343151/4503599627370496 - 1413743309125/2251799813685248*n + 3766212175509/4503599627370496*n^2) * eps^27
        + (1798281489207/9007199254740992 - 4987686394593/9007199254740992*n) * eps^28
        + 3788832068455/18014398509481984 * eps^29;
C3[27] = + (17383387729001/121597189939003392 - 1798281489207/4503599627370496*n + 7792553119897/13510798882111488*n^2) * eps^27
        + (1798281489207/9007199254740992 - 7792553119897/13510798882111488*n) * eps^28
        + 6593698793759/36028797018963968 * eps^29;
C3[28] = + (4709784852685/36028797018963968 - 6593698793759/18014398509481984*n) * eps^28
        + 6593698793759/36028797018963968 * eps^29;
C3[29] = + 125280277081421/1044835113549955072 * eps^29;

C4[0] = + (2/3 - 1/15*ep2 + 4/105*ep2^2 - 8/315*ep2^3 + 64/3465*ep2^4 - 128/9009*ep2^5 + 512/45045*ep2^6 - 1024/109395*ep2^7 + 16384/2078505*ep2^8 - 32768/4849845*ep2^9 + 131072/22309287*ep2^10 - 262144/50702925*ep2^11 + 2097152/456326325*ep2^12 - 4194304/1017958725*ep2^13 + 16777216/4508102925*ep2^14 - 33554432/9917826435*ep2^15 + 1073741824/347123925225*ep2^16 - 2147483648/755505013725*ep2^17 + 8589934592/3273855059475*ep2^18 - 17179869184/7064634602025*ep2^19 + 137438953472/60755857577415*ep2^20 - 274877906944/130191123380175*ep2^21 + 1099511627776/556271163533475*ep2^22 - 2199023255552/1185099435353925*ep2^23 + 35184372088832/20146690401016725*ep2^24 - 70368744177664/42710983650155457*ep2^25 + 281474976710656/180700315442965395*ep2^26 - 562949953421312/381478443712926945*ep2^27 + 4503599627370496/3215318311294669965*ep2^28 - 9007199254740992/6763255758240512685*ep2^29)
        - (1/20 - 1/35*ep2 + 2/105*ep2^2 - 16/1155*ep2^3 + 32/3003*ep2^4 - 128/15015*ep2^5 + 256/36465*ep2^6 - 4096/692835*ep2^7 + 8192/1616615*ep2^8 - 32768/7436429*ep2^9 + 65536/16900975*ep2^10 - 524288/152108775*ep2^11 + 1048576/339319575*ep2^12 - 4194304/1502700975*ep2^13 + 8388608/3305942145*ep2^14 - 268435456/115707975075*ep2^15 + 536870912/251835004575*ep2^16 - 2147483648/1091285019825*ep2^17 + 4294967296/2354878200675*ep2^18 - 34359738368/20251952525805*ep2^19 + 68719476736/43397041126725*ep2^20 - 274877906944/185423721177825*ep2^21 + 549755813888/395033145117975*ep2^22 - 8796093022208/6715563467005575*ep2^23 + 17592186044416/14236994550051819*ep2^24 - 70368744177664/60233438480988465*ep2^25 + 140737488355328/127159481237642315*ep2^26 - 1125899906842624/1071772770431556655*ep2^27 + 2251799813685248/2254418586080170895*ep2^28) * k2
        + (1/42 - 1/63*ep2 + 8/693*ep2^2 - 80/9009*ep2^3 + 64/9009*ep2^4 - 128/21879*ep2^5 + 2048/415701*ep2^6 - 4096/969969*ep2^7 + 81920/22309287*ep2^8 - 32768/10140585*ep2^9 + 262144/91265265*ep2^10 - 524288/203591745*ep2^11 + 2097152/901620585*ep2^12 - 4194304/1983565287*ep2^13 + 134217728/69424785045*ep2^14 - 268435456/151101002745*ep2^15 + 1073741824/654771011895*ep2^16 - 2147483648/1412926920405*ep2^17 + 17179869184/12151171515483*ep2^18 - 34359738368/26038224676035*ep2^19 + 137438953472/111254232706695*ep2^20 - 274877906944/237019887070785*ep2^21 + 4398046511104/4029338080203345*ep2^22 - 43980465111040/42710983650155457*ep2^23 + 35184372088832/36140063088593079*ep2^24 - 70368744177664/76295688742585389*ep2^25 + 562949953421312/643063662258933993*ep2^26 - 1125899906842624/1352651151648102537*ep2^27) * k2^2
        - (1/72 - 1/99*ep2 + 10/1287*ep2^2 - 8/1287*ep2^3 + 112/21879*ep2^4 - 1792/415701*ep2^5 + 512/138567*ep2^6 - 10240/3187041*ep2^7 + 4096/1448655*ep2^8 - 32768/13037895*ep2^9 + 65536/29084535*ep2^10 - 1835008/901620585*ep2^11 + 3670016/1983565287*ep2^12 - 16777216/9917826435*ep2^13 + 33554432/21585857535*ep2^14 - 134217728/93538715985*ep2^15 + 268435456/201846702915*ep2^16 - 2147483648/1735881645069*ep2^17 + 30064771072/26038224676035*ep2^18 - 120259084288/111254232706695*ep2^19 + 34359738368/33859983867255*ep2^20 - 549755813888/575619725743335*ep2^21 + 5497558138880/6101569092879351*ep2^22 - 4398046511104/5162866155513297*ep2^23 + 8796093022208/10899384106083627*ep2^24 - 70368744177664/91866237465561999*ep2^25 + 140737488355328/193235878806871791*ep2^26) * k2^3
        + (1/110 - 1/143*ep2 + 4/715*ep2^2 - 56/12155*ep2^3 + 896/230945*ep2^4 - 768/230945*ep2^5 + 3072/1062347*ep2^6 - 6144/2414425*ep2^7 + 16384/7243275*ep2^8 - 32768/16158075*ep2^9 + 917504/500900325*ep2^10 - 1835008/1101980715*ep2^11 + 8388608/5509903575*ep2^12 - 16777216/11992143075*ep2^13 + 67108864/51965953325*ep2^14 - 134217728/112137057175*ep2^15 + 1073741824/964378691705*ep2^16 - 15032385536/14465680375575*ep2^17 + 60129542144/61807907059275*ep2^18 - 17179869184/18811102148475*ep2^19 + 274877906944/319788736524075*ep2^20 - 549755813888/677952121431039*ep2^21 + 2199023255552/2868258975285165*ep2^22 - 13194139533312/18165640176806045*ep2^23 + 105553116266496/153110395775936665*ep2^24 - 211106232532992/322059798011452985*ep2^25) * k2^4
        - (1/156 - 1/195*ep2 + 14/3315*ep2^2 - 224/62985*ep2^3 + 64/20995*ep2^4 - 256/96577*ep2^5 + 5632/2414425*ep2^6 - 45056/21729825*ep2^7 + 90112/48474225*ep2^8 - 2523136/1502700975*ep2^9 + 458752/300540195*ep2^10 - 2097152/1502700975*ep2^11 + 4194304/3270584475*ep2^12 - 16777216/14172532725*ep2^13 + 33554432/30582833775*ep2^14 - 268435456/263012370465*ep2^15 + 3758096384/3945185556975*ep2^16 - 165356240896/185423721177825*ep2^17 + 47244640256/56433306445425*ep2^18 - 755914244096/959366209572225*ep2^19 + 1511828488192/2033856364293117*ep2^20 - 549755813888/782252447805045*ep2^21 + 1099511627776/1651421834255095*ep2^22 - 8796093022208/13919126888721515*ep2^23 + 17592186044416/29278163455586635*ep2^24) * k2^5
        + (1/210 - 1/255*ep2 + 16/4845*ep2^2 - 32/11305*ep2^3 + 128/52003*ep2^4 - 2816/1300075*ep2^5 + 22528/11700675*ep2^6 - 585728/339319575*ep2^7 + 2342912/1502700975*ep2^8 - 425984/300540195*ep2^9 + 13631488/10518906825*ep2^10 - 27262976/22894091325*ep2^11 + 8388608/7631363775*ep2^12 - 16777216/16467679725*ep2^13 + 134217728/141622045635*ep2^14 - 268435456/303475812075*ep2^15 + 11811160064/14263363167525*ep2^16 - 23622320128/30387165009075*ep2^17 + 377957122048/516581805154275*ep2^18 - 755914244096/1095153426927063*ep2^19 + 3573412790272/5475767134635315*ep2^20 - 7146825580544/11559952839785665*ep2^21 + 57174604644352/97433888221050605*ep2^22 - 114349209288704/204947144189106445*ep2^23) * k2^6
        - (1/272 - 1/323*ep2 + 6/2261*ep2^2 - 120/52003*ep2^3 + 528/260015*ep2^4 - 1408/780045*ep2^5 + 36608/22621305*ep2^6 - 146432/100180065*ep2^7 + 26624/20036013*ep2^8 - 851968/701260455*ep2^9 + 1703936/1526272755*ep2^10 - 524288/508757585*ep2^11 + 1048576/1097845315*ep2^12 - 8388608/9441469709*ep2^13 + 16777216/20231720805*ep2^14 - 738197504/950890877835*ep2^15 + 1476395008/2025811000605*ep2^16 - 23622320128/34438787010285*ep2^17 + 236223201280/365051142309021*ep2^18 - 223338299392/365051142309021*ep2^19 + 1340029796352/2311990567957133*ep2^20 - 10720238370816/19486777644210121*ep2^21 + 21440476741632/40989428837821289*ep2^22) * k2^7
        + (1/342 - 1/399*ep2 + 20/9177*ep2^2 - 88/45885*ep2^3 + 704/412965*ep2^4 - 18304/11975985*ep2^5 + 73216/53036505*ep2^6 - 13312/10607301*ep2^7 + 425984/371255535*ep2^8 - 14483456/13736454795*ep2^9 + 4456448/4578818265*ep2^10 - 8912896/9880607835*ep2^11 + 71303168/84973227381*ep2^12 - 142606336/182085487245*ep2^13 + 6274678784/8558017900515*ep2^14 - 12549357568/18232299005445*ep2^15 + 11811160064/18232299005445*ep2^16 - 118111600640/193262369457717*ep2^17 + 111669149696/193262369457717*ep2^18 - 223338299392/407998335521847*ep2^19 + 1786706395136/3438843113684139*ep2^20 - 3573412790272/7233428618439051*ep2^21) * k2^8
        - (1/420 - 1/483*ep2 + 22/12075*ep2^2 - 176/108675*ep2^3 + 4576/3151575*ep2^4 - 18304/13956975*ep2^5 + 3328/2791395*ep2^6 - 106496/97698825*ep2^7 + 3620864/3614856525*ep2^8 - 1114112/1204952175*ep2^9 + 42336256/49403039175*ep2^10 - 338690048/424866136905*ep2^11 + 677380096/910427436225*ep2^12 - 29804724224/42790089502575*ep2^13 + 59609448448/91161495027225*ep2^14 - 56103010304/91161495027225*ep2^15 + 112206020608/193262369457717*ep2^16 - 530428461056/966311847288585*ep2^17 + 55834574848/107367983032065*ep2^18 - 446676598784/904958714127405*ep2^19 + 893353197568/1903533846957645*ep2^20) * k2^9
        + (1/506 - 1/575*ep2 + 8/5175*ep2^2 - 208/150075*ep2^3 + 5824/4652325*ep2^4 - 11648/10235115*ep2^5 + 53248/51175575*ep2^6 - 1810432/1893496275*ep2^7 + 557056/631165425*ep2^8 - 21168128/25877782425*ep2^9 + 169345024/222548928855*ep2^10 - 2370830336/3338233932825*ep2^11 + 9483321344/14263363167525*ep2^12 - 2709520384/4341023572725*ep2^13 + 2550136832/4341023572725*ep2^14 - 5100273664/9202969974177*ep2^15 + 265214230528/506163348579735*ep2^16 - 27917287424/56240372064415*ep2^17 + 223338299392/474025993114355*ep2^18 - 446676598784/997089157930195*ep2^19) * k2^10
        - (1/600 - 1/675*ep2 + 26/19575*ep2^2 - 728/606825*ep2^3 + 1456/1335015*ep2^4 - 6656/6675075*ep2^5 + 226304/246977775*ep2^6 - 69632/82325925*ep2^7 + 2646016/3375362925*ep2^8 - 21168128/29028121155*ep2^9 + 296353792/435421817325*ep2^10 - 1185415168/1860438674025*ep2^11 + 7789871104/13023070718175*ep2^12 - 7331643392/13023070718175*ep2^13 + 14663286784/27608909922531*ep2^14 - 762490912768/1518490045739205*ep2^15 + 80262201344/168721116193245*ep2^16 - 642097610752/1422077979343065*ep2^17 + 1284195221504/2991267473790585*ep2^18) * k2^11
        + (1/702 - 1/783*ep2 + 28/24273*ep2^2 - 280/267003*ep2^3 + 256/267003*ep2^4 - 8704/9879111*ep2^5 + 34816/42809481*ep2^6 - 1323008/1755188721*ep2^7 + 52920320/75473115003*ep2^8 - 148176896/226419345009*ep2^9 + 592707584/967428110493*ep2^10 - 3894935552/6771996773451*ep2^11 + 3665821696/6771996773451*ep2^12 - 183291084800/358915828992903*ep2^13 + 146632867840/303698009147841*ep2^14 - 15435038720/33744223238649*ep2^15 + 123480309760/284415595868613*ep2^16 - 246960619520/598253494758117*ep2^17) * k2^12
        - (1/812 - 1/899*ep2 + 10/9889*ep2^2 - 64/69223*ep2^3 + 2176/2561251*ep2^4 - 26112/33296263*ep2^5 + 992256/1365146783*ep2^6 - 39690240/58701311669*ep2^7 + 5292032/8385901667*ep2^8 - 21168128/35830670759*ep2^9 + 973733888/1755702867191*ep2^10 - 916455424/1755702867191*ep2^11 + 45822771200/93052251961123*ep2^12 - 36658216960/78736520890181*ep2^13 + 34728837120/78736520890181*ep2^14 - 277830696960/663636390360097*ep2^15 + 555661393920/1395924821102273*ep2^16) * k2^13
        + (1/930 - 1/1023*ep2 + 32/35805*ep2^2 - 1088/1324785*ep2^3 + 4352/5740735*ep2^4 - 165376/235370135*ep2^5 + 1323008/2024183161*ep2^6 - 2646016/4337535345*ep2^7 + 10584064/18533105565*ep2^8 - 486866944/908122172685*ep2^9 + 458227712/908122172685*ep2^10 - 4582277120/9626095030461*ep2^11 + 3665821696/8145157333467*ep2^12 - 1157627904/2715052444489*ep2^13 + 9261023232/22884013460693*ep2^14 - 537139347456/1395924821102273*ep2^15) * k2^14
        - (1/1056 - 1/1155*ep2 + 34/42735*ep2^2 - 136/185185*ep2^3 + 5168/7592585*ep2^4 - 41344/65296231*ep2^5 + 82688/139920495*ep2^6 - 330752/597842115*ep2^7 + 15214592/29294263635*ep2^8 - 14319616/29294263635*ep2^9 + 143196160/310519194531*ep2^10 - 114556928/262747010757*ep2^11 + 36175872/87582336919*ep2^12 - 289406976/738193982603*ep2^13 + 16785604608/45029832938783*ep2^14) * k2^15
        + (1/1190 - 1/1295*ep2 + 12/16835*ep2^2 - 456/690235*ep2^3 + 3648/5936021*ep2^4 - 2432/4240015*ep2^5 + 107008/199280705*ep2^6 - 4922368/9764754545*ep2^7 + 78757888/166000827265*ep2^8 - 787578880/1759608769009*ep2^9 + 57278464/135354520693*ep2^10 - 54263808/135354520693*ep2^11 + 434110464/1140845245841*ep2^12 - 25178406912/69591559996301*ep2^13) * k2^16
        - (1/1332 - 1/1443*ep2 + 38/59163*ep2^2 - 1520/2544009*ep2^3 + 4256/7632027*ep2^4 - 187264/358705269*ep2^5 + 1230592/2510936883*ep2^6 - 19689472/42685927011*ep2^7 + 984473600/2262354131583*ep2^8 - 71598080/174027240891*ep2^9 + 7536640/19336360099*ep2^10 - 60293120/162977892263*ep2^11 + 3497000960/9941651428043*ep2^12) * k2^17
        + (1/1482 - 1/1599*ep2 + 40/68757*ep2^2 - 112/206271*ep2^3 + 4928/9694737*ep2^4 - 32384/67863159*ep2^5 + 518144/1153673703*ep2^6 - 25907200/61144706259*ep2^7 + 1884160/4703438943*ep2^8 - 3768320/9929482213*ep2^9 + 30146560/83691350081*ep2^10 - 1748500480/5105172354941*ep2^11) * k2^18
        - (1/1640 - 1/1763*ep2 + 14/26445*ep2^2 - 616/1242915*ep2^3 + 4048/8700405*ep2^4 - 64768/147906885*ep2^5 + 647680/1567812981*ep2^6 - 612352/1567812981*ep2^7 + 3674112/9929482213*ep2^8 - 29392896/83691350081*ep2^9 + 1704787968/5105172354941*ep2^10) * k2^19
        + (1/1806 - 1/1935*ep2 + 44/90945*ep2^2 - 2024/4456305*ep2^3 + 32384/75757185*ep2^4 - 323840/803026161*ep2^5 + 306176/803026161*ep2^6 - 612352/1695277451*ep2^7 + 4898816/14288767087*ep2^8 - 284131328/871614792307*ep2^9) * k2^20
        - (1/1980 - 1/2115*ep2 + 46/103635*ep2^2 - 736/1761795*ep2^3 + 7360/18675027*ep2^4 - 76544/205425297*ep2^5 + 153088/433675627*ep2^6 - 1224704/3655265999*ep2^7 + 71032832/222971225939*ep2^8) * k2^21
        + (1/2162 - 1/2303*ep2 + 16/39151*ep2^2 - 800/2075003*ep2^3 + 8320/22825033*ep2^4 - 149760/433675627*ep2^5 + 1198080/3655265999*ep2^6 - 69488640/222971225939*ep2^7) * k2^22
        - (1/2352 - 1/2499*ep2 + 50/132447*ep2^2 - 520/1456917*ep2^3 + 3120/9227141*ep2^4 - 24960/77771617*ep2^5 + 1447680/4744068637*ep2^6) * k2^23
        + (1/2550 - 1/2703*ep2 + 52/148665*ep2^2 - 312/941545*ep2^3 + 17472/55551155*ep2^4 - 1013376/3388620455*ep2^5) * k2^24
        - (1/2756 - 1/2915*ep2 + 18/55385*ep2^2 - 1008/3267715*ep2^3 + 58464/199330615*ep2^4) * k2^25
        + (1/2970 - 1/3135*ep2 + 56/184965*ep2^2 - 3248/11282865*ep2^3) * k2^26
        - (1/3192 - 1/3363*ep2 + 58/205143*ep2^2) * k2^27
        + (1/3422 - 1/3599*ep2) * k2^28
        - 1/3660 * k2^29;
C4[1] = + (1/180 - 1/315*ep2 + 2/945*ep2^2 - 16/10395*ep2^3 + 32/27027*ep2^4 - 128/135135*ep2^5 + 256/328185*ep2^6 - 4096/6235515*ep2^7 + 8192/14549535*ep2^8 - 32768/66927861*ep2^9 + 65536/152108775*ep2^10 - 524288/1368978975*ep2^11 + 1048576/3053876175*ep2^12 - 4194304/13524308775*ep2^13 + 8388608/29753479305*ep2^14 - 268435456/1041371775675*ep2^15 + 536870912/2266515041175*ep2^16 - 2147483648/9821565178425*ep2^17 + 4294967296/21193903806075*ep2^18 - 34359738368/182267572732245*ep2^19 + 68719476736/390573370140525*ep2^20 - 274877906944/1668813490600425*ep2^21 + 549755813888/3555298306061775*ep2^22 - 8796093022208/60440071203050175*ep2^23 + 17592186044416/128132950950466371*ep2^24 - 70368744177664/542100946328896185*ep2^25 + 140737488355328/1144435331138780835*ep2^26 - 1125899906842624/9645954933884009895*ep2^27 + 2251799813685248/20289767274721538055*ep2^28) * k2
        - (1/252 - 1/378*ep2 + 4/2079*ep2^2 - 40/27027*ep2^3 + 32/27027*ep2^4 - 64/65637*ep2^5 + 1024/1247103*ep2^6 - 2048/2909907*ep2^7 + 40960/66927861*ep2^8 - 16384/30421755*ep2^9 + 131072/273795795*ep2^10 - 262144/610775235*ep2^11 + 1048576/2704861755*ep2^12 - 2097152/5950695861*ep2^13 + 67108864/208274355135*ep2^14 - 134217728/453303008235*ep2^15 + 536870912/1964313035685*ep2^16 - 1073741824/4238780761215*ep2^17 + 8589934592/36453514546449*ep2^18 - 17179869184/78114674028105*ep2^19 + 68719476736/333762698120085*ep2^20 - 137438953472/711059661212355*ep2^21 + 2199023255552/12088014240610035*ep2^22 - 21990232555520/128132950950466371*ep2^23 + 17592186044416/108420189265779237*ep2^24 - 35184372088832/228887066227756167*ep2^25 + 281474976710656/1929190986776801979*ep2^26 - 562949953421312/4057953454944307611*ep2^27) * k2^2
        + (1/360 - 1/495*ep2 + 2/1287*ep2^2 - 8/6435*ep2^3 + 112/109395*ep2^4 - 1792/2078505*ep2^5 + 512/692835*ep2^6 - 2048/3187041*ep2^7 + 4096/7243275*ep2^8 - 32768/65189475*ep2^9 + 65536/145422675*ep2^10 - 1835008/4508102925*ep2^11 + 3670016/9917826435*ep2^12 - 16777216/49589132175*ep2^13 + 33554432/107929287675*ep2^14 - 134217728/467693579925*ep2^15 + 268435456/1009233514575*ep2^16 - 2147483648/8679408225345*ep2^17 + 30064771072/130191123380175*ep2^18 - 120259084288/556271163533475*ep2^19 + 34359738368/169299919336275*ep2^20 - 549755813888/2878098628716675*ep2^21 + 1099511627776/6101569092879351*ep2^22 - 4398046511104/25814330777566485*ep2^23 + 8796093022208/54496920530418135*ep2^24 - 70368744177664/459331187327809995*ep2^25 + 140737488355328/966179394034358955*ep2^26) * k2^3
        - (1/495 - 2/1287*ep2 + 8/6435*ep2^2 - 112/109395*ep2^3 + 1792/2078505*ep2^4 - 512/692835*ep2^5 + 2048/3187041*ep2^6 - 4096/7243275*ep2^7 + 32768/65189475*ep2^8 - 65536/145422675*ep2^9 + 1835008/4508102925*ep2^10 - 3670016/9917826435*ep2^11 + 16777216/49589132175*ep2^12 - 33554432/107929287675*ep2^13 + 134217728/467693579925*ep2^14 - 268435456/1009233514575*ep2^15 + 2147483648/8679408225345*ep2^16 - 30064771072/130191123380175*ep2^17 + 120259084288/556271163533475*ep2^18 - 34359738368/169299919336275*ep2^19 + 549755813888/2878098628716675*ep2^20 - 1099511627776/6101569092879351*ep2^21 + 4398046511104/25814330777566485*ep2^22 - 8796093022208/54496920530418135*ep2^23 + 70368744177664/459331187327809995*ep2^24 - 140737488355328/966179394034358955*ep2^25) * k2^4
        + (5/3276 - 1/819*ep2 + 2/1989*ep2^2 - 32/37791*ep2^3 + 64/88179*ep2^4 - 1280/2028117*ep2^5 + 5632/10140585*ep2^6 - 45056/91265265*ep2^7 + 90112/203591745*ep2^8 - 360448/901620585*ep2^9 + 65536/180324117*ep2^10 - 2097152/6311344095*ep2^11 + 4194304/13736454795*ep2^12 - 16777216/59524637445*ep2^13 + 33554432/128447901855*ep2^14 - 268435456/1104651955953*ep2^15 + 536870912/2367111334185*ep2^16 - 23622320128/111254232706695*ep2^17 + 47244640256/237019887070785*ep2^18 - 755914244096/4029338080203345*ep2^19 + 7559142440960/42710983650155457*ep2^20 - 549755813888/3285460280781189*ep2^21 + 1099511627776/6935971703871399*ep2^22 - 8796093022208/58460332932630363*ep2^23 + 17592186044416/122968286513463867*ep2^24) * k2^5
        - (1/840 - 1/1020*ep2 + 4/4845*ep2^2 - 8/11305*ep2^3 + 32/52003*ep2^4 - 704/1300075*ep2^5 + 5632/11700675*ep2^6 - 146432/339319575*ep2^7 + 585728/1502700975*ep2^8 - 106496/300540195*ep2^9 + 3407872/10518906825*ep2^10 - 6815744/22894091325*ep2^11 + 2097152/7631363775*ep2^12 - 4194304/16467679725*ep2^13 + 33554432/141622045635*ep2^14 - 67108864/303475812075*ep2^15 + 2952790016/14263363167525*ep2^16 - 5905580032/30387165009075*ep2^17 + 94489280512/516581805154275*ep2^18 - 188978561024/1095153426927063*ep2^19 + 893353197568/5475767134635315*ep2^20 - 1786706395136/11559952839785665*ep2^21 + 14293651161088/97433888221050605*ep2^22 - 28587302322176/204947144189106445*ep2^23) * k2^6
        + (7/7344 - 7/8721*ep2 + 2/2907*ep2^2 - 40/66861*ep2^3 + 176/334305*ep2^4 - 1408/3008745*ep2^5 + 36608/87253605*ep2^6 - 1025024/2704861755*ep2^7 + 186368/540972351*ep2^8 - 851968/2704861755*ep2^9 + 1703936/5887052055*ep2^10 - 524288/1962350685*ep2^11 + 1048576/4234546215*ep2^12 - 8388608/36417097449*ep2^13 + 117440512/546256461735*ep2^14 - 5167382528/25674053701545*ep2^15 + 1476395008/7813842430905*ep2^16 - 23622320128/132835321325385*ep2^17 + 236223201280/1408054406049081*ep2^18 - 223338299392/1408054406049081*ep2^19 + 446676598784/2972559301659171*ep2^20 - 3573412790272/25054428399698727*ep2^21 + 7146825580544/52700694220055943*ep2^22) * k2^7
        - (2/2565 - 4/5985*ep2 + 16/27531*ep2^2 - 352/688275*ep2^3 + 2816/6194475*ep2^4 - 73216/179639775*ep2^5 + 292864/795547575*ep2^6 - 53248/159109515*ep2^7 + 1703936/5568833025*ep2^8 - 57933824/206046821925*ep2^9 + 17825792/68682273975*ep2^10 - 35651584/148209117525*ep2^11 + 285212672/1274598410715*ep2^12 - 570425344/2731282308675*ep2^13 + 25098715136/128370268507725*ep2^14 - 50197430272/273484485081675*ep2^15 + 47244640256/273484485081675*ep2^16 - 94489280512/579787108373151*ep2^17 + 446676598784/2898935541865755*ep2^18 - 893353197568/6119975032827705*ep2^19 + 7146825580544/51582646705262085*ep2^20 - 14293651161088/108501429276585765*ep2^21) * k2^8
        + (1/1540 - 1/1771*ep2 + 2/4025*ep2^2 - 16/36225*ep2^3 + 416/1050525*ep2^4 - 1664/4652325*ep2^5 + 3328/10235115*ep2^6 - 106496/358229025*ep2^7 + 3620864/13254473925*ep2^8 - 1114112/4418157975*ep2^9 + 42336256/181144476975*ep2^10 - 338690048/1557842501985*ep2^11 + 677380096/3338233932825*ep2^12 - 2709520384/14263363167525*ep2^13 + 5419040768/30387165009075*ep2^14 - 5100273664/30387165009075*ep2^15 + 10200547328/64420789819239*ep2^16 - 530428461056/3543143440058145*ep2^17 + 55834574848/393682604450905*ep2^18 - 446676598784/3318181951800485*ep2^19 + 893353197568/6979624105511365*ep2^20) * k2^9
        - (5/9108 - 1/2070*ep2 + 4/9315*ep2^2 - 104/270135*ep2^3 + 2912/8374185*ep2^4 - 5824/18423207*ep2^5 + 26624/92116035*ep2^6 - 905216/3408293295*ep2^7 + 278528/1136097765*ep2^8 - 10584064/46580008365*ep2^9 + 84672512/400588071939*ep2^10 - 1185415168/6008821079085*ep2^11 + 4741660672/25674053701545*ep2^12 - 1354760192/7813842430905*ep2^13 + 1275068416/7813842430905*ep2^14 - 12750684160/82826729767593*ep2^15 + 132607115264/911094027443523*ep2^16 - 13958643712/101232669715947*ep2^17 + 111669149696/853246787605839*ep2^18 - 223338299392/1794760484274351*ep2^19) * k2^10
        + (11/23400 - 11/26325*ep2 + 22/58725*ep2^2 - 616/1820475*ep2^3 + 112/364095*ep2^4 - 512/1820475*ep2^5 + 17408/67357575*ep2^6 - 69632/291882825*ep2^7 + 2646016/11967195825*ep2^8 - 21168128/102917884095*ep2^9 + 296353792/1543768261425*ep2^10 - 13039566848/72557108286975*ep2^11 + 85688582144/507899758008825*ep2^12 - 80648077312/507899758008825*ep2^13 + 161296154624/1076747486978709*ep2^14 - 58653147136/414133648837965*ep2^15 + 6174015488/46014849870885*ep2^16 - 49392123904/387839448911745*ep2^17 + 98784247808/815800220124705*ep2^18) * k2^11
        - (1/2457 - 2/5481*ep2 + 8/24273*ep2^2 - 80/267003*ep2^3 + 512/1869021*ep2^4 - 17408/69153777*ep2^5 + 69632/299666367*ep2^6 - 2646016/12286321047*ep2^7 + 105840640/528311805021*ep2^8 - 42336256/226419345009*ep2^9 + 169345024/967428110493*ep2^10 - 7789871104/47403977414157*ep2^11 + 7331643392/47403977414157*ep2^12 - 366582169600/2512410802950321*ep2^13 + 293265735680/2125886064034887*ep2^14 - 30870077440/236209562670543*ep2^15 + 246960619520/1990909171080291*ep2^16 - 493921239040/4187774463306819*ep2^17) * k2^12
        + (13/36540 - 13/40455*ep2 + 26/89001*ep2^2 - 832/3115035*ep2^3 + 28288/115256295*ep2^4 - 8704/38418765*ep2^5 + 330752/1575169365*ep2^6 - 2646016/13546456539*ep2^7 + 5292032/29028121155*ep2^8 - 21168128/124029244935*ep2^9 + 973733888/6077433001815*ep2^10 - 916455424/6077433001815*ep2^11 + 9164554240/64420789819239*ep2^12 - 95311364096/708628688011629*ep2^13 + 10032775168/78736520890181*ep2^14 - 80262201344/663636390360097*ep2^15 + 160524402688/1395924821102273*ep2^16) * k2^13
        - (7/22320 - 7/24552*ep2 + 4/15345*ep2^2 - 136/567765*ep2^3 + 544/2460315*ep2^4 - 20672/100872915*ep2^5 + 165376/867507069*ep2^6 - 2315264/13012606035*ep2^7 + 9261056/55599316695*ep2^8 - 60858368/389195216865*ep2^9 + 57278464/389195216865*ep2^10 - 572784640/4125469298769*ep2^11 + 458227712/3490781714343*ep2^12 - 48234496/387864634927*ep2^13 + 385875968/3269144780099*ep2^14 - 22380806144/199417831586039*ep2^15) * k2^14
        + (5/17952 - 1/3927*ep2 + 2/8547*ep2^2 - 8/37037*ep2^3 + 304/1518517*ep2^4 - 12160/65296231*ep2^5 + 4864/27984099*ep2^6 - 19456/119568423*ep2^7 + 894976/5858852727*ep2^8 - 14319616/99600496359*ep2^9 + 715980800/5278826307027*ep2^10 - 572784640/4466699182869*ep2^11 + 180879360/1488899727623*ep2^12 - 1447034880/12549297704251*ep2^13 + 83928023040/765507159959311*ep2^14) * k2^15
        - (4/16065 - 8/34965*ep2 + 32/151515*ep2^2 - 1216/6212115*ep2^3 + 9728/53424189*ep2^4 - 19456/114480405*ep2^5 + 856064/5380579035*ep2^6 - 39378944/263648372715*ep2^7 + 630063104/4482022336155*ep2^8 - 6300631040/47509436763243*ep2^9 + 458227712/3654572058711*ep2^10 - 48234496/406063562079*ep2^11 + 385875968/3422535737523*ep2^12 - 22380806144/208774679988903*ep2^13) * k2^16
        + (17/75924 - 17/82251*ep2 + 34/177489*ep2^2 - 1360/7632027*ep2^3 + 3808/22896081*ep2^4 - 167552/1076115807*ep2^5 + 1101056/7532810649*ep2^6 - 1036288/7532810649*ep2^7 + 51814400/399238964397*ep2^8 - 3768320/30710689569*ep2^9 + 7536640/64833677979*ep2^10 - 60293120/546455285823*ep2^11 + 3497000960/33333772435203*ep2^12) * k2^17
        - (1/4940 - 1/5330*ep2 + 4/22919*ep2^2 - 56/343785*ep2^3 + 2464/16157895*ep2^4 - 16192/113105265*ep2^5 + 259072/1922789505*ep2^6 - 2590720/20381568753*ep2^7 + 188416/1567812981*ep2^8 - 1130496/9929482213*ep2^9 + 9043968/83691350081*ep2^10 - 524550144/5105172354941*ep2^11) * k2^18
        + (19/103320 - 19/111069*ep2 + 38/238005*ep2^2 - 1672/11186235*ep2^3 + 76912/548125515*ep2^4 - 1230592/9318133755*ep2^5 + 12305920/98772217803*ep2^6 - 11634688/98772217803*ep2^7 + 1224704/10974690867*ep2^8 - 9797632/92500965879*ep2^9 + 568262656/5642558918619*ep2^10) * k2^19
        - (5/29799 - 2/12771*ep2 + 8/54567*ep2^2 - 368/2673783*ep2^3 + 5888/45454311*ep2^4 - 294400/2409078483*ep2^5 + 3061760/26499863313*ep2^6 - 6123520/55944155883*ep2^7 + 48988160/471529313871*ep2^8 - 2841313280/28763288146131*ep2^9) * k2^20
        + (7/45540 - 7/48645*ep2 + 2/14805*ep2^2 - 32/251685*ep2^3 + 320/2667861*ep2^4 - 3328/29346471*ep2^5 + 6656/61953661*ep2^6 - 53248/522180857*ep2^7 + 3088384/31853032277*ep2^8) * k2^21
        - (11/77832 - 11/82908*ep2 + 44/352359*ep2^2 - 2200/18675027*ep2^3 + 2080/18675027*ep2^4 - 4160/39425057*ep2^5 + 33280/332296909*ep2^6 - 1930240/20270111449*ep2^7) * k2^22
        + (23/176400 - 23/187425*ep2 + 46/397341*ep2^2 - 2392/21853755*ep2^3 + 4784/46135705*ep2^4 - 38272/388858085*ep2^5 + 2219776/23720343185*ep2^6) * k2^23
        - (2/16575 - 4/35139*ep2 + 16/148665*ep2^2 - 96/941545*ep2^3 + 5376/55551155*ep2^4 - 311808/3388620455*ep2^5) * k2^24
        + (25/223236 - 5/47223*ep2 + 10/99693*ep2^2 - 560/5881887*ep2^3 + 32480/358795107*ep2^4) * k2^25
        - (13/124740 - 13/131670*ep2 + 52/554895*ep2^2 - 3016/33848595*ep2^3) * k2^26
        + (3/30856 - 3/32509*ep2 + 6/68381*ep2^2) * k2^27
        - (7/76995 - 14/161955*ep2) * k2^28
        + 29/340380 * k2^29;
C4[2] = + (1/2100 - 1/3150*ep2 + 4/17325*ep2^2 - 8/45045*ep2^3 + 32/225225*ep2^4 - 64/546975*ep2^5 + 1024/10392525*ep2^6 - 2048/24249225*ep2^7 + 8192/111546435*ep2^8 - 16384/253514625*ep2^9 + 131072/2281631625*ep2^10 - 262144/5089793625*ep2^11 + 1048576/22540514625*ep2^12 - 2097152/49589132175*ep2^13 + 67108864/1735619626125*ep2^14 - 134217728/3777525068625*ep2^15 + 536870912/16369275297375*ep2^16 - 1073741824/35323173010125*ep2^17 + 8589934592/303779287887075*ep2^18 - 17179869184/650955616900875*ep2^19 + 68719476736/2781355817667375*ep2^20 - 137438953472/5925497176769625*ep2^21 + 2199023255552/100733452005083625*ep2^22 - 4398046511104/213554918250777285*ep2^23 + 17592186044416/903501577214826975*ep2^24 - 35184372088832/1907392218564634725*ep2^25 + 281474976710656/16076591556473349825*ep2^26 - 562949953421312/33816278791202563425*ep2^27) * k2^2
        - (1/1800 - 1/2475*ep2 + 2/6435*ep2^2 - 8/32175*ep2^3 + 112/546975*ep2^4 - 1792/10392525*ep2^5 + 512/3464175*ep2^6 - 2048/15935205*ep2^7 + 4096/36216375*ep2^8 - 32768/325947375*ep2^9 + 65536/727113375*ep2^10 - 1835008/22540514625*ep2^11 + 3670016/49589132175*ep2^12 - 16777216/247945660875*ep2^13 + 33554432/539646438375*ep2^14 - 134217728/2338467899625*ep2^15 + 268435456/5046167572875*ep2^16 - 2147483648/43397041126725*ep2^17 + 30064771072/650955616900875*ep2^18 - 120259084288/2781355817667375*ep2^19 + 34359738368/846499596681375*ep2^20 - 549755813888/14390493143583375*ep2^21 + 1099511627776/30507845464396755*ep2^22 - 4398046511104/129071653887832425*ep2^23 + 8796093022208/272484602652090675*ep2^24 - 70368744177664/2296655936639049975*ep2^25 + 140737488355328/4830896970171794775*ep2^26) * k2^3
        + (1/1925 - 2/5005*ep2 + 8/25025*ep2^2 - 16/60775*ep2^3 + 256/1154725*ep2^4 - 1536/8083075*ep2^5 + 6144/37182145*ep2^6 - 12288/84504875*ep2^7 + 32768/253514625*ep2^8 - 65536/565532625*ep2^9 + 262144/2504501625*ep2^10 - 524288/5509903575*ep2^11 + 16777216/192846625125*ep2^12 - 33554432/419725007625*ep2^13 + 134217728/1818808366375*ep2^14 - 268435456/3924797001125*ep2^15 + 2147483648/33753254209675*ep2^16 - 4294967296/72328401877875*ep2^17 + 17179869184/309039535296375*ep2^18 - 34359738368/658388575196625*ep2^19 + 549755813888/11192605778342625*ep2^20 - 1099511627776/23728324250086365*ep2^21 + 4398046511104/100389064134980775*ep2^22 - 26388279066624/635797406188211575*ep2^23 + 211106232532992/5358863852157783275*ep2^24 - 422212465065984/11272092930400854475*ep2^25) * k2^4
        - (1/2184 - 1/2730*ep2 + 1/3315*ep2^2 - 16/62985*ep2^3 + 32/146965*ep2^4 - 128/676039*ep2^5 + 2816/16900975*ep2^6 - 22528/152108775*ep2^7 + 45056/339319575*ep2^8 - 180224/1502700975*ep2^9 + 32768/300540195*ep2^10 - 1048576/10518906825*ep2^11 + 2097152/22894091325*ep2^12 - 8388608/99207729075*ep2^13 + 16777216/214079836425*ep2^14 - 134217728/1841086593255*ep2^15 + 268435456/3945185556975*ep2^16 - 11811160064/185423721177825*ep2^17 + 23622320128/395033145117975*ep2^18 - 377957122048/6715563467005575*ep2^19 + 755914244096/14236994550051819*ep2^20 - 274877906944/5475767134635315*ep2^21 + 549755813888/11559952839785665*ep2^22 - 4398046511104/97433888221050605*ep2^23 + 8796093022208/204947144189106445*ep2^24) * k2^5
        + (1/2520 - 1/3060*ep2 + 4/14535*ep2^2 - 8/33915*ep2^3 + 32/156009*ep2^4 - 704/3900225*ep2^5 + 5632/35102025*ep2^6 - 146432/1017958725*ep2^7 + 585728/4508102925*ep2^8 - 106496/901620585*ep2^9 + 3407872/31556720475*ep2^10 - 6815744/68682273975*ep2^11 + 2097152/22894091325*ep2^12 - 4194304/49403039175*ep2^13 + 33554432/424866136905*ep2^14 - 67108864/910427436225*ep2^15 + 2952790016/42790089502575*ep2^16 - 5905580032/91161495027225*ep2^17 + 94489280512/1549745415462825*ep2^18 - 188978561024/3285460280781189*ep2^19 + 893353197568/16427301403905945*ep2^20 - 1786706395136/34679858519356995*ep2^21 + 14293651161088/292301664663151815*ep2^22 - 28587302322176/614841432567319335*ep2^23) * k2^6
        - (7/20400 - 7/24225*ep2 + 2/8075*ep2^2 - 8/37145*ep2^3 + 176/928625*ep2^4 - 1408/8357625*ep2^5 + 36608/242371125*ep2^6 - 1025024/7513504875*ep2^7 + 186368/1502700975*ep2^8 - 851968/7513504875*ep2^9 + 1703936/16352922375*ep2^10 - 524288/5450974125*ep2^11 + 1048576/11762628375*ep2^12 - 8388608/101158604025*ep2^13 + 117440512/1517379060375*ep2^14 - 5167382528/71316815837625*ep2^15 + 1476395008/21705117863625*ep2^16 - 23622320128/368987003681625*ep2^17 + 47244640256/782252447805045*ep2^18 - 223338299392/3911262239025225*ep2^19 + 446676598784/8257109171275475*ep2^20 - 3573412790272/69595634443607575*ep2^21 + 7146825580544/146390817277933175*ep2^22) * k2^7
        + (14/47025 - 4/15675*ep2 + 16/72105*ep2^2 - 32/163875*ep2^3 + 256/1474875*ep2^4 - 6656/42771375*ep2^5 + 186368/1325912625*ep2^6 - 372736/2917007775*ep2^7 + 1703936/14585038875*ep2^8 - 57933824/539646438375*ep2^9 + 17825792/179882146125*ep2^10 - 35651584/388166736375*ep2^11 + 285212672/3338233932825*ep2^12 - 3992977408/50073508992375*ep2^13 + 15971909632/213950447512875*ep2^14 - 4563402752/65115353590875*ep2^15 + 4294967296/65115353590875*ep2^16 - 8589934592/138044549612655*ep2^17 + 446676598784/7592450228696025*ep2^18 - 893353197568/16028506038358275*ep2^19 + 7146825580544/135097408037591175*ep2^20 - 14293651161088/284170410010105575*ep2^21) * k2^8
        - (1/3850 - 2/8855*ep2 + 4/20125*ep2^2 - 32/181125*ep2^3 + 832/5252625*ep2^4 - 3328/23261625*ep2^5 + 6656/51175575*ep2^6 - 212992/1791145125*ep2^7 + 7241728/66272369625*ep2^8 - 2228224/22090789875*ep2^9 + 84672512/905722384875*ep2^10 - 677380096/7789212509925*ep2^11 + 1354760192/16691169664125*ep2^12 - 5419040768/71316815837625*ep2^13 + 10838081536/151935825045375*ep2^14 - 10200547328/151935825045375*ep2^15 + 20401094656/322103949096195*ep2^16 - 1060856922112/17715717200290725*ep2^17 + 111669149696/1968413022254525*ep2^18 - 893353197568/16590909759002425*ep2^19 + 1786706395136/34898120527556825*ep2^20) * k2^9
        + (3/13156 - 3/14950*ep2 + 4/22425*ep2^2 - 8/50025*ep2^3 + 224/1550775*ep2^4 - 448/3411705*ep2^5 + 2048/17058525*ep2^6 - 69632/631165425*ep2^7 + 278528/2735050175*ep2^8 - 10584064/112137057175*ep2^9 + 84672512/964378691705*ep2^10 - 1185415168/14465680375575*ep2^11 + 4741660672/61807907059275*ep2^12 - 1354760192/18811102148475*ep2^13 + 1275068416/18811102148475*ep2^14 - 2550136832/39879536554767*ep2^15 + 10200547328/168721116193245*ep2^16 - 3221225472/56240372064415*ep2^17 + 25769803776/474025993114355*ep2^18 - 51539607552/997089157930195*ep2^19) * k2^10
        - (11/54600 - 11/61425*ep2 + 22/137025*ep2^2 - 88/606825*ep2^3 + 16/121365*ep2^4 - 512/4247775*ep2^5 + 17408/157167675*ep2^6 - 69632/681059925*ep2^7 + 2646016/27923456925*ep2^8 - 21168128/240141729555*ep2^9 + 42336256/514589420475*ep2^10 - 1862795264/24185702762325*ep2^11 + 85688582144/1185099435353925*ep2^12 - 80648077312/1185099435353925*ep2^13 + 161296154624/2512410802950321*ep2^14 - 58653147136/966311847288585*ep2^15 + 6174015488/107367983032065*ep2^16 - 49392123904/904958714127405*ep2^17 + 98784247808/1903533846957645*ep2^18) * k2^11
        + (11/61425 - 22/137025*ep2 + 88/606825*ep2^2 - 16/121365*ep2^3 + 512/4247775*ep2^4 - 17408/157167675*ep2^5 + 69632/681059925*ep2^6 - 2646016/27923456925*ep2^7 + 21168128/240141729555*ep2^8 - 42336256/514589420475*ep2^9 + 1862795264/24185702762325*ep2^10 - 85688582144/1185099435353925*ep2^11 + 80648077312/1185099435353925*ep2^12 - 161296154624/2512410802950321*ep2^13 + 58653147136/966311847288585*ep2^14 - 6174015488/107367983032065*ep2^15 + 49392123904/904958714127405*ep2^16 - 98784247808/1903533846957645*ep2^17) * k2^12
        - (13/81200 - 13/89900*ep2 + 13/98890*ep2^2 - 208/1730575*ep2^3 + 7072/64031275*ep2^4 - 6528/64031275*ep2^5 + 248064/2625282275*ep2^6 - 1984512/22577427565*ep2^7 + 1323008/16126733975*ep2^8 - 5292032/68905136075*ep2^9 + 243433472/3376351667675*ep2^10 - 229113856/3376351667675*ep2^11 + 458227712/7157865535471*ep2^12 - 23827841024/393682604450905*ep2^13 + 22573744128/393682604450905*ep2^14 - 180589953024/3318181951800485*ep2^15 + 361179906048/6979624105511365*ep2^16) * k2^13
        + (91/632400 - 91/695640*ep2 + 52/434775*ep2^2 - 104/946275*ep2^3 + 32/315425*ep2^4 - 1216/12932425*ep2^5 + 9728/111218855*ep2^6 - 136192/1668282825*ep2^7 + 544768/7128117525*ep2^8 - 3579904/49896822675*ep2^9 + 57278464/848245985475*ep2^10 - 114556928/1798281489207*ep2^11 + 5956960256/98905481906385*ep2^12 - 1881145344/32968493968795*ep2^13 + 15049162752/277877306308415*ep2^14 - 872851439616/16950515684813315*ep2^15) * k2^14
        - (7/53856 - 1/8415*ep2 + 2/18315*ep2^2 - 8/79365*ep2^3 + 304/3253965*ep2^4 - 2432/27984099*ep2^5 + 34048/419761485*ep2^6 - 136192/1793526345*ep2^7 + 894976/12554684415*ep2^8 - 14319616/213429635055*ep2^9 + 143196160/2262354131583*ep2^10 - 114556928/1914299649801*ep2^11 + 12058624/212699961089*ep2^12 - 96468992/1792756814893*ep2^13 + 5595201536/109358165708473*ep2^14) * k2^15
        + (4/33915 - 8/73815*ep2 + 32/319865*ep2^2 - 64/690235*ep2^3 + 512/5936021*ep2^4 - 1024/12720045*ep2^5 + 45056/597842115*ep2^6 - 2072576/29294263635*ep2^7 + 33161216/498002481795*ep2^8 - 331612160/5278826307027*ep2^9 + 24117248/406063562079*ep2^10 - 144703488/2571735893167*ep2^11 + 1157627904/21676059670979*ep2^12 - 67142418432/1322239639929719*ep2^13) * k2^16
        - (17/158175 - 68/685425*ep2 + 136/1479075*ep2^2 - 1088/12720045*ep2^3 + 15232/190800675*ep2^4 - 670208/8967631725*ep2^5 + 4404224/62773422075*ep2^6 - 4145152/62773422075*ep2^7 + 8290304/133079654799*ep2^8 - 3014656/51184482615*ep2^9 + 6029312/108056129965*ep2^10 - 48234496/910758809705*ep2^11 + 2797600768/55556287392005*ep2^12) * k2^17
        + (17/172900 - 17/186550*ep2 + 68/802165*ep2^2 - 136/1718925*ep2^3 + 5984/80789475*ep2^4 - 275264/3958684275*ep2^5 + 259072/3958684275*ep2^6 - 518144/8392410663*ep2^7 + 188416/3227850255*ep2^8 - 1130496/20443051615*ep2^9 + 9043968/172305720755*ep2^10 - 524550144/10510648966055*ep2^11) * k2^18
        - (57/631400 - 57/678755*ep2 + 38/484825*ep2^2 - 152/2071525*ep2^3 + 6992/101504725*ep2^4 - 111872/1725580325*ep2^5 + 223744/3658230289*ep2^6 - 11634688/201202665895*ep2^7 + 11022336/201202665895*ep2^8 - 88178688/1695851041115*ep2^9 + 5114363904/103446913508015*ep2^10) * k2^19
        + (19/228459 - 38/489555*ep2 + 152/2091735*ep2^2 - 304/4456305*ep2^3 + 4864/75757185*ep2^4 - 48640/803026161*ep2^5 + 505856/8833287771*ep2^6 - 53248/981476419*ep2^7 + 425984/8272444103*ep2^8 - 24707072/504619090283*ep2^9) * k2^20
        - (7/91080 - 7/97290*ep2 + 1/14805*ep2^2 - 16/251685*ep2^3 + 160/2667861*ep2^4 - 1664/29346471*ep2^5 + 3328/61953661*ep2^6 - 26624/522180857*ep2^7 + 1544192/31853032277*ep2^8) * k2^21
        + (77/1081000 - 11/164500*ep2 + 44/699125*ep2^2 - 88/1482145*ep2^3 + 416/7410725*ep2^4 - 7488/140803775*ep2^5 + 59904/1186774675*ep2^6 - 3474432/72393255175*ep2^7) * k2^22
        - (253/3822000 - 253/4060875*ep2 + 506/8609055*ep2^2 - 184/3311175*ep2^3 + 1104/20970775*ep2^4 - 8832/176753675*ep2^5 + 512256/10781974175*ep2^6) * k2^23
        + (46/745875 - 92/1581255*ep2 + 368/6689925*ep2^2 - 736/14123175*ep2^3 + 41216/833267325*ep2^4 - 2390528/50829306825*ep2^5) * k2^24
        - (5/86814 - 2/36729*ep2 + 4/77539*ep2^2 - 32/653543*ep2^3 + 1856/39866123*ep2^4) * k2^25
        + (13/241164 - 13/254562*ep2 + 52/1072797*ep2^2 - 104/2256573*ep2^3) * k2^26
        - (39/771400 - 39/812725*ep2 + 78/1709525*ep2^2) * k2^27
        + (63/1326025 - 126/2789225*ep2) * k2^28
        - 203/4538400 * k2^29;
C4[3] = + (1/17640 - 1/24255*ep2 + 2/63063*ep2^2 - 8/315315*ep2^3 + 16/765765*ep2^4 - 256/14549535*ep2^5 + 512/33948915*ep2^6 - 2048/156165009*ep2^7 + 4096/354920475*ep2^8 - 32768/3194284275*ep2^9 + 65536/7125711075*ep2^10 - 262144/31556720475*ep2^11 + 524288/69424785045*ep2^12 - 16777216/2429867476575*ep2^13 + 33554432/5288535096075*ep2^14 - 134217728/22916985416325*ep2^15 + 268435456/49452442214175*ep2^16 - 2147483648/425291003041905*ep2^17 + 4294967296/911337863661225*ep2^18 - 17179869184/3893898144734325*ep2^19 + 34359738368/8295696047477475*ep2^20 - 549755813888/141026832807117075*ep2^21 + 1099511627776/298976885551088199*ep2^22 - 4398046511104/1264902208100757765*ep2^23 + 8796093022208/2670349105990488615*ep2^24 - 70368744177664/22507228179062689755*ep2^25 + 140737488355328/47342790307683588795*ep2^26) * k2^3
        - (1/10780 - 1/14014*ep2 + 2/35035*ep2^2 - 4/85085*ep2^3 + 64/1616615*ep2^4 - 384/11316305*ep2^5 + 1536/52055003*ep2^6 - 3072/118306825*ep2^7 + 8192/354920475*ep2^8 - 16384/791745675*ep2^9 + 65536/3506302275*ep2^10 - 131072/7713865005*ep2^11 + 4194304/269985275175*ep2^12 - 8388608/587615010675*ep2^13 + 33554432/2546331712925*ep2^14 - 67108864/5494715801575*ep2^15 + 536870912/47254555893545*ep2^16 - 1073741824/101259762629025*ep2^17 + 4294967296/432655349414925*ep2^18 - 8589934592/921744005275275*ep2^19 + 137438953472/15669648089679675*ep2^20 - 274877906944/33219653950120911*ep2^21 + 1099511627776/140544689788973085*ep2^22 - 6597069766656/890116368663496205*ep2^23 + 52776558133248/7502409393020896585*ep2^24 - 105553116266496/15780930102561196265*ep2^25) * k2^4
        + (5/45864 - 1/11466*ep2 + 1/13923*ep2^2 - 16/264537*ep2^3 + 32/617253*ep2^4 - 640/14196819*ep2^5 + 2816/70984095*ep2^6 - 22528/638856855*ep2^7 + 45056/1425142215*ep2^8 - 180224/6311344095*ep2^9 + 32768/1262268819*ep2^10 - 1048576/44179408665*ep2^11 + 2097152/96155183565*ep2^12 - 8388608/416672462115*ep2^13 + 16777216/899135312985*ep2^14 - 134217728/7732563691671*ep2^15 + 268435456/16569779339295*ep2^16 - 11811160064/778779628946865*ep2^17 + 23622320128/1659139209495495*ep2^18 - 377957122048/28205366561423415*ep2^19 + 3779571220480/298976885551088199*ep2^20 - 274877906944/22998221965468323*ep2^21 + 549755813888/48551801927099793*ep2^22 - 4398046511104/409222330528412541*ep2^23 + 8796093022208/860778005594247069*ep2^24) * k2^5
        - (1/8820 - 1/10710*ep2 + 8/101745*ep2^2 - 16/237405*ep2^3 + 64/1092063*ep2^4 - 1408/27301575*ep2^5 + 11264/245714175*ep2^6 - 292864/7125711075*ep2^7 + 1171456/31556720475*ep2^8 - 212992/6311344095*ep2^9 + 6815744/220897043325*ep2^10 - 13631488/480775917825*ep2^11 + 4194304/160258639275*ep2^12 - 8388608/345821274225*ep2^13 + 67108864/2974062958335*ep2^14 - 134217728/6372992053575*ep2^15 + 5905580032/299530626518025*ep2^16 - 11811160064/638130465190575*ep2^17 + 188978561024/10848217908239775*ep2^18 - 377957122048/22998221965468323*ep2^19 + 1786706395136/114991109827341615*ep2^20 - 3573412790272/242759009635498965*ep2^21 + 28587302322176/2046111652642062705*ep2^22 - 57174604644352/4303890027971235345*ep2^23) * k2^6
        + (1/8976 - 1/10659*ep2 + 2/24871*ep2^2 - 40/572033*ep2^3 + 16/260015*ep2^4 - 128/2340135*ep2^5 + 3328/67863915*ep2^6 - 13312/300540195*ep2^7 + 26624/661188429*ep2^8 - 851968/23141595015*ep2^9 + 1703936/50367000915*ep2^10 - 524288/16789000305*ep2^11 + 1048576/36228895395*ep2^12 - 8388608/311568500397*ep2^13 + 16777216/667646786565*ep2^14 - 67108864/2852672633505*ep2^15 + 134217728/6077433001815*ep2^16 - 2147483648/103316361030855*ep2^17 + 21474836480/1095153426927063*ep2^18 - 223338299392/12046687696197693*ep2^19 + 446676598784/25431896247528463*ep2^20 - 3573412790272/214354554086311331*ep2^21 + 7146825580544/450883717216034179*ep2^22) * k2^7
        - (1/9405 - 2/21945*ep2 + 8/100947*ep2^2 - 16/229425*ep2^3 + 128/2064825*ep2^4 - 3328/59879925*ep2^5 + 13312/265182525*ep2^6 - 26624/583401555*ep2^7 + 851968/20419054425*ep2^8 - 28966912/755505013725*ep2^9 + 8912896/251835004575*ep2^10 - 17825792/543433430925*ep2^11 + 142606336/4673527505955*ep2^12 - 285212672/10014701798475*ep2^13 + 1140850688/42790089502575*ep2^14 - 2281701376/91161495027225*ep2^15 + 2147483648/91161495027225*ep2^16 - 4294967296/193262369457717*ep2^17 + 223338299392/10629430320174435*ep2^18 - 446676598784/22439908453701585*ep2^19 + 3573412790272/189136371252627645*ep2^20 - 7146825580544/397838574014147805*ep2^21) * k2^8
        + (1/10010 - 2/23023*ep2 + 4/52325*ep2^2 - 32/470925*ep2^3 + 64/1050525*ep2^4 - 256/4652325*ep2^5 + 512/10235115*ep2^6 - 16384/358229025*ep2^7 + 557056/13254473925*ep2^8 - 2228224/57436053675*ep2^9 + 84672512/2354878200675*ep2^10 - 677380096/20251952525805*ep2^11 + 1354760192/43397041126725*ep2^12 - 5419040768/185423721177825*ep2^13 + 10838081536/395033145117975*ep2^14 - 10200547328/395033145117975*ep2^15 + 20401094656/837470267650107*ep2^16 - 81604378624/3543143440058145*ep2^17 + 8589934592/393682604450905*ep2^18 - 68719476736/3318181951800485*ep2^19 + 137438953472/6979624105511365*ep2^20) * k2^9
        - (15/161161 - 6/73255*ep2 + 16/219765*ep2^2 - 32/490245*ep2^3 + 128/2171085*ep2^4 - 256/4776387*ep2^5 + 8192/167173545*ep2^6 - 278528/6185421165*ep2^7 + 1114112/26803491715*ep2^8 - 42336256/1098943160315*ep2^9 + 338690048/9450911178709*ep2^10 - 677380096/20251952525805*ep2^11 + 2709520384/86531069882985*ep2^12 - 5419040768/184348801055055*ep2^13 + 5100273664/184348801055055*ep2^14 - 51002736640/1954097291183583*ep2^15 + 40802189312/1653466938693801*ep2^16 - 12884901888/551155646231267*ep2^17 + 103079215104/4645454732520679*ep2^18 - 206158430208/9771473747715911*ep2^19) * k2^10
        + (11/127400 - 11/143325*ep2 + 22/319725*ep2^2 - 88/1415925*ep2^3 + 16/283185*ep2^4 - 512/9911475*ep2^5 + 17408/366724575*ep2^6 - 69632/1589139825*ep2^7 + 2646016/65154732825*ep2^8 - 21168128/560330702295*ep2^9 + 42336256/1200708647775*ep2^10 - 1862795264/56433306445425*ep2^11 + 85688582144/2765232015825825*ep2^12 - 80648077312/2765232015825825*ep2^13 + 161296154624/5862291873550749*ep2^14 - 58653147136/2254727643673365*ep2^15 + 6174015488/250525293741485*ep2^16 - 49392123904/2111570332963945*ep2^17 + 98784247808/4441578976234505*ep2^18) * k2^11
        - (11/137592 - 11/153468*ep2 + 11/169911*ep2^2 - 10/169911*ep2^3 + 64/1189377*ep2^4 - 2176/44006949*ep2^5 + 8704/190696779*ep2^6 - 330752/7818567939*ep2^7 + 13230080/336198421377*ep2^8 - 5292032/144085037733*ep2^9 + 232849408/6771996773451*ep2^10 - 10711072768/331827841899099*ep2^11 + 10081009664/331827841899099*ep2^12 - 504050483200/17586875620652247*ep2^13 + 36658216960/1352836586204019*ep2^14 - 3858759680/150315176244891*ep2^15 + 30870077440/1266942199778367*ep2^16 - 61740154880/2664947385740703*ep2^17) * k2^12
        + (143/1932560 - 143/2139620*ep2 + 13/213962*ep2^2 - 208/3744335*ep2^3 + 416/8149435*ep2^4 - 384/8149435*ep2^5 + 14592/334126835*ep2^6 - 116736/2873490781*ep2^7 + 77824/2052493415*ep2^8 - 3424256/96467190505*ep2^9 + 157515776/4726892334745*ep2^10 - 2520252416/80357169690665*ep2^11 + 25202524160/851785998721049*ep2^12 - 23827841024/851785998721049*ep2^13 + 22573744128/851785998721049*ep2^14 - 180589953024/7179339132077413*ep2^15 + 361179906048/15101368519197317*ep2^16) * k2^13
        - (13/189720 - 13/208692*ep2 + 104/1826055*ep2^2 - 208/3974355*ep2^3 + 64/1324785*ep2^4 - 2432/54316185*ep2^5 + 19456/467119191*ep2^6 - 38912/1000969695*ep2^7 + 155648/4276870515*ep2^8 - 7159808/209566655235*ep2^9 + 114556928/3562633138995*ep2^10 - 1145569280/37763911273347*ep2^11 + 11913920512/415403024006817*ep2^12 - 1254096896/46155891556313*ep2^13 + 10032775168/389028228831781*ep2^14 - 581900959744/23730721958738641*ep2^15) * k2^14
        + (65/1023264 - 13/223839*ep2 + 26/487179*ep2^2 - 8/162393*ep2^3 + 16/350427*ep2^4 - 640/15068361*ep2^5 + 256/6457869*ep2^6 - 1024/27592713*ep2^7 + 47104/1352042937*ep2^8 - 753664/22984729929*ep2^9 + 37683200/1218190686237*ep2^10 - 391905280/13400097548607*ep2^11 + 783810560/28289094824837*ep2^12 - 6270484480/238436656380769*ep2^13 + 363688099840/14544636039226909*ep2^14) * k2^15
        - (2/33915 - 4/73815*ep2 + 16/319865*ep2^2 - 32/690235*ep2^3 + 256/5936021*ep2^4 - 512/12720045*ep2^5 + 22528/597842115*ep2^6 - 1036288/29294263635*ep2^7 + 16580608/498002481795*ep2^8 - 165806080/5278826307027*ep2^9 + 12058624/406063562079*ep2^10 - 72351744/2571735893167*ep2^11 + 578813952/21676059670979*ep2^12 - 33571209216/1322239639929719*ep2^13) * k2^16
        + (17/310023 - 68/1343433*ep2 + 136/2898987*ep2^2 - 5440/124656441*ep2^3 + 2176/53424189*ep2^4 - 95744/2510936883*ep2^5 + 4404224/123035907267*ep2^6 - 4145152/123035907267*ep2^7 + 207257600/6520903085151*ep2^8 - 15073280/501607929627*ep2^9 + 30146560/1058950073657*ep2^10 - 241172480/8925436335109*ep2^11 + 13988003840/544451616441649*ep2^12) * k2^17
        - (34/665665 - 68/1436435*ep2 + 544/12353341*ep2^2 - 1088/26471445*ep2^3 + 4352/113105265*ep2^4 - 200192/5542157985*ep2^5 + 188416/5542157985*ep2^6 - 1884160/58746874641*ep2^7 + 1507328/49708893927*ep2^8 - 9043968/314822994871*ep2^9 + 72351744/2653508099627*ep2^10 - 4196401152/161863994077247*ep2^11) * k2^18
        + (969/20331080 - 969/21855911*ep2 + 646/15611365*ep2^2 - 2584/66703105*ep2^3 + 5168/142106615*ep2^4 - 4864/142106615*ep2^5 + 48640/1506330119*ep2^6 - 505856/16569631309*ep2^7 + 479232/16569631309*ep2^8 - 3833856/139658321033*ep2^9 + 222363648/8519157583013*ep2^10) * k2^19
        - (95/2132284 - 19/456918*ep2 + 38/976143*ep2^2 - 76/2079609*ep2^3 + 1216/35353353*ep2^4 - 60800/1873727709*ep2^5 + 632320/20611004799*ep2^6 - 199680/6870334933*ep2^7 + 1597440/57907108721*ep2^8 - 92651520/3532333631981*ep2^9) * k2^20
        + (19/455400 - 19/486450*ep2 + 19/518175*ep2^2 - 304/8808975*ep2^3 + 608/18675027*ep2^4 - 31616/1027126485*ep2^5 + 3328/114125165*ep2^6 - 26624/961912105*ep2^7 + 1544192/58676638405*ep2^8) * k2^21
        - (11/281060 - 11/299390*ep2 + 88/2544815*ep2^2 - 880/26975039*ep2^3 + 64/2075003*ep2^4 - 1152/39425057*ep2^5 + 9216/332296909*ep2^6 - 534528/20270111449*ep2^7) * k2^22
        + (253/6879600 - 253/7309575*ep2 + 506/15496299*ep2^2 - 184/5960115*ep2^3 + 368/12582465*ep2^4 - 2944/106052205*ep2^5 + 170752/6469184505*ep2^6) * k2^23
        - (253/7309575 - 506/15496299*ep2 + 184/5960115*ep2^2 - 368/12582465*ep2^3 + 2944/106052205*ep2^4 - 170752/6469184505*ep2^5) * k2^24
        + (575/17623242 - 230/7455987*ep2 + 460/15740417*ep2^2 - 3680/132669229*ep2^3 + 7360/279062861*ep2^4) * k2^25
        - (13/422037 - 26/890967*ep2 + 208/7509579*ep2^2 - 416/15796011*ep2^3) * k2^26
        + (195/6695752 - 195/7054453*ep2 + 390/14838677*ep2^2) * k2^27
        - (117/4243280 - 117/4462760*ep2) * k2^28
        + 87/3328160 * k2^29;
C4[4] = + (1/124740 - 1/162162*ep2 + 2/405405*ep2^2 - 4/984555*ep2^3 + 64/18706545*ep2^4 - 128/43648605*ep2^5 + 512/200783583*ep2^6 - 1024/456326325*ep2^7 + 8192/4106936925*ep2^8 - 16384/9161628525*ep2^9 + 65536/40572926325*ep2^10 - 131072/89260437915*ep2^11 + 4194304/3124115327025*ep2^12 - 8388608/6799545123525*ep2^13 + 33554432/29464695535275*ep2^14 - 67108864/63581711418225*ep2^15 + 536870912/546802718196735*ep2^16 - 1073741824/1171720110421575*ep2^17 + 4294967296/5006440471801275*ep2^18 - 8589934592/10665894918185325*ep2^19 + 137438953472/181320213609150525*ep2^20 - 274877906944/384398852851399113*ep2^21 + 1099511627776/1626302838986688555*ep2^22 - 2199023255552/3433305993416342505*ep2^23 + 17592186044416/28937864801652029685*ep2^24 - 35184372088832/60869301824164614165*ep2^25) * k2^4
        - (1/58968 - 1/73710*ep2 + 1/89505*ep2^2 - 16/1700595*ep2^3 + 32/3968055*ep2^4 - 128/18253053*ep2^5 + 2816/456326325*ep2^6 - 22528/4106936925*ep2^7 + 45056/9161628525*ep2^8 - 180224/40572926325*ep2^9 + 32768/8114585265*ep2^10 - 1048576/284010484275*ep2^11 + 2097152/618140465775*ep2^12 - 8388608/2678608685025*ep2^13 + 16777216/5780155583475*ep2^14 - 134217728/49709338017885*ep2^15 + 268435456/106520010038325*ep2^16 - 11811160064/5006440471801275*ep2^17 + 23622320128/10665894918185325*ep2^18 - 377957122048/181320213609150525*ep2^19 + 755914244096/384398852851399113*ep2^20 - 274877906944/147845712635153505*ep2^21 + 549755813888/312118726674212955*ep2^22 - 4398046511104/2630714981968366335*ep2^23 + 8796093022208/5533572893105874015*ep2^24) * k2^5
        + (1/41580 - 1/50490*ep2 + 8/479655*ep2^2 - 16/1119195*ep2^3 + 64/5148297*ep2^4 - 128/11700675*ep2^5 + 1024/105306075*ep2^6 - 26624/3053876175*ep2^7 + 106496/13524308775*ep2^8 - 212992/29753479305*ep2^9 + 6815744/1041371775675*ep2^10 - 13631488/2266515041175*ep2^11 + 4194304/755505013725*ep2^12 - 8388608/1630300292775*ep2^13 + 67108864/14020582517865*ep2^14 - 134217728/30044105395425*ep2^15 + 536870912/128370268507725*ep2^16 - 1073741824/273484485081675*ep2^17 + 17179869184/4649236246388475*ep2^18 - 34359738368/9856380842343567*ep2^19 + 1786706395136/542100946328896185*ep2^20 - 3573412790272/1144435331138780835*ep2^21 + 28587302322176/9645954933884009895*ep2^22 - 57174604644352/20289767274721538055*ep2^23) * k2^6
        - (7/242352 - 7/287793*ep2 + 2/95931*ep2^2 - 40/2206413*ep2^3 + 16/1002915*ep2^4 - 128/9026235*ep2^5 + 3328/261760815*ep2^6 - 93184/8114585265*ep2^7 + 186368/17852087583*ep2^8 - 851968/89260437915*ep2^9 + 1703936/194272717815*ep2^10 - 524288/64757572605*ep2^11 + 1048576/139740025095*ep2^12 - 8388608/1201764215817*ep2^13 + 117440512/18026463237255*ep2^14 - 469762048/77022161104635*ep2^15 + 134217728/23441527292715*ep2^16 - 2147483648/398505963976155*ep2^17 + 21474836480/4224163218147243*ep2^18 - 223338299392/46465795399619673*ep2^19 + 446676598784/98094456954752643*ep2^20 - 3573412790272/826796137190057991*ep2^21 + 7146825580544/1739122909261846119*ep2^22) * k2^7
        + (7/220077 - 2/73359*ep2 + 40/1687257*ep2^2 - 16/766935*ep2^3 + 128/6902415*ep2^4 - 256/15397695*ep2^5 + 7168/477328545*ep2^6 - 14336/1050122799*ep2^7 + 65536/5250613995*ep2^8 - 2228224/194272717815*ep2^9 + 8912896/841848443865*ep2^10 - 17825792/1816620326235*ep2^11 + 142606336/15622934805621*ep2^12 - 1996488704/234344022084315*ep2^13 + 7985954816/1001288094360255*ep2^14 - 2281701376/304739854805295*ep2^15 + 2147483648/304739854805295*ep2^16 - 21474836480/3230242460936127*ep2^17 + 17179869184/2733282082330569*ep2^18 - 34359738368/5770262173808979*ep2^19 + 274877906944/48635066893532823*ep2^20 - 549755813888/102301347603638007*ep2^21) * k2^8
        - (1/30030 - 2/69069*ep2 + 4/156975*ep2^2 - 32/1412775*ep2^3 + 64/3151575*ep2^4 - 256/13956975*ep2^5 + 512/30705345*ep2^6 - 16384/1074687075*ep2^7 + 557056/39763421775*ep2^8 - 2228224/172308161025*ep2^9 + 84672512/7064634602025*ep2^10 - 677380096/60755857577415*ep2^11 + 1354760192/130191123380175*ep2^12 - 5419040768/556271163533475*ep2^13 + 10838081536/1185099435353925*ep2^14 - 10200547328/1185099435353925*ep2^15 + 20401094656/2512410802950321*ep2^16 - 81604378624/10629430320174435*ep2^17 + 8589934592/1181047813352715*ep2^18 - 68719476736/9954545855401455*ep2^19 + 137438953472/20938872316534095*ep2^20) * k2^9
        + (1/29601 - 2/67275*ep2 + 16/605475*ep2^2 - 32/1350675*ep2^3 + 896/41870925*ep2^4 - 1792/92116035*ep2^5 + 8192/460580175*ep2^6 - 278528/17041466475*ep2^7 + 1114112/73846354725*ep2^8 - 42336256/3027700543725*ep2^9 + 338690048/26038224676035*ep2^10 - 4741660672/390573370140525*ep2^11 + 18966642688/1668813490600425*ep2^12 - 5419040768/507899758008825*ep2^13 + 5100273664/507899758008825*ep2^14 - 10200547328/1076747486978709*ep2^15 + 40802189312/4555470137217615*ep2^16 - 4294967296/506163348579735*ep2^17 + 34359738368/4266233938029195*ep2^18 - 68719476736/8973802421371755*ep2^19) * k2^10
        - (11/327600 - 11/368550*ep2 + 11/411075*ep2^2 - 44/1820475*ep2^3 + 8/364095*ep2^4 - 256/12743325*ep2^5 + 8704/471503025*ep2^6 - 34816/2043179775*ep2^7 + 1323008/83770370775*ep2^8 - 10584064/720425188665*ep2^9 + 21168128/1543768261425*ep2^10 - 931397632/72557108286975*ep2^11 + 42844291072/3555298306061775*ep2^12 - 40324038656/3555298306061775*ep2^13 + 80648077312/7537232408850963*ep2^14 - 29326573568/2898935541865755*ep2^15 + 3087007744/322103949096195*ep2^16 - 24696061952/2714876142382215*ep2^17 + 49392123904/5710601540872935*ep2^18) * k2^11
        + (11/334152 - 11/372708*ep2 + 11/412641*ep2^2 - 10/412641*ep2^3 + 64/2888487*ep2^4 - 128/6286707*ep2^5 + 512/27242397*ep2^6 - 19456/1116938277*ep2^7 + 778240/48028345911*ep2^8 - 311296/20583576819*ep2^9 + 13697024/967428110493*ep2^10 - 630063104/47403977414157*ep2^11 + 10081009664/805867616040669*ep2^12 - 504050483200/42710983650155457*ep2^13 + 36658216960/3285460280781189*ep2^14 - 3858759680/365051142309021*ep2^15 + 30870077440/3076859628033177*ep2^16 - 61740154880/6472015079655993*ep2^17) * k2^12
        - (143/4472496 - 143/4951692*ep2 + 65/2475846*ep2^2 - 208/8665461*ep2^3 + 416/18860121*ep2^4 - 128/6286707*ep2^5 + 4864/257754987*ep2^6 - 194560/11083464441*ep2^7 + 77824/4750056189*ep2^8 - 3424256/223252640883*ep2^9 + 157515776/10939379403267*ep2^10 - 2520252416/185969449855539*ep2^11 + 126012620800/9856380842343567*ep2^12 - 119139205120/9856380842343567*ep2^13 + 12540968960/1095153426927063*ep2^14 - 100327751680/9230578884099531*ep2^15 + 200655503360/19416045238967979*ep2^16) * k2^13
        + (1001/32442120 - 91/3244212*ep2 + 104/4055265*ep2^2 - 208/8826165*ep2^3 + 64/2942055*ep2^4 - 128/6348645*ep2^5 + 1024/54598347*ep2^6 - 14336/818975205*ep2^7 + 630784/38491834635*ep2^8 - 4145152/269442842445*ep2^9 + 66322432/4580528321565*ep2^10 - 663224320/48553600208589*ep2^11 + 627048448/48553600208589*ep2^12 - 1254096896/102502044884799*ep2^13 + 10032775168/863945806886163*ep2^14 - 581900959744/52700694220055943*ep2^15) * k2^14
        - (91/3069792 - 13/479655*ep2 + 26/1043955*ep2^2 - 8/347985*ep2^3 + 16/750915*ep2^4 - 128/6457869*ep2^5 + 1792/96868035*ep2^6 - 7168/413890695*ep2^7 + 47104/2897234865*ep2^8 - 753664/49252992705*ep2^9 + 7536640/522081722673*ep2^10 - 78381056/5742898949403*ep2^11 + 156762112/12123897782073*ep2^12 - 1254096896/102187138448901*ep2^13 + 72737619968/6233415445382961*ep2^14) * k2^15
        + (26/915705 - 52/1993005*ep2 + 16/664335*ep2^2 - 32/1433565*ep2^3 + 256/12328659*ep2^4 - 512/26418555*ep2^5 + 22528/1241672085*ep2^6 - 1036288/60841932165*ep2^7 + 16580608/1034312846805*ep2^8 - 165806080/10963716176133*ep2^9 + 156762112/10963716176133*ep2^10 - 313524224/23145623038503*ep2^11 + 2508193792/195084537038811*ep2^12 - 145475239936/11900156759367471*ep2^13) * k2^16
        - (17/626373 - 68/2714283*ep2 + 136/5857137*ep2^2 - 5440/251856891*ep2^3 + 15232/755570673*ep2^4 - 60928/3228347421*ep2^5 + 400384/22598431947*ep2^6 - 376832/22598431947*ep2^7 + 18841600/1197716893191*ep2^8 - 15073280/1013452755777*ep2^9 + 30146560/2139511373307*ep2^10 - 241172480/18033024432159*ep2^11 + 13988003840/1100014490361699*ep2^12) * k2^17
        + (34/1312311 - 68/2831829*ep2 + 2720/121768647*ep2^2 - 1088/52186563*ep2^3 + 4352/222978951*ep2^4 - 8704/475042113*ep2^5 + 8192/475042113*ep2^6 - 409600/25177231989*ep2^7 + 327680/21303811683*ep2^8 - 655360/44974713553*ep2^9 + 5242880/379072585661*ep2^10 - 304087040/23123427725321*ep2^11) * k2^18
        - (323/13069980 - 646/28100457*ep2 + 1292/60215265*ep2^2 - 5168/257283405*ep2^3 + 10336/548125515*ep2^4 - 9728/548125515*ep2^5 + 97280/5810130459*ep2^6 - 1011712/63911435049*ep2^7 + 106496/7101270561*ep2^8 - 851968/59853566157*ep2^9 + 49414144/3651067535577*ep2^10) * k2^19
        + (323/13707540 - 323/14686650*ep2 + 646/31376025*ep2^2 - 1292/66844575*ep2^3 + 1216/66844575*ep2^4 - 2432/141710499*ep2^5 + 126464/7794077445*ep2^6 - 13312/866008605*ep2^7 + 106496/7299215385*ep2^8 - 6176768/445252138485*ep2^9) * k2^20
        - (133/5920200 - 133/6323850*ep2 + 19/962325*ep2^2 - 304/16359525*ep2^3 + 608/34682193*ep2^4 - 2432/146732355*ep2^5 + 256/16303595*ep2^6 - 2048/137416015*ep2^7 + 118784/8382376915*ep2^8) * k2^21
        + (1463/68297580 - 209/10393110*ep2 + 1672/88341435*ep2^2 - 16720/936419211*ep2^3 + 1216/72032247*ep2^4 - 128/8003583*ep2^5 + 1024/67458771*ep2^6 - 59392/4114985031*ep2^7) * k2^22
        - (253/12383280 - 253/13157235*ep2 + 2530/139466691*ep2^2 - 184/10728207*ep2^3 + 368/22648437*ep2^4 - 2944/190893969*ep2^5 + 170752/11644532109*ep2^6) * k2^23
        + (253/12978225 - 506/27513837*ep2 + 184/10582245*ep2^2 - 368/22340295*ep2^3 + 20608/1318077405*ep2^4 - 41216/2772507645*ep2^5) * k2^24
        - (1265/67975362 - 46/2614437*ep2 + 92/5519367*ep2^2 - 736/46520379*ep2^3 + 1472/97853211*ep2^4) * k2^25
        + (299/16821189 - 598/35511399*ep2 + 4784/299310363*ep2^2 - 9568/629583867*ep2^3) * k2^26
        - (65/3826144 - 65/4031116*ep2 + 65/4239622*ep2^2) * k2^27
        + (455/28005648 - 455/29454216*ep2) * k2^28
        - 2639/169736160 * k2^29;
C4[5] = + (1/792792 - 1/990990*ep2 + 1/1203345*ep2^2 - 16/22863555*ep2^3 + 32/53348295*ep2^4 - 128/245402157*ep2^5 + 256/557732175*ep2^6 - 2048/5019589575*ep2^7 + 4096/11197545975*ep2^8 - 16384/49589132175*ep2^9 + 32768/109096090785*ep2^10 - 1048576/3818363177475*ep2^11 + 2097152/8310555150975*ep2^12 - 8388608/36012405654225*ep2^13 + 16777216/77710980622275*ep2^14 - 134217728/668314433351565*ep2^15 + 268435456/1432102357181925*ep2^16 - 1073741824/6118982798868225*ep2^17 + 2147483648/13036093788893175*ep2^18 - 34359738368/221613594411183975*ep2^19 + 68719476736/469820820151710027*ep2^20 - 274877906944/1987703469872619345*ep2^21 + 549755813888/4196262880842196395*ep2^22 - 4398046511104/35368501424241369615*ep2^23 + 8796093022208/74395813340645639535*ep2^24) * k2^5
        - (1/304920 - 1/370260*ep2 + 4/1758735*ep2^2 - 8/4103715*ep2^3 + 32/18877089*ep2^4 - 64/42902475*ep2^5 + 512/386122275*ep2^6 - 13312/11197545975*ep2^7 + 53248/49589132175*ep2^8 - 106496/109096090785*ep2^9 + 3407872/3818363177475*ep2^10 - 6815744/8310555150975*ep2^11 + 2097152/2770185050325*ep2^12 - 4194304/5977767740175*ep2^13 + 33554432/51408802565505*ep2^14 - 67108864/110161719783225*ep2^15 + 268435456/470690984528325*ep2^16 - 536870912/1002776445299475*ep2^17 + 8589934592/17047199570091075*ep2^18 - 17179869184/36140063088593079*ep2^19 + 893353197568/1987703469872619345*ep2^20 - 1786706395136/4196262880842196395*ep2^21 + 14293651161088/35368501424241369615*ep2^22 - 28587302322176/74395813340645639535*ep2^23) * k2^6
        + (7/1283568 - 7/1524237*ep2 + 2/508079*ep2^2 - 40/11685817*ep2^3 + 16/5311735*ep2^4 - 128/47805615*ep2^5 + 256/106643295*ep2^6 - 7168/3305942145*ep2^7 + 14336/7273072719*ep2^8 - 65536/36365363595*ep2^9 + 131072/79148144295*ep2^10 - 524288/342975291945*ep2^11 + 1048576/740104577355*ep2^12 - 8388608/6364899365253*ep2^13 + 117440512/95473490478795*ep2^14 - 469762048/407932186591215*ep2^15 + 134217728/124153274179935*ep2^16 - 2147483648/2110605661058895*ep2^17 + 21474836480/22372420007224287*ep2^18 - 17179869184/18930509236882089*ep2^19 + 34359738368/39964408388973299*ep2^20 - 274877906944/336842870707060663*ep2^21 + 549755813888/708531555625196567*ep2^22) * k2^7
        - (2/268983 - 4/627627*ep2 + 80/14435421*ep2^2 - 32/6561555*ep2^3 + 256/59053995*ep2^4 - 512/131735835*ep2^5 + 2048/583401555*ep2^6 - 4096/1283483421*ep2^7 + 131072/44921919735*ep2^8 - 4456448/1662111030195*ep2^9 + 17825792/7202481130845*ep2^10 - 35651584/15542196124455*ep2^11 + 285212672/133662886670313*ep2^12 - 570425344/286420471436385*ep2^13 + 2281701376/1223796559773645*ep2^14 - 4563402752/2607218757778635*ep2^15 + 4294967296/2607218757778635*ep2^16 - 42949672960/27636518832453531*ep2^17 + 34359738368/23384746704383757*ep2^18 - 68719476736/49367798598143487*ep2^19 + 549755813888/416100016755780819*ep2^20 - 1099511627776/875244862831125171*ep2^21) * k2^8
        + (1/110110 - 2/253253*ep2 + 4/575575*ep2^2 - 32/5180175*ep2^3 + 64/11555775*ep2^4 - 256/51175575*ep2^5 + 512/112586265*ep2^6 - 16384/3940519275*ep2^7 + 557056/145799213175*ep2^8 - 2228224/631796590425*ep2^9 + 84672512/25903660207425*ep2^10 - 677380096/222771477783855*ep2^11 + 1354760192/477367452393975*ep2^12 - 5419040768/2039660932956075*ep2^13 + 10838081536/4345364596297725*ep2^14 - 10200547328/4345364596297725*ep2^15 + 20401094656/9212172944151177*ep2^16 - 81604378624/38974577840639595*ep2^17 + 8589934592/4330508648959955*ep2^18 - 68719476736/36500001469805335*ep2^19 + 137438953472/76775865160625015*ep2^20) * k2^9
        - (3/289432 - 3/328900*ep2 + 2/246675*ep2^2 - 4/550275*ep2^3 + 112/17058525*ep2^4 - 224/37528755*ep2^5 + 1024/187643775*ep2^6 - 34816/6942819675*ep2^7 + 139264/30085551925*ep2^8 - 5292032/1233507628925*ep2^9 + 42336256/10608165608755*ep2^10 - 592707584/159122484131325*ep2^11 + 2370830336/679886977652025*ep2^12 - 677380096/206922123633225*ep2^13 + 637534208/206922123633225*ep2^14 - 1275068416/438674902102437*ep2^15 + 5100273664/1855932278125695*ep2^16 - 1610612736/618644092708565*ep2^17 + 12884901888/5214285924257905*ep2^18 - 25769803776/10967980737232145*ep2^19) * k2^10
        + (1/88400 - 1/99450*ep2 + 1/110925*ep2^2 - 28/3438675*ep2^3 + 56/7565085*ep2^4 - 256/37825425*ep2^5 + 512/82325925*ep2^6 - 2048/356745675*ep2^7 + 77824/14626572675*ep2^8 - 622592/125788525005*ep2^9 + 8716288/1886827875075*ep2^10 - 34865152/8061900920775*ep2^11 + 229113856/56433306445425*ep2^12 - 3665821696/959366209572225*ep2^13 + 7331643392/2033856364293117*ep2^14 - 29326573568/8604776925855495*ep2^15 + 3087007744/956086325095055*ep2^16 - 24696061952/8058441882944035*ep2^17 + 49392123904/16950515684813315*ep2^18) * k2^11
        - (1/83538 - 1/93177*ep2 + 4/412641*ep2^2 - 40/4539051*ep2^3 + 256/31773357*ep2^4 - 512/69153777*ep2^5 + 2048/299666367*ep2^6 - 77824/12286321047*ep2^7 + 3112960/528311805021*ep2^8 - 1245184/226419345009*ep2^9 + 4980736/967428110493*ep2^10 - 229113856/47403977414157*ep2^11 + 3665821696/805867616040669*ep2^12 - 183291084800/42710983650155457*ep2^13 + 146632867840/36140063088593079*ep2^14 - 15435038720/4015562565399231*ep2^15 + 123480309760/33845455908364947*ep2^16 - 246960619520/71192165876215923*ep2^17) * k2^12
        + (13/1049104 - 13/1161508*ep2 + 65/6388294*ep2^2 - 208/22359029*ep2^3 + 416/48663769*ep2^4 - 384/48663769*ep2^5 + 768/105011291*ep2^6 - 30720/4515485513*ep2^7 + 4096/645069359*ep2^8 - 16384/2756205443*ep2^9 + 753664/135054066707*ep2^10 - 12058624/2295919134019*ep2^11 + 602931200/121683714103007*ep2^12 - 6270484480/1338520855133077*ep2^13 + 112868720640/25431896247528463*ep2^14 - 902949765120/214354554086311331*ep2^15 + 1805899530240/450883717216034179*ep2^16) * k2^13
        - (91/7209360 - 91/7930296*ep2 + 52/4956435*ep2^2 - 104/10787535*ep2^3 + 32/3595845*ep2^4 - 64/7759455*ep2^5 + 512/66731313*ep2^6 - 7168/1000969695*ep2^7 + 28672/4276870515*ep2^8 - 188416/29938093605*ep2^9 + 3014656/508947591285*ep2^10 - 30146560/5394844467621*ep2^11 + 313524224/59343289143831*ep2^12 - 627048448/125280277081421*ep2^13 + 5016387584/1055933763971977*ep2^14 - 290950479872/64411959602290597*ep2^15) * k2^14
        + (13/1023264 - 13/1119195*ep2 + 26/2435895*ep2^2 - 8/811965*ep2^3 + 16/1752135*ep2^4 - 128/15068361*ep2^5 + 256/32289345*ep2^6 - 1024/137963565*ep2^7 + 47104/6760214685*ep2^8 - 753664/114923649645*ep2^9 + 7536640/1218190686237*ep2^10 - 78381056/13400097548607*ep2^11 + 156762112/28289094824837*ep2^12 - 1254096896/238436656380769*ep2^13 + 72737619968/14544636039226909*ep2^14) * k2^15
        - (52/4103715 - 104/8931615*ep2 + 32/2977205*ep2^2 - 64/6424495*ep2^3 + 512/55250657*ep2^4 - 1024/118394265*ep2^5 + 4096/505866405*ep2^6 - 188416/24787453845*ep2^7 + 3014656/421386715365*ep2^8 - 30146560/4466699182869*ep2^9 + 313524224/49133691011559*ep2^10 - 1881145344/311180043073207*ep2^11 + 15049162752/2622803220188459*ep2^12 - 872851439616/159990996431495999*ep2^13) * k2^16
        + (221/17608041 - 68/5869347*ep2 + 136/12665433*ep2^2 - 5440/544613619*ep2^3 + 15232/1633840857*ep2^4 - 60928/6980956389*ep2^5 + 17408/2124638901*ep2^6 - 16384/2124638901*ep2^7 + 819200/112605861753*ep2^8 - 8519680/1238664479283*ep2^9 + 17039360/2614958345153*ep2^10 - 136314880/22040363194861*ep2^11 + 7906263040/1344462154886521*ep2^12) * k2^17
        - (17/1374802 - 17/1483339*ep2 + 680/63783577*ep2^2 - 1904/191350731*ep2^3 + 7616/817589487*ep2^4 - 2176/248831583*ep2^5 + 2048/248831583*ep2^6 - 102400/13188073899*ep2^7 + 81920/11159139453*ep2^8 - 491520/70674549869*ep2^9 + 3932160/595685491753*ep2^10 - 228065280/36336814996933*ep2^11) * k2^18
        + (969/79872100 - 1938/171725015*ep2 + 1292/122660725*ep2^2 - 5168/524095825*ep2^3 + 10336/1116551975*ep2^4 - 9728/1116551975*ep2^5 + 19456/2367090187*ep2^6 - 1011712/130189960285*ep2^7 + 958464/130189960285*ep2^8 - 7667712/1097315379545*ep2^9 + 444727296/66936238152245*ep2^10) * k2^19
        - (646/54449395 - 1292/116677275*ep2 + 5168/498530175*ep2^2 - 10336/1062086025*ep2^3 + 9728/1062086025*ep2^4 - 19456/2251622373*ep2^5 + 77824/9526094655*ep2^6 - 24576/3175364885*ep2^7 + 196608/26763789745*ep2^8 - 11403264/1632591174445*ep2^9) * k2^20
        + (2261/195366600 - 2261/208687050*ep2 + 323/31756725*ep2^2 - 304/31756725*ep2^3 + 608/67324257*ep2^4 - 2432/284833395*ep2^5 + 256/31648155*ep2^6 - 2048/266748735*ep2^7 + 118784/16271672835*ep2^8) * k2^21
        - (19/1686360 - 19/1796340*ep2 + 76/7634445*ep2^2 - 760/80925117*ep2^3 + 608/68475099*ep2^4 - 192/22825033*ep2^5 + 1536/192382421*ep2^6 - 89088/11735327681*ep2^7) * k2^22
        + (437/39901680 - 437/42395535*ep2 + 4370/449392671*ep2^2 - 3496/380255337*ep2^3 + 368/42250593*ep2^4 - 2944/356112141*ep2^5 + 5888/749063469*ep2^6) * k2^23
        - (46/4326075 - 92/9171279*ep2 + 368/38801565*ep2^2 - 736/81914415*ep2^3 + 41216/4832950485*ep2^4 - 82432/10165861365*ep2^5) * k2^24
        + (115/11149398 - 46/4717053*ep2 + 92/9958223*ep2^2 - 5152/587535157*ep2^3 + 10304/1235849813*ep2^4) * k2^25
        - (299/29904336 - 299/31565688*ep2 + 299/33256707*ep2^2 - 598/69953763*ep2^3) * k2^26
        + (4485/462963424 - 4485/487765036*ep2 + 4485/512994262*ep2^2) * k2^27
        - (4095/436421348 - 4095/458994866*ep2) * k2^28
        + 1131/124473184 * k2^29;
C4[6] = + (1/4684680 - 1/5688540*ep2 + 4/27020565*ep2^2 - 8/63047985*ep2^3 + 32/290020731*ep2^4 - 64/659138025*ep2^5 + 512/5932242225*ep2^6 - 1024/13233463425*ep2^7 + 4096/58605338025*ep2^8 - 8192/128931743655*ep2^9 + 262144/4512611027925*ep2^10 - 524288/9821565178425*ep2^11 + 2097152/42560115773175*ep2^12 - 4194304/91840249826325*ep2^13 + 33554432/789826148506395*ep2^14 - 67108864/1692484603942275*ep2^15 + 268435456/7231525125935175*ep2^16 - 536870912/15406292659601025*ep2^17 + 8589934592/261906975213217425*ep2^18 - 17179869184/555242787452020941*ep2^19 + 68719476736/2349104100758550135*ep2^20 - 137438953472/4959219768268050285*ep2^21 + 1099511627776/41799138046830709545*ep2^22 - 2199023255552/87922324857126664905*ep2^23) * k2^6
        - (1/1516944 - 1/1801371*ep2 + 2/4203199*ep2^2 - 40/96673577*ep2^3 + 16/43942535*ep2^4 - 128/395482815*ep2^5 + 256/882230895*ep2^6 - 1024/3907022535*ep2^7 + 2048/8595449577*ep2^8 - 65536/300840735195*ep2^9 + 131072/654771011895*ep2^10 - 524288/2837341051545*ep2^11 + 1048576/6122683321755*ep2^12 - 8388608/52655076567093*ep2^13 + 16777216/112832306929485*ep2^14 - 67108864/482101675062345*ep2^15 + 134217728/1027086177306735*ep2^16 - 2147483648/17460465014214495*ep2^17 + 21474836480/185080929150673647*ep2^18 - 17179869184/156606940050570009*ep2^19 + 34359738368/330614651217870019*ep2^20 - 274877906944/2786609203122047303*ep2^21 + 549755813888/5861488323808444327*ep2^22) * k2^7
        + (2/1589445 - 4/3708705*ep2 + 16/17060043*ep2^2 - 32/38772825*ep2^3 + 256/348955425*ep2^4 - 512/778439025*ep2^5 + 2048/3447372825*ep2^6 - 4096/7584220215*ep2^7 + 131072/265447707525*ep2^8 - 4456448/9821565178425*ep2^9 + 17825792/42560115773175*ep2^10 - 35651584/91840249826325*ep2^11 + 285212672/789826148506395*ep2^12 - 570425344/1692484603942275*ep2^13 + 2281701376/7231525125935175*ep2^14 - 4563402752/15406292659601025*ep2^15 + 4294967296/15406292659601025*ep2^16 - 8589934592/32661340438354173*ep2^17 + 34359738368/138182594162267655*ep2^18 - 68719476736/291718809898120605*ep2^19 + 549755813888/2458772826284159385*ep2^20 - 1099511627776/5171901462183921465*ep2^21) * k2^8
        - (1/520520 - 1/598598*ep2 + 1/680225*ep2^2 - 8/6122025*ep2^3 + 16/13656825*ep2^4 - 64/60480225*ep2^5 + 128/133056495*ep2^6 - 4096/4656977325*ep2^7 + 139264/172308161025*ep2^8 - 557056/746668697775*ep2^9 + 21168128/30613416608775*ep2^10 - 169345024/263275382835465*ep2^11 + 338690048/564161534647425*ep2^12 - 1354760192/2410508375311725*ep2^13 + 2709520384/5135430886533675*ep2^14 - 2550136832/5135430886533675*ep2^15 + 5100273664/10887113479451391*ep2^16 - 20401094656/46060864720755885*ep2^17 + 2147483648/5117873857861765*ep2^18 - 17179869184/43136365373406305*ep2^19 + 34359738368/90735113371647745*ep2^20) * k2^9
        + (15/5814952 - 3/1321580*ep2 + 2/991185*ep2^2 - 4/2211105*ep2^3 + 112/68544255*ep2^4 - 224/150797361*ep2^5 + 1024/753986805*ep2^6 - 2048/1641030105*ep2^7 + 8192/7111130455*ep2^8 - 311296/291556348655*ep2^9 + 2490368/2507384598433*ep2^10 - 34865152/37610768976495*ep2^11 + 139460608/160700558354115*ep2^12 - 39845888/48908865586035*ep2^13 + 637534208/831450714962595*ep2^14 - 6375342080/8813377578603507*ep2^15 + 5100273664/7457473335741429*ep2^16 - 1610612736/2485824445247143*ep2^17 + 12884901888/20951948895654491*ep2^18 - 25769803776/44071340780514619*ep2^19) * k2^10
        - (11/3447600 - 11/3878550*ep2 + 11/4326075*ep2^2 - 308/134108325*ep2^3 + 56/26821665*ep2^4 - 256/134108325*ep2^5 + 512/291882825*ep2^6 - 2048/1264825575*ep2^7 + 77824/51857848575*ep2^8 - 622592/445977497745*ep2^9 + 8716288/6689662466175*ep2^10 - 383516672/314414135910225*ep2^11 + 2520252416/2200898951371575*ep2^12 - 40324038656/37415282173316775*ep2^13 + 80648077312/79320398207431563*ep2^14 - 29326573568/30507845464396755*ep2^15 + 3087007744/3389760607155195*ep2^16 - 24696061952/28570839403165215*ep2^17 + 49392123904/60097282882519935*ep2^18) * k2^11
        + (11/2947698 - 11/3287817*ep2 + 308/101922327*ep2^2 - 280/101922327*ep2^3 + 256/101922327*ep2^4 - 512/221830947*ep2^5 + 2048/961267437*ep2^6 - 4096/2074313943*ep2^7 + 163840/89195499549*ep2^8 - 458752/267586498647*ep2^9 + 20185088/12576565436409*ep2^10 - 132644864/88035958054863*ep2^11 + 2122317824/1496611286932671*ep2^12 - 106115891200/79320398207431563*ep2^13 + 7717519360/6101569092879351*ep2^14 - 15435038720/12881090307189741*ep2^15 + 123480309760/108569189732027817*ep2^16 - 246960619520/228369674953575753*ep2^17) * k2^12
        - (11/2622760 - 11/2903770*ep2 + 1/290377*ep2^2 - 32/10163195*ep2^3 + 64/22119895*ep2^4 - 768/287558635*ep2^5 + 1536/620521265*ep2^6 - 12288/5336482879*ep2^7 + 8192/3811773485*ep2^8 - 360448/179153353795*ep2^9 + 16580608/8778514335955*ep2^10 - 265289728/149234743711235*ep2^11 + 2652897280/1581888283339091*ep2^12 - 192937984/121683714103007*ep2^13 + 3472883712/2311990567957133*ep2^14 - 27783069696/19486777644210121*ep2^15 + 55566139392/40989428837821289*ep2^16) * k2^13
        + (11/2403120 - 1/240312*ep2 + 4/1051365*ep2^2 - 8/2288265*ep2^3 + 32/9915815*ep2^4 - 64/21397285*ep2^5 + 512/184016651*ep2^6 - 1024/394321395*ep2^7 + 45056/18533105565*ep2^8 - 2072576/908122172685*ep2^9 + 33161216/15438076935645*ep2^10 - 331612160/163643615517837*ep2^11 + 24117248/12587970424449*ep2^12 - 144703488/79723812688177*ep2^13 + 1157627904/671957849800349*ep2^14 - 67142418432/40989428837821289*ep2^15) * k2^14
        - (5/1023264 - 1/223839*ep2 + 2/487179*ep2^2 - 8/2111109*ep2^3 + 16/4555551*ep2^4 - 640/195888693*ep2^5 + 256/83952297*ep2^6 - 1024/358705269*ep2^7 + 47104/17576558181*ep2^8 - 753664/298801489077*ep2^9 + 37683200/15836478921081*ep2^10 - 30146560/13400097548607*ep2^11 + 60293120/28289094824837*ep2^12 - 482344960/238436656380769*ep2^13 + 27976007680/14544636039226909*ep2^14) * k2^15
        + (4/780045 - 8/1697745*ep2 + 32/7356895*ep2^2 - 64/15875405*ep2^3 + 512/136528483*ep2^4 - 1024/292561035*ep2^5 + 45056/13750368645*ep2^6 - 90112/29294263635*ep2^7 + 1441792/498002481795*ep2^8 - 14417920/5278826307027*ep2^9 + 1048576/406063562079*ep2^10 - 6291456/2571735893167*ep2^11 + 50331648/21676059670979*ep2^12 - 2919235584/1322239639929719*ep2^13) * k2^16
        - (17/3201462 - 34/6936501*ep2 + 68/14968239*ep2^2 - 2720/643634277*ep2^3 + 7616/1930902831*ep2^4 - 30464/8250221187*ep2^5 + 8704/2510936883*ep2^6 - 8192/2510936883*ep2^7 + 409600/133079654799*ep2^8 - 327680/112605861753*ep2^9 + 655360/237723485923*ep2^10 - 5242880/2003669381351*ep2^11 + 304087040/122223832262411*ep2^12) * k2^17
        + (17/3124550 - 17/3371225*ep2 + 136/28992535*ep2^2 - 1904/434888025*ep2^3 + 7616/1858157925*ep2^4 - 2176/565526325*ep2^5 + 2048/565526325*ep2^6 - 4096/1198915809*ep2^7 + 16384/5072336115*ep2^8 - 98304/32124795395*ep2^9 + 786432/270766132615*ep2^10 - 45613056/16516734089515*ep2^11) * k2^18
        - (969/175303700 - 1938/376902955*ep2 + 9044/1884514775*ep2^2 - 36176/8052017675*ep2^3 + 10336/2450614075*ep2^4 - 9728/2450614075*ep2^5 + 19456/5195301839*ep2^6 - 77824/21980123165*ep2^7 + 73728/21980123165*ep2^8 - 589824/185261038105*ep2^9 + 34209792/11300923324405*ep2^10) * k2^19
        + (646/115828713 - 1292/248204385*ep2 + 5168/1060509645*ep2^2 - 10336/2259346635*ep2^3 + 9728/2259346635*ep2^4 - 97280/23949074331*ep2^5 + 77824/20264601357*ep2^6 - 8192/2251622373*ep2^7 + 65536/18977960001*ep2^8 - 3801088/1157655560061*ep2^9) * k2^20
        - (323/57721950 - 646/123315075*ep2 + 1292/262714725*ep2^2 - 1216/262714725*ep2^3 + 2432/556955217*ep2^4 - 9728/2356348995*ep2^5 + 1024/261816555*ep2^6 - 8192/2206739535*ep2^7 + 475136/134611111635*ep2^8) * k2^21
        + (3553/635757720 - 3553/677220180*ep2 + 836/169305045*ep2^2 - 8360/1794633477*ep2^3 + 608/138048729*ep2^4 - 192/46016243*ep2^5 + 1536/387851191*ep2^6 - 3072/815824919*ep2^7) * k2^22
        - (4807/864536400 - 4807/918569925*ep2 + 9614/1947368241*ep2^2 - 3496/748987785*ep2^3 + 368/83220865*ep2^4 - 2944/701433005*ep2^5 + 5888/1475428045*ep2^6) * k2^23
        + (9614/1743408225 - 19228/3696025437*ep2 + 6992/1421548245*ep2^2 - 736/157949805*ep2^3 + 41216/9319038495*ep2^4 - 82432/19602115455*ep2^5) * k2^24
        - (6325/1159537392 - 115/22298796*ep2 + 115/23537618*ep2^2 - 3220/694359731*ep2^3 + 6440/1460549779*ep2^4) * k2^25
        + (23/4272048 - 23/4509384*ep2 + 161/33256707*ep2^2 - 322/69953763*ep2^3) * k2^26
        - (345/65044448 - 345/68528972*ep2 + 345/72073574*ep2^2) * k2^27
        + (207/39674668 - 207/41726806*ep2) * k2^28
        - 29/5657872 * k2^29;
C4[7] = + (1/26254800 - 1/31177575*ep2 + 2/72747675*ep2^2 - 8/334639305*ep2^3 + 16/760543875*ep2^4 - 128/6844894875*ep2^5 + 256/15269380875*ep2^6 - 1024/67621543875*ep2^7 + 2048/148767396525*ep2^8 - 65536/5206858878375*ep2^9 + 131072/11332575205875*ep2^10 - 524288/49107825892125*ep2^11 + 1048576/105969519030375*ep2^12 - 8388608/911337863661225*ep2^13 + 16777216/1952866850702625*ep2^14 - 67108864/8344067453002125*ep2^15 + 134217728/17776491530308875*ep2^16 - 2147483648/302200356015250875*ep2^17 + 4294967296/640664754752331855*ep2^18 - 17179869184/2710504731644480925*ep2^19 + 34359738368/5722176655693904175*ep2^20 - 274877906944/48229774669420049475*ep2^21 + 549755813888/101448836373607690275*ep2^22) * k2^7
        - (1/7335900 - 1/8558550*ep2 + 2/19684665*ep2^2 - 4/44737875*ep2^3 + 32/402640875*ep2^4 - 64/898198875*ep2^5 + 256/3977737875*ep2^6 - 512/8751023325*ep2^7 + 16384/306285816375*ep2^8 - 557056/11332575205875*ep2^9 + 2228224/49107825892125*ep2^10 - 4456448/105969519030375*ep2^11 + 35651584/911337863661225*ep2^12 - 71303168/1952866850702625*ep2^13 + 285212672/8344067453002125*ep2^14 - 570425344/17776491530308875*ep2^15 + 536870912/17776491530308875*ep2^16 - 1073741824/37686162044254815*ep2^17 + 4294967296/159441454802616525*ep2^18 - 8589934592/336598626805523775*ep2^19 + 68719476736/2837045568789414675*ep2^20 - 137438953472/5967578610212217075*ep2^21) * k2^8
        + (1/3403400 - 1/3913910*ep2 + 1/4447625*ep2^2 - 8/40028625*ep2^3 + 16/89294625*ep2^4 - 64/395447625*ep2^5 + 128/869984775*ep2^6 - 4096/30449467125*ep2^7 + 8192/66272369625*ep2^8 - 32768/287180268375*ep2^9 + 1245184/11774391003375*ep2^10 - 9961472/101259762629025*ep2^11 + 19922944/216985205633625*ep2^12 - 79691776/927118605889125*ep2^13 + 159383552/1975165725589875*ep2^14 - 2550136832/33577817335027875*ep2^15 + 5100273664/71184972750259095*ep2^16 - 20401094656/301167192404942325*ep2^17 + 2147483648/33463021378326925*ep2^18 - 17179869184/282045465903041225*ep2^19 + 34359738368/593268048968466025*ep2^20) * k2^9
        - (1/2012868 - 1/2287350*ep2 + 4/10293075*ep2^2 - 8/22961475*ep2^3 + 224/711805725*ep2^4 - 448/1565972595*ep2^5 + 2048/7829862975*ep2^6 - 4096/17041466475*ep2^7 + 16384/73846354725*ep2^8 - 622592/3027700543725*ep2^9 + 4980736/26038224676035*ep2^10 - 69730304/390573370140525*ep2^11 + 278921216/1668813490600425*ep2^12 - 79691776/507899758008825*ep2^13 + 1275068416/8634295886150025*ep2^14 - 2550136832/18304707278638053*ep2^15 + 10200547328/77442992332699455*ep2^16 - 1073741824/8604776925855495*ep2^17 + 8589934592/72525976946496315*ep2^18 - 17179869184/152554641163319835*ep2^19) * k2^10
        + (11/15116400 - 11/17005950*ep2 + 11/18968175*ep2^2 - 308/588013425*ep2^3 + 56/117602685*ep2^4 - 256/588013425*ep2^5 + 512/1279793925*ep2^6 - 2048/5545773675*ep2^7 + 4096/11967195825*ep2^8 - 32768/102917884095*ep2^9 + 458752/1543768261425*ep2^10 - 20185088/72557108286975*ep2^11 + 132644864/507899758008825*ep2^12 - 2122317824/8634295886150025*ep2^13 + 4244635648/18304707278638053*ep2^14 - 1543503872/7040272030245405*ep2^15 + 3087007744/14862796508295855*ep2^16 - 24696061952/125272141998493635*ep2^17 + 49392123904/263503471100279715*ep2^18) * k2^11
        - (11/11337300 - 11/12645450*ep2 + 154/196004475*ep2^2 - 28/39200895*ep2^3 + 128/196004475*ep2^4 - 256/426597975*ep2^5 + 1024/1848591225*ep2^6 - 2048/3989065275*ep2^7 + 16384/34305961365*ep2^8 - 229376/514589420475*ep2^9 + 10092544/24185702762325*ep2^10 - 66322432/169299919336275*ep2^11 + 1061158912/2878098628716675*ep2^12 - 2122317824/6101569092879351*ep2^13 + 771751936/2346757343415135*ep2^14 - 1543503872/4954265502765285*ep2^15 + 12348030976/41757380666164545*ep2^16 - 24696061952/87834490366759905*ep2^17) * k2^12
        + (143/118024200 - 143/130669650*ep2 + 13/13066965*ep2^2 - 416/457343775*ep2^3 + 832/995395275*ep2^4 - 256/331798425*ep2^5 + 512/715986075*ep2^6 - 4096/6157480245*ep2^7 + 8192/13194600525*ep2^8 - 360448/620146224675*ep2^9 + 16580608/30387165009075*ep2^10 - 265289728/516581805154275*ep2^11 + 530579456/1095153426927063*ep2^12 - 2508193792/5475767134635315*ep2^13 + 5016387584/11559952839785665*ep2^14 - 40131100672/97433888221050605*ep2^15 + 80262201344/204947144189106445*ep2^16) * k2^13
        - (13/9011700 - 13/9912870*ep2 + 208/173475225*ep2^2 - 416/377563725*ep2^3 + 128/125854575*ep2^4 - 256/271580925*ep2^5 + 2048/2335595955*ep2^6 - 4096/5004848475*ep2^7 + 16384/21384352575*ep2^8 - 753664/1047833276175*ep2^9 + 12058624/17813165694975*ep2^10 - 24117248/37763911273347*ep2^11 + 1254096896/2077015120034085*ep2^12 - 2508193792/4384809697849735*ep2^13 + 20065550336/36957681739019195*ep2^14 - 1163801919488/2254418586080170895*ep2^15) * k2^14
        + (13/7845024 - 13/8580495*ep2 + 26/18675195*ep2^2 - 8/6225065*ep2^3 + 16/13433035*ep2^4 - 128/115524101*ep2^5 + 256/247551645*ep2^6 - 1024/1057720665*ep2^7 + 2048/2253404895*ep2^8 - 32768/38307883215*ep2^9 + 327680/406063562079*ep2^10 - 3407872/4466699182869*ep2^11 + 20447232/28289094824837*ep2^12 - 163577856/238436656380769*ep2^13 + 9487515648/14544636039226909*ep2^14) * k2^15
        - (13/7020405 - 26/15279705*ep2 + 8/5093235*ep2^2 - 16/10990665*ep2^3 + 128/94519719*ep2^4 - 256/202542255*ep2^5 + 11264/9519485985*ep2^6 - 22528/20280644055*ep2^7 + 360448/344770948935*ep2^8 - 3604480/3654572058711*ep2^9 + 3407872/3654572058711*ep2^10 - 6815744/7715207679501*ep2^11 + 54525952/65028179012937*ep2^12 - 3162505216/3966718919789157*ep2^13) * k2^16
        + (221/109140750 - 34/18190125*ep2 + 68/39252375*ep2^2 - 544/337570425*ep2^3 + 7616/5063556375*ep2^4 - 335104/237987149625*ep2^5 + 95744/72430871625*ep2^6 - 90112/72430871625*ep2^7 + 180224/153553447845*ep2^8 - 851968/767767239225*ep2^9 + 1703936/1620841949475*ep2^10 - 13631488/13661382145575*ep2^11 + 790626304/833344310880075*ep2^12) * k2^17
        - (17/7811375 - 34/16856125*ep2 + 272/144962675*ep2^2 - 3808/2174440125*ep2^3 + 15232/9290789625*ep2^4 - 4352/2827631625*ep2^5 + 4096/2827631625*ep2^6 - 8192/5994579045*ep2^7 + 32768/25361680575*ep2^8 - 196608/160623976975*ep2^9 + 1572864/1353830663075*ep2^10 - 91226112/82583670447575*ep2^11) * k2^18
        + (323/140035500 - 646/301076325*ep2 + 9044/4516144875*ep2^2 - 36176/19296255375*ep2^3 + 10336/5872773375*ep2^4 - 9728/5872773375*ep2^5 + 19456/12450279555*ep2^6 - 1011712/684765375525*ep2^7 + 106496/76085041725*ep2^8 - 851968/641288208825*ep2^9 + 49414144/39118580738325*ep2^10) * k2^19
        - (323/133648515 - 646/286389675*ep2 + 2584/1223664975*ep2^2 - 5168/2606938425*ep2^3 + 4864/2606938425*ep2^4 - 9728/5526709461*ep2^5 + 38912/23382232335*ep2^6 - 4096/2598025815*ep2^7 + 32768/21897646155*ep2^8 - 1900544/1335756415455*ep2^9) * k2^20
        + (323/128764350 - 646/275087475*ep2 + 1292/586055925*ep2^2 - 1216/586055925*ep2^3 + 2432/1242438561*ep2^4 - 9728/5256470835*ep2^5 + 1024/584052315*ep2^6 - 8192/4922726655*ep2^7 + 16384/10354700895*ep2^8) * k2^21
        - (3553/1375437375 - 7106/2930279625*ep2 + 6688/2930279625*ep2^2 - 13376/6212192805*ep2^3 + 4864/2389304925*ep2^4 - 512/265478325*ep2^5 + 4096/2237603025*ep2^6 - 8192/4706682225*ep2^7) * k2^22
        + (81719/30923802000 - 4807/1932737625*ep2 + 9614/4097403765*ep2^2 - 3496/1575924525*ep2^3 + 368/175102725*ep2^4 - 2944/1475865825*ep2^5 + 5888/3104407425*ep2^6) * k2^23
        - (4807/1788111000 - 4807/1895397660*ep2 + 437/182249775*ep2^2 - 46/20249975*ep2^3 + 2576/1194748525*ep2^4 - 5152/2513091725*ep2^5) * k2^24
        + (2185/802756656 - 437/169813908*ep2 + 23/9434106*ep2^2 - 644/278306127*ep2^3 + 1288/585402543*ep2^4) * k2^25
        - (299/108937224 - 299/114989292*ep2 + 4186/1696092057*ep2^2 - 8372/3567641913*ep2^3) * k2^26
        + (897/325222240 - 897/342644860*ep2 + 897/360367870*ep2^2) * k2^27
        - (299/108203640 - 299/113800380*ep2) * k2^28
        + 8671/3140118960 * k2^29;
C4[8] = + (1/141338340 - 1/164894730*ep2 + 2/379257879*ep2^2 - 4/861949725*ep2^3 + 32/7757547525*ep2^4 - 64/17305298325*ep2^5 + 256/76637749725*ep2^6 - 512/168603049395*ep2^7 + 16384/5901106728825*ep2^8 - 32768/12843585233325*ep2^9 + 131072/55655536011075*ep2^10 - 262144/120098788234425*ep2^11 + 2097152/1032849578816055*ep2^12 - 4194304/2213249097462975*ep2^13 + 16777216/9456609780069075*ep2^14 - 33554432/20146690401016725*ep2^15 + 536870912/342493736817284325*ep2^16 - 1073741824/726086722052642769*ep2^17 + 4294967296/3071905362530411715*ep2^18 - 8589934592/6485133543119758065*ep2^19 + 68719476736/54660411292009389405*ep2^20 - 137438953472/114975347890088715645*ep2^21) * k2^8
        - (1/34714680 - 1/39921882*ep2 + 1/45365775*ep2^2 - 8/408291975*ep2^3 + 16/910805175*ep2^4 - 64/4033565775*ep2^5 + 128/8873844705*ep2^6 - 4096/310584564675*ep2^7 + 8192/675978170175*ep2^8 - 32768/2929238737425*ep2^9 + 1245184/120098788234425*ep2^10 - 9961472/1032849578816055*ep2^11 + 19922944/2213249097462975*ep2^12 - 79691776/9456609780069075*ep2^13 + 159383552/20146690401016725*ep2^14 - 2550136832/342493736817284325*ep2^15 + 5100273664/726086722052642769*ep2^16 - 20401094656/3071905362530411715*ep2^17 + 2147483648/341322818058934635*ep2^18 - 17179869184/2876863752211020495*ep2^19 + 34359738368/6051334099478353455*ep2^20) * k2^9
        + (5/72239596 - 1/16418090*ep2 + 4/73881405*ep2^2 - 8/164812365*ep2^3 + 224/5109183315*ep2^4 - 448/11240203293*ep2^5 + 2048/56201016465*ep2^6 - 4096/122319859365*ep2^7 + 16384/530052723915*ep2^8 - 32768/1143797983185*ep2^9 + 262144/9836662655391*ep2^10 - 3670016/147549939830865*ep2^11 + 14680064/630440652004605*ep2^12 - 4194304/191873241914445*ep2^13 + 67108864/3261845112545565*ep2^14 - 671088640/34575558192982989*ep2^15 + 536870912/29256241547908683*ep2^16 - 1073741824/61763176601140553*ep2^17 + 8589934592/520575345638184661*ep2^18 - 17179869184/1095003313238940149*ep2^19) * k2^10
        - (11/85659600 - 11/96367050*ep2 + 11/107486325*ep2^2 - 308/3332076075*ep2^3 + 56/666415215*ep2^4 - 256/3332076075*ep2^5 + 512/7252165575*ep2^6 - 2048/31426050825*ep2^7 + 4096/67814109675*ep2^8 - 32768/583201343205*ep2^9 + 458752/8748020148075*ep2^10 - 20185088/411156946959525*ep2^11 + 132644864/2878098628716675*ep2^12 - 2122317824/48927676688183475*ep2^13 + 4244635648/103726674578948967*ep2^14 - 1543503872/39894874838057295*ep2^15 + 3087007744/84222513547009845*ep2^16 - 24696061952/709875471324797265*ep2^17 + 49392123904/1493186336234918385*ep2^18) * k2^11
        + (11/53965548 - 11/60192342*ep2 + 22/133283043*ep2^2 - 20/133283043*ep2^3 + 128/932981301*ep2^4 - 256/2030606361*ep2^5 + 1024/8799294231*ep2^6 - 2048/18987950709*ep2^7 + 81920/816481880487*ep2^8 - 32768/349920805923*ep2^9 + 1441792/16446277878381*ep2^10 - 66322432/805867616040669*ep2^11 + 1061158912/13699749472691373*ep2^12 - 53057945600/726086722052642769*ep2^13 + 3858759680/55852824773280213*ep2^14 - 7717519360/117911518965813783*ep2^15 + 61740154880/993825659854716171*ep2^16 - 123480309760/2090460870728885739*ep2^17) * k2^12
        - (13/44586920 - 13/49364090*ep2 + 13/54300499*ep2^2 - 416/1900517465*ep2^3 + 832/4136420365*ep2^4 - 768/4136420365*ep2^5 + 1536/8925959735*ep2^6 - 12288/76763253721*ep2^7 + 8192/54830895515*ep2^8 - 32768/234277462655*ep2^9 + 1507328/11479595670095*ep2^10 - 24117248/195153126391615*ep2^11 + 241172480/2068623139751119*ep2^12 - 2508193792/22754854537262309*ep2^13 + 45147488256/432342236207983871*ep2^14 - 361179906048/3644027419467292627*ep2^15 + 722359812096/7665023192672581043*ep2^16) * k2^13
        + (91/234904980 - 91/258395478*ep2 + 208/645988695*ep2^2 - 416/1405975395*ep2^3 + 128/468658465*ep2^4 - 256/1011315635*ep2^5 + 2048/8697314461*ep2^6 - 28672/130459716915*ep2^7 + 114688/557418790455*ep2^8 - 32768/169649197095*ep2^9 + 524288/2884036350615*ep2^10 - 5242880/30570785316519*ep2^11 + 54525952/336278638481709*ep2^12 - 327155712/2129764710384157*ep2^13 + 2617245696/17950873987523609*ep2^14 - 151800250368/1095003313238940149*ep2^15) * k2^14
        - (65/133365408 - 13/29173683*ep2 + 26/63495663*ep2^2 - 8/21165221*ep2^3 + 16/45672319*ep2^4 - 640/1963909717*ep2^5 + 256/841675593*ep2^6 - 1024/3596250261*ep2^7 + 2048/7661576643*ep2^8 - 32768/130246802931*ep2^9 + 1638400/6903080555343*ep2^10 - 17039360/75933886108773*ep2^11 + 102236160/480914612022229*ep2^12 - 817889280/4053423158473073*ep2^13 + 47437578240/247258812666857453*ep2^14) * k2^15
        + (13/22101275 - 26/48102775*ep2 + 24/48102775*ep2^2 - 48/103800725*ep2^3 + 384/892686235*ep2^4 - 256/637633025*ep2^5 + 11264/29968752175*ep2^6 - 22528/63846472025*ep2^7 + 360448/1085390024425*ep2^8 - 720896/2301026851781*ep2^9 + 3407872/11505134258905*ep2^10 - 61341696/218597550919195*ep2^11 + 490733568/1842465072033215*ep2^12 - 28462546944/112390369394026115*ep2^13) * k2^16
        - (1/1455210 - 2/3152955*ep2 + 4/6803745*ep2^2 - 32/58512207*ep2^3 + 448/877683105*ep2^4 - 19712/41251105935*ep2^5 + 5632/12554684415*ep2^6 - 90112/213429635055*ep2^7 + 901120/2262354131583*ep2^8 - 65536/174027240891*ep2^9 + 131072/367390841881*ep2^10 - 1048576/3096579952997*ep2^11 + 60817408/188891377132817*ep2^12) * k2^17
        + (1/1278225 - 2/2758275*ep2 + 16/23721165*ep2^2 - 224/355817475*ep2^3 + 9856/16723421325*ep2^4 - 2816/5089736925*ep2^5 + 45056/86525527725*ep2^6 - 90112/183434118777*ep2^7 + 32768/70551584145*ep2^8 - 65536/148942233195*ep2^9 + 524288/1255370251215*ep2^10 - 30408704/76577585324115*ep2^11) * k2^18
        - (19/21783300 - 38/46834095*ep2 + 76/100358775*ep2^2 - 304/428805675*ep2^3 + 608/913542525*ep2^4 - 9728/15530222925*ep2^5 + 19456/32924072601*ep2^6 - 1011712/1810823993055*ep2^7 + 106496/201202665895*ep2^8 - 851968/1695851041115*ep2^9 + 49414144/103446913508015*ep2^10) * k2^19
        + (19/19875933 - 38/42591285*ep2 + 152/181980945*ep2^2 - 304/387698535*ep2^3 + 4864/6590875095*ep2^4 - 48640/69863276007*ep2^5 + 505856/768496036077*ep2^6 - 53248/85388448453*ep2^7 + 425984/719702636961*ep2^8 - 851968/1513857270849*ep2^9) * k2^20
        - (133/128764350 - 266/275087475*ep2 + 76/83722275*ep2^2 - 1216/1423278675*ep2^3 + 2432/3017350791*ep2^4 - 9728/12765714885*ep2^5 + 1024/1418412765*ep2^6 - 8192/11955193305*ep2^7 + 16384/25147130745*ep2^8) * k2^21
        + (209/189504705 - 418/403727415*ep2 + 6688/6863366055*ep2^2 - 66880/72751680183*ep2^3 + 4864/5596283091*ep2^4 - 1536/1865427697*ep2^5 + 12288/15722890589*ep2^6 - 24576/33072287101*ep2^7) * k2^22
        - (4807/4123173600 - 4807/4380871950*ep2 + 4807/4643724267*ep2^2 - 1748/1786047795*ep2^3 + 184/198449755*ep2^4 - 1472/1672647935*ep2^5 + 2944/3518328415*ep2^6) * k2^23
        + (437/357622200 - 437/379079532*ep2 + 437/400949505*ep2^2 - 46/44549945*ep2^3 + 2576/2628446755*ep2^4 - 5152/5528801795*ep2^5) * k2^24
        - (10925/8592469392 - 2185/1817637756*ep2 + 345/302939626*ep2^2 - 9660/8936718967*ep2^3 + 19320/18797926103*ep2^4) * k2^25
        + (5681/4321176552 - 299/240065364*ep2 + 598/505852017*ep2^2 - 1196/1064033553*ep2^3) * k2^26
        - (1495/1105755616 - 1495/1164992524*ep2 + 1495/1225250758*ep2^2) * k2^27
        + (6279/4537339304 - 6279/4772029268*ep2) * k2^28
        - 8671/6147020752 * k2^29;
C4[9] = + (1/737176440 - 1/847752906*ep2 + 1/963355575*ep2^2 - 8/8670200175*ep2^3 + 16/19341215775*ep2^4 - 64/85653955575*ep2^5 + 128/188438702265*ep2^6 - 4096/6595354579275*ep2^7 + 8192/14354595260775*ep2^8 - 32768/62203246130025*ep2^9 + 65536/134228057438475*ep2^10 - 524288/1154361293970885*ep2^11 + 1048576/2473631344223325*ep2^12 - 4194304/10569152107136025*ep2^13 + 8388608/22516889271724575*ep2^14 - 134217728/382787117619317775*ep2^15 + 268435456/811508689352953683*ep2^16 - 1073741824/3433305993416342505*ep2^17 + 2147483648/7248090430545611955*ep2^18 - 17179869184/61091047914598729335*ep2^19 + 34359738368/128501859406569741015*ep2^20) * k2^9
        - (1/161476744 - 1/183496300*ep2 + 2/412866675*ep2^2 - 4/921010275*ep2^3 + 112/28551318525*ep2^4 - 224/62812900755*ep2^5 + 1024/314064503775*ep2^6 - 2048/683552155275*ep2^7 + 8192/2962059339525*ep2^8 - 16384/6391812258975*ep2^9 + 131072/54969585427185*ep2^10 - 1835008/824543781407775*ep2^11 + 7340032/3523050702378675*ep2^12 - 2097152/1072232822463075*ep2^13 + 33554432/18227957981872275*ep2^14 - 67108864/38643270921569223*ep2^15 + 268435456/163490761591254405*ep2^16 - 536870912/345147163359314855*ep2^17 + 4294967296/2909097519742796635*ep2^18 - 8589934592/6119136162217606715*ep2^19) * k2^10
        + (11/670160400 - 11/753930450*ep2 + 11/840922425*ep2^2 - 44/3724085025*ep2^3 + 8/744817005*ep2^4 - 256/26068595175*ep2^5 + 512/56737530675*ep2^6 - 2048/245862632925*ep2^7 + 4096/530545681575*ep2^8 - 32768/4562692861545*ep2^9 + 65536/9777198989025*ep2^10 - 2883584/459528352484175*ep2^11 + 132644864/22516889271724575*ep2^12 - 2122317824/382787117619317775*ep2^13 + 4244635648/811508689352953683*ep2^14 - 1543503872/312118726674212955*ep2^15 + 3087007744/658917311867782905*ep2^16 - 24696061952/5553731628599884485*ep2^17 + 49392123904/11681987218779067365*ep2^18) * k2^11
        - (1/30157218 - 1/33636897*ep2 + 4/148963401*ep2^2 - 40/1638597411*ep2^3 + 256/11470181877*ep2^4 - 512/24964513497*ep2^5 + 2048/108179558487*ep2^6 - 4096/233440099893*ep2^7 + 163840/10037924295399*ep2^8 - 65536/4301967555171*ep2^9 + 262144/18381134099367*ep2^10 - 12058624/900675570868983*ep2^11 + 192937984/15311484704772711*ep2^12 - 9646899200/811508689352953683*ep2^13 + 7717519360/686661198683268501*ep2^14 - 15435038720/1449618086109122391*ep2^15 + 123480309760/12218209582919745867*ep2^16 - 246960619520/25700371881313948203*ep2^17) * k2^12
        + (13/229229224 - 13/253789498*ep2 + 65/1395842239*ep2^2 - 416/9770895673*ep2^3 + 832/21266067053*ep2^4 - 768/21266067053*ep2^5 + 1536/45889934167*ep2^6 - 61440/1973267169181*ep2^7 + 8192/281895309883*ep2^8 - 32768/1204461778591*ep2^9 + 65536/2566027267433*ep2^10 - 1048576/43622463546361*ep2^11 + 52428800/2311990567957133*ep2^12 - 545259520/25431896247528463*ep2^13 + 9814671360/483206028703040797*ep2^14 - 78517370880/4072736527639915289*ep2^15 + 157034741760/8566790627104649401*ep2^16) * k2^13
        - (91/1050163440 - 91/1155179784*ep2 + 52/721987365*ep2^2 - 104/1571384265*ep2^3 + 32/523794755*ep2^4 - 64/1130293945*ep2^5 + 512/9720527927*ep2^6 - 7168/145807918905*ep2^7 + 28672/622997471685*ep2^8 - 8192/189607926165*ep2^9 + 131072/3223334744805*ep2^10 - 1310720/34167348294933*ep2^11 + 13631488/375840831244263*ep2^12 - 81788928/2380325264546999*ep2^13 + 654311424/20062741515467563*ep2^14 - 37950062592/1223827232443521343*ep2^15) * k2^14
        + (91/745277280 - 13/116449575*ep2 + 26/253449075*ep2^2 - 8/84483025*ep2^3 + 16/182305475*ep2^4 - 128/1567827085*ep2^5 + 1792/23517406275*ep2^6 - 7168/100483463175*ep2^7 + 2048/30581923575*ep2^8 - 32768/519892700775*ep2^9 + 65536/1102172525643*ep2^10 - 3407872/60619488910365*ep2^11 + 20447232/383923429765645*ep2^12 - 163577856/3235926050881865*ep2^13 + 9487515648/197391489103793765*ep2^14) * k2^15
        - (4/24701425 - 8/53761925*ep2 + 96/698905025*ep2^2 - 192/1508163475*ep2^3 + 1536/12970205885*ep2^4 - 1024/9264432775*ep2^5 + 45056/435428340425*ep2^6 - 90112/927651681775*ep2^7 + 1441792/15770078590175*ep2^8 - 2883584/33432566611171*ep2^9 + 1048576/12858679465835*ep2^10 - 18874368/244314909850865*ep2^11 + 150994944/2059225668743005*ep2^12 - 8757706752/125612765793323305*ep2^13) * k2^16
        + (17/82946970 - 34/179718435*ep2 + 68/387813465*ep2^2 - 544/3335195799*ep2^3 + 7616/50027936985*ep2^4 - 335104/2351313038295*ep2^5 + 95744/715617011655*ep2^6 - 90112/715617011655*ep2^7 + 901120/7585540323543*ep2^8 - 65536/583503101811*ep2^9 + 131072/1231839881601*ep2^10 - 1048576/10382650430637*ep2^11 + 60817408/633341676268857*ep2^12) * k2^17
        - (17/68001570 - 17/73370115*ep2 + 136/630982989*ep2^2 - 272/1352106405*ep2^3 + 11968/63549001035*ep2^4 - 23936/135387002205*ep2^5 + 22528/135387002205*ep2^6 - 225280/1435102223373*ep2^7 + 16384/110392478721*ep2^8 - 32768/233050788411*ep2^9 + 262144/1964285216607*ep2^10 - 15204352/119821398213027*ep2^11) * k2^18
        + (17/57428700 - 34/123471705*ep2 + 68/264582225*ep2^2 - 2992/12435364575*ep2^3 + 5984/26492733225*ep2^4 - 5632/26492733225*ep2^5 + 11264/56164594437*ep2^6 - 53248/280822972185*ep2^7 + 106496/592848496835*ep2^8 - 851968/4996865901895*ep2^9 + 1703936/10510648966055*ep2^10) * k2^19
        - (34/99379665 - 68/212956425*ep2 + 272/909904725*ep2^2 - 544/1938492675*ep2^3 + 512/1938492675*ep2^4 - 1024/4109604471*ep2^5 + 53248/226028245905*ep2^6 - 106496/477170741355*ep2^7 + 851968/4021867677135*ep2^8 - 1703936/8459790631215*ep2^9) * k2^20
        + (119/307053450 - 238/655977825*ep2 + 68/199645425*ep2^2 - 64/199645425*ep2^3 + 128/423248301*ep2^4 - 6656/23278656555*ep2^5 + 13312/49143830505*ep2^6 - 106496/414212285685*ep2^7 + 212992/871274118165*ep2^8) * k2^21
        - (1309/3032075280 - 187/461402760*ep2 + 22/57675345*ep2^2 - 220/611358657*ep2^3 + 16/47027589*ep2^4 - 96/297841397*ep2^5 + 768/2510377489*ep2^6 - 1536/5280449201*ep2^7) * k2^22
        + (391/824634720 - 23/51539670*ep2 + 115/273160251*ep2^2 - 92/231135597*ep2^3 + 184/487952927*ep2^4 - 1472/4112746099*ep2^5 + 2944/8650948691*ep2^6) * k2^23
        - (23/44702775 - 46/94769883*ep2 + 184/400949505*ep2^2 - 368/846448955*ep2^3 + 20608/49940488345*ep2^4 - 41216/105047234105*ep2^5) * k2^24
        + (115/208122096 - 23/44025828*ep2 + 69/139415122*ep2^2 - 276/587535157*ep2^3 + 552/1235849813*ep2^4) * k2^25
        - (299/508373712 - 299/536616696*ep2 + 299/565364019*ep2^2 - 598/1189213971*ep2^3) * k2^26
        + (1495/2406644576 - 1495/2535571964*ep2 + 1495/2666722238*ep2^2) * k2^27
        - (31395/48175867316 - 31395/50667722522*ep2) * k2^28
        + 4669/6870199664 * k2^29;
C4[10] = + (1/3747960216 - 1/4259045700*ep2 + 2/9582852825*ep2^2 - 4/21377133225*ep2^3 + 16/94670161425*ep2^4 - 32/208274355135*ep2^5 + 1024/7289602429725*ep2^6 - 2048/15865605288225*ep2^7 + 8192/68750956248975*ep2^8 - 16384/148357326642525*ep2^9 + 131072/1275873009125715*ep2^10 - 262144/2734013590983675*ep2^11 + 1048576/11681694434202975*ep2^12 - 2097152/24887088142432425*ep2^13 + 33554432/423080498421351225*ep2^14 - 67108864/896930656653264597*ep2^15 + 268435456/3794706624302273295*ep2^16 - 536870912/8011047317971465845*ep2^17 + 4294967296/67521684537188069265*ep2^18 - 8589934592/142028370923050766385*ep2^19) * k2^10
        - (1/740703600 - 1/833291550*ep2 + 1/929440575*ep2^2 - 4/4116093975*ep2^3 + 8/9055406745*ep2^4 - 256/316939236075*ep2^5 + 512/689808925575*ep2^6 - 2048/2989172010825*ep2^7 + 4096/6450318549675*ep2^8 - 32768/55472739527205*ep2^9 + 65536/118870156129725*ep2^10 - 262144/507899758008825*ep2^11 + 12058624/24887088142432425*ep2^12 - 192937984/423080498421351225*ep2^13 + 385875968/896930656653264597*ep2^14 - 1543503872/3794706624302273295*ep2^15 + 3087007744/8011047317971465845*ep2^16 - 24696061952/67521684537188069265*ep2^17 + 49392123904/142028370923050766385*ep2^18) * k2^11
        + (1/255542742 - 1/285028443*ep2 + 4/1262268819*ep2^2 - 40/13884957009*ep2^3 + 256/97194699063*ep2^4 - 512/211541403843*ep2^5 + 2048/916679416653*ep2^6 - 4096/1978097688567*ep2^7 + 163840/85058200608381*ep2^8 - 65536/36453514546449*ep2^9 + 262144/155755925789373*ep2^10 - 524288/331827841899099*ep2^11 + 8388608/5641073312284683*ep2^12 - 419430400/298976885551088199*ep2^13 + 335544320/252980441620151553*ep2^14 - 671088640/534069821198097723*ep2^15 + 5368709120/4501445635812537951*ep2^16 - 10737418240/9468558061536717759*ep2^17) * k2^12
        - (13/1520151696 - 13/1683025092*ep2 + 65/9256638006*ep2^2 - 208/32398233021*ep2^3 + 416/70513801281*ep2^4 - 128/23504600427*ep2^5 + 256/50720453553*ep2^6 - 10240/2180979502779*ep2^7 + 4096/934705501191*ep2^8 - 16384/3993741686907*ep2^9 + 32768/8508406202541*ep2^10 - 524288/144642905443197*ep2^11 + 26214400/7666073988489441*ep2^12 - 272629760/84326813873383851*ep2^13 + 545259520/178023273732699241*ep2^14 - 4362076160/1500481878604179317*ep2^15 + 8724152320/3156186020512239253*ep2^16) * k2^13
        + (13/829076400 - 13/911984040*ep2 + 52/3989930175*ep2^2 - 104/8683965675*ep2^3 + 32/2894655225*ep2^4 - 64/6246361275*ep2^5 + 512/53718706965*ep2^6 - 1024/115111514925*ep2^7 + 4096/491840109225*ep2^8 - 8192/1047833276175*ep2^9 + 131072/17813165694975*ep2^10 - 262144/37763911273347*ep2^11 + 13631488/2077015120034085*ep2^12 - 27262976/4384809697849735*ep2^13 + 218103808/36957681739019195*ep2^14 - 12650020864/2254418586080170895*ep2^15) * k2^14
        - (1/39225120 - 1/42902475*ep2 + 2/93375975*ep2^2 - 8/404629225*ep2^3 + 16/873147275*ep2^4 - 128/7509066565*ep2^5 + 256/16090856925*ep2^6 - 1024/68751843225*ep2^7 + 2048/146471318175*ep2^8 - 32768/2490012408975*ep2^9 + 65536/5278826307027*ep2^10 - 262144/22333495914345*ep2^11 + 1572864/141445474124185*ep2^12 - 12582912/1192183281903845*ep2^13 + 729808896/72723180196134545*ep2^14) * k2^15
        + (4/105306075 - 8/229195575*ep2 + 32/993180825*ep2^2 - 64/2143179675*ep2^3 + 512/18431345205*ep2^4 - 1024/39495739725*ep2^5 + 45056/1856299767075*ep2^6 - 90112/3954725590725*ep2^7 + 1441792/67230335042325*ep2^8 - 2883584/142528310289729*ep2^9 + 1048576/54818580880665*ep2^10 - 2097152/115728115192515*ep2^11 + 16777216/975422685194055*ep2^12 - 973078528/59500783796837355*ep2^13) * k2^16
        - (17/320873805 - 68/1390453155*ep2 + 136/3000451545*ep2^2 - 1088/25803883287*ep2^3 + 2176/55294035615*ep2^4 - 95744/2598819673905*ep2^5 + 191488/5536615827015*ep2^6 - 180224/5536615827015*ep2^7 + 1802240/58688127766359*ep2^8 - 131072/4514471366643*ep2^9 + 262144/9530550662913*ep2^10 - 2097152/80328927015981*ep2^11 + 121634816/4900064547974841*ep2^12) * k2^17
        + (17/242181030 - 17/261300585*ep2 + 136/2247185031*ep2^2 - 272/4815396495*ep2^3 + 11968/226323635265*ep2^4 - 23936/482167744695*ep2^5 + 22528/482167744695*ep2^6 - 225280/5110978093767*ep2^7 + 16384/393152161059*ep2^8 - 32768/829987895569*ep2^9 + 262144/6995612262653*ep2^10 - 524288/14714908552477*ep2^11) * k2^18
        - (323/3618008100 - 646/7778717415*ep2 + 1292/16668680175*ep2^2 - 56848/783427968225*ep2^3 + 113696/1669042193175*ep2^4 - 107008/1669042193175*ep2^5 + 214016/3538369449531*ep2^6 - 1011712/17691847247655*ep2^7 + 106496/1965760805295*ep2^8 - 851968/16568555358915*ep2^9 + 1703936/34851099203235*ep2^10) * k2^19
        + (646/5881469265 - 1292/12603148425*ep2 + 56848/592347975975*ep2^2 - 113696/1261958731425*ep2^3 + 107008/1261958731425*ep2^4 - 214016/2675352510621*ep2^5 + 1011712/13376762553105*ep2^6 - 106496/1486306950345*ep2^7 + 851968/12527444295765*ep2^8 - 1703936/26350831104885*ep2^9) * k2^20
        - (323/2456427600 - 323/2623911300*ep2 + 323/2795035950*ep2^2 - 152/1397517975*ep2^3 + 304/2962738107*ep2^4 - 15808/162950595885*ep2^5 + 1664/18105621765*ep2^6 - 13312/152604526305*ep2^7 + 26624/320995727745*ep2^8) * k2^21
        + (323/2099129040 - 323/2236028760*ep2 + 38/279503595*ep2^2 - 380/2962738107*ep2^3 + 3952/32590119177*ep2^4 - 416/3621124353*ep2^5 + 3328/30520905261*ep2^6 - 6656/64199145549*ep2^7) * k2^22
        - (437/2473904160 - 437/2628523170*ep2 + 2185/13931172801*ep2^2 - 1748/11787915447*ep2^3 + 184/1309768383*ep2^4 - 1472/11039476371*ep2^5 + 2944/23220967539*ep2^6) * k2^23
        + (437/2190435975 - 874/4643724267*ep2 + 3496/19646525745*ep2^2 - 368/2182947305*ep2^3 + 2944/18399127285*ep2^4 - 5888/38701612565*ep2^5) * k2^24
        - (2185/9833769036 - 437/2080220373*ep2 + 46/231135597*ep2^2 - 368/1948142889*ep2^3 + 736/4097817801*ep2^4) * k2^25
        + (5681/23235669072 - 299/1290870504*ep2 + 299/1360024281*ep2^2 - 598/2860740729*ep2^3) * k2^26
        - (4485/16846512032 - 4485/17749003748*ep2 + 4485/18667055666*ep2^2) * k2^27
        + (115/400353468 - 115/421061406*ep2) * k2^28
        - 667/2169536736 * k2^29;
C4[11] = + (1/18658676400 - 1/20991010950*ep2 + 1/23413050675*ep2^2 - 4/103686367275*ep2^3 + 8/228110008005*ep2^4 - 256/7983850280175*ep2^5 + 512/17376615315675*ep2^6 - 2048/75298666367925*ep2^7 + 4096/162486595846575*ep2^8 - 32768/1397384724280545*ep2^9 + 65536/2994395837744025*ep2^10 - 262144/12794236761269925*ep2^11 + 524288/27257287013140275*ep2^12 - 8388608/463373879223384675*ep2^13 + 16777216/982352623953575511*ep2^14 - 67108864/4156107255188204085*ep2^15 + 134217728/8774004205397319735*ep2^16 - 1073741824/73952321159777409195*ep2^17 + 2147483648/155554882439531791755*ep2^18) * k2^11
        - (1/3358561752 - 1/3746088108*ep2 + 1/4147454691*ep2^2 - 10/45622001601*ep2^3 + 64/319354011207*ep2^4 - 128/695064612627*ep2^5 + 512/3011946654717*ep2^6 - 1024/6499463833863*ep2^7 + 40960/279476944856109*ep2^8 - 16384/119775833509761*ep2^9 + 65536/511769470450797*ep2^10 - 131072/1090291480525611*ep2^11 + 2097152/18534955168935387*ep2^12 - 104857600/982352623953575511*ep2^13 + 83886080/831221451037640817*ep2^14 - 167772160/1754800841079463947*ep2^15 + 1342177280/14790464231955481839*ep2^16 - 2684354560/31110976487906358351*ep2^17) * k2^12
        + (13/13874400400 - 13/15360943300*ep2 + 13/16897037630*ep2^2 - 208/295698158525*ep2^3 + 416/643578345025*ep2^4 - 384/643578345025*ep2^5 + 768/1388774323475*ep2^6 - 6144/11943459181885*ep2^7 + 4096/8531042272775*ep2^8 - 16384/36450816983675*ep2^9 + 32768/77656088356525*ep2^10 - 524288/1320153502060925*ep2^11 + 1048576/2798725424369161*ep2^12 - 54525952/153929898340303855*ep2^13 + 981467136/2924668068465773245*ep2^14 - 7851737088/24650773719925803065*ep2^15 + 15703474176/51851627479843930585*ep2^16) * k2^13
        - (7/3178126200 - 7/3495938820*ep2 + 8/4369923525*ep2^2 - 16/9511010025*ep2^3 + 64/41214376775*ep2^4 - 128/88936286725*ep2^5 + 1024/764852065835*ep2^6 - 14336/11472780987525*ep2^7 + 57344/49020064219425*ep2^8 - 16384/14919149979825*ep2^9 + 262144/253625549657025*ep2^10 - 524288/537686165272893*ep2^11 + 2097152/2274826083846855*ep2^12 - 12582912/14407231864363415*ep2^13 + 100663296/121432382856777355*ep2^14 - 5838471168/7407375354263418655*ep2^15) * k2^14
        + (7/1623919968 - 1/253737495*ep2 + 2/552252195*ep2^2 - 8/2393092845*ep2^3 + 16/5164042455*ep2^4 - 128/44410765113*ep2^5 + 1792/666161476695*ep2^6 - 7168/2846326309515*ep2^7 + 2048/866273224635*ep2^8 - 32768/14726644818795*ep2^9 + 327680/156102435079227*ep2^10 - 262144/132086675836269*ep2^11 + 524288/278849648987679*ep2^12 - 4194304/2350304184324723*ep2^13 + 243269632/143368555243808103*ep2^14) * k2^15
        - (2/269115525 - 4/585722025*ep2 + 16/2538128775*ep2^2 - 32/5477014725*ep2^3 + 256/47102326635*ep2^4 - 512/100933557075*ep2^5 + 22528/4743877182525*ep2^6 - 45056/10106520954075*ep2^7 + 720896/171810856219275*ep2^8 - 1441792/364239015184863*ep2^9 + 524288/140091928917255*ep2^10 - 1048576/295749627714205*ep2^11 + 8388608/2492746862162585*ep2^12 - 486539264/152057558591917685*ep2^13) * k2^16
        + (17/1455937605 - 68/6309062955*ep2 + 136/13614293745*ep2^2 - 1088/117082926207*ep2^3 + 15232/1756243893105*ep2^4 - 670208/82543462975935*ep2^5 + 191488/25121923514415*ep2^6 - 180224/25121923514415*ep2^7 + 1802240/266292389252799*ep2^8 - 131072/20484029942523*ep2^9 + 262144/43244063211993*ep2^10 - 2097152/364485675643941*ep2^11 + 4194304/766676766009669*ep2^12) * k2^17
        - (34/1989344175 - 68/4292795325*ep2 + 544/36918039795*ep2^2 - 1088/79110085275*ep2^3 + 47872/3718174007925*ep2^4 - 95744/7921327234275*ep2^5 + 90112/7921327234275*ep2^6 - 180224/16793213736663*ep2^7 + 65536/6458928360255*ep2^8 - 131072/13635515427205*ep2^9 + 1048576/114927915743585*ep2^10 - 2097152/241744926219265*ep2^11) * k2^18
        + (323/13648887700 - 646/29345108555*ep2 + 1292/62882375475*ep2^2 - 56848/2955471647325*ep2^3 + 113696/6296439596475*ep2^4 - 107008/6296439596475*ep2^5 + 214016/13348451944527*ep2^6 - 1011712/66742259722635*ep2^7 + 319488/22247419907545*ep2^8 - 2555904/187513967792165*ep2^9 + 5111808/394425932252485*ep2^10) * k2^19
        - (323/10306574712 - 323/11042758620*ep2 + 3553/129752413785*ep2^2 - 7106/276429055455*ep2^3 + 6688/276429055455*ep2^4 - 66880/2930147987823*ep2^5 + 63232/2930147987823*ep2^6 - 6656/325571998647*ep2^7 + 53248/2744106845739*ep2^8 - 106496/5772086813451*ep2^9) * k2^20
        + (2261/56497834800 - 2261/60349959900*ep2 + 323/9183689550*ep2^2 - 152/4591844775*ep2^3 + 304/9734710923*ep2^4 - 15808/535409100765*ep2^5 + 1664/59489900085*ep2^6 - 13312/501414872145*ep2^7 + 26624/1054700248305*ep2^8) * k2^21
        - (133/2682220440 - 19/408163980*ep2 + 76/1734696915*ep2^2 - 760/18387787299*ep2^3 + 7904/202265660289*ep2^4 - 2496/67421886763*ep2^5 + 19968/568270188431*ep2^6 - 39936/1195326948079*ep2^7) * k2^22
        + (19/317167200 - 19/336990150*ep2 + 19/357209559*ep2^2 - 988/19646525745*ep2^3 + 104/2182947305*ep2^4 - 832/18399127285*ep2^5 + 1664/38701612565*ep2^6) * k2^23
        - (19/268216650 - 19/284309649*ep2 + 76/1202848515*ep2^2 - 8/133649835*ep2^3 + 448/7885340265*ep2^4 - 896/16586405385*ep2^5) * k2^24
        + (475/5775388164 - 95/1221716727*ep2 + 10/135746303*ep2^2 - 80/1144147411*ep2^3 + 160/2406654899*ep2^4) * k2^25
        - (13/138307554 - 13/145991307*ep2 + 104/1230498159*ep2^2 - 208/2588289231*ep2^3) * k2^26
        + (15/141567328 - 15/149151292*ep2 + 15/156866014*ep2^2) * k2^27
        - (63/533804624 - 63/561415208*ep2) * k2^28
        + 203/1560543968 * k2^29;
C4[12] = + (1/91265265000 - 1/101795872500*ep2 + 1/112702573125*ep2^2 - 2/247945660875*ep2^3 + 64/8678098130625*ep2^4 - 128/18887625343125*ep2^5 + 512/81846376486875*ep2^6 - 1024/176615865050625*ep2^7 + 8192/1518896439435375*ep2^8 - 16384/3254778084504375*ep2^9 + 65536/13906779088336875*ep2^10 - 131072/29627485883848125*ep2^11 + 2097152/503667260025418125*ep2^12 - 4194304/1067774591253886425*ep2^13 + 16777216/4517507886074134875*ep2^14 - 33554432/9536961092823173625*ep2^15 + 268435456/80382957782366749125*ep2^16 - 536870912/169081393956012817125*ep2^17) * k2^12
        - (1/15080870000 - 1/16696677500*ep2 + 1/18366345250*ep2^2 - 16/321411041875*ep2^3 + 32/699541679375*ep2^4 - 384/9094041831875*ep2^5 + 768/19623985005625*ep2^6 - 6144/168766271048375*ep2^7 + 4096/120547336463125*ep2^8 - 16384/515065892160625*ep2^9 + 32768/1097314291994375*ep2^10 - 524288/18654342963904375*ep2^11 + 1048576/39547207083477275*ep2^12 - 4194304/167315106891634625*ep2^13 + 75497472/3178987030941057875*ep2^14 - 603979776/26794319260788916375*ep2^15 + 1207959552/56360464652004272375*ep2^16) * k2^13
        + (7/31090365000 - 7/34199401500*ep2 + 8/42749251875*ep2^2 - 16/93042489375*ep2^3 + 64/403184120625*ep2^4 - 128/870028891875*ep2^5 + 1024/7482248470125*ep2^6 - 14336/112233727051875*ep2^7 + 57344/479544106494375*ep2^8 - 16384/145948206324375*ep2^9 + 262144/2481119507514375*ep2^10 - 524288/5259973355930475*ep2^11 + 2097152/22253733428936625*ep2^12 - 4194304/46980103905532875*ep2^13 + 33554432/395975161489491375*ep2^14 - 1946157056/24154484850858973875*ep2^15) * k2^14
        - (1/1765130400 - 1/1930611375*ep2 + 2/4201918875*ep2^2 - 8/18208315125*ep2^3 + 16/39291627375*ep2^4 - 128/337907995425*ep2^5 + 256/724088561625*ep2^6 - 1024/3093832945125*ep2^7 + 2048/6591209317875*ep2^8 - 32768/112050558403875*ep2^9 + 65536/237547183816215*ep2^10 - 262144/1005007316145525*ep2^11 + 524288/2121682111862775*ep2^12 - 4194304/17882749228557675*ep2^13 + 243269632/1090847702942018175*ep2^14) * k2^15
        + (2/1696597875 - 4/3692595375*ep2 + 16/16001246625*ep2^2 - 32/34529005875*ep2^3 + 256/296949450525*ep2^4 - 512/636320251125*ep2^5 + 22528/29907051802875*ep2^6 - 45056/63715023406125*ep2^7 + 720896/1083155397904125*ep2^8 - 1441792/2296289443556745*ep2^9 + 524288/883188247521825*ep2^10 - 1048576/1864508522546075*ep2^11 + 8388608/15715143261459775*ep2^12 - 16777216/33055990998242975*ep2^13) * k2^16
        - (17/7912704375 - 68/34288385625*ep2 + 136/73990726875*ep2^2 - 1088/636320251125*ep2^3 + 15232/9544803766875*ep2^4 - 670208/448605777043125*ep2^5 + 191488/136532193013125*ep2^6 - 180224/136532193013125*ep2^7 + 360448/289448249187825*ep2^8 - 131072/111326249687625*ep2^9 + 262144/235022082673875*ep2^10 - 2097152/1980900411108375*ep2^11 + 4194304/4166721554400375*ep2^12) * k2^17
        + (34/9576035625 - 68/20664076875*ep2 + 544/177711061125*ep2^2 - 7616/2665665916875*ep2^3 + 335104/125286298093125*ep2^4 - 95744/38130612463125*ep2^5 + 90112/38130612463125*ep2^6 - 180224/80836898421825*ep2^7 + 65536/31091114777625*ep2^8 - 131072/65636797863875*ep2^9 + 1048576/553224439138375*ep2^10 - 2097152/1163678992670375*ep2^11) * k2^18
        - (323/59342990000 - 323/63793714250*ep2 + 323/68350408125*ep2^2 - 14212/3212469181875*ep2^3 + 28424/6843956083125*ep2^4 - 26752/6843956083125*ep2^5 + 53504/14509186896225*ep2^6 - 252928/72545934481125*ep2^7 + 79872/24181978160375*ep2^8 - 638976/203819530208875*ep2^9 + 1277952/428723839404875*ep2^10) * k2^19
        + (323/41076928200 - 323/44010994500*ep2 + 323/47011744125*ep2^2 - 646/100155454875*ep2^3 + 608/100155454875*ep2^4 - 1216/212329564335*ep2^5 + 63232/11678126038425*ep2^6 - 6656/1297569559825*ep2^7 + 53248/10936657718525*ep2^8 - 106496/23004693821725*ep2^9) * k2^20
        - (133/12282138000 - 133/13119556500*ep2 + 19/1996454250*ep2^2 - 152/16969861125*ep2^3 + 304/35976105585*ep2^4 - 15808/1978685807175*ep2^5 + 1664/219853978575*ep2^6 - 13312/1853054962275*ep2^7 + 26624/3897805265475*ep2^8) * k2^21
        + (209/14577285000 - 209/15527977500*ep2 + 836/65993904375*ep2^2 - 1672/139907077275*ep2^3 + 7904/699535386375*ep2^4 - 2496/233178462125*ep2^5 + 19968/1965361323625*ep2^6 - 39936/4134035887625*ep2^7) * k2^22
        - (437/23787540000 - 437/25274261250*ep2 + 437/26790716925*ep2^2 - 22724/1473489430875*ep2^3 + 2392/163721047875*ep2^4 - 19136/1379934546375*ep2^5 + 38272/2902620942375*ep2^6) * k2^23
        + (437/19084646250 - 437/20229725025*ep2 + 22724/1112634876375*ep2^2 - 2392/123626097375*ep2^3 + 133952/7293939745125*ep2^4 - 267904/15342424981125*ep2^5) * k2^24
        - (23/825055452 - 23/872654805*ep2 + 46/1842271255*ep2^2 - 2576/108694004045*ep2^3 + 5152/228632215405*ep2^4) * k2^25
        + (23/691537770 - 23/729956535*ep2 + 184/6152490795*ep2^2 - 368/12941446155*ep2^3) * k2^26
        - (69/1769591600 - 69/1864391150*ep2 + 69/1960825175*ep2^2) * k2^27
        + (1449/32185278800 - 1449/33850034600*ep2) * k2^28
        - 2001/39013599200 * k2^29;
C4[13] = + (1/439758169200 - 1/486875115900*ep2 + 1/535562627490*ep2^2 - 16/9372345981075*ep2^3 + 32/20398635370575*ep2^4 - 128/88394086605825*ep2^5 + 256/190745134254675*ep2^6 - 2048/1640408154590205*ep2^7 + 4096/3515160331264725*ep2^8 - 16384/15019321415403825*ep2^9 + 32768/31997684754555975*ep2^10 - 524288/543960640827451575*ep2^11 + 1048576/1153196558554197339*ep2^12 - 4194304/4878908516960065665*ep2^13 + 8388608/10299917980249027515*ep2^14 - 67108864/86813594404956089055*ep2^15 + 134217728/182607905472493842495*ep2^16) * k2^13
        - (1/67155188400 - 1/73870707240*ep2 + 4/323184344175*ep2^2 - 8/703401219675*ep2^3 + 32/3048071951925*ep2^4 - 64/6577418422575*ep2^5 + 512/56565798434145*ep2^6 - 1024/121212425216025*ep2^7 + 4096/517907635013925*ep2^8 - 8192/1103368439812275*ep2^9 + 131072/18757263476808675*ep2^10 - 262144/39765398570834391*ep2^11 + 1048576/168238224722760885*ep2^12 - 2097152/355169585525828535*ep2^13 + 16777216/2993572220860554795*ep2^14 - 973078528/182607905472493842495*ep2^15) * k2^14
        + (1/18427961376 - 1/20155582755*ep2 + 2/43868033055*ep2^2 - 8/190094809905*ep2^3 + 16/410204589795*ep2^4 - 128/3527759472237*ep2^5 + 256/7559484583365*ep2^6 - 1024/32299615947105*ep2^7 + 2048/68812225278615*ep2^8 - 32768/1169807829736455*ep2^9 + 327680/12399962995206423*ep2^10 - 262144/10492276380559281*ep2^11 + 524288/22150361247847371*ep2^12 - 4194304/186695901946142127*ep2^13 + 8388608/392705173059126543*ep2^14) * k2^15
        - (4/27484885575 - 8/59820045075*ep2 + 32/259220195325*ep2^2 - 64/559369895175*ep2^3 + 512/4810581098505*ep2^4 - 1024/10308388068225*ep2^5 + 45056/484494239206575*ep2^6 - 90112/1032183379179225*ep2^7 + 1441792/17547117446046825*ep2^8 - 2883584/37199888985619269*ep2^9 + 1048576/14307649609853565*ep2^10 - 2097152/30205038065246415*ep2^11 + 16777216/254585320835648355*ep2^12 - 33554432/535507054171536195*ep2^13) * k2^16
        + (17/52983468495 - 68/229595030145*ep2 + 136/495441907155*ep2^2 - 1088/4260800401533*ep2^3 + 15232/63912006022995*ep2^4 - 670208/3003864283080765*ep2^5 + 191488/914219564415885*ep2^6 - 180224/914219564415885*ep2^7 + 1802240/9690727382808381*ep2^8 - 131072/745440567908337*ep2^9 + 262144/1573707865584267*ep2^10 - 2097152/13264109152781679*ep2^11 + 4194304/27900367528264911*ep2^12) * k2^17
        - (17/27578982600 - 17/29756270700*ep2 + 34/63975982005*ep2^2 - 476/959639730075*ep2^3 + 20944/45103067313525*ep2^4 - 5984/13727020486725*ep2^5 + 5632/13727020486725*ep2^6 - 11264/29101283431857*ep2^7 + 4096/11192801319945*ep2^8 - 8192/23629247230995*ep2^9 + 65536/199160798089815*ep2^10 - 131072/418924437361335*ep2^11) * k2^18
        + (323/302140594800 - 323/324801139410*ep2 + 2261/2436008545575*ep2^2 - 9044/10408400149275*ep2^3 + 2584/3167773958475*ep2^4 - 2432/3167773958475*ep2^5 + 4864/6715680791967*ep2^6 - 252928/369362443558185*ep2^7 + 26624/41040271506465*ep2^8 - 212992/345910859840205*ep2^9 + 425984/727605601732845*ep2^10) * k2^19
        - (19/11090770614 - 19/11882968515*ep2 + 76/50772683655*ep2^2 - 152/108167891265*ep2^3 + 2432/1838854151505*ep2^4 - 24320/19491854005953*ep2^5 + 252928/214410394065483*ep2^6 - 26624/23823377118387*ep2^7 + 212992/200797035712119*ep2^8 - 425984/422366178566871*ep2^9) * k2^20
        + (19/7369282800 - 19/7871733900*ep2 + 19/8385107850*ep2^2 - 152/71273416725*ep2^3 + 304/151099643457*ep2^4 - 15808/8310480390135*ep2^5 + 1664/923386710015*ep2^6 - 13312/7782830841555*ep2^7 + 26624/16370782114995*ep2^8) * k2^21
        - (209/56676484080 - 209/60372776520*ep2 + 418/128292150105*ep2^2 - 4180/1359896791113*ep2^3 + 3952/1359896791113*ep2^4 - 416/151099643457*ep2^5 + 3328/1273554137709*ep2^6 - 6656/2678855255181*ep2^7) * k2^22
        + (4807/950550098400 - 4807/1009959479550*ep2 + 4807/1070557048323*ep2^2 - 22724/5352785241615*ep2^3 + 2392/594753915735*ep2^4 - 19136/5012925861195*ep2^5 + 38272/10544430259755*ep2^6) * k2^23
        - (23/3435236325 - 46/7282701009*ep2 + 2392/400548555495*ep2^2 - 4784/845602506045*ep2^3 + 267904/49890547856655*ep2^4 - 535808/104942186870895*ep2^5) * k2^24
        + (575/66829491612 - 115/14137007841*ep2 + 230/29844794331*ep2^2 - 12880/1760842865529*ep2^3 + 25760/3703841889561*ep2^4) * k2^25
        - (23/2133887976 - 23/2252437308*ep2 + 322/33223450293*ep2^2 - 644/69883809237*ep2^3) * k2^26
        + (115/8706390672 - 115/9172804458*ep2 + 115/9647259861*ep2^2) * k2^27
        - (23/1448337546 - 23/1523251557*ep2) * k2^28
        + 667/35525324448 * k2^29;
C4[14] = + (1/2091759757200 - 1/2300935732920*ep2 + 4/10066593831525*ep2^2 - 8/21909645398025*ep2^3 + 32/94941796724775*ep2^4 - 64/204874403458725*ep2^5 + 512/1761919869745035*ep2^6 - 1024/3775542578025075*ep2^7 + 4096/16131863742470775*ep2^8 - 8192/34367883625263825*ep2^9 + 131072/584254021629485025*ep2^10 - 262144/1238618525854508253*ep2^11 + 1048576/5240309147845996455*ep2^12 - 2097152/11062874867674881405*ep2^13 + 16777216/93244231027545428985*ep2^14 - 33554432/196134416988974867865*ep2^15) * k2^14
        - (1/296894933280 - 1/324728833275*ep2 + 2/706762754775*ep2^2 - 8/3062638604025*ep2^3 + 16/6608851724475*ep2^4 - 128/56836124830485*ep2^5 + 256/121791696065325*ep2^6 - 1024/520382701370025*ep2^7 + 2048/1108641407266575*ep2^8 - 32768/18846903923531775*ep2^9 + 65536/39955436317887363*ep2^10 - 262144/169042230575677305*ep2^11 + 524288/356866931215318755*ep2^12 - 4194304/3007878420243400935*ep2^13 + 8388608/6326916677063705415*ep2^14) * k2^15
        + (4/305048297925 - 8/663928648425*ep2 + 32/2877024143175*ep2^2 - 64/6208315256325*ep2^3 + 512/53391511204395*ep2^4 - 1024/114410381152275*ep2^5 + 45056/5377287914156925*ep2^6 - 90112/11455961208421275*ep2^7 + 1441792/194751340543161675*ep2^8 - 2883584/412872841951502751*ep2^9 + 1048576/158797246904424135*ep2^10 - 2097152/335238632353784285*ep2^11 + 16777216/2825582758410467545*ep2^12 - 33554432/5943467181484086905*ep2^13) * k2^16
        - (17/455265358920 - 17/493204138830*ep2 + 17/532141307685*ep2^2 - 136/4576415246091*ep2^3 + 1904/68646228691365*ep2^4 - 83776/3226372748494155*ep2^5 + 23936/981939532150395*ep2^6 - 22528/981939532150395*ep2^7 + 225280/10408559040794187*ep2^8 - 16384/800658387753399*ep2^9 + 32768/1690278818590509*ep2^10 - 262144/14246635756691433*ep2^11 + 524288/29967061419247497*ep2^12) * k2^17
        + (17/195504343320 - 17/210938896740*ep2 + 34/453518627991*ep2^2 - 476/6802779419865*ep2^3 + 1904/29066421157605*ep2^4 - 544/8846302091445*ep2^5 + 512/8846302091445*ep2^6 - 5120/93770802169317*ep2^7 + 4096/79344524912499*ep2^8 - 8192/167505108148609*ep2^9 + 65536/1411828768681133*ep2^10 - 131072/2969708789294797*ep2^11) * k2^18
        - (19/108173793200 - 19/116286827690*ep2 + 133/872151207675*ep2^2 - 532/3726464250975*ep2^3 + 152/1134141293775*ep2^4 - 2432/19280401994175*ep2^5 + 4864/40874452227651*ep2^6 - 252928/2248094872520805*ep2^7 + 79872/749364957506935*ep2^8 - 638976/6316076070415595*ep2^9 + 1277952/13285539320529355*ep2^10) * k2^19
        + (19/59561545890 - 19/63815942025*ep2 + 76/272668115925*ep2^2 - 152/580901638275*ep2^3 + 2432/9875327850675*ep2^4 - 4864/20935695043431*ep2^5 + 252928/1151463227388705*ep2^6 - 26624/127940358598745*ep2^7 + 212992/1078354451046565*ep2^8 - 425984/2268262810822085*ep2^9) * k2^20
        - (19/35618200200 - 19/38046713850*ep2 + 19/40528021275*ep2^2 - 304/688976361675*ep2^3 + 608/1460629886751*ep2^4 - 31616/80334643771305*ep2^5 + 3328/8926071530145*ep2^6 - 26624/75234031468365*ep2^7 + 53248/158250893778285*ep2^8) * k2^21
        + (209/250262828880 - 209/266584317720*ep2 + 418/566491675155*ep2^2 - 4180/6004811756643*ep2^3 + 3952/6004811756643*ep2^4 - 1248/2001603918881*ep2^5 + 9984/16870661601997*ep2^6 - 19968/35486564059373*ep2^7) * k2^22
        - (253/204192243360 - 253/216954258570*ep2 + 1265/1149857570421*ep2^2 - 1196/1149857570421*ep2^3 + 2392/2427477093111*ep2^4 - 19136/20460164070507*ep2^5 + 38272/43036896837963*ep2^6) * k2^23
        + (253/143898232725 - 506/305064253377*ep2 + 184/117332405145*ep2^2 - 368/247701744195*ep2^3 + 20608/14614402907505*ep2^4 - 41216/30740640598545*ep2^5) * k2^24
        - (115/47853216216 - 23/10122795738*ep2 + 23/10685173279*ep2^2 - 1288/630425223461*ep2^3 + 2576/1326066849349*ep2^4) * k2^25
        + (299/93970103832 - 299/99190665156*ep2 + 4186/1463062311051*ep2^2 - 8372/3077475895659*ep2^3) * k2^26
        - (345/84161776496 - 345/88670443094*ep2 + 345/93256845323*ep2^2) * k2^27
        + (1035/200675213318 - 1035/211054965731*ep2) * k2^28
        - 69/10854960248 * k2^29;
C4[15] = + (1/9838483823520 - 1/10760841681975*ep2 + 2/23420655425475*ep2^2 - 8/101489506843725*ep2^3 + 16/219003672662775*ep2^4 - 128/1883431584899865*ep2^5 + 256/4035924824785425*ep2^6 - 1024/17244406069537725*ep2^7 + 2048/36738082495971675*ep2^8 - 32768/624547402431518475*ep2^9 + 65536/1324040493154819167*ep2^10 - 262144/5601709778731927245*ep2^11 + 524288/11825831755100735295*ep2^12 - 4194304/99674867650134768915*ep2^13 + 8388608/209660928505455893235*ep2^14) * k2^15
        - (1/1304344446300 - 1/1419433662150*ep2 + 2/3075439601325*ep2^2 - 4/6636474929175*ep2^3 + 32/57073684390905*ep2^4 - 64/122300752266225*ep2^5 + 2816/5748135356512575*ep2^6 - 5632/12246027498657225*ep2^7 + 90112/208182467477172825*ep2^8 - 180224/441346831051606389*ep2^9 + 65536/169748781173694765*ep2^10 - 131072/358358538033355615*ep2^11 + 1048576/3020450534852568755*ep2^12 - 2097152/6353361469862299795*ep2^13) * k2^16
        + (17/5353292668680 - 17/5799400391070*ep2 + 17/6257247790365*ep2^2 - 136/53812330997139*ep2^3 + 1904/807184964957085*ep2^4 - 7616/3448881213907545*ep2^5 + 2176/1049659499884905*ep2^6 - 2048/1049659499884905*ep2^7 + 20480/11126390698779993*ep2^8 - 16384/9414638283583071*ep2^9 + 32768/19875347487564261*ep2^10 - 262144/167520785966613057*ep2^11 + 524288/352371308412530913*ep2^12) * k2^17
        - (1/104493700740 - 1/112743203430*ep2 + 4/484795774749*ep2^2 - 56/7271936621235*ep2^3 + 224/31071001927095*ep2^4 - 64/9456391890855*ep2^5 + 1024/160758662144535*ep2^6 - 10240/1704041818732071*ep2^7 + 8192/1441881538927137*ep2^8 - 16384/3043972137735067*ep2^9 + 131072/25656336589481279*ep2^10 - 262144/53966776964081311*ep2^11) * k2^18
        + (19/809438383600 - 19/870146262370*ep2 + 19/932299566825*ep2^2 - 76/3983461785525*ep2^3 + 152/8486505543075*ep2^4 - 2432/144270594232275*ep2^5 + 4864/305853659772423*ep2^6 - 252928/16821951287483265*ep2^7 + 79872/5607317095827755*ep2^8 - 638976/47261672664833935*ep2^9 + 1277952/99412483881202415*ep2^10) * k2^19
        - (19/382015432260 - 19/409302248850*ep2 + 38/874418440725*ep2^2 - 76/1862891460675*ep2^3 + 1216/31669154831475*ep2^4 - 2432/67138608242727*ep2^5 + 126464/3692623453349985*ep2^6 - 13312/410291494816665*ep2^7 + 106496/3458171170597605*ep2^8 - 212992/7274084186429445*ep2^9) * k2^20
        + (133/1408761228600 - 133/1504813130550*ep2 + 19/228993302475*ep2^2 - 304/3892886142075*ep2^3 + 608/8252918621199*ep2^4 - 31616/453910524165945*ep2^5 + 3328/50434502685105*ep2^6 - 26624/425090808345885*ep2^7 + 53248/894156527899965*ep2^8) * k2^21
        - (11/66880583580 - 11/71242360770*ep2 + 88/605560066545*ep2^2 - 880/6418936705377*ep2^3 + 832/6418936705377*ep2^4 - 4992/40653265800721*ep2^5 + 39936/342648954606077*ep2^6 - 79872/720744352792093*ep2^7) * k2^22
        + (253/945856023840 - 253/1004972025330*ep2 + 1265/5326351734249*ep2^2 - 92/409719364173*ep2^3 + 184/864963102143*ep2^4 - 1472/7290403289491*ep2^5 + 2944/15334986229619*ep2^6) * k2^23
        - (253/615288995100 - 253/652206334806*ep2 + 46/125424295155*ep2^2 - 92/264784623105*ep2^3 + 5152/15622292763195*ep2^4 - 10304/32860684777755*ep2^5) * k2^24
        + (1265/2097290958984 - 23/40332518442*ep2 + 23/42573213911*ep2^2 - 1288/2511819620749*ep2^3 + 2576/5283482650541*ep2^4) * k2^25
        - (299/351577802268 - 299/371109902394*ep2 + 1196/1563963160089*ep2^2 - 2392/3289715612601*ep2^3) * k2^26
        + (4485/3868539588592 - 4485/4075782780838*ep2 + 4485/4286599131571*ep2^2) * k2^27
        - (7245/4719327430444 - 7245/4963430573398*ep2) * k2^28
        + 667/336503767688 * k2^29;
C4[16] = + (1/45820358129700 - 1/49863330905850*ep2 + 2/108037216962675*ep2^2 - 4/233132941866825*ep2^3 + 32/2004943300054695*ep2^4 - 64/4296307071545775*ep2^5 + 256/18356948396604675*ep2^6 - 512/39108281366679525*ep2^7 + 8192/664840783233551925*ep2^8 - 16384/1409462460455130081*ep2^9 + 65536/5963110409617858035*ep2^10 - 131072/12588788642526589185*ep2^11 + 1048576/106105504272724108845*ep2^12 - 2097152/223187440021936918605*ep2^13) * k2^16
        - (1/5698666389240 - 1/6173555255010*ep2 + 1/6660941196195*ep2^2 - 8/57284094287277*ep2^3 + 112/859261414309155*ep2^4 - 448/3671389679320935*ep2^5 + 128/1117379467619415*ep2^6 - 2048/18995450949530055*ep2^7 + 20480/201351780065018583*ep2^8 - 16384/170374583131938801*ep2^9 + 32768/359679675500759691*ep2^10 - 262144/3031585836363545967*ep2^11 + 524288/6376784000626769103*ep2^12) * k2^17
        + (1/1297744347900 - 1/1400197849050*ep2 + 4/6020850750915*ep2^2 - 8/12901823037675*ep2^3 + 32/55125971160975*ep2^4 - 64/117442286386425*ep2^5 + 1024/1996518868569225*ep2^6 - 2048/4232620001366757*ep2^7 + 8192/17907238467320895*ep2^8 - 16384/37804170097677445*ep2^9 + 131072/318635147966138465*ep2^10 - 262144/670232552618429185*ep2^11) * k2^18
        - (19/7754941933200 - 19/8336562578190*ep2 + 19/8932031333775*ep2^2 - 76/38164133880675*ep2^3 + 152/81306198267525*ep2^4 - 2432/1382205370547925*ep2^5 + 4864/2930275385561601*ep2^6 - 252928/161165146205888055*ep2^7 + 26624/17907238467320895*ep2^8 - 212992/150932438510276115*ep2^9 + 425984/317478577556098035*ep2^10) * k2^19
        + (19/3009295759932 - 19/3224245457070*ep2 + 38/6888160749195*ep2^2 - 76/14674777248285*ep2^3 + 1216/249471213220845*ep2^4 - 12160/2644394860140957*ep2^5 + 126464/29088343461550527*ep2^6 - 13312/3232038162394503*ep2^7 + 106496/27241464511610811*ep2^8 - 212992/57301011558905499*ep2^9) * k2^20
        - (7/499883016600 - 7/533965949550*ep2 + 1/81255687975*ep2^2 - 16/1381346695575*ep2^3 + 32/2928454994619*ep2^4 - 1664/161065024704045*ep2^5 + 3328/340026163264095*ep2^6 - 26624/2865934804654515*ep2^7 + 53248/6028345623583635*ep2^8) * k2^21
        + (7/252420267060 - 1/38411779770*ep2 + 8/326500128045*ep2^2 - 80/3460901357277*ep2^3 + 64/2928454994619*ep2^4 - 128/6182293877529*ep2^5 + 1024/52107905539173*ep2^6 - 2048/109606284065157*ep2^7) * k2^22
        - (23/457672269600 - 23/486276786450*ep2 + 23/515453393637*ep2^2 - 92/2180764357695*ep2^3 + 184/4603835866245*ep2^4 - 1472/38803759444065*ep2^5 + 2944/81621700899585*ep2^6) * k2^23
        + (23/271256438700 - 23/287531825022*ep2 + 46/608240399085*ep2^2 - 92/1284063064735*ep2^3 + 5152/75759720819365*ep2^4 - 10304/159356654137285*ep2^5) * k2^24
        - (575/4262236465032 - 115/901626944526*ep2 + 115/951717330333*ep2^2 - 920/8021617498521*ep2^3 + 1840/16873057496889*ep2^4) * k2^25
        + (299/1463017306212 - 299/1544296045446*ep2 + 1196/6508104762951*ep2^2 - 2392/13689461742759*ep2^3) * k2^26
        - (4485/15099783555472 - 4485/15908700531658*ep2 + 4485/16731564352261*ep2^2) * k2^27
        + (2093/5023800167892 - 2093/5283651900714*ep2) * k2^28
        - 203/358213688184 * k2^29;
C4[17] = + (1/211541403843000 - 1/229169854163250*ep2 + 1/247262211070875*ep2^2 - 8/2126455015209525*ep2^3 + 16/4556689318306125*ep2^4 - 64/19469490723671625*ep2^5 + 128/41478480237387375*ep2^6 - 2048/705134164035585375*ep2^7 + 4096/1494884427755440995*ep2^8 - 16384/6324511040503788825*ep2^9 + 32768/13351745529952443075*ep2^10 - 262144/112536140895313448775*ep2^11 + 524288/236713951538417943975*ep2^12) * k2^17
        - (1/24775119369000 - 1/26731049845500*ep2 + 2/57471757167825*ep2^2 - 4/123153765359625*ep2^3 + 16/526202451991125*ep2^4 - 32/1121040006415875*ep2^5 + 512/19057680109069875*ep2^6 - 1024/40402281831228135*ep2^7 + 4096/170932730824426725*ep2^8 - 8192/360857987296011975*ep2^9 + 65536/3041517321494958075*ep2^10 - 131072/6397674365903187675*ep2^11) * k2^18
        + (19/101440907106000 - 19/109048975138950*ep2 + 19/116838187648875*ep2^2 - 76/499217710863375*ep2^3 + 152/1063550775317625*ep2^4 - 2432/18080363180399625*ep2^5 + 4864/38330369942447205*ep2^6 - 252928/2108170346834596275*ep2^7 + 26624/234241149648288475*ep2^8 - 212992/1974318261321288575*ep2^9 + 425984/4152876342779262175*ep2^10) * k2^19
        - (1/1595838660570 - 1/1709827136325*ep2 + 4/7305625037025*ep2^2 - 8/15564157687575*ep2^3 + 128/264590680688775*ep2^4 - 256/560932243060203*ep2^5 + 13312/30851273368311165*ep2^6 - 26624/65130465999768015*ep2^7 + 212992/548956784855187555*ep2^8 - 425984/1154702202626428995*ep2^9) * k2^20
        + (1/590770837800 - 1/631050667650*ep2 + 1/672206145975*ep2^2 - 16/11427504481575*ep2^3 + 32/24226309500939*ep2^4 - 128/102495924811665*ep2^5 + 256/216380285713515*ep2^6 - 2048/1823776693871055*ep2^7 + 4096/3836219942280495*ep2^8) * k2^21
        - (11/2804669634000 - 11/2987582871000*ep2 + 22/6348613600875*ep2^2 - 44/13459060833855*ep2^3 + 16/5176561859175*ep2^4 - 96/32784891774775*ep2^5 + 768/276329802101675*ep2^6 - 1536/581245445800075*ep2^7) * k2^22
        + (253/31274271756000 - 253/33228913740750*ep2 + 253/35222648565195*ep2^2 - 92/13547172525075*ep2^3 + 184/28599586441825*ep2^4 - 1472/241053657152525*ep2^5 + 2944/507043899527725*ep2^6) * k2^23
        - (253/16614456870375 - 506/35222648565195*ep2 + 184/13547172525075*ep2^2 - 368/28599586441825*ep2^3 + 2944/241053657152525*ep2^4 - 5888/507043899527725*ep2^5) * k2^24
        + (1265/47516043554616 - 23/913770068358*ep2 + 69/2893605216467*ep2^2 - 552/24388958253079*ep2^3 + 1104/51300912187511*ep2^4) * k2^25
        - (299/6827414095656 - 299/7206714878748*ep2 + 598/15185577780219*ep2^2 - 1196/31942077399771*ep2^3) * k2^26
        + (299/4367705987120 - 299/4601690236430*ep2 + 299/4839708696935*ep2^2) * k2^27
        - (39/380590921810 - 39/400276659145*ep2) * k2^28
        + 377/2550915658280 * k2^29;
C4[18] = + (1/969061097604600 - 1/1045565921099700*ep2 + 2/2247966730364355*ep2^2 - 4/4817071565066475*ep2^3 + 16/20582033050738575*ep2^4 - 32/43848679108095225*ep2^5 + 512/745427544837618825*ep2^6 - 1024/1580306395055751909*ep2^7 + 4096/6685911671389719615*ep2^8 - 8192/14114702417378296965*ep2^9 + 65536/118966777517902788705*ep2^10 - 131072/250240463054898969345*ep2^11) * k2^18
        - (1/107237530369200 - 1/115280345146890*ep2 + 1/123514655514525*ep2^2 - 4/527744437198425*ep2^3 + 8/1124325105335775*ep2^4 - 128/19113526790708175*ep2^5 + 256/40520676796301331*ep2^6 - 13312/2228637223796573205*ep2^7 + 26624/4704900805792765655*ep2^8 - 212992/39655592505967596235*ep2^9 + 425984/83413487684966323115*ep2^10) * k2^19
        + (1/21931382735262 - 1/23497910073495*ep2 + 4/100400161223115*ep2^2 - 8/213895995649245*ep2^3 + 128/3636231926037165*ep2^4 - 1280/38544058415993949*ep2^5 + 1024/32614203275071803*ep2^6 - 2048/68852206914040473*ep2^7 + 16384/580325743989769701*ep2^8 - 32768/1220685185633653509*ep2^9) * k2^20
        - (7/43717041997200 - 7/46697749406100*ep2 + 1/7106179257450*ep2^2 - 8/60402523688325*ep2^3 + 16/128053350219249*ep2^4 - 64/541764174004515*ep2^5 + 128/1143724367342865*ep2^6 - 1024/9639962524747005*ep2^7 + 2048/20277162552054045*ep2^8) * k2^21
        + (77/170187353391120 - 11/25898075516040*ep2 + 22/55033410471585*ep2^2 - 220/583354150998801*ep2^3 + 16/44873396230677*ep2^4 - 96/284198176127621*ep2^5 + 768/2395384627361377*ep2^6 - 1536/5038567664449793*ep2^7) * k2^22
        - (253/231429610994400 - 253/245893961681550*ep2 + 253/260647599382443*ep2^2 - 92/100249076685555*ep2^3 + 184/211636939669505*ep2^4 - 1472/1783797062928685*ep2^5 + 2944/3752124856505165*ep2^6) * k2^23
        + (253/107892248492925 - 506/228731566805001*ep2 + 184/87973679540385*ep2^2 - 368/185722212363035*ep2^3 + 20608/10957610529419065*ep2^4 - 41216/23048766975674585*ep2^5) * k2^24
        - (575/125578115108628 - 115/26564601272979*ep2 + 690/168242474728867*ep2^2 - 5520/1418043715571879*ep2^3 + 11040/2982781608616711*ep2^4) * k2^25
        + (299/36087760219896 - 299/38092635787668*ep2 + 598/80266625409729*ep2^2 - 1196/168836694827361*ep2^3) * k2^26
        - (65/4617289186384 - 65/4864643964226*ep2 + 65/5116263479617*ep2^2) * k2^27
        + (273/12033592964138 - 273/12656020186421*ep2) * k2^28
        - 2639/75507103485088 * k2^29;
C4[19] = + (1/4408331991663600 - 1/4738956891038370*ep2 + 1/5077453811826825*ep2^2 - 4/21694575377805525*ep2^3 + 8/46218877978803075*ep2^4 - 128/785720925639652275*ep2^5 + 256/1665728362356062823*ep2^6 - 1024/7047312302275650405*ep2^7 + 2048/14877659304804150855*ep2^8 - 16384/125397414140492128635*ep2^9 + 32768/263766974571379994715*ep2^10) * k2^19
        - (1/462337257662280 - 1/495361347495300*ep2 + 1/529135984824525*ep2^2 - 2/1127289706800075*ep2^3 + 32/19163925015601275*ep2^4 - 64/40627521033074703*ep2^5 + 256/171885665909162205*ep2^6 - 512/362869739141564655*ep2^7 + 4096/3058473515621759235*ep2^8 - 8192/6433340843204390115*ep2^9) * k2^20
        + (7/629761713094800 - 7/672700011714900*ep2 + 1/102367393087050*ep2^2 - 8/870122841239925*ep2^3 + 16/1844660423428641*ep2^4 - 64/7804332560659635*ep2^5 + 128/16475813183614785*ep2^6 - 1024/138867568261896045*ep2^7 + 2048/292100747033643405*ep2^8) * k2^21
        - (11/269080004685960 - 11/286628700643740*ep2 + 44/1218171977735895*ep2^2 - 440/12912622964000487*ep2^3 + 32/993278689538499*ep2^4 - 64/2096921677914609*ep2^5 + 512/17674054142423133*ep2^6 - 1024/37176458713372797*ep2^7) * k2^22
        + (253/2097878149392480 - 253/2228995533729510*ep2 + 1265/11813676328766403*ep2^2 - 92/908744332982031*ep2^3 + 184/1918460258517621*ep2^4 - 1472/16169879321791377*ep2^5 + 2944/34012504780319793*ep2^6) * k2^23
        - (23/75816174616650 - 23/80365145093649*ep2 + 92/340006383088515*ep2^2 - 184/717791253186865*ep2^3 + 10304/42349683938025035*ep2^4 - 20608/89080369662742315*ep2^5) * k2^24
        + (115/170185013139492 - 23/36000675856431*ep2 + 46/76001426808021*ep2^2 - 2576/4484084181673239*ep2^3 + 5152/9432039140760951*ep2^4) * k2^25
        - (1/731508653106 - 1/772148022723*ep2 + 8/6508104762951*ep2^2 - 16/13689461742759*ep2^3) * k2^26
        + (15/5865205182704 - 15/6179412603206*ep2 + 15/6499037393027*ep2^2) * k2^27
        - (35/7805573814576 - 35/8209310391192*ep2) * k2^28
        + 29/3895943914464 * k2^29;
C4[20] = + (1/19927921285392120 - 1/21351344234348700*ep2 + 1/22807117704872475*ep2^2 - 2/48589076849510925*ep2^3 + 32/826014306441685725*ep2^4 - 64/1751150329656373737*ep2^5 + 256/7408712933161581195*ep2^6 - 512/15640616192230004745*ep2^7 + 4096/131828050763081468565*ep2^8 - 8192/277293486087861020085*ep2^9) * k2^20
        - (1/1986171556683600 - 1/2121592344639300*ep2 + 1/2259957062767950*ep2^2 - 8/19209635033527575*ep2^3 + 16/40724426271078459*ep2^4 - 64/172295649608408865*ep2^5 + 128/363735260284418715*ep2^6 - 1024/3065768622397243455*ep2^7 + 2048/6448685722973512095*ep2^8) * k2^21
        + (11/4054598703088440 - 11/4319029053289860*ep2 + 44/18355873476481905*ep2^2 - 440/194572258850708193*ep2^3 + 32/14967096834669861*ep2^4 - 192/94791613286242453*ep2^5 + 1536/798957883412614961*ep2^6 - 3072/1680566582350672849*ep2^7) * k2^22
        - (23/2205461644233120 - 23/2343302996997690*ep2 + 115/12419505884087757*ep2^2 - 92/10508812671151179*ep2^3 + 184/22185271194652489*ep2^4 - 1472/186990142926356693*ep2^5 + 2944/393324093741646837*ep2^6) * k2^23
        + (23/717337652142150 - 23/760377911270679*ep2 + 92/3216983470760565*ep2^2 - 184/6791409549383415*ep2^3 + 10304/400693163413621485*ep2^4 - 20608/842837343732100365*ep2^5) * k2^24
        - (5/59637483236916 - 1/12615621453963*ep2 + 2/26632978625033*ep2^2 - 112/1571345738876947*ep2^3 + 224/3305244485223923*ep2^4) * k2^25
        + (13/67124627358822 - 13/70853773323201*ep2 + 728/4180372626068859*ep2^2 - 1456/8793197592765531*ep2^3) * k2^26
        - (195/480946824981728 - 195/506711833462892*ep2 + 195/532921066228214*ep2^2) * k2^27
        + (585/746733228261104 - 585/785357360757368*ep2) * k2^28
        - 377/266222834155040 * k2^29;
C4[21] = + (1/89571492885560400 - 1/95678640127757700*ep2 + 1/101918551440437550*ep2^2 - 8/866307687243719175*ep2^3 + 16/1836572296956684651*ep2^4 - 64/7770113564047511985*ep2^5 + 128/16403573079655858635*ep2^6 - 1024/138258687385670808495*ep2^7 + 2048/290819997604342045455*ep2^8) * k2^21
        - (1/8504768011356240 - 1/9059426794705560*ep2 + 2/19251281938749315*ep2^2 - 20/204063588550742739*ep2^3 + 16/172669190312166933*ep2^4 - 96/1093571538643723909*ep2^5 + 768/9217245825711387233*ep2^6 - 1536/19387999840289469697*ep2^7) * k2^22
        + (23/34695677086106400 - 23/36864156903988050*ep2 + 23/39076006318227333*ep2^2 - 92/165321565192500255*ep2^3 + 184/349012193184167205*ep2^4 - 1472/2941674199695123585*ep2^5 + 2944/6187659523496639265*ep2^6) * k2^23
        - (1/376164866367225 - 2/797469516698517*ep2 + 8/3373909493724495*ep2^2 - 16/7122697820085045*ep2^3 + 896/420239171385017655*ep2^4 - 1792/883951360499519895*ep2^5) * k2^24
        + (25/2939691551751396 - 5/621857828255103*ep2 + 10/1312810970760773*ep2^2 - 560/77455847274885607*ep2^3 + 1120/162924368405793863*ep2^4) * k2^25
        - (13/563191995400848 - 13/594480439589784*ep2 + 91/4384293241974657*ep2^2 - 182/9222134060705313*ep2^3) * k2^26
        + (195/3530853519987808 - 195/3720006387130012*ep2 + 195/3912420510602254*ep2^2) * k2^27
        - (117/978949049244740 - 117/1029584344895330*ep2) * k2^28
        + 1131/4746558335788640 * k2^29;
C4[22] = + (1/400515237744102000 - 1/426635796727413000*ep2 + 2/906601068045752625*ep2^2 - 4/1921994264256995565*ep2^3 + 16/8131514194933442775*ep2^4 - 32/17166529967081712525*ep2^5 + 256/144689324008260148425*ep2^6 - 512/304346509120823070825*ep2^7) * k2^22
        - (1/36309429508716000 - 1/38578768853010750*ep2 + 1/40893494984191395*ep2^2 - 4/173010940317732825*ep2^3 + 8/365245318448547075*ep2^4 - 64/3078496255494896775*ep2^5 + 128/6475457640868575975*ep2^6) * k2^23
        + (1/6167354204392875 - 2/13074790913312895*ep2 + 8/55316423094785325*ep2^2 - 16/116779115422324575*ep2^3 + 896/6889967809917149925*ep2^4 - 1792/14492690910515384325*ep2^5) * k2^24
        - (5/7383411339282576 - 1/1561875475617468*ep2 + 1/1648646335373994*ep2^2 - 28/48635066893532823*ep2^3 + 56/102301347603638007*ep2^4) * k2^25
        + (13/5775992324924976 - 13/6096880787420808*ep2 + 13/6423499401032637*ep2^2 - 26/13511498740103133*ep2^3) * k2^26
        - (13/2052821813946400 - 13/2162794411122100*ep2 + 13/2274663087559450*ep2^2) * k2^27
        + (13/829342217798700 - 13/872239229064150*ep2) * k2^28
        - 29/827888081823600 * k2^29;
C4[23] = + (1/1782389550772303200 - 1/1893788897695572150*ep2 + 1/2007416231557306479*ep2^2 - 4/8492914825819373565*ep2^3 + 8/17929486854507566415*ep2^4 - 64/151119960630849488355*ep2^5 + 128/317873020637304096195*ep2^6) * k2^23
        - (1/154595012056781400 - 1/163870712780188284*ep2 + 1/173324792363660685*ep2^2 - 2/365907894989950335*ep2^3 + 112/21588565804407069765*ep2^4 - 224/45410431519614870885*ep2^5) * k2^24
        + (25/629777641272880464 - 5/133222193346186252*ep2 + 5/140623426309863266*ep2^2 - 20/592627296591566621*ep2^3 + 40/1246560865244329789*ep2^4) * k2^25
        - (13/75408788686520520 - 13/79598165835771660*ep2 + 26/167724706582518855*ep2^2 - 52/352800244880470695*ep2^3) * k2^26
        + (39/65608185173726944 - 39/69122909379462316*ep2 + 39/72698232278400022*ep2^2) * k2^27
        - (9/5197211231538520 - 9/5466032502135340*ep2) * k2^28
        + 87/19640659160215120 * k2^29;
C4[24] = + (1/7897502637198556200 - 1/8371352795430469572*ep2 + 1/8854315456705304355*ep2^2 - 2/18692443741933420305*ep2^3 + 16/157550597253438828285*ep2^4 - 32/331399532153785121565*ep2^5) * k2^24
        - (1/656576689837683888 - 1/694456114251396420*ep2 + 1/733037009487585110*ep2^2 - 4/3089227397126251535*ep2^3 + 8/6498030042231080815*ep2^4) * k2^25
        + (13/1336500446295140280 - 13/1410750471089314740*ep2 + 26/2972652778366770345*ep2^2 - 52/6252821361392172105*ep2^3) * k2^26
        - (3/68400022840694048 - 3/72064309778588372*ep2 + 3/75791774077480874*ep2^2) * k2^27
        + (9/57434713056619304 - 9/60405474076789268*ep2) * k2^28
        - 29/61429295671311120 * k2^29;
C4[25] = + (1/34852162658526852912 - 1/36862864350364940580*ep2 + 1/38910801258718548390*ep2^2 - 4/163981233876028168215*ep2^3 + 8/344926043670266146935*ep2^4) * k2^25
        - (1/2782102969838863440 - 1/2936664245941022520*ep2 + 1/3093985544830720155*ep2^2 - 2/6508038559816342395*ep2^3) * k2^26
        + (3/1257722868968680352 - 3/1325100879806288228*ep2 + 3/1393640580485923826*ep2^2) * k2^27
        - (1/89668480588395444 - 1/94306505446415898*ep2) * k2^28
        + 29/703302752481745680 * k2^29;
C4[26] = + (1/153233867495634654960 - 1/161746860134281024680*ep2 + 1/170411870498617508145*ep2^2 - 2/358452555186747172305*ep2^3) * k2^26
        - (1/11763408009765892704 - 1/12393590581717636956*ep2 + 1/13034638370427169902*ep2^2) * k2^27
        + (1/1708389679184135420 - 1/1796754662590211390*ep2) * k2^28
        - 29/10232365536106966560 * k2^29;
C4[27] = + (1/671402060934751423200 - 1/707370028484827392300*ep2 + 1/743958133406456395350*ep2^2) * k2^27
        - (1/49640001998935255600 - 1/52207588309225010200*ep2) * k2^28
        + 29/201751358211920378400 * k2^29;
C4[28] = + (1/2932370299900739008080 - 1/3084044625757673784360*ep2) * k2^28
        - 1/209087771237808392160 * k2^29;
C4[29] = + 1/12769026871558087949280 * k2^29;
    
geographiclib-1.21/doc/Geographic.doc0000644000175000017500000052140611745620415017375 0ustar frankiefrankie// -*- text -*- /** * \file Geographic.doc * \brief Documentation for GeographicLib * * Written by Charles Karney and licensed under the * MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // $Id: 39fe7aa302faa3170132f94a3e800b401ce18c89 $ /** \mainpage Geographic library \author Charles Karney \version 1.21 \date 2012-04-25 \section abstract Abstract %GeographicLib is a small set of C++ classes for performing conversions between geographic, UTM, UPS, MGRS, geocentric, and local cartesian coordinates, for gravity (e.g., EGM2008), geoid height and geomagnetic field (e.g., WMM2010) calculations, and for solving geodesic problems. The emphasis is on returning accurate results with errors close to round-off (about 5–15 nanometers). New accurate algorithms for \ref geodesic and \ref transversemercator have been developed for this library. The functionality of the library can be accessed from user code, from the \ref utilities provided, or via the \ref other. For a sample of the geodesic capabilities in Javascript, check out the online geodesic calculator and the script for displaying geodesics in Google Maps This library is not a general purpose projection library; use proj.4 for that. On the other hand, it does provide the core functionality offered by geotrans and it cures several of the defects of that package. \section download Download The main project page is at - http://sourceforge.net/projects/geographiclib . The code is available for download at - GeographicLib-1.21.tar.gz - GeographicLib-1.21.zip . as either a compressed tar file (tar.gz) or a zip file. (The two archives have identical contents.) Alternatively you can get the latest stable release using git \verbatim git clone git://geographiclib.git.sf.net/gitroot/geographiclib/geographiclib-release geographiclib cd geographiclib; git checkout stable \endverbatim There are also a binary installers for Windows available at - GeographicLib-1.21-win32.exe - GeographicLib-1.21-win64.exe . It is licensed under the MIT/X11 License; see LICENSE.txt for the terms. For more information, see http://geographiclib.sourceforge.net/. \section contents Contents - \ref intro - \ref install - \ref start - \ref utilities - \ref organization - \ref other - \ref geoid - \ref gravity - \ref magnetic - \ref geodesic - \ref transversemercator - \ref geocentric - \ref old
Forward to \ref intro.
**********************************************************************/ /** \page intro Introduction
Forward to \ref install. Up to \ref contents.
%GeographicLib offers a C++ interfaces to a small (but important!) set of geographic transformations. It grew out of a desire to improve on the geotrans package for transforming between geographic and MGRS coordinates. At present, %GeographicLib provides UTM, UPS, MGRS, geocentric, and local cartesian projections, gravity and geomagnetic models, and classes for geodesic calculations. The goals of %GeographicLib are: - Accuracy. In most applications the accuracy is close to round-off, about 5 nm (5 nanometers). Even though in many geographic applications 1 cm is considered "accurate enough", there is little penalty in providing much better accuracy. If situations where a faster approximate algorithm is necessary, %GeographicLib offers an accurate benchmark to guide the development. - Completeness. For each of the projections included, an attempt is made to provide a complete solution. For example, GeographicLib::Geodesic::Inverse works for anti-podal points. Similarly, GeographicLib::Geocentric.Reverse will return accurate geodetic coordinates even for points close to the center of the earth. - C++ interface. For the projection methods, this allows encapsulation of the ellipsoid parameters. - Emphasis on projections necessary for analyzing military data. - Uniform treatment of UTM/UPS. The GeographicLib::UTMUPS class treats UPS as zone 0. This simplifies conversions between UTM and UPS coordinates, etc. - Well defined and stable conventions for the conversion between UTM/UPS to MGRS coordinates. - Detailed internal documentation on the algorithms. For the most part %GeographicLib uses published algorithms and references are given. If changes have been made (usually to improve the numerical accuracy), these are described in the code. Various \ref utilities are provided with the library. These illustrate the use of the library and are useful in their own right. This library and the utilities have been tested with g++ 4.4 under Linux, with g++ 4.2 under Mac OS X, and with MS Visual Studio 2008 and 2010. Matlab, Javascript, and Python interfaces are provided to portions of %GeographicLib; see \ref other. The section \ref geodesic documents the method of solving the geodesic problem. The section \ref transversemercator documents various properties of this projection. Undoubtedly, bugs lurk in this code and in the documentation. Please report any you find to .
Forward to \ref install. Up to \ref contents.
**********************************************************************/ /** \page install Installing %GeographicLib
Back to \ref intro. Forward to \ref start. Up to \ref contents.
%GeographicLib has been developed under Linux with the g++ compiler (versions 4.0 and later) and under Windows with Visual Studio 2005, 2008, and 2010. Earlier versions were tested also under Darwin and Solaris. It should compile on a wide range of other systems. First download either GeographicLib-1.21.tar.gz or GeographicLib-1.21.zip (or GeographicLib-1.21-win32.exe or GeographicLib-1.21-win64.exe for binary installation under Windows). Then pick one of the first five options below: - \ref cmake. This is the preferred installation method as it will work on the widest range of platforms. However it requires that you have cmake installed. - \ref autoconf. This method works for most Unix-like systems, including Linux and Mac OS X. - \ref gnu. This is a simple installation method that works with g++ and GNU make on Linux and many Unix platforms. - \ref windows. This is a simple installation method that works with Visual Studio 2005, 2008, and 2010 under Windows. - \ref windowsbin. Use this installation method if you only need to use the \ref utilities supplied with %GeographicLib. (This method also installs the header files and the static library for use by Visual Studio 2010.) - \ref qt. How to compile %GeographicLib so that it can be used by Qt programs. - \ref maintainer. This describes addition tasks of interest only to the maintainers of this code. . This section documents only how to install the software. If you wish to use %GeographicLib to evaluate geoid heights or the earth's gravitational or magnetic fields, then you must also install the relevant data files. See \ref geoidinst, \ref gravityinst, and \ref magneticinst for instructions. The first two installation methods use two important techniques which make software maintanence simpler - Out-of-source builds: This means that you create a separate directory for compiling the code. In the description here the directories are called BUILD and are located in the top-level of the source tree. You might want to use a suffix to denote the type of build, e.g., BUILD-vc9 for Visual Studio 9, or BUILD-shared for a build which creates a shared library. The advantages of out-of-source builds are: - You don't mess up the source tree, so it's easy to "clean up". Indeed the source tree might be on a read-only file system. - Builds for multiple platforms or compilers don't interfere with each other. - The library is installed: After compilation, there is a separate install step which copies the headers, libraries, tools, and documentation to a "central" location. You may at this point delete the source and build directories. If you have administrative privileges, you can install %GeographicLib for the use of all users (e.g., in /usr/local). Otherwise, you can install it for your personal use (e.g., in $HOME/packages). \section cmake Installation with cmake This is the recommended method of installation; however it requires that cmake be installed on your system. This permits %GeographicLib to be built either as a shared or a static library on a wide variety of systems. cmake can also determine the capabilities of your system and adjust the compilation of the libraries and examples appropriately. cmake is available for most computer platforms. On Linux systems cmake will typically one of the standard packages and can be installed by a command like \verbatim yum install cmake \endverbatim (executed as root). On other systems, download a binary installer from http://www.cmake.org click on download, and save and run the appropriate installer. Run the cmake command with no arguments to get help. Other useful tools are ccmake and cmake-gui which offer curses and graphical interfaces to cmake. Building under cmake depends on whether it is targeting an IDE (interactive development environment) or generating Unix-style makefiles. The instructions below have been tested with makefiles and g++ on Linux and with the Visual Studio IDE on Windows. Here are the steps to compile and install %GeographicLib: - Unpack the source, running one of \verbatim tar xfpz GeographicLib-1.21.tar.gz unzip -q GeographicLib-1.21.zip \endverbatim then enter the directory created with one of \verbatim cd GeographicLib-1.21 \endverbatim - Create a separate build directory and enter it, for example, \verbatim mkdir BUILD cd BUILD\endverbatim - Run cmake, pointing it to the source directory (..). On Linux, Unix, and MacOSX systems, the command is \verbatim cmake .. \endverbatim For Windows, the command is typically one of \verbatim cmake -G "Visual Studio 10" -D CMAKE_INSTALL_PREFIX=C:/pkg-vc10/GeographicLib .. cmake -G "Visual Studio 9 2008" -D CMAKE_INSTALL_PREFIX=C:/pkg-vc9/GeographicLib .. cmake -G "Visual Studio 8 2005" -D CMAKE_INSTALL_PREFIX=C:/pkg-vc8/GeographicLib .. \endverbatim Instead of setting CMAKE_INSTALL_PREFIX, you can (on Windows) set CMAKE_PREFIX_PATH to point to its parent directory, e.g., \verbatim cmake -G "Visual Studio 10" -D CMAKE_PREFIX_PATH=C:/pkg-vc10 .. \endverbatim The definitions of CMAKE_INSTALL_PREFIX are optional (see below). The settings given above are recommended to ensure that packages that use %GeographicLib use the version compiled with the right compiler. If you need to rerun cmake, use \verbatim cmake . \endverbatim possibly including some options via -D (see the next step). - cmake allows you to configure how %GeographicLib is built and installed by supplying options, for example \verbatim cmake -D CMAKE_INSTALL_PREFIX=/tmp/geographic . \endverbatim The options you might need to change are - CMAKE_INSTALL_PREFIX (default: /usr/local on non-Windows systems, C:/Program Files/GeographicLib on Windows systems) specifies where the library will be installed. For windows systems, it is recommended to use a prefix which includes the compiler version, as shown above (and also, possibly, whether this is a 64-bit build, e.g., cmake -G "Visual Studio 10 Win64" -D CMAKE_INSTALL_PREFIX=C:/pkg-vc10-x64/GeographicLib ..) If you just want to try the library to see if it suits your needs, pick CMAKE_INSTALL_PREFIX=/tmp/geographic, for example, and set GEOGRAPHIC_SHARED_LIB=OFF. - GEOGRAPHICLIB_DATA (default: /usr/local/share/GeographicLib for non-Windows systems, C:/Documents and Settings/All Users/Application Data/GeographicLib for Windows systems) specifies the default location for the various datasets for use by GeographicLib::Geoid, GeographicLib::GravityModel, and GeographicLib::MagneticModel. See \ref geoidinst, \ref gravityinst, and \ref magneticinst for more information. - GEOGRAPHIC_SHARED_LIB (default: ON for non-Windows systems, OFF for Windows systems) determines whether a shared or static library is built. The default is OFF for Windows because there's no standard place to install the dlls. - CMAKE_BUILD_TYPE (default: Release). This flags only affects non-IDE compile environments (like make + g++). The default is actually blank, but this is treated as Release. Choose one of \verbatim Debug Release RelWithDebInfo MinSizeRel \endverbatim (With IDE compile environments, you get to select the build type in the IDE.) - MATLAB_COMPILER (default: OFF). Set this to either "mex" (for Matlab) or "mkoctfile" (for Octave) to specify the compiler to use for the Matlab/Octave interface. See \ref matlab for more information. - MAINTAINER (default: ON for non-Windows environments provided doxygen, pod2man, and pod2html are found). This affects whether the targets for creating source packages are activated. See \ref maintainer for details. - GEOGRAPHICLIB_EXAMPLES (default: ON for the maintainer and OFF otherwise). If set to ON, then the short example programs in the examples directory are built. - Build and install the software. In non-IDE environments, run \verbatim make # compile the library and the examples make test # run some tests make install # as root, if CMAKE_INSTALL_PREFIX is a system directory \endverbatim On IDE environments, run your IDE (e.g., Visual Studio), load GeographicLib.sln, pick the build type (e.g., Release), and select "Build Solution". If this succeeds, select "RUN_TESTS" to build. Finally, select "INSTALL" to build. - The headers, library, and utilities are installed in the include/GeographicLib, lib, and bin directories under CMAKE_INSTALL_PREFIX. (dll dynamic libraries are installed in bin.) The Matlab/Octave interface is installed in libexec/GeographicLib/matlab. For documentation, open share/doc/GeographicLib/html/index.html in a web browser. \section autoconf Installation using the autoconfigure tools The method works on most Unix-like systems including Linux and Mac OS X. Here are the steps to compile and install %GeographicLib: - Unpack the source, running \verbatim tar xfpz GeographicLib-1.21.tar.gz \endverbatim then enter the directory created \verbatim cd GeographicLib-1.21 \endverbatim - Create a separate build directory and enter it, for example, \verbatim mkdir BUILD cd BUILD\endverbatim - Configure the software, specifing the path of the source directory, with \verbatim ../configure \endverbatim - By default %GeographicLib will be installed under /usr/local. You can change this with, for example \verbatim ../configure --prefix=/tmp/geographic \endverbatim - Compile and install the software with \verbatim make make install \endverbatim - The headers, library, and utilities are installed in the include/GeographicLib, lib, and bin directories under prefix. This installation method does not compile the Matlab/Octave interface; however the source for the interface is installed in libexec/GeographicLib/matlab, see \ref matlab of instructions on compiling the interface. For documentation, open share/doc/GeographicLib/html/index.html in a web browser. \section gnu Installation with GNU compiler and Make This method requires the standard GNU suite of tools, in particular make and g++. This builds a static library and the examples. Here are the steps to compile and install %GeographicLib: - Unpack the source, running \verbatim tar xfpz GeographicLib-1.21.tar.gz \endverbatim then enter the directory created \verbatim cd GeographicLib-1.21 \endverbatim - Edit \verbatim include/GeographicLib/Config.h \endverbatim If your C++ compiler does not recognize the long double type (unlikely), insert \code #undef HAVE_LONG_DOUBLE \endcode If you machine using big endian ordering, then insert \code #define WORDS_BIGENDIAN 1 \endcode - Build and install the software: \verbatim make # compile the library and the examples make install # as root \endverbatim The installation is in directories under /usr/local. You can specify a different installation directory with, for example, \verbatim make PREFIX=/tmp/geographic install \endverbatim - The headers, library, and utilities are installed in the include/GeographicLib, lib, and bin directories under PREFIX. This installation method does not compile the Matlab/Octave interface; however the source for the interface is installed in libexec/GeographicLib/matlab, see \ref matlab of instructions on compiling the interface. For documentation, open share/doc/GeographicLib/html/index.html in a web browser. \section windows Installation on Windows This method requires Visual Studio 2005, 2008, or 2010. This builds a static library and the utilities. If you only have Visual Studio 2003, use cmake to create the necessary solution file, see \ref cmake. (cmake is needed to build the Matlab interface and to run the tests.) - Unpack the source, running \verbatim unzip -q GeographicLib-1.21.zip \endverbatim - Open GeographicLib-1.21/windows/GeographicLib-vc10.sln in Visual Studio 2010 (for Visual Studio 2005 and 2008, replace -vc10 by -vc8 or -vc9). - Pick the build type (e.g., Release), and select "Build Solution". - The library and the compiled examples are in the windows/Release. - Copy the library windows/Release/Geographic.lib and the headers in include/GeographicLib somewhere convenient. The headers should remain in a directory named %GeographicLib. If you expect to use the Matlab/Octave interface, copy matlab/*.m and matlab/*.cpp to a directory in your matlab/octave path, see \ref matlab for instructions on compiling the interface. For documentation, open doc/html/index.html in a web browser. \section windowsbin Using a binary installer for Windows Use this method if you only need to use the %GeographicLib utilities. The header files and static library are provided, but can only be used by Visual Studio 2010 in release mode. However, if you plan to use the library, it is advisable to build it with the compiler you are using for your own code using either \ref cmake or \ref windows. Download and run GeographicLib-1.21-win32.exe or GeographicLib-1.21-win64.exe: - read the MIT/X11 License agreement, - select whether you want your PATH modified, - select the installation folder, by default C:\\pkg-vc10\\GeographicLib-1.21 or C:\\pkg-vc10-x64\\GeographicLib-1.21, - select the start menu folder, - and install. . (Note that the default installation folder adheres the the convention given in \ref cmake.) The start menu will now include links to the documentation for the library and for the utilities (and a link for uninstalling the library). If you ask for your PATH to be modified, it will include C:/pkg-vc10/GeographicLib-1.21/bin where the utilities are installed. The headers and library are installed in the include/GeographicLib and lib folders. With the 64-bit installer, the Matlab interface is installed in the libexec/GeographicLib/matlab folder. Add this to your path in Matlab to access this interface. The binaries were built using Visual Studio 10 (2010) in Release mode. The Matlab interface was compiled with Matlab R2010b 64-bit, however it may work with some other 64-bit versions of Matlab. \section qt Building the library for use with Qt If Qt is using a standard compiler, then build %GeographicLib with that same compiler (and optimization flags) as Qt. If you are using the mingw compiler on Windows for Qt, then you need to build %GeographicLib with mingw. You can accomplish this with cmake under cygwin with, for example, \verbatim export PATH="`cygpath -m c:/QtSDK/mingw/bin`:$PATH" mkdir BUILD cd BUILD cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX=C:/pkg-mingw/GeographicLib .. mingw32-make mingw32-make install \endverbatim If cmake complains that sh mustn't be in your path, invoke cmake with \verbatim env PATH="$( echo $PATH | tr : '\n' | while read d; do test -f "$d/sh.exe" || echo -n "$d:"; done | sed 's/:$//' )" cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX=C:/pkg-mingw/GeographicLib .. \endverbatim If cmake is not available, there is a simple project file that compiles the %GeographicLib library only with the Qt compiler: \verbatim cd src qmake Geographic.pro # configure the project make # build the library \endverbatim The library will be in the src directory (or the src/release or src/debug directory under Windows). The headers are in include/GeographicLib. \section maintainer Maintainer tasks Check the code out of git with \verbatim git clone git://geographiclib.git.sf.net/gitroot/geographiclib/geographiclib \endverbatim The autoconf configuration script, the html version of the documentation, and the formatted man pages not checked into git. In order to create the autoconf configuration script, run \verbatim sh autogen.sh \endverbatim in the top level directory. Provided you are running on a system with doxygen, pod2man, and pod2html installed, then you can create the documentation and the man pages by building the system using cmake (the MAINTAINER configuration variable set to ON, if the necessary tools are found) or configure. In the case of cmake, you then run \verbatim make dist \endverbatim which will copy the documentation and man pages from the build directory back into the source tree and package the resulting source tree for distribution as \verbatim GeographicLib-1.21.tar.gz GeographicLib-1.21.zip \endverbatim Finally, \verbatim make package \endverbatim or building PACKAGE in Visual Studio will create a binary installer for %GeographicLib. For Windows, this requires in the installation of NSIS. With configure, run \verbatim make dist-gzip \endverbatim which will create the additional files and packages the results ready for distribution as \verbatim geographiclib-1.21.tar.gz \endverbatim
Back to \ref intro. Forward to \ref start. Up to \ref contents.
**********************************************************************/ /** \page start Getting started
Back to \ref install. Forward to \ref utilities. Up to \ref contents.
Much (but not all!) of the useful functionality of %GeographicLib is available via simple command line utilities. Interfaces to some of them are available via the web. See \ref utilities for documentation on these. In order to use %GeographicLib from C++ code, you will need to - Include the header files for the %GeographicLib classes in your code. E.g., \code #include \endcode - Include the GeographicLib:: namespace prefix to the %GeographicLib classes, or include \code using namespace GeographicLib; \endcode in your code. - Tell the compiler where to find the header files. With g++ and with /usr/local specified as the installation directory, this is accomplished with \verbatim g++ -c -g -O3 -I/usr/local/include testprogram.cpp \endverbatim With Visual Studio, specify the include directory in the IDE via, e.g., \verbatim C/C++ -> General -> Additional Include Directories = C:\pkg-vc10\GeographicLib\include \endverbatim - Tell the linker the name, Geographic, and location of the library. Using g++ as the linker, you would use \verbatim g++ -g -o testprogram testprogram.o -L/usr/local/lib -lGeographic \endverbatim With Visual Studio, you supply this information in the IDE via, e.g., \verbatim Linker -> Input -> Additional Dependencies = Geographic.lib Linker -> General -> Additional Library Directories = C:\pkg-vc10\GeographicLib\lib \endverbatim Note that the library name is Geographic and not %GeographicLib. If the library was configured and built with cmake, then the debug version of the library is called Geographic_d.lib. - Tell the runtime environment where to find the shared library (assuming you compiled %GeographicLib as a shared library). With g++, this is accomplished by modifying the link line above to read \verbatim g++ -g -o testprogram testprogram.o -Wl,-rpath=/usr/local/lib -L/usr/local/lib -lGeographic \endverbatim (There are two other ways to specify the location of shared libraries at runtime: (1) define the environment variable LD_LIBRARY_PATH to be a colon-separated list of directories to search; (2) as root, specify /usr/local/lib as a directory searched by ldconfig(8).) On Windows, you need to ensure that Geographic.dll is in the same directory as your executable or else include the directory containing the dll in your PATH. - If you're using cmake to configure and build your project, then instead of the previous three steps, insert \verbatim # Put in your top-level CMakeLists.txt find_package (GeographicLib 1.9 REQUIRED) # In the top-level CMakeLists.txt or wherever your code is compiled include_directories (${GeographicLib_INCLUDE_DIRS}) # In the CMakeLists.txt where you define your executable targets target_link_libraries (program1 ${GeographicLib_LIBRARIES}) target_link_libraries (program2 ${GeographicLib_LIBRARIES}) \endverbatim in your CMakeLists.txt files (as noted). find_package command should find the library and set the required cmake variables (including GEOGRAPHICLIB_FOUND = TRUE). For find_package to be able to locate %GeographicLib, it may be necessary for %GeographicLib to be built and installed with cmake (see \ref cmake) instead of using some other installation method. In addition, on Windows systems, you should specify CMAKE_PREFIX_PATH with, for example, \verbatim cmake -G "Visual Studio 10" -D CMAKE_PREFIX_PATH=C:/pkg-vc10 -D CMAKE_INSTALL_PREFIX=C:/pkg-vc10/XYZProject .. \endverbatim (If you used some other method of installing %GeographicLib, you can try copying cmake/FindGeographicLib.cmake to somewhere in your CMAKE_MODULE_PATH in order for find_package to work. However, this method has not been thoroughly tested.) - For Windows, ensure that you build the library with the same version of the compiler and you use for your code. In addition, you have to build a separate debug version of the library when you can compiling your code in debug mode. The configuration of cmake described above ensures that the right version of the compiler is used and, assuming you built and installed %GeographicLib in debug mode, the debug version of the library Geographic_d.lib will be used. Here is a very simple test code, which uses the GeographicLib::Geodesic class: \include example-Geodesic-small.cpp This example is examples/example-Geodesic-small.cpp. If you compile, link, and run it according to the instructions above, it should print out \verbatim 5551.76 km \endverbatim The next steps are: - Learn about and run the \ref utilities. - Read the section, \ref organization, for an overview of the library. - Browse the Class List for full documentation on the classes in the library. - Look at the example code in the examples directory. Each file provides a very simple standalone example of using one %GeographicLib class. These are included in the descriptions of the classes. - Look at the source code for the utilities in the tools directory for more examples of using %GeographicLib from C++ code, e.g., GeodesicProj.cpp is a program to performing various geodesic projections. Here's a list of some of the abbreviations used here with links to the corresponding Wikipedia articles: - WGS84, World Geodetic System 1984. - UTM, Universal Transverse Mercator coordinate system. - UPS, Universal Polar Stereographic coordinate system. - MGRS, Military Grid Reference System. - EGM, Earth Gravity Model. - WMM, World Magnetic Model. - IGRF, International Geomagnetic Reference Field.
Back to \ref install. Forward to \ref utilities. Up to \ref contents.
**********************************************************************/ /** \page utilities Utility programs
Back to \ref start. Forward to \ref organization. Up to \ref contents.
Various utility programs are provided with %GeographicLib. These should be installed in a directory included in your PATH (e.g., /usr/local/bin). These programs are wrapper programs that invoke the underlying functionality provided by the library. The utilities are - GeoConvert: convert geographic coordinates using GeographicLib::GeoCoords. - Geod: perform geodesic calculations using GeographicLib::Geodesic and GeographicLib::GeodesicLine. - Planimeter: compute the area of geodesic polygons using GeographicLib::PolygonArea. - TransverseMercatorProj: convert between geographic and transverse Mercator. This is for testing GeographicLib::TransverseMercatorExact and GeographicLib::TransverseMercator. - CartConvert: convert geodetic coordinates to geocentric or local cartesian using GeographicLib::Geocentric and GeographicLib::LocalCartesian. - GeodesicProj: perform projections based on geodesics using GeographicLib::AzimuthalEquidistant, GeographicLib::Gnomonic, and GeographicLib::CassiniSoldner. - ConicProj: perform conic projections using GeographicLib::LambertConformalConic and GeographicLib::AlbersEqualArea. - GeoidEval: look up geoid heights using GeographicLib::Geoid. - Gravity: compute the earth's gravitational field using GeographicLib::GravityModel and GeographicLib::GravityCircle. - MagneticField: compute the earth's magnetic field using GeographicLib::MagneticModel and GeographicLib::MagneticCircle. . The documentation for these utilities is in the form of man pages. This documentation can be accessed by clicking on the utility name in the list above, running the man command on Unix-like systems, or by invoking the utility with the --help option. A brief summary of usage is given by invoking the utility with the -h option. The version of the utility is given by the --version option. The utilities all accept data on standard input, transform it in some way, and print the results on standard output. This makes the utilities easy to use within scripts to transform tabular data; however they can also be used interactively, often with the input supplied via a pipe, e.g., - echo 38SMB4488 | GeoConvert -d Online versions of three of these utilities are provided: - GeoConvert - Geod - Planimeter - GeoidEval
Back to \ref start. Forward to \ref organization. Up to \ref contents.
**********************************************************************/ /** \page organization Code organization
Back to \ref utilities. Forward to \ref other. Up to \ref contents.
Here is a brief description of the relationship between the various components of %GeographicLib. All of these are defined in the GeographicLib namespace. GeographicLib::TransverseMercator, GeographicLib::PolarStereographic, GeographicLib::LambertConformalConic, and GeographicLib::AlbersEqualArea provide the basic projections. The constructors for these classes specify the ellipsoid and the forward and reverse projections are implemented as const member functions. TransverseMercator uses Krüger's series which have been extended to sixth order in the square of the eccentricity. PolarStereographic, LambertConformalConic, and AlbersEqualArea use the exact formulas for the projections (e.g., from Snyder). GeographicLib::TransverseMercator::UTM and GeographicLib::PolarStereographic::UPS are const static instantiations specific for the WGS84 ellipsoid with the UTM and UPS scale factors. (These do \e not add the standard false eastings or false northings for UTM and UPS.) Similarly GeographicLib::LambertConformalConic::Mercator is a const static instantiation of this projection for a WGS84 ellipsoid and a standard parallel of 0 (which gives the Mercator projection). GeographicLib::AlbersEqualArea::CylindricalEqualArea, AzimuthalEqualAreaNorth, and AzimuthalEqualAreaSouth, likewise provide special cases of the equal area projection. GeographicLib::UTMUPS uses TransverseMercator::UTM and PolarStereographic::UPS to perform the UTM and UPS projections. The class offers a uniform interface to UTM and UPS by treating UPS as UTM zone 0. This class stores no internal state and the forward and reverse projections are provided via static member functions. The forward projection offers the ability to override the standard UTM/UPS choice and the UTM zone. GeographicLib::MGRS transforms between UTM/UPS coordinates and MGRS. UPS coordinates are handled as UTM zone 0. This class stores no internal state and the forward (UTM/UPS to MGRS) and reverse (MGRS to UTM/UPS) conversions are provided via static member functions. GeographicLib::GeoCoords holds a single geographic location which may be specified as latitude and longitude, UTM or UPS, or MGRS. Member functions are provided to convert between coordinate systems and to provide formatted representations of them. GeoConvert is a simple command line utility to provide access to the GeoCoords class. GeographicLib::TransverseMercatorExact is a drop in replacement for TransverseMercator which uses the exact formulas, based on elliptic functions, for the projection as given by Lee. TransverseMercatorProj is a simple command line utility to test to the TransverseMercator and TransverseMercatorExact. GeographicLib::Geodesic and GeographicLib::GeodesicLine perform geodesic calculations. The constructor for GeographicLib::Geodesic specifies the ellipsoid and the direct and inverse calculations are implemented as const member functions. GeographicLib::Geocentric::WGS84 is a const static instantiation of Geodesic specific for the WGS84 ellipsoid. In order to perform a series of direct geodesic calculations on a single line, the GeographicLib::GeodesicLine class can be used. This packages all the information needed to specify a geodesic. A const member function returns the coordinates a specified distance from the starting point. Geod is a simple command line utility to perform geodesic calculations. GeographicLib::PolygonArea is a class which compute the area of geodesic polygons using the Geodesic class and Geod is a command line utility for the same purpose. GeographicLib::AzimuthalEquidistant, GeographicLib::CassiniSoldner, and GeographicLib::Gnomonic are projections based on the Geodesic class. GeodesicProj is a command line utility to exercise these projections. GeographicLib::Geocentric and GeographicLib::LocalCartesian convert between geodetic and geocentric or a local cartesian system. The constructor for specifies the ellipsoid and the forward and reverse projections are implemented as const member functions. GeographicLib::Geocentric::WGS84 is a const static instantiation of Geocentric specific for the WGS84 ellipsoid. CartConvert is a simple command line utility to provide access to these classes. GeographicLib::Geoid evaluates geoid heights by interpolation. This is provided by the operator() member function. GeoidEval is a simple command line utility to provide access to this class. This class requires installation of data files for the various geoid models; see \ref geoidinst for details. GeographicLib::GravityModel evaluates the earth's gravitational field using a particular gravity model. Various member functions return the gravitational field, the gravity disturbance, the gravity anomaly, and the geoid height Gravity is a simple command line utility to provide access to this class. If the field several points on a circle of latitude are sought then use GeographicLib::GravityModel::Circle to return a GeographicLib::GravityCircle object whose member functions performs the calculations efficiently. (This is particularly important for high degree models such as EGM2008.) These classes requires installation of data files for the various gravity models; see \ref gravityinst for details. GeographicLib::MagneticModel evaluates the earth's magnetic field using a particular magnetic model. The field is provided by the operator() member function. MagneticField is a simple command line utility to provide access to this class. If the field several points on a circle of latitude are sought then use GeographicLib::MagneticModel::Circle to return a GeographicLib::MagneticCircle object whose operator() member function performs the calculation efficiently. (This is particularly important for high degree models such as emm2010.) These classes requires installation of data files for the various magnetic models; see \ref magneticinst for details. GeographicLib::Constants, GeographicLib::Math, GeographicLib::Utility, GeographicLib::DMS, are general utility class which are used internally by the library; in addition GeographicLib::EllipticFunction is used by GeographicLib::TransverseMercatorExact, GeographicLib::Accumulator is used by GeographicLib::PolygonArea, and GeographicLib::SphericalEngine, GeographicLib::CircularEngine, GeographicLib::SphericalHarmonic, GeographicLib::SphericalHarmonic1, and GeographicLib::SphericalHarmonic2 facilitate the summation of spherical harmonic series which is needed by and GeographicLib::MagneticModel and GeographicLib::MagneticCircle. One important definition is GeographicLib::Math::real which is the type used for real numbers. This allows the library to be easily switched to using floats, doubles, or long doubles. However all the testing has been with real set to double and the library should be installed in this way. In general, the constructors for the classes in %GeographicLib check their arguments and throw GeographicLib::GeographicErr exceptions with a explanatory message if these are illegal. The member functions, e.g., the projections implemented by TransverseMercator and PolarStereographic, the solutions to the geodesic problem, etc., typically do not check their arguments; the calling program should ensure that the arguments are legitimate. However, the functions implemented by UTMUPS, MGRS, and GeoCoords do check their arguments and may throw GeographicLib::GeographicErr exceptions. Similarly Geoid may throw exceptions on file errors. If a function does throw an exception, then the function arguments used for return values will not have been altered. %GeographicLib attempts to act sensibly with NaNs. NaNs in constructors typically throw errors (an exception is GeodesicLine). However, calling the class functions with NaNs as arguments is not an error; NaNs are returned as appropriate. "INV" is treated as an invalid zone designation by UTMUPS. "INVALID" is the corresponding invalid MGRS string. NaNs allow the projection of polylines which are separated by NaNs; in this format they can be easily plotted in Matlab. A note about portability. For the most part, the code uses standard C++ and should be able to be deployed on any system with a modern C++ compiler. System dependencies come into - GeographicLib::Math -- GeographicLib needs to define functions such as atanh for systems that lack them. The system dependence will disappear with the adoption of C++11 because the needed functions are part of that standard. - use of long double -- the type is used only for testing. On systems which lack this data type the cmake and autoconf configuration methods should detect its absence and omit the code that depends on it. - GeographicLib::Geoid, GeographicLib::GravityModel, and GeographicLib::MagneticModel -- these class uses system-dependent default paths for looking up the respective datasets. It also relies on getenv to find the value of the environment variables. - GeographicLib::Utility::readarray reads numerical data from binary files. This assumes that floating point numbers are in IEEE format. It attempts to handled the "endianness" of the target platform using the WORDS_BIGENDIAN macro (which sets the compile-time constant GeographicLib::Math::bigendian).
Back to \ref utilities. Forward to \ref other. Up to \ref contents.
**********************************************************************/ /** \page other Other interfaces (Javascript, Python, Matlab, Octave)
Back to \ref organization. Forward to \ref geoid. Up to \ref contents.
Interfaces to subsets of %GeographicLib are available in other languages - \ref javascript. - \ref python. - \ref matlab. \section javascript Javascript interface The directory doc/scripts/GeographicLib contains the classes - GeographicLib::Math - GeographicLib::Accumulator - GeographicLib::Geodesic - GeographicLib::GeodesicLine - GeographicLib::PolygonArea - GeographicLib::DMS . translated into Javascript. See Interface.js for a simple Javascript interface to these routines (documented near the top of the file). Examples of using this interface are - a geodesic calculator showing the solution of direct and inverse geodesic problem, finding intermediate points on a geodesic line, and computing the area of a geodesic polygon. - displaying geodesics in Google Maps which shows the geodesic, the geodesic circle, and various geodesic envelopes. . These examples include a "stripped" version of the Javascript code, \code \endcode which loads faster. \section python Python interface A python implementation of the geodesic routines from GeographicLib are provided in the python/geographiclib directory (which is installed as PREFIX/lib/python/site-packages/geographiclib). This contains implementations of the classes - GeographicLib::Math - GeographicLib::Accumulator - GeographicLib::Geodesic - GeographicLib::GeodesicLine - GeographicLib::PolygonArea . You can also download the python interface independent of the rest of %GeographicLib from - http://pypi.python.org/pypi/geographiclib . and then unpack the .tar.gz or .zip file. You can "install" these routines, so that they are in python's default path with, for example \verbatim cd geographiclib-1.16 python setup.py install \endverbatim (this will require root privileges). Or else you can set the path within python using \code >>> import sys >>> sys.path.append("/usr/local/lib/python/site-packages"); \endcode An example of using this interface is \code >>> from geographiclib.geodesic import Geodesic >>> # The geodesic inverse problem ... Geodesic.WGS84.Inverse(-41.32, 174.81, 40.96, -5.50) >>> # The geodesic direct problem ... Geodesic.WGS84.Direct(40.6, -73.8, 45, 10000e3) >>> # How to obtain several points along a geodesic ... line = Geodesic.WGS84.Line(40.6, -73.8, 45) >>> line.Position( 5000e3) >>> line.Position(10000e3) >>> # Computing the area of a geodesic polygon ... def p(lat,lon): return {'lat': lat, 'lon': lon} ... >>> Geodesic.WGS84.Area([p(0, 0), p(0, 90), p(90, 0)]) >>> # Introductory help ... help(Geodesic) \endcode (Note: The initial version of setup.py was provided by Andrew MacIntyre of the Australian Communications and Media Authority.) \section matlab Matlab and Octave interfaces The matlab directory contains interface code so that some %GeographicLib classes can be accessed from Matlab or Octave. There are two ways of compiling this code: (1) using cmake and (2) invoking the compiler from Matlab. - Using cmake: Before running cmake, configure MATLAB on Windows to use the same compiler that you're going to use for compiling %GeographicLib. For example \verbatim mex.bat -setup Please choose your compiler for building external interface (MEX) files: Would you like mex to locate installed compilers [y]/n? y Select a compiler: [1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2010b\sys\lcc [2] Microsoft Visual C++ 2010 in C:\Program Files\Microsoft Visual Studio 10.0 [0] None Compiler: 2 etc. \endverbatim (This will require that mex.bat is in your PATH. With Linux, use mex -setup.) Then configure cmake with, for example \verbatim cmake -G "Visual Studio 10" -D MATLAB_COMPILER=mex .. \endverbatim If you are running a 64-bit version of Matlab, be sure to select a 64-bit generator with cmake, e.g., "Visual Studio 10 Win64". Finally compile %GeographicLib with Visual Studio. (The binary installer for 64-bit Windows includes the compiled interface built with Visual Studio 10 and Matlab R2010b 64-bit).
On Linux systems, you can compile the interface for use with octave instead by using \verbatim cmake -D MATLAB_COMPILER=mkoctfile .. \endverbatim - Invoking the compiler from Matlab or Octave: Start Matlab or Octave and run, e.g., \code mex -setup cd 'C:/pkg-vc10-x64/GeographicLib-1.21/libexec/GeographicLib/matlab' help geographiclibinterface geographiclibinterface('C:/pkg-vc10/GeographicLib-1.21'); addpath(pwd); \endcode The first command allows you to select the compiler to use (which should be the same as that used to compile %GeographicLib). To use the interface routines for %GeographicLib, run one of (for example) \verbatim addpath /usr/local/libexec/GeographicLib/matlab addpath 'C:/pkg-vc10-x64/GeographicLib-1.21/libexec/GeographicLib/matlab' \endverbatim in Octave or Matlab. The available functions are: - geodesicdirect: solve direct geodesic problem (see GeographicLib::Geodesic::Direct) - geodesicinverse: solve inverse geodesic problem (see GeographicLib::Geodesic::Inverse) - geodesicline: compute points along a geodesic (see GeographicLib::GeodesicLine::Position) - polygonarea: compute area of a geodesic polygon (see GeographicLib::PolygonArea) - utmupsforward: convert geographic coordinates to UTM/UPS (see GeographicLib::UTMUPS::Forward) - utmupsreverse: convert UTM/UPS coordinates to geographic (see GeographicLib::UTMUPS::Reverse) - mgrsforward: convert UTM/UPS coordinates to MGRS (see GeographicLib::MGRS::Forward) - mgrsreverse: convert MGRS coordinates to UTM/UPS (see GeographicLib::MGRS::Reverse) - geoidheight: compute geoid height (see GeographicLib::Geoid::operator()()) - geocentricforward: convert geographic coordinates to geocentric (see GeographicLib::Geocentric::Forward) - geocentricreverse: convert geocentric coordinates to geographic (see GeographicLib::Geocentric::Reverse) - localcartesianforward: convert geographic coordinates to local cartesian (see GeographicLib::LocalCartesian::Forward) - localcartesianreverse: convert local cartesian coordinates to geographic (see GeographicLib::LocalCartesian::Reverse) . These routines just offer a simple interface to the corresponding C++ class. Use the help function to get documentation, e.g., \code help geodesicdirect \endcode Unfortunately, the help function does not work for compiled functions in Octave; in this case, just list the .m file, e.g., \code type geodesicdirect \endcode Other useful functions, e.g., to convert from geographic coordinates to MGRS can easily be written with Matlab code. Note that geoidheight, when compiled with Visual Studio 2008 causes Matlab to crash. (The problem does not occur with Visual Studio 2005 or Visual Studio 2010.)
Back to \ref organization. Forward to \ref geoid. Up to \ref contents.
**********************************************************************/ /** \page geoid Geoid height
Back to \ref other. Forward to \ref gravity. Up to \ref contents.
The gravitational equipotential surface approximately coinciding with mean sea level is called the geoid. The GeographicLib::Geoid class and the GeoidEval utility evaluate the height of the geoid above the WGS84 ellipsoid. This can be used to convert heights above mean sea level to heights above the WGS84 ellipsoid. Because the normal to the ellipsoid differs from the normal to the geoid (the direction of a plumb line) there is a slight ambiguity in the measurement of heights; however for heights up to 10 km this ambiguity is only 1 mm. The geoid is usually approximated by an "earth gravity model" (EGM). The models published by the NGA are: - EGM84: http://earth-info.nga.mil/GandG/wgs84/gravitymod/wgs84_180/wgs84_180.html - EGM96: http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html - EGM2008: http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008 . GeographicLib::Geoid offers a uniform way to handle all 3 geoids at a variety of grid resolutions. (In contrast, the software tools that NGA offers are different for each geoid, and the interpolation programs are different for each grid resolution. In addition these tools are written in Fortran with is nowadays difficult to integrate with other software.) Unlike other components of %GeographicLib, there is a appreciable error in the results obtained (at best, the RMS error is 1 mm). However the class provides methods to report the maximum and RMS errors in the results. The class also returns the gradient of the geoid. This can be used to estimate the direction of a plumb line relative to the WGS84 ellipsoid. The GeographicLib::GravityModel class calculates geoid heights using the underlying gravity model. This is slower then GeographicLib::Geoid but considerably more accurate. This class also can accurately compute all the components of the acceleration due to gravity (and hence the direction of plumb line). Go to - \ref geoidinst - \ref geoidformat - \ref geoidinterp - \ref geoidcache - \ref testgeoid \section geoidinst Installing the geoid datasets The geoid heights are computed using interpolation into a rectangular grid. The grids are read from data files which have been are computed using the NGA synthesis programs in the case of the EGM84 and EGM96 models and using the NGA binary gridded data files in the case of EGM2008. These data files are available for download:
Available geoid data files
name geoid grid size\n(MB)
Download Links (size, MB)
tar file Windows\n installer zip file
egm84-30 EGM84
30'
0.6
link (0.5)
link (0.8)
link (0.5)
egm84-15 EGM84
15'
2.1
link (1.5)
link (1.9)
link (2.0)
egm96-15 EGM96
15'
2.1
link (1.5)
link (1.9)
link (2.0)
egm96-5 EGM96
5'
19
link (11)
link (11)
link (17)
egm2008-5 EGM2008
5'
19
link (11)
link (11)
link (17)
egm2008-2_5 EGM2008
2.5'
75
link (35)
link (33)
link (65)
egm2008-1 EGM2008
1'
470
link (170)
link (130)
link (390)
The "size" column is the size of the uncompressed data and it also gives the memory requirements for caching the entire dataset using the GeographicLib::Geoid::CacheAll method. At a minimum you should install egm96-5 and either egm2008-1 or egm2008-2_5. Many applications use the EGM96 geoid, however the use of EGM2008 is growing. (EGM84 is rarely used now.) For Linux and Unix systems, %GeographicLib provides a shell script geographiclib-get-geoids (typically installed in /usr/local/sbin) which automates the process of downloading and installing the geoid data. For example \verbatim geographiclib-get-geoids best # to install egm84-15, egm96-5, egm2008-1 geographiclib-get-geoids -h # for help \endverbatim This script should be run as a user with write access to the installation directory, which is typically /usr/local/share/GeographicLib (this can be overridden with the -p flag), and the data will then be placed in the "geoids" subdirectory. Windows users should download and run the Windows installers. These will prompt for an installation directory with the default being one of \verbatim C:/Documents and Settings/All Users/Application Data/GeographicLib C:/ProgramData/GeographicLib \endverbatim (which you probably should not change) and the data is installed in the "geoids" sub-directory. (The second directory name is an alternate name that Windows 7 for the "Application Data" directory.) Otherwise download \e either the tar.bz2 file \e or the zip file (they have the same contents). If possible use the tar.bz2 files, since these are compressed about 2 times better than the zip file. To unpack these, run, for example \verbatim mkdir -p /usr/local/share/GeographicLib tar xofjC egm96-5.tar.bz2 /usr/local/share/GeographicLib tar xofjC egm2008-2_5.tar.bz2 /usr/local/share/GeographicLib etc. \endverbatim and, again, the data will be placed in the "geoids" subdirectory. However you install the geoid data, all the datasets should be installed in the same directory. GeographicLib::Geoid and GeoidEval uses a compile time default to locate the datasets. This is - /usr/local/share/GeographicLib/geoids, for non-Windows systems - C:/Documents and Settings/All Users/Application Data/GeographicLib/geoids, for Windows systems . consistent with the examples above. This may be overridden at run-time by defining the GEOID_PATH or the GEOGRAPHIC_DATA environment variables; see GeographicLib::Geoid::DefaultGeoidPath() for details. Finally, the path may be set using the optional second argument to the GeographicLib::Geoid constructor or with the "-d" flag to GeoidEval. Supplying the "-h" flag to GeoidEval reports the default geoid path for that utility. The "-v" flag causes GeoidEval to report the full path name of the data file it uses. \section geoidformat The format of the geoid data files The gridded data used by the GeographicLib::Geoid class is stored in 16-bit PGM files. Thus the data for egm96-5 might be stored in the file - /usr/local/share/GeographicLib/geoids/egm96-5.pgm . PGM simple graphic format with the following properties - it is well documented here; - there are no separate "little-endian" and "big-endian" versions; - it uses 1 or 2 bytes per pixel; - pixels can be randomly accessed; - comments can be added to the file header; - it is sufficiently simple that it can be easily read without using the libnetpbm library (and thus we avoid adding a software dependency to %GeographicLib). . The major drawback of this format is that since there are only 65535 possible pixel values, the height must be quantized to 3 mm. However, the resulting quantization error (up to 1.5 mm) is typically smaller than the linear interpolation errors. The comments in the header for egm96-5 are \verbatim # Geoid file in PGM format for the GeographicLib::Geoid class # Description WGS84 EGM96, 5-minute grid # URL http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html # DateTime 2009-08-29 18:45:03 # MaxBilinearError 0.140 # RMSBilinearError 0.005 # MaxCubicError 0.003 # RMSCubicError 0.001 # Offset -108 # Scale 0.003 # Origin 90N 0E # AREA_OR_POINT Point # Vertical_Datum WGS84 \endverbatim Of these lines, the Scale and Offset lines are required and define the conversion from pixel value to height (in meters) using \e height = \e offset + \e scale \e pixel. The Geoid constructor also reads the Description, DateTime, and error lines (if present) and stores the resulting data so that it can be returned by GeographicLib::Geoid::Description, GeographicLib::Geoid::DateTime, GeographicLib::Geoid::MaxError, and GeographicLib::Geoid::RMSError methods. The other lines serve as additional documentation but are not used by this class. Accompanying egm96-5.pgm (and similarly with the other geoid data files) are two files egm96-5.wld and egm96-5.pgm.aux.xml. The first is an ESRI "world" file and the second supplies complete projection metadata for use by GDAL. Neither of these files is read by GeographicLib::Geoid. You can use gdal_translate to convert the data files to a standard GeoTiff, e.g., with \verbatim gdal_translate -ot Float32 -scale 0 65000 -108 87 egm96-5.pgm egm96-5.tif \endverbatim The arguments to -scale here are specific to the Offset and Scale parameters used in the pgm file (note 65000 * 0.003 - 108 = 87). You can check these by running GeoidEval with the "-v" option. Here is a sample script which uses GDAL to create a 1-degree squared grid of geoid heights at 3" resolution (matching DTED1) by bilinear interpolation. \verbatim #! /bin/sh lat=37 lon=067 res=3 # resolution in seconds TEMP=`mktemp junkXXXXXXXXXX` # temporary file for GDAL gdalwarp -q -te `echo $lon $lat $res | awk '{ lon = $1; lat = $2; res = $3; printf "%.14f %.14f %.14f %.14f", lon -0.5*res/3600, lat -0.5*res/3600, lon+1+0.5*res/3600, lat+1+0.5*res/3600; }'` -ts $((3600/res+1)) $((3600/res+1)) -r bilinear egm96-5.tif $TEMP gdal_translate -quiet \ -mo AREA_OR_POINT=Point \ -mo Description="WGS84 EGM96, $res-second grid" \ -mo Vertical_Datum=WGS84 \ -mo Tie_Point_Location=pixel_corner \ $TEMP e$lon-n$lat.tif rm -f $TEMP \endverbatim Because the pgm files are uncompressed, they can take up a lot of disk space. Some compressed formats compress in tiles and so might be compatible with the requirement that the data can be randomly accessed. In particular gdal_translate can be used to convert the pgm files to compressed tiff files with \verbatim gdal_translate -co COMPRESS=LZW -co PREDICTOR=2 \ -co TILED=YES -co BLOCKXSIZE=256 -co BLOCKYSIZE=256 \ egmyy-g.pgm egmyy-g.tif \endverbatim The resulting files sizes are \verbatim pgm tif egm84-30 0.6 MB 0.5 MB egm84-15 2.1 MB 1.4 MB egm96-15 2.1 MB 1.5 MB egm96-5 19 MB 8.5 MB egm2008-5 19 MB 9.8 MB egm2008-2_5 75 MB 28 MB egm2008-1 470 MB 97 MB \endverbatim Currently, there are no plans for %GeographicLib to support this compressed format. \section geoidinterp Interpolating the geoid data GeographicLib::Geoid evaluates the geoid height using bilinear or cubic interpolation. The gradient of the geoid height is obtained by differentiating the interpolated height and referencing the result to distance on the WGS84 ellipsoid. WARNING: Although GeographicLib::Geoid computes the gradient of the geoid height, this is subject to large quantization errors as a result of the way that the geoid data is stored. This is particularly acute for fine grids, at high latitudes, and for the easterly gradient. If you need to compute the direction of the acceleration due to gravity accurately, you should use GeographicLib::GravityModel::Gravity. The bilinear interpolation is based on the values at the 4 corners of the enclosing cell. The interpolated height is a continuous function of position; however the gradient has discontinuities are cell boundaries. The quantization of the data files exacerbates the errors in the gradients. The cubic interpolation is a least-squares fit to the values on a 12-point stencil with weights as follows: \verbatim . 1 1 . 1 2 2 1 1 2 2 1 . 1 1 . \endverbatim The cubic is constrained to be independent of longitude when evaluating the height at one of the poles. Cubic interpolation is considerably more accurate than bilinear interpolation; however, in this implementation there are small discontinuities in the heights are cell boundaries. The over-constrained cubic fit slightly reduces the quantization errors on average. The algorithm for the least squares fit is taken from, F. H. Lesh, Multi-dimensional least-squares polynomial curve fitting, CACM 2, 29-30 (1959). This algorithm is not part of GeographicLib::Geoid; instead it is implemented as Maxima code which is used to precompute the matrices to convert the function values on the stencil into the coefficients from the cubic polynomial. This code is included as a comment in Geoid.cpp. The interpolation methods are quick and give good accuracy. Here is a summary of the combined quantization and interpolation errors for the heights.
Interpolation and quantization errors for geoid heights
name geoid grid
bilinear error
cubic error
max
rms
max
rms
egm84-30 EGM84
30'
1.546 m
70 mm
0.274 m
14 mm
egm84-15 EGM84
15'
0.413 m
18 mm
0.021 m
1.2 mm
egm96-15 EGM96
15'
1.152 m
40 mm
0.169 m
7.0 mm
egm96-5 EGM96
5'
0.140 m
4.6 mm
0.0032 m
0.7 mm
egm2008-5 EGM2008
5'
0.478 m
12 mm
0.294 m
4.5 mm
egm2008-2_5EGM2008
2.5'
0.135 m
3.2 mm
0.031 m
0.8 mm
egm2008-1 EGM2008
1'
0.025 m
0.8 mm
0.0022 m
0.7 mm
The errors are with respect to the specific NGA earth gravity model (not to any "real" geoid). The RMS values are obtained using 5 million uniformly distributed random points. The maximum values are obtained by evaluating the errors using a different grid with points at the centers of the original grid. (The RMS difference between EGM96 and EGM2008 is about 0.5 m. The RMS difference between EGM84 and EGM96 is about 1.5 m.) The errors in the table above include the quantization errors that arise because the height data that GeographicLib::Geoid uses are quantized to 3 mm. If, instead, GeographicLib::Geoid were to use data files without such quantization artifacts, the overall error would be reduced but only modestly as shown in the following table, where only the changed rows are included and where the changed entries are given in bold:
Interpolation (only!) errors for geoid heights
name geoid grid
bilinear error
cubic error
max
rms
max
rms
egm96-5 EGM96
5'
0.140 m
4.6 mm
0.0026 m
0.1 mm
egm2008-2_5EGM2008
2.5'
0.135 m
3.2 mm
0.031 m
0.4 mm
egm2008-1 EGM2008
1'
0.025 m
0.6 mm
0.0010 m
0.011 mm
\section geoidcache Caching the geoid data A simple way of calling Geoid is as follows \code #include #include ... GeographicLib::Geoid g("egm96-5"); double lat, lon; while (std::cin >> lat >> lon) std::cout << g(lat, lon) << "\n"; ... \endcode The first call to g(lat, lon) causes the data for the stencil points (4 points for bilinear interpolation and 12 for cubic interpolation) to be read and the interpolated value returned. A simple 0th-order caching scheme is provided by default, so that, if the second and subsequent points falls within the same grid cell, the data values are not reread from the file. This is adequate for most interactive use and also minimizes disk accesses for the case when a continuous track is being followed. If a large quantity of geoid calculations are needed, the calculation can be sped up by preloading the data for a rectangular block with GeographicLib::Geoid::CacheArea or the entire dataset with GeographicLib::Geoid::CacheAll. If the requested points lie within the cached area, the cached data values are used; otherwise the data is read from disk as before. Caching all the data is a reasonable choice for the 5' grids and coarser. Caching all the data for the 1' grid will require 0.5 GB of RAM and should only be used on systems with sufficient memory. The use of caching does not affect the values returned. Because of the caching and the random file access, this class is \e not normally thread safe; i.e., a single instantiation cannot be safely used by multiple threads. If multiple threads need to calculate geoid heights, there are two alternatives: - they should all construct thread-local instantiations. - GeographicLib::Geoid should be constructed with \e threadsafe = true. This causes all the data to be read at the time of construction (and if this fails, an exception is thrown), the data file to be closed and the single-cell caching to be turned off. The resulting object may then be shared safely between threads. \section testgeoid Test data for geoids A test set for the geoid models is available at - GeoidHeights.dat.gz . This is about 11 MB (compressed). This test set consists of a set of 500000 geographic coordinates together with the corresponding geoid heights according to various earth gravity models. Each line of the test set gives 6 space delimited numbers - latitude (degrees, exact) - longitude (degrees, exact) - EGM84 height (meters, accurate to 1 um) - EGM96 height (meters, accurate to 1 um) - EGM2008 height (meters, accurate to 1 um) . The latitude and longitude are all multiples of 10-6 deg and should be regarded as exact. The geoid heights are computed using the harmonic NGA synthesis programs, where the programs were compiled (with gfortran) and run under Linux. In the case of the EGM2008 program, a SAVE statement needed to be added to subroutine latf, in order for the program to compile correctly with a stack-based compiler. Similarly the EGM96 code requires a SAVE statement in subroutine legfdn.
Back to \ref other. Forward to \ref gravity. Up to \ref contents.
**********************************************************************/ /** \page gravity Gravity models
Back to \ref geoid. Forward to \ref magnetic. Up to \ref contents.
%GeographicLib can compute the earth's gravitational field with an earth gravity model using the GeographicLib::GravityModel and GeographicLib::GravityCircle classes and with the Gravity utility. These models expand the gravitational potential of the earth as sum of spherical harmonics. The models also specify a reference ellipsoid, relative to which geoid heights and gravity disturbances are measured. The supported models are - egm84, the Earth Gravity Model 1984, which includes terms up to degree 180. - egm96, the Earth Gravity Model 1996, which includes terms up to degree 360. - egm2008, the Earth Gravity Model 2008, which includes terms up to degree 2190. - wgs84, the WGS84 Reference Ellipsoid. This is just reproduces the normal gravitational field for the reference ellipsoid. Usually GeographicLib::NormalGravity::WGS84 should be used instead. See - W. A. Heiskanen and H. Moritz, Physical Geodesy (Freeman, San Francisco, 1967). . for more information. Acknowledgment: I would like to thank Mathieu Peyréga for sharing EGM_Geoid_CalculatorClass from his Geo library with me. His implementation was the first I could easily understand and he and I together worked through some of the issues with overflow and underflow the occur while performing high-degree spherical harmonic sums. Go to - \ref gravityinst - \ref gravityformat - \ref gravitynga - \ref gravitygeoid - \ref gravityatmos - \ref gravityparallel \section gravityinst Installing the gravity models These gravity models are available for download:
Available gravity models
name max\n degree size\n(kB)
Download Links (size, kB)
tar file Windows\n installer zip file
egm84
180
27
link (26)
link (55)
link (26)
egm96
360
2100
link (2100)
link (2300)
link (2100)
egm2008
2190
76000
link (75000)
link (72000)
link (73000)
wgs84
20
1
link (1)
link (30)
link (1)
The "size" column is the size of the uncompressed data. For Linux and Unix systems, %GeographicLib provides a shell script geographiclib-get-gravity (typically installed in /usr/local/sbin) which automates the process of downloading and installing the gravity models. For example \verbatim geographiclib-get-gravity all # to install egm84, egm96, egm2008, wgs84 geographiclib-get-gravity -h # for help \endverbatim This script should be run as a user with write access to the installation directory, which is typically /usr/local/share/GeographicLib (this can be overridden with the -p flag), and the data will then be placed in the "gravity" subdirectory. Windows users should download and run the Windows installers. These will prompt for an installation directory with the default being one of \verbatim C:/Documents and Settings/All Users/Application Data/GeographicLib C:/ProgramData/GeographicLib \endverbatim (which you probably should not change) and the data is installed in the "gravity" sub-directory. (The second directory name is an alternate name that Windows 7 for the "Application Data" directory.) Otherwise download \e either the tar.bz2 file \e or the zip file (they have the same contents). To unpack these, run, for example \verbatim mkdir -p /usr/local/share/GeographicLib tar xofjC egm96.tar.bz2 /usr/local/share/GeographicLib tar xofjC egm2008.tar.bz2 /usr/local/share/GeographicLib etc. \endverbatim and, again, the data will be placed in the "gravity" subdirectory. However you install the gravity models, all the datasets should be installed in the same directory. GeographicLib::GravityModel and Gravity uses a compile time default to locate the datasets. This is - /usr/local/share/GeographicLib/gravity, for non-Windows systems - C:/Documents and Settings/All Users/Application Data/GeographicLib/gravity, for Windows systems . consistent with the examples above. This may be overridden at run-time by defining the GRAVITY_PATH or the GEOGRAPHIC_DATA environment variables; see GeographicLib::GravityModel::DefaultGravityPath() for details. Finally, the path may be set using the optional second argument to the GeographicLib::GravityModel constructor or with the "-d" flag to Gravity. Supplying the "-h" flag to Gravity reports the default path for gravity models for that utility. The "-v" flag causes Gravity to report the full path name of the data file it uses. \section gravityformat The format of the gravity model files The constructor for GeographicLib::GravityModel reads a file called NAME.egm which specifies various properties for the gravity model. It then opens a binary file NAME.egm.cof to obtain the coefficients of the spherical harmonic sum. The first line of the .egm file must consist of "EGMF-v" where EGMF stands for "Earth Gravity Model Format" and v is the version number of the format (currently "1"). The rest of the File is read a line at a time. A # character and everything after it are discarded. If the result is just white space it is discarded. The remaining lines are of the form "KEY WHITESPACE VALUE". In general, the KEY and the VALUE are case-sensitive. GeographicLib::GravityModel only pays attention to the following keywords - keywords that affect the field calculation, namely: - ModelRadius (required), the normalizing radius for the model in meters. - ReferenceRadius (required), the major radius \e a for the reference ellipsoid meters. - ModelMass (required), the mass constant \e GM for the model in meters3/seconds2. - ReferenceMass (required), the mass constant \e GM for the reference ellipsoid in meters3/seconds2. - AngularVelocity (required), the angular velocity \e omega for the model \e and the reference ellipsoid in rad seconds-1. - Flattening, the flattening of the reference ellipsoid; this can be given a fraction, e.g., 1/298.257223563. One of Flattening and DynamicalFormFactor is required. - DynamicalFormFactor, the dynamical form factor J2 for the reference ellipsoid. One of Flattening and DynamicalFormFactor is required. - HeightOffset (default 0), the constant height offset (meters) added to obtain the geoid height. - CorrectionMultiplier (default 1), the multiplier for the "zeta-to-N" correction terms for the geoid height to convert them to meters. - Normalization (default full), the normalization used for the associated Legendre functions (full or schmidt). - ID (required), 8 printable characters which serve as a signature for the .egm.cof file (they must appear as the first 8 bytes of this file). . The parameters ModelRadius, ModelMass, and AngularVelocity apply to the gravity model, while ReferenceRadius, ReferenceMass, AngularVelocity, and either Flattening or DynamicalFormFactor characterize the reference ellipsoid. AngularVelocity (because it can be measured precisely) is the same for the gravity model and the reference ellipsoid. ModelRadius is merely a scaling parameter for the gravity model and there's no requirement that it be close to the major radius of the earth (although that's typically how it is chosen). ModelMass and ReferenceMass need not be the same and, indeed, they are slightly difference for egm2008. As a result the disturbing potential \e T has a 1/\e r dependence at large distances. - keywords that store data that the user can query: - Name, the name of the model. - Description, a more descriptive name of the model. - ReleaseDate, when the model was created. - keywords that are examined to verify that their values are valid: - ByteOrder (default little), the order of bytes in the .egm.cof file. Only little endian is supported at present. . Other keywords are ignored. The coefficient file NAME.egm.cof is a binary file in little endian order. The first 8 bytes of this file must match the ID given in NAME.egm. This is followed by 2 sets of spherical harmonic coefficients. The first of these gives the gravity potential and the second gives the zeta-to-N corrections to the geoid height. The format for each set of coefficients is: - \e N, the maximum degree of the sum stored as a 4-byte signed integer. This must satisfy \e N >= -1. - \e M, the maximum order of the sum stored as a 4-byte signed integer. This must satisfy \e N >= \e M >= -1. - \e C\e nm, the coefficients of the cosine coefficients of the sum in column (i.e., \e m) major order. There are (\e M + 1) (2\e N - \e M + 2) / 2 elements which are stored as IEEE doubles (8 bytes). For example for \e N = \e M = 3, there are 10 coefficients arranged as C00, C10, C20, C30, C11, C21, C31, C22, C32, C33. - \e S\e nm, the coefficients of the sine coefficients of the sum in column (i.e., \e m) major order starting at \e m = 1. There are \e M (2\e N - \e M + 1) / 2 elements which are stored as IEEE doubles (8 bytes). For example for \e N = \e M = 3, there are 6 coefficients arranged as S11, S21, S31, S22, S32, S33. . Although the coefficient file is in little endian order, %GeographicLib can read it on big endian machines. It can only be read on machines which store doubles in IEEE format. As an illustration, here is egm2008.egm: \verbatim EGMF-1 # An Earth Gravity Model (Format 1) file. For documentation on the # format of this file see # http://geographiclib.sf.net/html/gravity.html#gravityformat Name egm2008 Publisher National Geospatial Intelligence Agency Description Earth Gravity Model 2008 URL http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008 ReleaseDate 2008-06-01 ConversionDate 2011-11-19 DataVersion 1 ModelRadius 6378136.3 ModelMass 3986004.415e8 AngularVelocity 7292115e-11 ReferenceRadius 6378137 ReferenceMass 3986004.418e8 Flattening 1/298.257223563 HeightOffset -0.41 # Gravitational and correction coefficients taken from # EGM2008_to2190_TideFree and Zeta-to-N_to2160_egm2008 from # the egm2008 distribution. ID EGM2008A \endverbatim \section gravitynga Comments on the NGA harmonic synthesis code GeographicLib::GravityModel attempts to reproduce the results of NGA's harmonic synthesis code for EGM2008, hsynth_WGS84.f. Listed here are issues that I encountered using the NGA code: -# A compiler which allocates local variables on the stack produces an executable with just returns NaNs. The problem here is a missing SAVE statement in subroutine latf. -# Because the model and references masses for egm2008 differ (by about 1 part in 109), there should be a 1/\e r contribution to the disturbing potential \e T. However, this term is set to zero in hsynth_WGS84 (effectively altering the normal potential). This shifts the surface \e W = U0 outward by about 5 mm. Note too that the reference ellipsoid is no longer a level surface of the effective normal potential. -# Subroutine radgrav computes the ellipsoidal coordinate \e beta incorrectly. This leads to small errors in the deflection of the vertical, \e xi and \e eta, when the height above the ellipsoid, \e h, is non-zero (about 1e-7 arcsec at \e h = 400 km). -# There are several expressions which will return inaccurate results due to cancellation. For example, subroutine grs computes the flattening using \e f = 1 - sqrt(1 - e2). Much better is to use \e f = e2/(1 + sqrt(1 - e2)). The expressions for \e q and \e q' in grs and radgrav suffer from similar problems. The resulting errors are tiny (about 50 pm in the geoid height); however, given that's there's essentially no cost to using more accurate expressions, it's preferable to do so. -# hsynth_WGS84 returns an "undefined" value for \e xi and \e eta at the poles. Better would be to return the value obtained by taking the limit \e lat -> +/- 90o. . Issues 1–4 have been reported to the authors of hsynth_WGS84. Issue 1 is peculiar to Fortran and is not encountered in C++ code and GeographicLib::GravityModel corrects issues 3–5. On issue 2, GeographicLib::GravityModel neglects the 1/\e r term in \e T in GeographicLib::GravityModel::GeoidHeight and GeographicLib::GravityModel::SphericalAnomaly in order to produce results which match NGA's for these quantities. On the other hand, GeographicLib::GravityModel::Disturbance and GeographicLib::GravityModel::T do include this term. \section gravitygeoid Details of the geoid height and anomaly calculations Ideally, the geoid represents a surface of constant gravitational potential which approximates mean sea level. In reality some approximations are taken in determining this surface. The steps taking by GeographicLib::GravityModel in computing the geoid height are described here (in the context of EGM2008). This mimics NGA's code hsynth_WGS84 closely because most users of EGM2008 use the gridded data generated by this code (e.g., GeographicLib::Geoid) and it is desirable to use a consistent definition of the geoid height. - The model potential is band limited; the minimum wavelength that is represented is 360o/2160 = 10' (i.e., about 10NM or 18.5km). The maximum degree for the spherical harmonic sum is 2190; however the model was derived using ellipsoidal harmonics of degree and order 2160 and the degree was increased to 2190 in order to capture the ellipsoidal harmonics faithfully with spherical harmonics. - The 1/\e r term is omitted from the \e T (this is issue 2 in \ref gravitynga). This moves the equipotential surface by about 5mm. - The surface \e W = U0 is determined by Bruns' formula, which is roughly equivalent to a single iteration of Newton's method. The RMS error in this approximation is about 1.5mm with a maximum error of about 10 mm. - The model potential is only valid above the earth's surface. A correction therefore needs to be included where the geoid lies beneath the terrain. This is NGA's "zeta-to-N" correction, which is represented by a spherical harmonic sum of degree and order 2160 (and so it misses short wavelength terrain variations). In addition, it entails estimating the isostatic equilibrium of the earth's crust. The correction lies in the range [-5.05 m, 0.05 m], however for 99.9% of the earth's surface the correction is less than 10 mm in magnitude. - The resulting surface lies above the observed mean sea level, so -0.41m is added to the geoid height. (Better would be to change the potential used to define the geoid; but this would only change the result by about 2mm.) . A useful discussion of the problems with defining a geoid is given by Dru A. Smith in There is no such thing as "The" EGM96 geoid: Subtle points on the use of a global geopotential model, IGeS Bulletin No. 8, International Geoid Service, Milan, Italy, pp. 17–28 (1998). GeographicLib::GravityModel::GeoidHeight reproduces the results of the several NGA codes for harmonic synthesis with the following maximum discrepancies: - egm84 = 1.1mm. This is probably due to inconsistent parameters for the reference ellipsoid in the NGA code. (In particular, the value of mass constant excludes the atmosphere; however, it's not clear whether the other parameters have been correspondingly adjusted.) Note that geoid heights predicted by egm84 differ from those of more recent gravity models by about 1 meter. - egm96 = 23nm. - egm2008 = 78pm. After addressing some of the issues alluded to in issue 4 in \ref gravitynga, the maximum discrepancy becomes 23pm. The formula for the gravity anomaly vector involves computing gravity and normal gravity at two different points (with the displacement between the points unknown ab initio). Since the gravity anomaly is already a small quantity it is sometimes acceptable to employ approximations that change the quantities by \e O(\e f). The NGA code uses the spherical approximation described by Heiskanen and Moritz, Sec. 2-14 and GeographicLib::GravityModel::SphericalAnomaly uses the same approximation for compatibility. In this approximation, the gravity disturbance delta = grad \e T is calculated. Here, \e T once again excludes the 1/\e r term (this is issue 2 in \ref gravitynga and is consistent with the computation of the geoid height). Note that delta compares the gravity and the normal gravity at the \e same point; the gravity anomaly vector is then found by estimating the gradient of the normal gravity in the limit that the earth is spherically symmetric. delta is expressed in \e spherical coordinates as \e deltax, \e deltay, \e deltaz where, for example, \e deltaz is the \e radial component of delta (not the component perpendicular to the ellipsoid) and \e deltay is similarly slightly different from the usual northerly component. The components of the anomaly are then given by - gravity anomaly, \e Dg01 = \e deltaz - 2T/\e R, where \e R distance to the center of the earth; - northerly component of the deflection of the vertical, \e xi = - deltay/\e gamma, where \e gamma is the magnitude of the normal gravity; - easterly component of the deflection of the vertical, \e eta = - deltax/\e gamma. . GeographicLib::NormalGravity computes the normal gravity accurately and avoids issue 3 of \ref gravitynga. Thus while GeographicLib::GravityModel::SphericalAnomaly reproduces the results for \e xi and \e eta at \e h = 0, there is a slight discrepancy if \e h is non-zero. \section gravityatmos The effect of the mass of the atmosphere All of the supported models use WGS84 for the reference ellipsoid. This has (see TR8350.2, table 3.1) - \e a = 6378137 m - \e f = 1/298.257223563 - \e omega = 7292115e-11 rad s-1 - \e GM = 3986004.418e8 m3/s2. . The value of \e GM includes the mass of the atmosphere and so strictly only applies above the earth's atmosphere. Near the surface of the earth, the value of \e g will be less (in absolute value) than the value predicted by these models by about \e delta \e g = (4 \e pi G/\e g) \e A = 8.552e-11 \e A m2/kg, where \e G is the gravitational constant, \e g is the earth's gravity, and \e A is the pressure of the atmosphere. At sea level we have \e A = 101.3 kPa, and \e delta \e g = 8.7e-6 m s-2, approximately. (In other words the effect is about 1 part in a million; by way of comparison, buoyancy effects are about 100 times larger.) \section gravityparallel Geoid heights on a multi-processor system The egm2008 model includes many terms (over 2 million spherical harmonics). For that reason computations using this model may be slow; for example it takes about 78 ms to compute the geoid height at a single point. There are two ways to speed up this computation: - Use a GeographicLib::GravityCircle to compute the geoid height at several points on a circle of latitude. This reduces the cost per point to about 92 us (a reduction by a factor of over 800). - Compute the values on several circles of latitude in parallel. One of the simplest ways of doing this is with OpenMP; on an 8-processor system, this can speed up the computation by another factor of 8. . Both of these techniques are illustrated by the following code, which computes a table of geoid heights on a regular grid and writes on the result in a .gtx file. On an 8-processor Intel 2.66 GHz machine using OpenMP (-DHAVE_OPENMP=1), it takes about 40 minutes of elapsed time to compute the geoid height for EGM2008 on a 1' gride. (Without these optimizations, the computation would have taken about 200 days!) \include GeoidToGTX.cpp This example is built if cmake is invoked with -D GEOGRAPHICLIB_EXAMPLES=ON. cmake will add in support for OpenMP, if it is available.
Back to \ref geoid. Forward to \ref magnetic. Up to \ref contents.
**********************************************************************/ /** \page magnetic Magnetic models
Back to \ref gravity. Forward to \ref geodesic. Up to \ref contents.
%GeographicLib can compute the earth's magnetic field by a magnetic model using the GeographicLib::MagneticModel and GeographicLib::MagneticCircle classes and with the MagneticField utility. These models expand the internal magnetic potential of the earth as sum of spherical harmonics. They neglect magnetic fields due to the ionosphere, the magnetosphere, nearby magnetized materials, electric machinery, etc. Users of GeographicLib::MagneticModel are advised to read the "Health Warning" this is provided with igrf11. Although the advice is specific to igrf11, many of the comments apply to all magnetic field models. The supported models are - wmm2010, the World Magnetic Model 2010, which approximates the main magnetic field for the period 2010–2015. - igrf11, the International Geomagnetic Reference Field (11th generation), which approximates the main magnetic field for the period 1900–2015. - emm2010, the Enhanced Magnetic Model 2010, which approximates the main and crustal magnetic fields for the period 2010–2015. Go to - \ref magneticinst - \ref magneticformat \section magneticinst Installing the magnetic field models These magnetic models are available for download:
Available magnetic models
name max\n degree time\n interval size\n(kB)
Download Links (size, kB)
tar file Windows\n installer zip file
wmm2010
12
2010–2015
3
link (2)
link (300)
link (2)
igrf11
13
1900–2015
25
link (7)
link (310)
link (8)
emm2010
739
2010–2015
4400
link (3700)
link (3000)
link (4100)
The "size" column is the size of the uncompressed data. For Linux and Unix systems, %GeographicLib provides a shell script geographiclib-get-magnetic (typically installed in /usr/local/sbin) which automates the process of downloading and installing the magnetic models. For example \verbatim geographiclib-get-magnetic all # to install wmm2010, igrf11, emm2010 geographiclib-get-magnetic -h # for help \endverbatim This script should be run as a user with write access to the installation directory, which is typically /usr/local/share/GeographicLib (this can be overridden with the -p flag), and the data will then be placed in the "magnetic" subdirectory. Windows users should download and run the Windows installers. These will prompt for an installation directory with the default being one of \verbatim C:/Documents and Settings/All Users/Application Data/GeographicLib C:/ProgramData/GeographicLib \endverbatim (which you probably should not change) and the data is installed in the "magnetic" sub-directory. (The second directory name is an alternate name that Windows 7 for the "Application Data" directory.) Otherwise download \e either the tar.bz2 file \e or the zip file (they have the same contents). To unpack these, run, for example \verbatim mkdir -p /usr/local/share/GeographicLib tar xofjC wmm2010.tar.bz2 /usr/local/share/GeographicLib tar xofjC emm2010.tar.bz2 /usr/local/share/GeographicLib etc. \endverbatim and, again, the data will be placed in the "magnetic" subdirectory. However you install the magnetic models, all the datasets should be installed in the same directory. GeographicLib::MagneticModel and MagneticField uses a compile time default to locate the datasets. This is - /usr/local/share/GeographicLib/magnetic, for non-Windows systems - C:/Documents and Settings/All Users/Application Data/GeographicLib/magnetic, for Windows systems . consistent with the examples above. This may be overridden at run-time by defining the MAGNETIC_PATH or the GEOGRAPHIC_DATA environment variables; see GeographicLib::MagneticModel::DefaultMagneticPath() for details. Finally, the path may be set using the optional second argument to the GeographicLib::MagneticModel constructor or with the "-d" flag to MagneticField. Supplying the "-h" flag to MagneticField reports the default path for magnetic models for that utility. The "-v" flag causes MagneticField to report the full path name of the data file it uses. \section magneticformat The format of the magnetic model files The constructor for GeographicLib::MagneticModel reads a file called NAME.wmm which specifies various properties for the magnetic model. It then opens a binary file NAME.wmm.cof to obtain the coefficients of the spherical harmonic sum. The first line of the .wmm file must consist of "WMMF-v" where WMMF stands for "World Magnetic Model Format" and v is the version number of the format (currently "1"). The rest of the File is read a line at a time. A # character and everything after it are discarded. If the result is just white space it is discarded. The remaining lines are of the form "KEY WHITESPACE VALUE". In general, the KEY and the VALUE are case-sensitive. GeographicLib::MagneticModel only pays attention to the following keywords - keywords that affect the field calculation, namely: - Radius (required), the normalizing radius of the model in meters. - NumModels (default 1), the number of models. WMM2010 consists of a single model giving the magnetic field and its time variation at 2010. IGRF11 consists of 23 models for 1900 thru 2010 at 5 year intervals. The time variation is given only for the last model to allow extrapolation beyond 2010. For dates prior to 2010, linear interpolation is used. - Epoch (required), the time origin (in fractional years) for the first model. - DeltaEpoch (default 1), the interval between models in years (only relevant for NumModels > 1). - Normalization (default schmidt), the normalization used for the associated Legendre functions (schmidt or full). - ID (required), 8 printable characters which serve as a signature for the .wmm.cof file (they must appear as the first 8 bytes of this file). - keywords that store data that the user can query: - Name, the name of the model. - Description, a more descriptive name of the model. - ReleaseDate, when the model was created. - MinTime, the minimum date at which the model should be used. - MaxTime, the maximum date at which the model should be used. - MinHeight, the minimum height above the ellipsoid for which the model should be used. - MaxHeight, the maximum height above the ellipsoid for which the model should be used. . GeographicLib::MagneticModel does not enforce the restrictions implied by last four quantities. However, MagneticField issues a warning if these limits are exceeded. - keywords that are examined to verify that their values are valid: - Type (default linear), the type of the model. "linear" means that the time variation is piece-wise linear (either using interpolation between the field at two dates or using the field and its first derivative with respect to time). This is the only type of model supported at present. - ByteOrder (default little), the order of bytes in the .wmm.cof file. Only little endian is supported at present. . Other keywords are ignored. The coefficient file NAME.wmm.cof is a binary file in little endian order. The first 8 bytes of this file must match the ID given in NAME.wmm. This is followed by NumModels + 1 sets of spherical harmonic coefficients. The first NumModels of these model the magnetic field at Epoch + \e i * DeltaEpoch for 0 <= \e i < NumModels. The last set of coefficients model the rate of change of the magnetic field at Epoch + (NumModels - 1) * DeltaEpoch. The format for each set of coefficients is: - \e N, the maximum degree of the sum stored as a 4-byte signed integer. This must satisfy \e N >= -1. - \e M, the maximum order of the sum stored as a 4-byte signed integer. This must satisfy \e N >= \e M >= -1. - \e C\e nm, the coefficients of the cosine coefficients of the sum in column (i.e., \e m) major order. There are (\e M + 1) (2\e N - \e M + 2) / 2 elements which are stored as IEEE doubles (8 bytes). For example for \e N = \e M = 3, there are 10 coefficients arranged as C00, C10, C20, C30, C11, C21, C31, C22, C32, C33. - \e S\e nm, the coefficients of the sine coefficients of the sum in column (i.e., \e m) major order starting at \e m = 1. There are \e M (2\e N - \e M + 1) / 2 elements which are stored as IEEE doubles (8 bytes). For example for \e N = \e M = 3, there are 6 coefficients arranged as S11, S21, S31, S22, S32, S33. . Although the coefficient file is in little endian order, %GeographicLib can read it on big endian machines. It can only be read on machines which store doubles in IEEE format. As an illustration, here is igrf11.wmm: \verbatim WMMF-1 # A World Magnetic Model (Format 1) file. For documentation on the # format of this file see # http://geographiclib.sf.net/html/magnetic.html#magneticformat Name igrf11 Description International Geomagnetic Reference Field 11th Generation URL http://ngdc.noaa.gov/IAGA/vmod/igrf.html Publisher National Oceanic and Atmospheric Administration ReleaseDate 2009-12-15 DataCutOff 2009-10-01 ConversionDate 2011-11-04 DataVersion 1 Radius 6371200 NumModels 23 Epoch 1900 DeltaEpoch 5 MinTime 1900 MaxTime 2015 MinHeight -1000 MaxHeight 600000 # The coefficients are stored in a file obtained by appending ".cof" to # the name of this file. The coefficients were obtained from IGRF11.COF # in the geomag70 distribution. ID IGRF11-A \endverbatim
Back to \ref gravity. Forward to \ref geodesic. Up to \ref contents.
**********************************************************************/ /** \page geodesic Geodesics on the ellipsoid
Back to \ref magnetic. Forward to \ref transversemercator. Up to \ref contents.
GeographicLib::Geodesic and GeographicLib::GeodesicLine provide accurate solutions to the direct and inverse geodesic problems. The Geod utility provides an interface to these classes. GeographicLib::AzimuthalEquidistant implements the azimuthal equidistant projection in terms of geodesics. GeographicLib::CassiniSoldner implements a transverse cylindrical equidistant projection in terms of geodesics. The GeodesicProj utility provides an interface to these projections. References - F. W. Bessel, The calculation of longitude and latitude from geodesic measurements (1825), Astron. Nachr. 331(8), 852-861 (2010); translated by C. F. F. Karney and R. E. Deakin. Preprint: arXiv:0908.1824. - F. R. Helmert, Mathematical and Physical Theories of Higher Geodesy, Part 1 (1880), Aeronautical Chart and Information Center (St. Louis, 1964), Chaps. 5–7. - J. Danielsen, The Area under the Geodesic, Survey Review 30 (232), 61–66 (1989). - C. F. F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011; preprint arxiv:1102.1215v1; resource page geod.html. - C. F. F. Karney, Algorithms for geodesics, Sept. 2011, preprint arXiv:1109.4448. - A collection of some papers on geodesics is available at http://geographiclib.sourceforge.net/geodesic-papers/biblio.html \section testgeod Test data for geodesics A test set a geodesics is available at - GeodTest.dat.gz . This is about 39 MB (compressed). This consists of a set of geodesics for the WGS84 ellipsoid. A subset of this (consisting of 1/50 of the members — about 690 kB, compressed) is available at - GeodTest-short.dat.gz Each line of the test set gives 10 space delimited numbers - latitude for point 1, \e lat1 (degrees, exact) - longitude for point 1, \e lon1 (degrees, always 0) - azimuth for point 1, \e azi1 (clockwise from north in degrees, exact) - latitude for point 2, \e lat2 (degrees, accurate to 10-18 deg) - longitude for point 2, \e lon2 (degrees, accurate to 10-18 deg) - azimuth for point 2, \e azi2 (degrees, accurate to 10-18 deg) - geodesic distance from point 1 to point 2, \e s12 (meters, exact) - arc distance on the auxiliary sphere, \e a12 (degrees, accurate to 10-18 deg) - reduced length of the geodesic, \e m12 (meters, accurate to 0.1 pm) - the area under the geodesic, \e S12 (m2, accurate to 1 mm2) . These are computed using as direct geodesic calculations with the given \e lat1, \e lon1, \e azi1, and \e s12. The distance \e s12 always corresponds to an arc length \e a12 <= 180o, so the given geodesics give the shortest paths from point 1 to point 2. For simplicity and without loss of generality, \e lat1 is chosen in [0o, 90o], \e lon1 is taken to be zero, \e azi1 is chosen in [0o, 180o]. Furthermore, \e lat1 and \e azi1 are taken to be multiples of 10-12 deg and \e s12 is a multiple of 0.1 um in [0 m, 20003931.4586254 m]. This results \e lon2 in [0o, 180o] and \e azi2 in [0o, 180o]. The direct calculation uses an expansion of the geodesic equations accurate to f30 (approximately 1 part in 1050) and is computed with with Maxima's bfloats and fpprec set to 100 (so the errors in the data are probably 1/2 of the values quoted above). The contents of the file are as follows: - 100000 entries randomly distributed - 50000 entries which are nearly antipodal - 50000 entries with short distances - 50000 entries with one end near a pole - 50000 entries with both ends near opposite poles - 50000 entries which are nearly meridional - 50000 entries which are nearly equatorial - 50000 entries running between vertices (\e azi1 = \e azi2 = 90o) - 50000 entries ending close to vertices . (a total of 500000 entries). The values for \e s12 for the geodesics running between vertices are truncated to a multiple of 0.1 pm and this is used to determine point 2. This data can be fed to the Geod utility as follows - Direct from point 1: \verbatim gunzip -c GeodTest.dat.gz | cut -d' ' -f1,2,3,7 | ./Geod \endverbatim This should yield columns 4, 5, 6, and 9 of the test set. - Direct from point 2: \verbatim gunzip -c GeodTest.dat.gz | cut -d' ' -f4,5,6,7 | sed "s/ \([^ ]*$\)/ -\1/" | ./Geod \endverbatim (The sed command negates the distance.) This should yield columns 1, 2, and 3, and the negative of column 9 of the test set. - Inverse between points 1 and 2: \verbatim gunzip -c GeodTest.dat.gz | cut -d' ' -f1,2,4,5 | ./Geod -i \endverbatim This should yield columns 3, 6, 7, and 9 of the test set. . Add, e.g., "-p 6", to the call to Geod to change the precision of the output. Adding "-f" causes Geod to print 12 fields specifying the geodesic; these include the 10 fields in the test set plus the geodesic scales \e M12 and \e M21 which are inserted between \e m12 and \e S12. \section geodseries Expansions for geodesics We give here the series expansions for the various geodesic integrals valid to order f10. In this release of the code, we use a 6th-order expansions. This is sufficient to maintain accuracy for doubles for the SRMmax ellipsoid (\e a = 6400 km, \e f = 1/150). However, the preprocessor macro GEOD_ORD can be used to select any order up to 8. (If using long doubles, with a 64-bit fraction, the default order is 7.) The series expanded to order f30 are given in geodseries30.html. In the formulas below ^ indicates exponentiation (\e f^3 = \e f*\e f*\e f) and / indicates real division (3/5 = 0.6). The equations need to be converted to Horner form, but are here left in expanded form so that they can be easily truncated to lower order. These expansions were obtained using the Maxima code, geod.mac. In the expansions below, we have - \e alpha is the azimuth - alpha0 is the azimuth at the equator crossing - \e lambda is the longitude measured from the equator crossing - \e omega is the spherical longitude - \e sigma is the spherical arc length - \e a is the equatorial radius - \e b is the polar semi-axis - \e f is the flattening - e2 = \e f (2 - \e f) - e'2 = e2/(1 - e2) - k2 = e'2 cos2 alpha0 = 4 \e eps / (1 - \e eps)2 - \e n = \e f / (2 - \e f) - c2 = a2/2 + b2/2 (tanh-1 \e e)/\e e - \e ep2 = e'2 - \e k2 = k2 The formula for distance is     s/\e b = \e I1(\e sigma) where     \e I1(\e sigma) = \e A1 (\e sigma + \e B1(\e sigma))
    \e B1(\e sigma) = sum\e j = 1 \e C1j sin(2 \e j \e sigma) and \verbatim A1 = (1 + 1/4 * eps^2 + 1/64 * eps^4 + 1/256 * eps^6 + 25/16384 * eps^8 + 49/65536 * eps^10) / (1 - eps); \endverbatim \verbatim C1[1] = - 1/2 * eps + 3/16 * eps^3 - 1/32 * eps^5 + 19/2048 * eps^7 - 3/4096 * eps^9; C1[2] = - 1/16 * eps^2 + 1/32 * eps^4 - 9/2048 * eps^6 + 7/4096 * eps^8 + 1/65536 * eps^10; C1[3] = - 1/48 * eps^3 + 3/256 * eps^5 - 3/2048 * eps^7 + 17/24576 * eps^9; C1[4] = - 5/512 * eps^4 + 3/512 * eps^6 - 11/16384 * eps^8 + 3/8192 * eps^10; C1[5] = - 7/1280 * eps^5 + 7/2048 * eps^7 - 3/8192 * eps^9; C1[6] = - 7/2048 * eps^6 + 9/4096 * eps^8 - 117/524288 * eps^10; C1[7] = - 33/14336 * eps^7 + 99/65536 * eps^9; C1[8] = - 429/262144 * eps^8 + 143/131072 * eps^10; C1[9] = - 715/589824 * eps^9; C1[10] = - 2431/2621440 * eps^10; \endverbatim The function \e tau(\e sigma) = s/(\e b \e A1) = \e sigma + \e B1(\e sigma) may be inverted by series reversion giving     \e sigma(\e tau) = \e tau + sum\e j = 1 \e C1'j sin(2 \e j \e tau) where \verbatim C1'[1] = + 1/2 * eps - 9/32 * eps^3 + 205/1536 * eps^5 - 4879/73728 * eps^7 + 9039/327680 * eps^9; C1'[2] = + 5/16 * eps^2 - 37/96 * eps^4 + 1335/4096 * eps^6 - 86171/368640 * eps^8 + 4119073/28311552 * eps^10; C1'[3] = + 29/96 * eps^3 - 75/128 * eps^5 + 2901/4096 * eps^7 - 443327/655360 * eps^9; C1'[4] = + 539/1536 * eps^4 - 2391/2560 * eps^6 + 1082857/737280 * eps^8 - 2722891/1548288 * eps^10; C1'[5] = + 3467/7680 * eps^5 - 28223/18432 * eps^7 + 1361343/458752 * eps^9; C1'[6] = + 38081/61440 * eps^6 - 733437/286720 * eps^8 + 10820079/1835008 * eps^10; C1'[7] = + 459485/516096 * eps^7 - 709743/163840 * eps^9; C1'[8] = + 109167851/82575360 * eps^8 - 550835669/74317824 * eps^10; C1'[9] = + 83141299/41287680 * eps^9; C1'[10] = + 9303339907/2972712960 * eps^10; \endverbatim The reduced length is given by     m/\e b = sqrt(1 + k2 sin2sigma2) cos sigma1 sin sigma2
            - sqrt(1 + k2 sin2sigma1) sin sigma1 cos sigma2
            - cos sigma1 cos sigma2 (\e J(sigma2) - \e J(sigma1)) where     \e J(\e sigma) = \e I1(\e sigma) - \e I2(\e sigma)
    \e I2(\e sigma) = \e A2 (\e sigma + \e B2(\e sigma))
    \e B2(\e sigma) = sum\e j = 1 \e C2j sin(2 \e j \e sigma) \verbatim A2 = (1 + 1/4 * eps^2 + 9/64 * eps^4 + 25/256 * eps^6 + 1225/16384 * eps^8 + 3969/65536 * eps^10) * (1 - eps); \endverbatim \verbatim C2[1] = + 1/2 * eps + 1/16 * eps^3 + 1/32 * eps^5 + 41/2048 * eps^7 + 59/4096 * eps^9; C2[2] = + 3/16 * eps^2 + 1/32 * eps^4 + 35/2048 * eps^6 + 47/4096 * eps^8 + 557/65536 * eps^10; C2[3] = + 5/48 * eps^3 + 5/256 * eps^5 + 23/2048 * eps^7 + 191/24576 * eps^9; C2[4] = + 35/512 * eps^4 + 7/512 * eps^6 + 133/16384 * eps^8 + 47/8192 * eps^10; C2[5] = + 63/1280 * eps^5 + 21/2048 * eps^7 + 51/8192 * eps^9; C2[6] = + 77/2048 * eps^6 + 33/4096 * eps^8 + 2607/524288 * eps^10; C2[7] = + 429/14336 * eps^7 + 429/65536 * eps^9; C2[8] = + 6435/262144 * eps^8 + 715/131072 * eps^10; C2[9] = + 12155/589824 * eps^9; C2[10] = + 46189/2621440 * eps^10; \endverbatim The longitude is given in terms of the spherical longitude by     \e lambda = \e omega - \e f sin alpha0 \e I3(\e sigma) where     \e I3(\e sigma) = \e A3 (\e sigma + \e B3(\e sigma))
    \e B3(\e sigma) = sum\e j = 1 \e C3j sin(2 \e j \e sigma) and \verbatim A3 = 1 - (1/2 - 1/2 * n) * eps - (1/4 + 1/8 * n - 3/8 * n^2) * eps^2 - (1/16 + 3/16 * n + 1/16 * n^2 - 5/16 * n^3) * eps^3 - (3/64 + 1/32 * n + 5/32 * n^2 + 5/128 * n^3 - 35/128 * n^4) * eps^4 - (3/128 + 5/128 * n + 5/256 * n^2 + 35/256 * n^3 + 7/256 * n^4) * eps^5 - (5/256 + 15/1024 * n + 35/1024 * n^2 + 7/512 * n^3) * eps^6 - (25/2048 + 35/2048 * n + 21/2048 * n^2) * eps^7 - (175/16384 + 35/4096 * n) * eps^8 - 245/32768 * eps^9; \endverbatim \verbatim C3[1] = + (1/4 - 1/4 * n) * eps + (1/8 - 1/8 * n^2) * eps^2 + (3/64 + 3/64 * n - 1/64 * n^2 - 5/64 * n^3) * eps^3 + (5/128 + 1/64 * n + 1/64 * n^2 - 1/64 * n^3 - 7/128 * n^4) * eps^4 + (3/128 + 11/512 * n + 3/512 * n^2 + 1/256 * n^3 - 7/512 * n^4) * eps^5 + (21/1024 + 5/512 * n + 13/1024 * n^2 + 1/512 * n^3) * eps^6 + (243/16384 + 189/16384 * n + 83/16384 * n^2) * eps^7 + (435/32768 + 109/16384 * n) * eps^8 + 345/32768 * eps^9; C3[2] = + (1/16 - 3/32 * n + 1/32 * n^2) * eps^2 + (3/64 - 1/32 * n - 3/64 * n^2 + 1/32 * n^3) * eps^3 + (3/128 + 1/128 * n - 9/256 * n^2 - 3/128 * n^3 + 7/256 * n^4) * eps^4 + (5/256 + 1/256 * n - 1/128 * n^2 - 7/256 * n^3 - 3/256 * n^4) * eps^5 + (27/2048 + 69/8192 * n - 39/8192 * n^2 - 47/4096 * n^3) * eps^6 + (187/16384 + 39/8192 * n + 31/16384 * n^2) * eps^7 + (287/32768 + 47/8192 * n) * eps^8 + 255/32768 * eps^9; C3[3] = + (5/192 - 3/64 * n + 5/192 * n^2 - 1/192 * n^3) * eps^3 + (3/128 - 5/192 * n - 1/64 * n^2 + 5/192 * n^3 - 1/128 * n^4) * eps^4 + (7/512 - 1/384 * n - 77/3072 * n^2 + 5/3072 * n^3 + 65/3072 * n^4) * eps^5 + (3/256 - 1/1024 * n - 71/6144 * n^2 - 47/3072 * n^3) * eps^6 + (139/16384 + 143/49152 * n - 383/49152 * n^2) * eps^7 + (243/32768 + 95/49152 * n) * eps^8 + 581/98304 * eps^9; C3[4] = + (7/512 - 7/256 * n + 5/256 * n^2 - 7/1024 * n^3 + 1/1024 * n^4) * eps^4 + (7/512 - 5/256 * n - 7/2048 * n^2 + 9/512 * n^3 - 21/2048 * n^4) * eps^5 + (9/1024 - 43/8192 * n - 129/8192 * n^2 + 39/4096 * n^3) * eps^6 + (127/16384 - 23/8192 * n - 165/16384 * n^2) * eps^7 + (193/32768 + 3/8192 * n) * eps^8 + 171/32768 * eps^9; C3[5] = + (21/2560 - 9/512 * n + 15/1024 * n^2 - 7/1024 * n^3 + 9/5120 * n^4) * eps^5 + (9/1024 - 15/1024 * n + 3/2048 * n^2 + 57/5120 * n^3) * eps^6 + (99/16384 - 91/16384 * n - 781/81920 * n^2) * eps^7 + (179/32768 - 55/16384 * n) * eps^8 + 141/32768 * eps^9; C3[6] = + (11/2048 - 99/8192 * n + 275/24576 * n^2 - 77/12288 * n^3) * eps^6 + (99/16384 - 275/24576 * n + 55/16384 * n^2) * eps^7 + (143/32768 - 253/49152 * n) * eps^8 + 33/8192 * eps^9; C3[7] = + (429/114688 - 143/16384 * n + 143/16384 * n^2) * eps^7 + (143/32768 - 143/16384 * n) * eps^8 + 429/131072 * eps^9; C3[8] = + (715/262144 - 429/65536 * n) * eps^8 + 429/131072 * eps^9; C3[9] = + 2431/1179648 * eps^9; \endverbatim The formula for area between the geodesic and the equator is given in Sec. 15 of arxiv:1102.1215v1 in terms of \e S,     \e S = c2 \e alpha + e2 a2 cos alpha0 sin alpha0 \e I4(\e sigma) where     \e I4(\e sigma) = sum\e j = 0 \e C4j cos((2\e j + 1) \e sigma) with \verbatim C4[0] = + (2/3 - 1/15 * ep2 + 4/105 * ep2^2 - 8/315 * ep2^3 + 64/3465 * ep2^4 - 128/9009 * ep2^5 + 512/45045 * ep2^6 - 1024/109395 * ep2^7 + 16384/2078505 * ep2^8 - 32768/4849845 * ep2^9) - (1/20 - 1/35 * ep2 + 2/105 * ep2^2 - 16/1155 * ep2^3 + 32/3003 * ep2^4 - 128/15015 * ep2^5 + 256/36465 * ep2^6 - 4096/692835 * ep2^7 + 8192/1616615 * ep2^8) * k2 + (1/42 - 1/63 * ep2 + 8/693 * ep2^2 - 80/9009 * ep2^3 + 64/9009 * ep2^4 - 128/21879 * ep2^5 + 2048/415701 * ep2^6 - 4096/969969 * ep2^7) * k2^2 - (1/72 - 1/99 * ep2 + 10/1287 * ep2^2 - 8/1287 * ep2^3 + 112/21879 * ep2^4 - 1792/415701 * ep2^5 + 512/138567 * ep2^6) * k2^3 + (1/110 - 1/143 * ep2 + 4/715 * ep2^2 - 56/12155 * ep2^3 + 896/230945 * ep2^4 - 768/230945 * ep2^5) * k2^4 - (1/156 - 1/195 * ep2 + 14/3315 * ep2^2 - 224/62985 * ep2^3 + 64/20995 * ep2^4) * k2^5 + (1/210 - 1/255 * ep2 + 16/4845 * ep2^2 - 32/11305 * ep2^3) * k2^6 - (1/272 - 1/323 * ep2 + 6/2261 * ep2^2) * k2^7 + (1/342 - 1/399 * ep2) * k2^8 - 1/420 * k2^9; C4[1] = + (1/180 - 1/315 * ep2 + 2/945 * ep2^2 - 16/10395 * ep2^3 + 32/27027 * ep2^4 - 128/135135 * ep2^5 + 256/328185 * ep2^6 - 4096/6235515 * ep2^7 + 8192/14549535 * ep2^8) * k2 - (1/252 - 1/378 * ep2 + 4/2079 * ep2^2 - 40/27027 * ep2^3 + 32/27027 * ep2^4 - 64/65637 * ep2^5 + 1024/1247103 * ep2^6 - 2048/2909907 * ep2^7) * k2^2 + (1/360 - 1/495 * ep2 + 2/1287 * ep2^2 - 8/6435 * ep2^3 + 112/109395 * ep2^4 - 1792/2078505 * ep2^5 + 512/692835 * ep2^6) * k2^3 - (1/495 - 2/1287 * ep2 + 8/6435 * ep2^2 - 112/109395 * ep2^3 + 1792/2078505 * ep2^4 - 512/692835 * ep2^5) * k2^4 + (5/3276 - 1/819 * ep2 + 2/1989 * ep2^2 - 32/37791 * ep2^3 + 64/88179 * ep2^4) * k2^5 - (1/840 - 1/1020 * ep2 + 4/4845 * ep2^2 - 8/11305 * ep2^3) * k2^6 + (7/7344 - 7/8721 * ep2 + 2/2907 * ep2^2) * k2^7 - (2/2565 - 4/5985 * ep2) * k2^8 + 1/1540 * k2^9; C4[2] = + (1/2100 - 1/3150 * ep2 + 4/17325 * ep2^2 - 8/45045 * ep2^3 + 32/225225 * ep2^4 - 64/546975 * ep2^5 + 1024/10392525 * ep2^6 - 2048/24249225 * ep2^7) * k2^2 - (1/1800 - 1/2475 * ep2 + 2/6435 * ep2^2 - 8/32175 * ep2^3 + 112/546975 * ep2^4 - 1792/10392525 * ep2^5 + 512/3464175 * ep2^6) * k2^3 + (1/1925 - 2/5005 * ep2 + 8/25025 * ep2^2 - 16/60775 * ep2^3 + 256/1154725 * ep2^4 - 1536/8083075 * ep2^5) * k2^4 - (1/2184 - 1/2730 * ep2 + 1/3315 * ep2^2 - 16/62985 * ep2^3 + 32/146965 * ep2^4) * k2^5 + (1/2520 - 1/3060 * ep2 + 4/14535 * ep2^2 - 8/33915 * ep2^3) * k2^6 - (7/20400 - 7/24225 * ep2 + 2/8075 * ep2^2) * k2^7 + (14/47025 - 4/15675 * ep2) * k2^8 - 1/3850 * k2^9; C4[3] = + (1/17640 - 1/24255 * ep2 + 2/63063 * ep2^2 - 8/315315 * ep2^3 + 16/765765 * ep2^4 - 256/14549535 * ep2^5 + 512/33948915 * ep2^6) * k2^3 - (1/10780 - 1/14014 * ep2 + 2/35035 * ep2^2 - 4/85085 * ep2^3 + 64/1616615 * ep2^4 - 384/11316305 * ep2^5) * k2^4 + (5/45864 - 1/11466 * ep2 + 1/13923 * ep2^2 - 16/264537 * ep2^3 + 32/617253 * ep2^4) * k2^5 - (1/8820 - 1/10710 * ep2 + 8/101745 * ep2^2 - 16/237405 * ep2^3) * k2^6 + (1/8976 - 1/10659 * ep2 + 2/24871 * ep2^2) * k2^7 - (1/9405 - 2/21945 * ep2) * k2^8 + 1/10010 * k2^9; C4[4] = + (1/124740 - 1/162162 * ep2 + 2/405405 * ep2^2 - 4/984555 * ep2^3 + 64/18706545 * ep2^4 - 128/43648605 * ep2^5) * k2^4 - (1/58968 - 1/73710 * ep2 + 1/89505 * ep2^2 - 16/1700595 * ep2^3 + 32/3968055 * ep2^4) * k2^5 + (1/41580 - 1/50490 * ep2 + 8/479655 * ep2^2 - 16/1119195 * ep2^3) * k2^6 - (7/242352 - 7/287793 * ep2 + 2/95931 * ep2^2) * k2^7 + (7/220077 - 2/73359 * ep2) * k2^8 - 1/30030 * k2^9; C4[5] = + (1/792792 - 1/990990 * ep2 + 1/1203345 * ep2^2 - 16/22863555 * ep2^3 + 32/53348295 * ep2^4) * k2^5 - (1/304920 - 1/370260 * ep2 + 4/1758735 * ep2^2 - 8/4103715 * ep2^3) * k2^6 + (7/1283568 - 7/1524237 * ep2 + 2/508079 * ep2^2) * k2^7 - (2/268983 - 4/627627 * ep2) * k2^8 + 1/110110 * k2^9; C4[6] = + (1/4684680 - 1/5688540 * ep2 + 4/27020565 * ep2^2 - 8/63047985 * ep2^3) * k2^6 - (1/1516944 - 1/1801371 * ep2 + 2/4203199 * ep2^2) * k2^7 + (2/1589445 - 4/3708705 * ep2) * k2^8 - 1/520520 * k2^9; C4[7] = + (1/26254800 - 1/31177575 * ep2 + 2/72747675 * ep2^2) * k2^7 - (1/7335900 - 1/8558550 * ep2) * k2^8 + 1/3403400 * k2^9; C4[8] = + (1/141338340 - 1/164894730 * ep2) * k2^8 - 1/34714680 * k2^9; C4[9] = + 1/737176440 * k2^9; \endverbatim
Back to \ref magnetic. Forward to \ref transversemercator. Up to \ref contents.
**********************************************************************/ /** \page transversemercator Transverse Mercator projection
Back to \ref geodesic. Forward to \ref geocentric. Up to \ref contents.
GeographicLib::TransverseMercator and GeographicLib::TransverseMercatorExact provide accurate implementations of the transverse Mercator projection. The TransverseMercatorProj utility provides an interface to these classes. References - L. Krüger, Konforme Abbildung des Erdellipsoids in der Ebene (Conformal mapping of the ellipsoidal earth to the plane), Royal Prussian Geodetic Institute, New Series 52, 172 pp. (1912). - L. P. Lee, Conformal Projections Based on Elliptic Functions, (B. V. Gutsell, Toronto, 1976), 128pp., ISBN: 0919870163 (Also appeared as: Monograph 16, Suppl. No. 1 to Canadian Cartographer, Vol 13). Part V, pp. 67–101, Conformal Projections Based On Jacobian Elliptic Functions. - C. F. F. Karney, Transverse Mercator with an accuracy of a few nanometers, J. Geodesy 85(8), 475–485 (Aug. 2011); preprint arXiv:1002.1417; resource page tm.html. . The algorithm for GeographicLib::TransverseMercator is based on Krüger (1912); that for GeographicLib::TransverseMercatorExact is based on Lee (1976). See tm-grid.kmz, for an illustration of the exact transverse Mercator grid in Google Earth. \section testmerc Test data for the transverse Mercator projection A test set for the transverse Mercator projection is available at - TMcoords.dat.gz . This is about 17 MB (compressed). This test set consists of a set of geographic coordinates together with the corresponding transverse Mercator coordinates. The WGS84 ellipsoid is used, with central meridian 0o, central scale factor 0.9996 (the UTM value), false easting = false northing = 0 m. Each line of the test set gives 6 space delimited numbers - latitude (degrees, exact) - longitude (degrees, exact — see below) - easting (meters, accurate to 0.1 pm) - northing (meters, accurate to 0.1 pm) - meridian convergence (degrees, accurate to 10-18 deg) - scale (accurate to 10-20) . The latitude and longitude are all multiples of 10-12 deg and should be regarded as exact, except that longitude = 82.63627282416406551 should be interpreted as exactly 90 (1 - \e e) degrees. These results are computed using Lee's formulas with Maxima's bfloats and fpprec set to 80 (so the errors in the data are probably 1/2 of the values quoted above). The Maxima code, tm.mac and ellint.mac, used to prepare this data set is included in the distribution. You will need to have Maxima installed to use this code. The comments at the top of tm.mac illustrate how to run it. The contents of the file are as follows: - 250000 entries randomly distributed in lat in [0, 90], lon in [0, 90]; - 1000 entries randomly distributed on lat in [0, 90], lon = 0; - 1000 entries randomly distributed on lat = 0, lon in [0, 90]; - 1000 entries randomly distributed on lat in [0, 90], lon = 90; - 1000 entries close to lat = 90 with lon in [0, 90]; - 1000 entries close to lat = 0, lon = 0 with lat >= 0, lon >= 0; - 1000 entries close to lat = 0, lon = 90 with lat >= 0, lon <= 90; - 2000 entries close to lat = 0, lon = 90 (1 - \e e) with lat >= 0; - 25000 entries randomly distributed in lat in [-89, 0], lon in [90 (1 - \e e), 90]; - 1000 entries randomly distributed on lat in [-89, 0], lon = 90; - 1000 entries randomly distributed on lat in [-89, 0], lon = 90 (1 - \e e); - 1000 entries close to lat = 0, lon = 90 (lat < 0, lon <= 90); - 1000 entries close to lat = 0, lon = 90 (1 - \e e) (lat < 0, lon <= 90 (1 - \e e)); . (a total of 287000 entries). The entries for lat < 0o and lon in [90o (1 - \e e), 90o] use the "extended" domain for the transverse Mercator projection explained in Sec. 5 of arXiv:1002.1417. The first 258000 entries have lat >= 0o and are suitable for testing implementations following the standard convention. \section tmseries Series approximation for transverse Mercator Krüger (1912) gives a 4th-order approximation to the transverse Mercator projection. This is accurate to about 200 nm (200 nanometers) within the UTM domain. Here we present the series extended to 10th order. By default, GeographicLib::TransverseMercator uses the 6th-order approximation. The preprocessor variable TM_TX_MAXPOW can be used to select an order from 4 thru 8. The series expanded to order n30 are given in tmseries30.html. In the formulas below ^ indicates exponentiation (\e n^3 = \e n*\e n*\e n) and / indicates real division (3/5 = 0.6). The equations need to be converted to Horner form, but are here left in expanded form so that they can be easily truncated to lower order in \e n. Some of the integers here are not representable as 32-bit integers and will need to be included as double literals. \e A in Krüger, p. 12, eq. (5) \verbatim A = a/(n + 1) * (1 + 1/4 * n^2 + 1/64 * n^4 + 1/256 * n^6 + 25/16384 * n^8 + 49/65536 * n^10); \endverbatim \e gamma in Krüger, p. 21, eq. (41) \verbatim alpha[1] = 1/2 * n - 2/3 * n^2 + 5/16 * n^3 + 41/180 * n^4 - 127/288 * n^5 + 7891/37800 * n^6 + 72161/387072 * n^7 - 18975107/50803200 * n^8 + 60193001/290304000 * n^9 + 134592031/1026432000 * n^10; alpha[2] = 13/48 * n^2 - 3/5 * n^3 + 557/1440 * n^4 + 281/630 * n^5 - 1983433/1935360 * n^6 + 13769/28800 * n^7 + 148003883/174182400 * n^8 - 705286231/465696000 * n^9 + 1703267974087/3218890752000 * n^10; alpha[3] = 61/240 * n^3 - 103/140 * n^4 + 15061/26880 * n^5 + 167603/181440 * n^6 - 67102379/29030400 * n^7 + 79682431/79833600 * n^8 + 6304945039/2128896000 * n^9 - 6601904925257/1307674368000 * n^10; alpha[4] = 49561/161280 * n^4 - 179/168 * n^5 + 6601661/7257600 * n^6 + 97445/49896 * n^7 - 40176129013/7664025600 * n^8 + 138471097/66528000 * n^9 + 48087451385201/5230697472000 * n^10; alpha[5] = 34729/80640 * n^5 - 3418889/1995840 * n^6 + 14644087/9123840 * n^7 + 2605413599/622702080 * n^8 - 31015475399/2583060480 * n^9 + 5820486440369/1307674368000 * n^10; alpha[6] = 212378941/319334400 * n^6 - 30705481/10378368 * n^7 + 175214326799/58118860800 * n^8 + 870492877/96096000 * n^9 - 1328004581729009/47823519744000 * n^10; alpha[7] = 1522256789/1383782400 * n^7 - 16759934899/3113510400 * n^8 + 1315149374443/221405184000 * n^9 + 71809987837451/3629463552000 * n^10; alpha[8] = 1424729850961/743921418240 * n^8 - 256783708069/25204608000 * n^9 + 2468749292989891/203249958912000 * n^10; alpha[9] = 21091646195357/6080126976000 * n^9 - 67196182138355857/3379030566912000 * n^10; alpha[10]= 77911515623232821/12014330904576000 * n^10; \endverbatim \e beta in Krüger, p. 18, eq. (26*) \verbatim beta[1] = 1/2 * n - 2/3 * n^2 + 37/96 * n^3 - 1/360 * n^4 - 81/512 * n^5 + 96199/604800 * n^6 - 5406467/38707200 * n^7 + 7944359/67737600 * n^8 - 7378753979/97542144000 * n^9 + 25123531261/804722688000 * n^10; beta[2] = 1/48 * n^2 + 1/15 * n^3 - 437/1440 * n^4 + 46/105 * n^5 - 1118711/3870720 * n^6 + 51841/1209600 * n^7 + 24749483/348364800 * n^8 - 115295683/1397088000 * n^9 + 5487737251099/51502252032000 * n^10; beta[3] = 17/480 * n^3 - 37/840 * n^4 - 209/4480 * n^5 + 5569/90720 * n^6 + 9261899/58060800 * n^7 - 6457463/17740800 * n^8 + 2473691167/9289728000 * n^9 - 852549456029/20922789888000 * n^10; beta[4] = 4397/161280 * n^4 - 11/504 * n^5 - 830251/7257600 * n^6 + 466511/2494800 * n^7 + 324154477/7664025600 * n^8 - 937932223/3891888000 * n^9 - 89112264211/5230697472000 * n^10; beta[5] = 4583/161280 * n^5 - 108847/3991680 * n^6 - 8005831/63866880 * n^7 + 22894433/124540416 * n^8 + 112731569449/557941063680 * n^9 - 5391039814733/10461394944000 * n^10; beta[6] = 20648693/638668800 * n^6 - 16363163/518918400 * n^7 - 2204645983/12915302400 * n^8 + 4543317553/18162144000 * n^9 + 54894890298749/167382319104000 * n^10; beta[7] = 219941297/5535129600 * n^7 - 497323811/12454041600 * n^8 - 79431132943/332107776000 * n^9 + 4346429528407/12703122432000 * n^10; beta[8] = 191773887257/3719607091200 * n^8 - 17822319343/336825216000 * n^9 - 497155444501631/1422749712384000 * n^10; beta[9] = 11025641854267/158083301376000 * n^9 - 492293158444691/6758061133824000 * n^10; beta[10]= 7028504530429621/72085985427456000 * n^10; \endverbatim The high-order expansions for \e alpha and \e beta were produced by the Maxima program tmseries.mac (included in the distribution). To run, start Maxima and enter \verbatim load("tmseries.mac")$ \endverbatim Further instructions are included at the top of the file.
Back to \ref geodesic. Forward to \ref geocentric. Up to \ref contents.
**********************************************************************/ /** \page geocentric Geocentric coordinates
Back to \ref transversemercator. Forward to \ref old. Up to \ref contents.
The implementation of GeographicLib::Geocentric::Reverse is adapted from - H. Vermeille, Direct transformation from geocentric coordinates to geodetic coordinates, J. Geodesy 76, 451–454 (2002). This provides a closed-form solution but can't directly be applied close to the center of the earth. Several changes have been made to remove this restriction and to improve the numerical accuracy. Now the method is accurate for all inputs (even if \e h is infinite). The changes are described in Appendix B of - C. F. F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011; preprint arxiv:1102.1215v1. The problems encountered near the center of the ellipsoid are: - There's a potential division by zero in the definition of \e s. The equations are easily reformulated to avoid this problem. - t3 may be negative. This is OK; we just take the real root. - The solution for \e t may be complex. However this leads to 3 real roots for u/\e r. It's then just a matter of picking the one that computes the geodetic result which minimizes |\e h| and which avoids large round-off errors. - Some of the equations result in a large loss of accuracy due to subtracting nearly equal quantities. E.g., \e k= sqrt(\e u + \e v + w2) - \e w is inaccurate if \e u + \e v is small; we can fix this by writing \e k = (\e u + \e v)/(sqrt(\e u + \e v + w2) + \e w). The error is computed as follows. Write a version of Geocentric::WGS84.Forward which uses long doubles (including using long doubles for the WGS84 parameters). Generate random (long double) geodetic coordinates (\e lat0, \e lon0, \e h0) and use the "long double" WGS84.Forward to obtain the corresponding (long double) geocentric coordinates (\e x0, \e y0, \e z0). [We restrict \e h0 so that \e h0 >= - \e a (1 - e2) / sqrt(1 - e2 sin2\e lat0), which ensures that (\e lat0, \e lon0, \e h0) is the principal geodetic inverse of (\e x0, \e y0, \e z0).] Because the forward calculation is numerically stable and because long doubles (on Linux systems using g++) provide 11 bits additional accuracy (about 3.3 decimal digits), we regard this set of test data as exact. Apply the double version of WGS84.Reverse to (\e x0, \e y0, \e z0) to compute the approximate geodetic coordinates (\e lat1, \e lon1, \e h1). Convert (\e lat1 - \e lat0, \e lon1 - \e lon0) to a distance, \e ds, on the surface of the ellipsoid and define \e err = hypot(\e ds, \e h1 - \e h0). For |\e h0| < 5000 km, we have \e err < 7 nm (7 nanometers). This methodology is not very useful very far from the globe, because the absolute errors in the approximate geodetic height become large, or within 50 km of the center of the earth, because of errors in computing the approximate geodetic latitude. To illustrate the second issue, the maximum value of \e err for \e h0 < 0 is about 80 mm. The error is maximum close to the circle given by geocentric coordinates satisfying hypot(\e x, \e y) = \e a e2 (= 42.7 km), \e z = 0. (This is the center of meridional curvature for \e lat = 0.) The geodetic latitude for these points is \e lat = 0. However, if we move 1 nm towards the center of the earth, the geodetic latitude becomes 0.04", a distance of 1.4 m from the equator. If, instead, we move 1 nm up, the geodetic latitude becomes 7.45", a distance of 229 m from the equator. In light of this, Reverse does quite well in this vicinity. To obtain a practical measure of the error for the general case we define - errh = |\e h1 - \e h0| / max(1, \e h0 / \e a) - for \e h0 > 0, errout = \e ds - for \e h0 < 0, apply the long double version of WGS84.Forward to (\e lat1, \e lon1, \e h1) to give (\e x1, \e y1, \e z1) and compute errin = hypot(\e x1 - \e x0, \e y1 - \e y0, \e z1 - \e z0). . We then find errh < 8 nm, errout < 4 nm, and errin < 7 nm. (1 nm = 1 nanometer.) The testing has been confined to the WGS84 ellipsoid. The method will work for all ellipsoids used in terrestrial geodesy. However, the central region, which leads to multiple real roots for the cubic equation in Reverse, pokes outside the ellipsoid (at the poles) for ellipsoids with \e e > 1/sqrt(2). Reverse has not been analyzed for this case. Similarly ellipsoids which are very nearly spherical near yield inaccurate results due to underflow; in the other hand, the case of the sphere, \e f = 0, is treated specially and gives accurate results. Other comparable methods are K. M. Borkowski, Transformation of geocentric to geodetic coordinates without approximations, Astrophys. Space Sci. 139, 1–4 (1987) ( erratum) and T. Fukushima, Fast transform from geocentric to geodetic coordinates, J. Geodesy 73, 603–610 (2003). However the choice of independent variables in these methods leads to a loss of accuracy for points near the equatorial plane.
Back to \ref transversemercator. Forward to \ref old. Up to \ref contents.
**********************************************************************/ /** \page old Old versions
Back to \ref geocentric. Up to \ref contents.
List of versions in reverse chronological order together with a brief list of changes. (Note: Old versions of the library use a year-month style of numbering. Now, the library uses a major and minor version number.) Recent versions of %GeographicLib are available at http://sourceforge.net/projects/geographiclib/files/distrib/. Older versions are in http://sourceforge.net/projects/geographiclib/files/distrib/archive/. - Version 1.21 (released 2012-04-25) - Support colon-separated DMS output: - GeographicLib::DMS::Encode and GeographicLib::GeoCoords::DMSRepresentation generalized; - GeoConvert and Geod now accept a -: option. - GeoidEval does not print the gradient of the geoid height by default (because it's subject to large errors); give the -g option to get the gradient printed. - Work around optimization BUG in GeographicLib::Geodesic::Inverse with tdm mingw g++ version 4.6.1. - autoconf fixed to ensure that that out-of-sources builds work; document this as the preferred method of using autoconf. - cmake tweaks: - simplify the configuration of doxygen; - allow the Matlab compiler to be specified with the MATLAB_COMPILER option. - Version 1.20 (released 2012-03-23) - cmake tweaks: - improve find_package's matching of compiler versions; - CMAKE_INSTALL_PREFIX set from CMAKE_PREFIX_PATH if available; - add "x64" to the package name for the 64-bit binary installer; - fix cmake warning with Visual Studio Express. - Fix GeographicLib::SphericalEngine to deal with aggessive iterator checking by Visual Studio. - Fix transcription BUG is Geodesic.js. - Version 1.19 (released 2012-03-13) - Slight improvement in GeographicLib::Geodesic::Inverse for very short lines. - Fix argument checking tests in GeographicLib::MGRS::Forward. - Add --comment-delimiter and --line-separator options to the \ref utilities. - Add installer for 64-bit Windows; the compiled Matlab interface is supplied with the Windows 64-bit installer only. - Version 1.18 (released 2012-02-18) - Improve documentation on configuration with cmake. - cmake's find_package ensures that the compiler versions match on Windows. - Improve documentation on compiling Matlab interface. - Binary installer for Windows installs under C:/pkg-vc10 by default. - Version 1.17 (released 2012-01-21) - Work around optimization BUG in GeographicLib::Geodesic::Inverse with g++ version 4.4.0 (mingw). - Fix BUG in argument checking with GeographicLib::OSGB::GridReference. - Fix missing include file in GeographicLib::SphericalHarmonic2. - Add simple examples of usage for each class. - Add internal documentation to the cmake configuration files. - Version 1.16 (released 2011-12-07) - Add calculation of the earth's gravitational field: - add GeographicLib::NormalGravity GeographicLib::GravityModel and GeographicLib::GravityCircle classes; - add command line utility Gravity; - add \ref gravity; - add GeographicLib::Constants::WGS84_GM(), GeographicLib::Constants::WGS84_omega(), and similarly for GRS80. - Build uses GEOGRAPHICLIB_DATA to specify a common parent directory for geoid, gravity, and magnetic data (instead of GEOGRAPHICLIB_GEOID_PATH, etc.); similarly, GeoidEval, Gravity, and MagneticField, look at the environment variable GEOGRAPHICLIB_DATA to locate the data. - Spherical harmonic software changes: - capitalize enums GeographicLib::SphericalHarmonic::FULL and GeographicLib::SphericalHarmonic::SCHMIDT (the lower case names are retained but deprecated); - optimize the sum by using a static table of square roots which is updated by GeographicLib::SphericalEngine::RootTable; - avoid overflow for high degree models. - Magnetic software fixes: - fix documentation BUG in GeographicLib::MagneticModel::Circle; - make GeographicLib::MagneticModel constructor explicit; - provide default GeographicLib::MagneticCircle constructor; - add additional inspector functions to GeographicLib::MagneticCircle; - add -c option to MagneticField; - default height to zero in MagneticField. - Version 1.15 (released 2011-11-08) - Add calculation of the earth's magnetic field: - add GeographicLib::MagneticModel and GeographicLib::MagneticCircle classes; - add command line utility MagneticField; - add \ref magnetic; - add \ref magneticinst; - add \ref magneticformat; - add classes GeographicLib::SphericalEngine, GeographicLib::CircularEngine, GeographicLib::SphericalHarmonic, GeographicLib::SphericalHarmonic1, and GeographicLib::SphericalHarmonic2. which sum spherical harmonic series. - Add GeographicLib::Utility class to support I/O and date manipulation. - Cmake configuration includes a _d suffix on the library built in debug mode. - For the Python package, include manifest and readme files; don't install setup.py for non-Windows systems. - Include Doxygen tag file in distribution as doc/html/Geographic.tag. - Version 1.14 (released 2011-09-30) - Ensure that geographiclib-config.cmake is relocatable. - Allow more unicode symbols to be used in GeographicLib::DMS::Decode. - Modify GeoidEval so that it can be used to convert the height datum for LIDAR data. - Modest speed-up of Geodesic::Inverse. - Changes in python interface: - FIX BUG in transcription of Geodesic::Inverse; - include setup.py for easy installation; - python only distribution is available at http://pypi.python.org/pypi/geographiclib - Supply a minimal Qt qmake project file for library src/Geographic.pro. - Version 1.13 (released 2011-08-13) - Changes to I/O: - allow : (colon) to be used as a DMS separator in GeographicLib::DMS::Decode(const std::string&, flag&); - also accept Unicode symbols for degrees, minutes, and seconds (coded as UTF-8); - provide optional \e swaplatlong argument to various GeographicLib::DMS and GeographicLib::GeoCoords functions to make longitude precede latitude; - GeoConvert now has a -w option to make longitude precede latitude on input and output; - include a Javascript version of GeographicLib::DMS. - Slight improvement in starting guess for solution of geographic latitude in terms of conformal latitude in TransverseMercator, TransverseMercatorExact, and LambertConformalConic. - For most classes, get rid of const member variables so that the default copy assignment works. - Put GeographicLib::Math and GeographicLib::Accumulator in their own header files. - Remove unused "fast" GeographicLib::Accumulator method. - Reorganize the \ref python. - Withdraw some deprecated routines. - cmake changes: - include FindGeographic.cmake in distribution; - building with cmake creates and installs geographiclib-config.cmake; - better support for building a shared library under Windows. - Version 1.12 (released 2011-07-21) - Change license to MIT/X11. - Add GeographicLib::PolygonArea class and equivalent Matlab function. - Provide Javascript and Python implementations of geodesic routines. - Fix Windows installer to include runtime dlls for Matlab. - Fix (innocuous) unassigned variable in Geodesic::GenInverse. - Geodesic routines in Matlab return a12 as first column of aux return value (incompatible change). - A couple of code changes to enable compilation with Visual Studio 2003. - Version 1.11 (released 2011-06-27) - Changes to Planimeter: - add -l flag to Planimeter for polyline calculations; - trim precision of area to 3 decimal places; - FIX BUG with pole crossing edges (due to compiler optimization). - Geod no longer reports the reduced length by default; however the -f flag still reports this and in addition gives the geodesic scales and the geodesic area. - FIX BUGS (compiler-specific) in inverse geodesic calculations. - FIX BUG: accommodate tellg() returning -1 at end of string. - Change way flattening of the ellipsoid is specified: - constructors take \e f argument which is taken to be the flattening if \e f < 1 and the inverse flattening otherwise (this is a compatible change for spheres and oblate ellipsoids, but it is an INCOMPATIBLE change for prolate ellipsoids); - the -e arguments to the \ref utilities are handled similarly; in addition, simple fractions, e.g., 1/297, can be used for the flattening; - introduce GeographicLib::Constants::WGS84_f() for the WGS84 flattening (and deprecate Constants::WGS84_r() for the inverse flattening); - most classes have a Flattening() member function; - InverseFlattening() has been deprecated (and now returns inf for a sphere, instead of 0). - Version 1.10 (released 2011-06-11) - Improvements to Matlab/Octave interface: - add {geocentric,localcartesian}{forward,reverse}; - make geographiclibinterface more general; - install the source for the interface; - cmake compiles the interface if ENABLE_MATLAB=ON; - include compiled interface with Windows binary installer. - Fix various configuration issues - autoconf did not install Config.h; - cmake installed in man/man1 instead of share/man/man1; - cmake did not set the rpath on the tools. - Version 1.9 (released 2011-05-28) - FIX BUG in area returned by Planimeter for pole encircling polygons. - FIX BUG in error message reported when DMS::Decode reads the string "5d.". - FIX BUG in AlbersEqualArea::Reverse (lon0 not being used). - Ensure that all exceptions thrown in the \ref utilities are caught. - Avoid using catch within GeographicLib::DMS. - Move GeographicLib::Accumulator class from Planimeter.cpp to Constants.hpp. - Add GeographicLib::Math::sq. - Simplify \ref geoidinst - add geographiclib-get-geoids for Unix-like systems; - add installers for Windows. - Provide cmake support: - build binary installer for Windows; - include regression tests; - add --input-string, --input-file, --output-file options to the \ref utilities to support tests. - Rename utility EquidistantTest as GeodesicProj and TransverseMercatorTest as TransverseMercatorProj. - Add ConicProj. - Reverse the initial sense of the -s option for Planimeter. - Migrate source from subversion to git. - Version 1.8 (released 2011-02-22) - Optionally return rotation matrix from GeographicLib::Geocentric and GeographicLib::LocalCartesian. - For the \ref utilities, supply man pages, -h prints the synopsis, --help prints the man page, --version prints the version. - Use accurate summation in Planimeter. - Add 64-bit targets for Visual Studio 2010. - Use templates for defining math functions and some constants. - GeographicLib::Geoid updates - Add GeographicLib::Geoid::DefaultGeoidPath and GeographicLib::Geoid::DefaultGeoidName; - GeoidEval uses environment variable GEOID_NAME as the default geoid; - Add --msltohae and --haetomsl as GeoidEval options (and don't document the single hyphen versions). - Remove documentation that duplicates papers on transverse Mercator and geodesics. - Version 1.7 (released 2010-12-21) - FIX BUG in scale returned by GeographicLib::LambertConformalConic::Reverse. - Add GeographicLib::AlbersEqualArea projection. - Library created by Visual Studio is Geographic.lib instead of GeographicLib.lib (compatible with makefiles). - Make classes NaN aware. - Use cell arrays for MGRS strings in Matlab. - Add solution/project files for Visual Studio 2010 (32-bit only). - Use C++11 static_assert and math functions, if available. - Version 1.6 (released 2010-11-23) - FIX BUG introduced in GeographicLib::Geoid in version 1.5 (found by Dave Edwards). - Version 1.5 (released 2010-11-19) - Improve area calculations for small polygons. - Add -s and -r flags to Planimeter. - Improve the accuracy of GeographicLib::LambertConformalConic using divided differences. - FIX BUG in meridian convergence returned by LambertConformalConic::Forward. - Add optional threadsafe parameter to GeographicLib::Geoid constructor. WARNING: This changes may break binary compatibility with previous versions of %GeographicLib. However, the library is source compatible. - Add GeographicLib::OSGB. - Matlab and Octave interfaces to GeographicLib::UTMUPS, GeographicLib::MGRS, GeographicLib::Geoid, GeographicLib::Geodesic provided. - Minor changes - explicitly turn on optimization in Visual Studio 2008 projects; - add missing dependencies in some Makefiles; - move pi() and degree() from GeographicLib::Constants to GeographicLib::Math; - introduce GeographicLib::Math::extended type to aid testing; - add GeographicLib::Math::epi() and GeographicLib::Math::edegree(). - fixes to compile under cygwin; - tweak expression used to find latitude from conformal latitude. - Version 1.4 (released 2010-09-12) - Changes to GeographicLib::Geodesic and GeographicLib::GeodesicLine: - FIX BUG in Geodesic::Inverse with prolate ellipsoids; - add area computations to Geodesic::Direct and Geodesic::Inverse; - add geodesic areas to geodesic test set; - make GeodesicLine constructor public; - change longitude series in Geodesic into Helmert-like form; - ensure that equatorial geodesics have cos(alpha0) = 0 identically; - generalize interface for Geodesic and GeodesicLine; - split GeodesicLine and Geodesic into different files; - signal convergence failure in Geodesic::Inverse with NaNs; - deprecate one function in Geodesic and two functions in GeodesicLine; - deprecate -n option for Geod. . WARNING: These changes may break binary compatibility with previous versions of %GeographicLib. However, the library is source compatible (with the proviso that GeographicLib/GeodesicLine.hpp may now need to be included). - Add the Planimeter utility for computing the areas of geodesic polygons. - Improve iterative solution of GeographicLib::Gnomonic::Reverse. - Add GeographicLib::Geoid::ConvertHeight. - Add -msltohae, -haetomsl, and -z options to GeoidEval. - Constructors check that minor radius is positive. - Add overloaded Forward and Reverse functions to the projection classes which don't return the convergence (or azimuth) and scale. - Document function parameters and return values consistently. - Version 1.3 (released 2010-07-21) - Add GeographicLib::Gnomonic, the ellipsoid generalization of the gnomonic projection. - Add -g and -e options to EquidistantTest. - Use fixed-point notation for output from CartConvert, EquidistantTest, TransverseMercatorTest. - PolarStereographic: - Improved conversion to conformal coordinates; - Fix bug with scale at opposite pole; - Complain if latitude out of range in SetScale. - Add GeographicLib::Math::NaN(). - Add long double version of hypot for Windows. - Add EllipticFunction::E(real). - Update references to Geotrans in MGRS documentation. - Speed up tmseries.mac. - Version 1.2 (released 2010-05-21) - FIX BUGS in GeographicLib::Geodesic, - wrong azimuth returned by Direct if point 2 is on a pole; - Inverse sometimes fails with very close points. - Improve calculation of scale in GeographicLib::CassiniSoldner, - add GeographicLib::GeodesicLine::Scale, GeographicLib::GeodesicLine::EquatorialAzimuth, and GeographicLib::GeodesicLine::EquatorialArc; - break friend connection between CassiniSoldner and Geodesic. - Add GeographicLib::DMS::DecodeAngle and GeographicLib::DMS::DecodeAzimuth. Extend GeographicLib::DMS::Decode and GeographicLib::DMS::Encode to deal with distances. - Code and documentation changes in GeographicLib::Geodesic and GeographicLib::Geocentric for consistency with the forthcoming paper on geodesics. - Increase order of series using in GeographicLib::Geodesic to 6 (full accuracy maintained for ellipsoid flattening < 0.01). - Macro __NO_LONG_DOUBLE_MATH to disable use of long double. - Correct declaration of GeographicLib::Math::isfinite to return a bool. - Changes in the \ref utilities, - improve error reporting when parsing command line arguments; - accept latitudes and longitudes in decimal degrees or degrees, minutes, and seconds, with optional hemisphere designators; - GeoConvert -z accepts zone or zone+hemisphere; - GeoidEval accepts any of the input formats used by GeoConvert; - CartConvert allows the ellipsoid to be specified with -e. - Version 1.1 (released 2010-02-09) - FIX BUG (introduced in 2009-03) in EllipticFunction::E(sn,cn,dn). - Increase accuracy of scale calculation in TransverseMercator and TransverseMercatorExact. - Code and documentation changes for consistency with arXiv:1002.1417 - Version 1.0 (released 2010-01-07) - Add autoconf configuration files. - BUG FIX: Improve initial guess for Newton's method in PolarStereographic::Reverse. (Previously this failed to converge when the co-latitude exceeded about 130 deg.) - Constructors for TransverseMercator, TransverseMercatorExact, PolarStereographic, Geocentric, and Geodesic now check for obvious problems with their arguments and throw an exception if necessary. - Most classes now include inspector functions such as MajorRadius() so that you can determine how instances were constructed. - Add GeographicLib::LambertConformalConic class. - Add GeographicLib::PolarStereographic::SetScale to allow the latitude of true scale to be specified. - Add solution and project files for Visual Studio 2008. - Add GeographicLib::GeographicErr for exceptions. - GeographicLib::Geoid changes: - BUG FIX: fix typo in GeographicLib::Geoid::Cache which could cause a segmentation fault in some cases when the cached area spanned the prime meridian. - Include sufficient edge data to allow heights to be returned for cached area without disk reads; - Add inspector functions to query the extent of the cache. - Version 2009-11 - Allow specification of "closest UTM zone" in GeographicLib::UTMUPS and GeoConvert (via -t option). - Utilities now complain is there are too many tokens on input lines. - Include real-to-real versions of GeographicLib::DMS::Decode and GeographicLib::DMS::Encode. - More house-cleaning changes: - Ensure that functions which return results through reference arguments do not alter the arguments when an exception is thrown. - Improve accuracy of GeographicLib::MGRS::Forward. - Include more information in some error messages. - Improve accuracy of inverse hyperbolic functions. - Fix the way GeographicLib::Math functions handle different precisions. - Version 2009-10 - Change web site to http://geographiclib.sourceforge.net - Several house-cleaning changes: - Change from the a flat directory structure to a more easily maintained one. - Introduce Math class for common mathematical functions (in Constants.hpp). - Use Math::real as the type for all real quantities. By default this is typedef'ed to double; and the library should be installed this way. - Eliminate const reference members of AzimuthalEquidistant, CassiniSoldner and LocalCartesian so that they may be copied. - Make several constructors explicit. Disallow some constructors. Disallow copy constructor/assignment for Geoid. - Document least squares formulas in Geoid.cpp. - Use unsigned long long for files positions of geoid files in Geoid. - Introduce optional mgrslimits argument in UTMUPS::Forward and UTMUPS::Reverse to enforce stricter MGRS limits on eastings and northings. - Add 64-bit targets in Visual Studio project files. - Version 2009-09 - Add GeographicLib::Geoid and GeoidEval utility. - Version 2009-08 - Add GeographicLib::CassiniSoldner class and EquidistantTest utility. - Fix bug in GeographicLib::Geodesic::Inverse where NaNs were sometimes returned. - INCOMPATIBLE CHANGE: AzimuthalEquidistant now returns the reciprocal of the azimuthal scale instead of the reduced length. - Add -n option to GeoConvert. - Version 2009-07 - Speed up the series inversion code in tmseries.mac and geod.mac. - Reference Borkowski in section on \ref geocentric. - Version 2009-06 - Add routines to decode and encode zone+hemisphere to GeographicLib::UTMUPS. - Clean up code in GeographicLib::Geodesic. - Version 2009-05 - Improvements to GeographicLib::Geodesic: - more economical series expansions, - return reduced length (as does the Geod utility), - improved calculation of starting point for inverse method, - use reduced length to give derivative for Newton's method. - Add GeographicLib::AzimuthalEquidistant class. - Make GeographicLib::Geocentric, GeographicLib::TransverseMercator, and GeographicLib::PolarStereographic classes work with prolate ellipsoids. - CartConvert checks its inputs more carefully. - Remove reference to defunct Constants.cpp from GeographicLib.vcproj. - Version 2009-04 - Use compile-time constants to select the order of series in GeographicLib::TransverseMercator. - 2x unroll of Clenshaw summation to avoid data shuffling. - Simplification of GeographicLib::EllipticFunction::E. - Use STATIC_ASSERT for compile-time checking of constants. - Improvements to GeographicLib::Geodesic: - compile-time option to change order of series used, - post Maxima code for generating the series, - tune the order of series for double, - improvements in the selection of starting points for Newton's method, - accept and return spherical arc lengths, - works with both oblate and prolate ellipsoids, - add -a, -e, -b options to the Geod utility. - Version 2009-03 - Add GeographicLib::Geodesic and the Geod utility. - Declare when no exceptions are thrown by functions. - Minor changes to GeographicLib::DMS class. - Use invf = 0 to mean a sphere in constructors to some classes. - The makefile creates a library and includes an install target. - Rename GeographicLib::ECEF to GeographicLib::Geocentric, ECEFConvert to CartConvert. - Use inline functions to define constant doubles in Constants.hpp. - Version 2009-02 - Fix documentation of constructors (flattening -> inverse flattening). - Use std versions of math functions. - Add GeographicLib::ECEF and GeographicLib::LocalCartesian classes and the ECEFConvert utility. - Gather the documentation on the \ref utilities onto one page. - Version 2009-01 - First proper release of library. - More robust GeographicLib::TransverseMercatorExact: - Introduce \e extendp version of constructor, - Test against extended test data, - Optimize starting positions for Newton's method, - Fix behavior near all singularities, - Fix order dependence in C++ start-up code, - Improved method of computing scale and convergence. - Documentation on transverse Mercator projection. - Add GeographicLib::MGRS, GeographicLib::UTMUPS, etc. - Version 2008-09 - Ad hoc posting of information on the transverse Mercator projection.
Back to \ref geocentric. Up to \ref contents.
**********************************************************************/ geographiclib-1.21/doc/tmseries30.html0000644000175000017500000025411611745620414017522 0ustar frankiefrankie Krueger's series for the transverse Mercator projection

Krueger's series for the transverse Mercator projection

This extends Krueger's series for the transverse Mercator projection given in here to 30th order in the flattening. See
Louis Krueger, Konforme Abbildung des Erdellipsoids in der Ebene, Royal Prussian Geodetic Institute, New Series 52, 172 pp. (1912), DOI: 10.2312/GFZ.b103-krueger28
and
Charles F. F. Karney, Transverse Mercator with an accuracy of a few nanometers, J. Geodesy 85(8), 475–485 (Aug. 2011); preprint arXiv:1002.1417; resource page tm.html.

Krueger, p. 12, Eq. (5)
A = a/(n + 1) * (1 + 1/4 * n^2
                   + 1/64 * n^4
                   + 1/256 * n^6
                   + 25/16384 * n^8
                   + 49/65536 * n^10
                   + 441/1048576 * n^12
                   + 1089/4194304 * n^14
                   + 184041/1073741824 * n^16
                   + 511225/4294967296 * n^18
                   + 5909761/68719476736 * n^20
                   + 17631601/274877906944 * n^22
                   + 863948449/17592186044416 * n^24
                   + 2704312009/70368744177664 * n^26
                   + 34493775625/1125899906842624 * n^28
                   + 111759833025/4503599627370496 * n^30);

Krueger's gamma[j], p. 21, Eq. (41)
alpha[1]
   = 1/2 * n
   - 2/3 * n^2
   + 5/16 * n^3
   + 41/180 * n^4
   - 127/288 * n^5
   + 7891/37800 * n^6
   + 72161/387072 * n^7
   - 18975107/50803200 * n^8
   + 60193001/290304000 * n^9
   + 134592031/1026432000 * n^10
   - 1043934033787/3218890752000 * n^11
   + 1107802529272207/5178390497280000 * n^12
   + 142419537515471/2027901173760000 * n^13
   - 20550145413484373/80782891757568000 * n^14
   + 2101511170951245259/11421139410616320000 * n^15
   + 6871484604164555073473/152001089131039948800000 * n^16
   - 316612189636291463036929/1590165240140110233600000 * n^17
   + 311760891443585845069947023/2276285401141473705984000000 * n^18
   + 347174131720182892842402053/5544999731500337332224000000 * n^19
   - 10268774819324130983842267351303/53283288669919616509673472000000 * n^20
   + 464746136644252720151415143064067/3701786370752310199619420160000000 * n^21
   + 2064362591952186950153454576839857/30080838421836438047733841920000000 * n^22
   - 371073254699693809696179501698840034443/1863568101909611009933206974627840000000 * n^23
   + 5346008647175289889016543194428866601311819/37129264970421612359156732460741427200000000 * n^24
   + 6137137281591956159684411551066421423706607/167888850301036855884882616344222105600000000 * n^25
   - 5694433253276142746311340663687118018405227/34071560796386891341343825081621544960000000 * n^26
   + 1499618325109985269858805780437308686284756403/11441314242737326475117926447161802752000000000 * n^27
   + 28163788993539415131077859632876464031084037436421/1310187798864261519640035449688674889891840000000000 * n^28
   - 1382954166683887199687110280755185774160434238372379/10481502390914092157120283597509399119134720000000000 * n^29
   + 115342138314917862218900682540434301181025997372394740949/1236751772737919661464211462733624662313402368000000000000 * n^30;
alpha[2]
   = 13/48 * n^2
   - 3/5 * n^3
   + 557/1440 * n^4
   + 281/630 * n^5
   - 1983433/1935360 * n^6
   + 13769/28800 * n^7
   + 148003883/174182400 * n^8
   - 705286231/465696000 * n^9
   + 1703267974087/3218890752000 * n^10
   + 490493610499/373621248000 * n^11
   - 1975809888712343/976396861440000 * n^12
   + 1116592309932851/2013818526720000 * n^13
   + 802251814098377521231/445424437014036480000 * n^14
   - 25718419234005720100069/10254041727093964800000 * n^15
   + 10411677743818269012186343/20672148121821433036800000 * n^16
   + 58069234404819345427642159/24548175894662951731200000 * n^17
   - 1619780216513490679161882727/538657116774318483701760000 * n^18
   + 15210374203334956573188013/39416197422363181056000000 * n^19
   + 1350424643880191120787483875017417/444214364490277223954330419200000 * n^20
   - 363512649110052773321859331443938611/101105040251172472327105413120000000 * n^21
   + 110501360211107135866854552436284378043/372713620381922201986641394925568000000 * n^22
   + 435725651868235317320938241439343987241/116473006369350688120825435914240000000 * n^23
   - 236785644303962703650496588593815148631118759/55962950100345618628294205448074035200000000 * n^24
   + 29951219608236318375984513968969852637391/119180356695180484115811733824602112000000 * n^25
   + 62685650245065205952020811520018086774286032497/14257637748641899145916185264924708044800000000 * n^26
   - 4483003054643316539810052609365683886313161406697/933182192923263190626805875846634536960000000000 * n^27
   + 1345853871818243074858148169703931833087859724988709/10481502390914092157120283597509399119134720000000000 * n^28
   + 645835710031983279557286116276652061340439304187459/126360334379353222116394530036641089380679680000000 * n^29
   - 6417447834385545863906095749619028053009319834823545892863/1194396760656532610281735373146342851007532236800000000000 * n^30;
alpha[3]
   = 61/240 * n^3
   - 103/140 * n^4
   + 15061/26880 * n^5
   + 167603/181440 * n^6
   - 67102379/29030400 * n^7
   + 79682431/79833600 * n^8
   + 6304945039/2128896000 * n^9
   - 6601904925257/1307674368000 * n^10
   + 35472608886503/41845579776000 * n^11
   + 7660808256523559/1098446469120000 * n^12
   - 388334559174821269/43261891706880000 * n^13
   - 121304505560337904991/236631732163706880000 * n^14
   + 171473290780515481554677/12620359048731033600000 * n^15
   - 132727036454031241642633/9465269286548275200000 * n^16
   - 30639039363651602964664613/7934763925547620761600000 * n^17
   + 41628755176036445034328803761/1767468664415732524646400000 * n^18
   - 62731007539014996251923219444381/3110744849371689243377664000000 * n^19
   - 4253576948330492615223590251863457/425705432636515672956233318400000 * n^20
   + 21109173608034038907290057857778161/560369142096606397967892480000000 * n^21
   - 228353389351527744252835451931600005809/8319500454953620580058959708160000000 * n^22
   - 36528815353507244513448437301156996025493/1863568101909611009933206974627840000000 * n^23
   + 179949541301186621467483604212502389572317467/3179713073883273785698534400458752000000000 * n^24
   - 6667459517369124611809567288843679508075480287/186543167001152062094314018160246784000000000 * n^25
   - 236468538717455606379697014767782772375800752929/7057680450680141777849792338335891456000000000 * n^26
   + 2724615431989937919395302944576209366322330213709/33653452487089882156338604087632199680000000000 * n^27
   - 326200170759406656773108233662108528251650506200184011/7290019291116532045176607502113909002731520000000000 * n^28
   - 36898523581280468039266697831389451828857036025105495411081/698722104984071577014815193290610567839406358528000000000 * n^29
   + 48301814797856398208935403861888385264392898018206796432963809/432334302458894288277916900848565288850632684339200000000000 * n^30;
alpha[4]
   = 49561/161280 * n^4
   - 179/168 * n^5
   + 6601661/7257600 * n^6
   + 97445/49896 * n^7
   - 40176129013/7664025600 * n^8
   + 138471097/66528000 * n^9
   + 48087451385201/5230697472000 * n^10
   - 634613396309/40864824000 * n^11
   + 152161926556090753/1124809184378880000 * n^12
   + 797541596189032241/27161585418240000 * n^13
   - 670034891213941619/19612057573785600 * n^14
   - 797738204370016183711/62444484876533760000 * n^15
   + 1262572420740885661534720343/17264651178664053964800000 * n^16
   - 1504688538793152003510638173/24548175894662951731200000 * n^17
   - 4908380662744446707535585282187/97210776542865288855552000000 * n^18
   + 21617826231307521472044305870999/139740491280368852729856000000 * n^19
   - 9011412074161616811750466480987610329/96159344783777657891290349568000000 * n^20
   - 5712764954291035029425456603013754181/42570543263651567295623331840000000 * n^21
   + 13285505291912233404719867451738427771511/45538318279746133701375358402560000000 * n^22
   - 179649231017237416866042466928297549711/1455912579616883601510317948928000000 * n^23
   - 29884145110494866094058551866948880229303499503/101750818364264761142353100814680064000000000 * n^24
   + 2382017529810135366707938471482990925184741/4716709930568539119450511386869760000000 * n^25
   - 188545346993373372341522235835513997267194575937/1391079045351448234474741678280697446400000000 * n^26
   - 77189939882994048469559094011678147843496599936029/135603037409161682387957728833964081152000000000 * n^27
   + 5055292347375802605991447871089890508241922361424571717527/6177914279257927294560700205929359574176890880000000000 * n^28
   - 896129405773425784164009625079521008114002654837731749413/8398102223366244916043451842435223171146711040000000000 * n^29
   - 4583499403987764386036616357058392174411208549700462493009598039/4522881933416124861984361424261913791052772697702400000000000 * n^30;
alpha[5]
   = 34729/80640 * n^5
   - 3418889/1995840 * n^6
   + 14644087/9123840 * n^7
   + 2605413599/622702080 * n^8
   - 31015475399/2583060480 * n^9
   + 5820486440369/1307674368000 * n^10
   + 98568244458947/3678732288000 * n^11
   - 1367520624030470251/29877743960064000 * n^12
   - 11234223222165655787/1912175613444096000 * n^13
   + 2982454477844692970369/27248502491578368000 * n^14
   - 869190895988598534264203/7266267331087564800000 * n^15
   - 2458295530839889742624897/30213139562662094438400 * n^16
   + 20076007526718092337920372531/60426279125324188876800000 * n^17
   - 92612134608258706595931646307/396778679766797097369600000 * n^18
   - 3111621093870597339292256540131/8985511024872697343508480000 * n^19
   + 618939899724538734690312503581728709/751244881123262952275705856000000 * n^20
   - 349880405493459820104679463829848683211/1041726235157591293822312120320000000 * n^21
   - 207806888296724735724043450497658236815707/199230142473889334943517193011200000000 * n^22
   + 1022460523953867701806308301182024494003729/579578596287678065290231834214400000000 * n^23
   - 383432658756943317231248322200166817451364947/1418641217578691381311653809435443200000000 * n^24
   - 763997490849414433043000164958612268471750563033/295077373256367807312823992362572185600000000 * n^25
   + 69453259794643484263302719504607020126095692449473/20581646784631654560069473467289409945600000000 * n^26
   + 3526475778372639978202920400355285382983253400925713433/11591583469104547848231127456777395681361920000000000 * n^27
   - 3386844879506808385587873157467763778147265832357828657961/599864444526160351145960845888230226510479360000000000 * n^28
   + 8975715445112376764326365404354369942872021811244023950781587/1522855869837079078109212600761587135034603601920000000000 * n^29
   + 1141689688674260410162806230731137824563608969465073820136479347/565360241677015607748045178032739223881596587212800000000000 * n^30;
alpha[6]
   = 212378941/319334400 * n^6
   - 30705481/10378368 * n^7
   + 175214326799/58118860800 * n^8
   + 870492877/96096000 * n^9
   - 1328004581729009/47823519744000 * n^10
   + 3512873113922087/355687428096000 * n^11
   + 986615629722639449/13133074268160000 * n^12
   - 186591382609938512501/1419192838103040000 * n^13
   - 11945326540608489526613/373693748455931904000 * n^14
   + 4125626927677466366821/10899400996631347200 * n^15
   - 4011823062707782237989439819/10071046520887364812800000 * n^16
   - 5594107510292126787316683247/14477129373775586918400000 * n^17
   + 14982221707493385549304025695646893/11007251005469054245797888000000 * n^18
   - 7291595279883773582199320279582809/8943391441943606574710784000000 * n^19
   - 8513492703227656510956084303336491/4584255567495120990240768000000 * n^20
   + 157105326583313971040653100185655846951/40692431060843409914934067200000000 * n^21
   - 342420444562433578699362565080425434441037/375021444656732865776032363315200000000 * n^22
   - 6663996141625951282430738551524458085888493/1050486205771416493338545199513600000000 * n^23
   + 1065943196304789336567113254479304136821982769941/116477910495934660781377891722067968000000000 * n^24
   + 282615555043864261481140961100818513817314366357/285856205342106313334298242601241804800000000 * n^25
   - 2234022131193996792575080782842298020429068641824778623/126453637844776885617066844983026134705766400000000 * n^26
   + 1670315644839955612203042568472364219380574770260571/89166026685419598832547134282903043702784000000 * n^27
   + 10801933283402577517707581324454394034794780353978810731521/1182341513848663880519575000591294359498915840000000000 * n^28
   - 16737951977035205802462496054004751707736362520790525486549/392219059882489460364666706926919763487621120000000000 * n^29
   + 608596584899951573523771478197765351237552575059720715257651893101/18091527733664499447937445697047655164211090790809600000000000 * n^30;
alpha[7]
   = 1522256789/1383782400 * n^7
   - 16759934899/3113510400 * n^8
   + 1315149374443/221405184000 * n^9
   + 71809987837451/3629463552000 * n^10
   - 52653013293696143/812999835648000 * n^11
   + 101784256296129577/4455864483840000 * n^12
   + 4323558791348929159/21064086650880000 * n^13
   - 4743350772552838010233/12772735542927360000 * n^14
   - 29903451511253057978977829/239786821925889638400000 * n^15
   + 15436840428957043227623443109/12408968034664788787200000 * n^16
   - 510180710084169862809596281619/397086977109273241190400000 * n^17
   - 25997085578966927070281529664931/16379837805757521199104000000 * n^18
   + 35427299825029861083061489601504459/6814012527195128818827264000000 * n^19
   - 41290529970653089580171330206559029/15331528186189039842361344000000 * n^20
   - 5636751993648050664276890397282425312669/651078896973494558638945075200000000 * n^21
   + 141025630513942054689154210633777771281593/8496579605504103990238233231360000000 * n^22
   - 5083353505162393632768455472240415265887349/3625207298348417702501646178713600000000 * n^23
   - 2146307295003485715426155323634480307223656521293/64478843310249544361119904346144768000000000 * n^24
   + 2825817217957521232544774598978333849050291610759191/66026335549695533425786782050452242432000000000 * n^25
   + 1121526321726686366084998741747165637003373989067391/71050078471954976186444471989073608704000000000 * n^26
   - 24751330931089944559270444413306567745123372815680765867/240606738674941774627508140128468530626560000000000 * n^27
   + 283315570304624430111229930361091346970544306955451389315961/3103646473852742686363884376552147693684654080000000000 * n^28
   + 4800340784447363734591990355494651667081994231886256711/55232397096636431665504905041636298326016000000000 * n^29
   - 5883627608079327862661606773104442557734582970571316091093779/21654584826138278971716016135829556194222643609600000000 * n^30;
alpha[8]
   = 1424729850961/743921418240 * n^8
   - 256783708069/25204608000 * n^9
   + 2468749292989891/203249958912000 * n^10
   + 117880637749661/2707556544000 * n^11
   - 5921832934345276446697/38926432130826240000 * n^12
   + 58559280970406047561/1064394628577280000 * n^13
   + 707308930074513293534401/1284572260317265920000 * n^14
   - 174465694566990976559029/168307400643782400000 * n^15
   - 4693110873155601006258565965271/11118435359059650753331200000 * n^16
   + 676391985485095809371733839/171665565696943718400000 * n^17
   - 2198445417091794111397602386175901/542023723754157974224896000000 * n^18
   - 53363941504564359044259819052979/8957723800023644405760000000 * n^19
   + 3980756637943323854029497343795084553/210875756104775565551075328000000 * n^20
   - 57605246865079073769101876100784936151/6705002845252607315528908800000000 * n^21
   - 131556990309544385502695007449463535506251/3577507202317517469573992939520000000 * n^22
   + 16563201841502261061487372612686514822354259/246931844784963022216298653286400000000 * n^23
   + 3716622905750730591889081511594229480962791354087/1091129684472639151636059353184731136000000000 * n^24
   - 2213908725034918327552841712951816333387504312678259/14018459110275430350511715674314768384000000000 * n^25
   + 17011573703835625757730804229750060144161108086423592979/91512501071878009328140479921926808010752000000000 * n^26
   + 682892898514410238829628389193295165408986121549166351/5831466588978968792019684149065332817920000000000 * n^27
   - 155436494065578924089463413379949231968540857163058763243101/289553023799672787066018367491745557428305920000000000 * n^28
   + 165551112077463450636444122527612450331221233114708176183743/410124712616255283555227578330105230951186432000000000 * n^29
   + 1403124695221106030113716236806514839242351489435235474477081785401/2304047825501112882590584116852264779065289280061440000000000 * n^30;
alpha[9]
   = 21091646195357/6080126976000 * n^9
   - 67196182138355857/3379030566912000 * n^10
   + 395018924202597949/15446996877312000 * n^11
   + 91220875613845291081/946128558735360000 * n^12
   - 4988552993547340999703/13876552194785280000 * n^13
   + 2274808037645071351151/16571805601849344000 * n^14
   + 535711648203373741428799361/367673126953030778880000 * n^15
   - 27678709003769097826752781127/9651419582517057945600000 * n^16
   - 5280108162364963042999830777751/4014990546327096105369600000 * n^17
   + 1174431699627195631670489145666649/96789950670385352540160000000 * n^18
   - 1183738252014628519027860764867029/93856921862191857008640000000 * n^19
   - 40137685403486395923628481749776837043/1911061539699528562806620160000000 * n^20
   + 287333201658715623813482736998287053515959/4357220310514925123199093964800000000 * n^21
   - 106257838315599820564882015419176890518173209/3950909516559408355460778452582400000000 * n^22
   - 90892763520143573996692682431035087078662489897/622420206916436023998744174683750400000000 * n^23
   + 201524866709123266853440470935579547318921733655003/778803283904190575028428648573042688000000000 * n^24
   + 10814621264427896099430746759393142670689600538379/246140297135151589144787325968764108800000000 * n^25
   - 530693286808080774017187055905756612819533423821542721/762604175598983411067837332682723400089600000000 * n^26
   + 528646912311960943475639104830106896257711233429178692933/691427785876411626034839181632335882747904000000000 * n^27
   + 1238335239482617295952056865714588188866564716732256454849533/1822776500516690149134344792578245470894161920000000000 * n^28
   - 65933487212841390272205814518074033193900839255445948294377851/25518871007233662087880827096095436592518266880000000000 * n^29
   + 162727413247772587683519571850133568153397325055616238461382829/98282138338670185068189671924151343633347379200000000000 * n^30;
alpha[10]
   = 77911515623232821/12014330904576000 * n^10
   - 268897530802721453/6758061133824000 * n^11
   + 8257746726303249815683/149866763703681024000 * n^12
   + 323404376453879141969/1506527781986304000 * n^13
   - 565045774309646240886321061/661811628515455401984000 * n^14
   + 606966182513981199158868163/1723467782592331776000000 * n^15
   + 75743290339815584481785361977/19854348855463662059520000 * n^16
   - 22241327027192487028642722150343/2823040227886239449088000000 * n^17
   - 1526410847130700516846978043440307/394199071821205799436288000000 * n^18
   + 1980853898587532814589028918136701/54202372375415797422489600000 * n^19
   - 32336501755791644291373778373511296903/833917762777976100133797888000000 * n^20
   - 9178264588912399043908657569412179727459/129878682332656421941511454720000000 * n^21
   + 1806166894952081193938559978698482758385827197/8083379310603065246736937333555200000000 * n^22
   - 361654991248988355171855093660297726396047881/4322362548030805722213501213081600000000 * n^23
   - 105020035995730778911321036642305474913412418767240671/190651043899745852766959333170680850022400000000 * n^24
   + 2294386994267351811538453796616269131419043757692511/2383138048746823159586991664633510625280000000 * n^25
   + 2743769449547669368889674700489658732983220398593193929/10458571551071772494644626276791635201228800000000 * n^26
   - 23157882459582328183252760859500524302121767786137065570859/7994633774196009426027828037623883644272640000000000 * n^27
   + 89430614800491857673988760128056842290692364119137870498038657/29634817943884252747216444369659216688085729280000000000 * n^28
   + 2567130086431563482452599790796650371294900574502194735538864809/746426976961584616070514192560791520331159306240000000000 * n^29
   - 509038828002331582891050965787949294310918940649244811719555481648577/43567449791293770870803772391388279458689106386616320000000000 * n^30;
alpha[11]
   = 12809767642647461/1029799791820800 * n^11
   - 5303630969873795374429/65282870552739840000 * n^12
   + 505329992704194411750631/4178103715375349760000 * n^13
   + 902773043678795981447423/1880146671918907392000 * n^14
   - 52457275102567933937177869/25762220537492275200000 * n^15
   + 67595745292234822704267032563/73325720204837388288000000 * n^16
   + 81338369151994478217697814085661/8212480662941787488256000000 * n^17
   - 19217318226298386878750945280512161/893107272094919389347840000000 * n^18
   - 1873245185945872710662470867765863817/171476596242224522754785280000000 * n^19
   + 476337982883129731566963871315011795997/4406497269224532801843363840000000 * n^20
   - 8440994919935476843536233253371860518791717/71444009058360425160553739059200000000 * n^21
   - 33526203318350561460792162793779755990401717/146245349369463351503464326758400000000 * n^22
   + 710399978033562118273811779126576411439704335403/961922137961764764361695542693068800000000 * n^23
   - 34930525249908548784563565768397098265832106510929/133733897236073129045285727532744704000000000 * n^24
   - 23048480004933480948529688590232835511983254849209969/11554608721196718349512686858829142425600000000 * n^25
   + 3343638043167525209592261539785084441516908110518987/960960215823802999597333847150375731200000000 * n^26
   + 3245082101525034287044377973345367353808255099669736817511/2599324777920413759906374035762203880062976000000000 * n^27
   - 1563650841338021630530049879900135725592709642522865259185153573/135713995811197202921911671374689367332938055680000000000 * n^28
   + 100228142507845651554674218817828912081709008921929406668291104191/8685695731916620987002346967980119509308035563520000000000 * n^29
   + 1348681612012517778664036601950009019623074500848299186242899657141/84859828283817488489232796254889378316274578227200000000000 * n^30;
alpha[12]
   = 2240624428311897034834681/91918281738257694720000 * n^12
   - 1694308924283012695547/10043518546575360000 * n^13
   + 2898270966023179721324929303/10754438963376150282240000 * n^14
   + 5049523426723058614103389/4683336365740032000000 * n^15
   - 293488823111024724225343654073741/60224858194906441580544000000 * n^16
   + 15397766080743841984369762728863/6297551277592380309504000000 * n^17
   + 5863952550107110495571900519504737/229656155681550700118016000000 * n^18
   - 1430933931370883795713846515020911423/24472734089815246481326080000000 * n^19
   - 1870907814706500734631241404968509423277611/62870727971357174141287290372096000000 * n^20
   + 85087672018039782610988182307863449111159229/270147659251925357638343825817600000000 * n^21
   - 17181221423420856035067255437638564537594025459/48096106898088238218084777134653440000000 * n^22
   - 29840743030792811125826874514052113793829046631/41332591865544579718666605350092800000000 * n^23
   + 233752394874908577315877184530185132629657928559209871/97769766102433770649722734959323512832000000000 * n^24
   - 201646398092527015113891771761912798737265288328930229/244933632787867935846440809976221925376000000000 * n^25
   - 1478405663522054837879701822965363491041325865689756503513/211622658728717896571324859819455743524864000000000 * n^26
   + 321386243763712289433592425205485189709512429739435078423/26177282004203385643588361566208718274560000000000 * n^27
   + 2818199590151532790384019625468928958215697625600921714777625549/535252958269371601439920541444153022982568017920000000000 * n^28
   - 11378071070442404926793965546213173776855685042822972281764801951/257713735203578688495924900168357493335389739417600000000 * n^29
   + 26391837116130703226086300212905604518448450453630780847639554556493/613134590884340253673783066835327045013588110475264000000000 * n^30;
alpha[13]
   = 1987049611350093295679/40852569661447864320 * n^13
   - 49990807275475500894703/140691247558557696000 * n^14
   + 620844046443235040902108541/1021314241536196608000000 * n^15
   + 30593679475357306372670316797813/12595102555184760619008000000 * n^16
   - 785749129848932618333134357025453/67173880294318723301376000000 * n^17
   + 275581708051003997988541817255279573/42168403354758578552438784000000 * n^18
   + 642193387846955979009281483738217042761/9813737508016541917658480640000000 * n^19
   - 10379707152495210640484367519099555203413/65622913178605350033605787648000000 * n^20
   - 28662530127283669901885121584468088960326233/364665822910787579541585710284800000000 * n^21
   + 4609055620394562855489493272499773205216196129/5087088229605486734605120658472960000000 * n^22
   - 873057563036453343326459102080494704028393390097/813934116736877877536819305355673600000000 * n^23
   - 19289084079854993646765928794776984023563835229561783/8695868619687619024133993253593677824000000000 * n^24
   + 1182490481385670104330958793922877551368861956689593353/155502591787355069608043173476028121088000000000 * n^25
   - 293417158736416271896554762676460700877470285796817656847/111689736551267778745977009349157197971456000000000 * n^26
   - 39859038349761443605955883817872550236932196068750468867903/1675346048269016681189655140237357969571840000000000 * n^27
   + 26244234609643418748414712844720424679053976070350152552610637/618202691811267155358982746747585090772008960000000000 * n^28
   + 2077245025145718452430941958359096421872386057259172217716184873/101286329026358010734015733227124341272085948006400000000 * n^29
   - 191207856187024789574592797220884621637003872633248259491607835405551/1166134827662716367083406640577189322150843540884684800000000 * n^30;
alpha[14]
   = 10469176753142937388346729/106216681119764447232000 * n^14
   - 2524263545672345614192283257/3332037713011841433600000 * n^15
   + 28798233421533175181823218687239/20791915329193890545664000000 * n^16
   + 13912456133127892258104161571997/2535377787082646618112000000 * n^17
   - 5642793384271167571209335562965961618499/200480637663766499175023247360000000 * n^18
   + 2416612854960792848747357744110015450361/137830438393839468182828482560000000 * n^19
   + 37531174405336506824031127490381559959133931/224939275458746012074376083537920000000 * n^20
   - 2616330145733138560090205392154735810050979/6139719528452849037235086950400000000 * n^21
   - 68829610700469773329308127037458237442895425239/341327210244497174450924224826572800000000 * n^22
   + 63069353283833076130495586379466422512525299809581/24468894384402391193450630367254937600000000 * n^23
   - 714098347019839680389819042844541592537678056730181857/223156316785749807684269748949365030912000000000 * n^24
   - 2661752462851196865891091928419385880894607083642023593/398891916254527781235632176246989992755200000000 * n^25
   + 5961320530838574206567558505826389702787945152445692779/250285123924409588226279012547130975846400000000 * n^26
   - 94590092745211556049112510107228668331259876881195561421/11150842204387935702723354017813583888384000000000 * n^27
   - 17802000569076164486140040573046212865608178116650965279535007359/225025779819301244550669719816120973041011261440000000000 * n^28
   + 6231272989222159551881242282050573601231377672788471696790420989/43196913090312292480708919428987508217694126080000000000 * n^29
   + 422268052780700950950541531621666843181077037988763165839750231840343627/5605286734647678672031164692522288170338508448622182400000000000 * n^30;
alpha[15]
   = 100206984674719544740861653301/495045603076045012992000000 * n^15
   - 36822741875265270244508239254871/22559228132175371242045440000 * n^16
   + 179792631498449481362046446075850677/56496153931013103632252928000000 * n^17
   + 1198746750769645158859022771229488225047/96481306875687627727979937792000000 * n^18
   - 712415136407467601227112286139274196716669/10497166188074813896804217231769600000 * n^19
   + 4324780012493436320334302458159540323213361/91850204145654621597036900777984000000 * n^20
   + 1555975364258875353541471977713778721787643043/3674008165826184863881476031119360000000 * n^21
   - 1749084094448959255650030230541491009564819115959/1529305899025149449590664397953433600000000 * n^22
   - 3736902111701391887100479481424584566863791566838269/7438543892858326922808991631645501030400000000 * n^23
   + 160288079478771431803467565454719360005157928068793941/22073070464677426629639725167817628057600000000 * n^24
   - 205505625990694957725950514798454096070237493947357149/21661039816003447999219783631351699000524800000 * n^25
   - 12495724210779737453458596500764106334450954721020624496477/634054042883350928573315637689830862330265600000000 * n^26
   + 5055693252244555496228110569294083881781629217112771929053811/68689187979029683928775860749731676752445440000000000 * n^27
   - 3183992173345900271685562628167128755396195058359564971811781053/115191768240832779948557118477300021913851002880000000000 * n^28
   - 5698640861911756799224037518645406078168295920245835514736969952989/22116819502239893750122966747641604207459392552960000000000 * n^29
   + 142278670225215087706896520822001994673082990276889571404960221414791/294749152212543199400677229925300609918641519984640000000000 * n^30;
alpha[16]
   = 7712781743942384637654934879373/18338215136419449195724800000 * n^16
   - 2402063456298622602221186822696471/676776843965261137261363200000 * n^17
   + 7668107436276322919714287100049904599403/1041385534531231537381370757120000000 * n^18
   + 361303680860095904135414295125524607/12819051189903224347361280000000 * n^19
   - 7227390188103426658110578949868094476645931431/44088097989914218366577712373432320000000 * n^20
   + 12901408373363616730918554960524450439118853/102117113984051111751513381273600000000 * n^21
   + 497747383538267321534956030212997835594308172021801/464908993303645432675561976977843814400000000 * n^22
   - 252499664598382602456303781455085911751340300461/82547761595107498699496089662259200000000 * n^23
   - 131281534185888595153825331846748525760537617955805958541/108305199080017239996098918156758495002624000000000 * n^24
   + 1426262784250791324747799093000080956187589936714029719/70320626514158153080237367679905483980800000000 * n^25
   - 23170473116883805794188278794166757632616659619691851519/828740273599081251646377980227632916070400000000 * n^26
   - 44044500279817699335584829646278793104954720796019992410409/769175802890176148160771357353766171967488000000000 * n^27
   + 62420418657558519149643437875852556019705678659537976085016650961/277762254345241993722109472497853742008909168640000000000 * n^28
   - 109511822578379305705407097075954475716527637153298910483976431823/1209513566528744189459849744011650230095435530240000000000 * n^29
   - 168398596910687560076596170666837371522448204565539850254693515405079907/204359412200696618251136212748208422876924787189350400000000000 * n^30;
alpha[17]
   = 136336614071421552738346511544707/154416107000986498341273600000 * n^17
   - 27801197719443334715141091692509100501/3573381736136578804739997696000000 * n^18
   + 576392411336288932474450636964598560303/33631828104814859338729390080000000 * n^19
   + 556540535711605007979630683151193569919453/8691707297670641941407583961088000000 * n^20
   - 301243011881263087198414763542811432614781470369/759655217816414105679022838199091200000000 * n^21
   + 989789926631181163755007364622407618669102051/2925597777633984541291825940398080000000 * n^22
   + 2103270728132227977532547099652140536893417990637/779966854656425178023381737616179200000000 * n^23
   - 149750803535199564120198336297627481136417850061461067253/18366093042521305863309053676398844051456000000000 * n^24
   - 827633945205212562322541676028753996760694367358637422131/293857488680340893812944858822381504823296000000000 * n^25
   + 10871559511195696848205970321319912766271482873182818466013/193406204284510078070764728510649051643904000000000 * n^26
   - 1185910777714920025608418139877185236744968114328617926870881/14478603348520962788908637314894422060564480000000000 * n^27
   - 1794514783827843337644294958827668476221297946256830260008605439/10945824131481847868414929810060183077786746880000000000 * n^28
   + 128661408285411985453738219706261617148768669184661116871488103229/189555919076956236027138549181277523417671663616000000000 * n^29
   - 1855414703915628112302305459595288498254055876861869243258846990726549/6247526147877631344159452657828430574942185943203840000000000 * n^30;
alpha[18]
   = 67752028110741493306780180177177973987/36222105548912401300221591552000000 * n^18
   - 5545658735018547601364002065686581343/322869656256540697864175616000000 * n^19
   + 6903145472582253547590916629983711429839564343/172188516038387197287245176658460672000000 * n^20
   + 2594359997714507009889054556821919665165991039/17814495239540271366199495675084800000000 * n^21
   - 2653661574489733699865151526666294107005175728022119/2762887731633092857043339748896900382720000000 * n^22
   + 223899545504288463905906021765274294443981546647858717/247796493430843015616074533729190753075200000000 * n^23
   + 144506895392063363464005464205241390539753389057581011317/21348620972503398268461805982822587957248000000000 * n^24
   - 199508703723852397940714471767792646467211904185547826559/9208240064528857740794868475615606996992000000000 * n^25
   - 123747223374921892225259794899435553979183207374624389411529/19856370306543034681931845460426635968774144000000000 * n^26
   + 74365730590824979951370872254622112553384627249684845833999/480734876806360092600482098346103857479680000000000 * n^27
   - 453806568576657850636481186180714169477831867390896126354437393759/1902140993515290007355661135881569592628719124480000000000 * n^28
   - 129377367350744075863584786744687343612005128384626716428469495967/279376958422558219830362729332605533917343121408000000000 * n^29
   + 9812276168495581890730160638055577559800537496316269869797927437190396177/4833641563655724730627900082998991975493047684412997632000000000 * n^30;
alpha[19]
   = 471824901393496747102665687245792177081/118103493571358059411833618432000000 * n^19
   - 50561675675044750669650971499055765086319/1324934718670261598085912408883200000 * n^20
   + 67251111238362727892454291277989954473027123753/714019364752482795768480796350873600000000 * n^21
   + 240180124848943302649869868199872368699919588928959/724551150382581917006065888097048985600000000 * n^22
   - 485940263706654462038872744309833664639315267073048459/208670731310183592097746975771950107852800000000 * n^23
   + 1699999199365185300098132938338874634674993023922086094213/706611263899109188740995696707766052716544000000000 * n^24
   + 18316002921325135783401359443916180813949011876130693396319/1081422456054288845377523848874494132853145600000000 * n^25
   - 1070798289679403964467272203329695220087675802370874334174677/18654537366936482582762286393085023791716761600000000 * n^26
   - 66905570444410496337928253364613460714163911189816744933/5208993291563945942641955456499557439897600000000 * n^27
   + 639717024183652714810791734101835747576462370463927529907834770743/1512416617024375325397452369319368303913436446720000000000 * n^28
   - 121315610544001063260669429484399550327396846073348792749387872304069/175562790458797122792695361672570558744154047774720000000000 * n^29
   - 2310657553908327208643487025983368468395539176694805984465325989447845451/1788765381287069184854074866241403280404499554264678400000000000 * n^30;
alpha[20]
   = 202399116895368048088234707551711981612353729/23547147492429018432443784842182656000000 * n^20
   - 3365095273417630466576291762515903066833421003/39463570282275703540635396955176960000000 * n^21
   + 2717825461890719651841152458000965236132994648134207/12236863873128050153880223887861271756800000000 * n^22
   + 167575736694631175164505551372730340638238831166089517/221984358698463534822733436465733382963200000000 * n^23
   - 1780457197357285934359849612457829809553519546045920132315603/315054408863816150286651947972102624037883084800000000 * n^24
   + 31433611667605561414091907198192986558131456317053607536179/4922725138497127348228936687064103500591923200000000 * n^25
   + 81043708724580147220822100302291795209006507032171545390245907/1918125371612057150274616271477213034583582310400000000 * n^26
   - 1577108197581107731425828348589622362098940512581130343622369/10399988029071674998896733424633161124413440000000000 * n^27
   - 5514916654831738928837454570878277449201710700255298388849026950313581/235404621606609970647462666379821037767518556059074560000000000 * n^28
   + 2277087194186373183792618936007821692864753094815436081352010122233691/1980567729863305041505094548868686615832487851458560000000000 * n^29
   - 143439353635410339941300281453638717803865413230045426199413290694870693/72062639267329582851264081544843174826791394711961600000000000 * n^30;
alpha[21]
   = 7593597428771861155598510033855442354788700917369/407895462437601671796007462928709058560000000 * n^21
   - 45805642625336613066067381416091711616993807717957/239175066611139162098568012353652129792000000 * n^22
   + 1990618787705329951428358040285346629497792311202946171/3788533055120444327641317315681849735905280000000 * n^23
   + 930144112851858298709480062321695584642393218056377949791/540958806428255752552630405171879505559552000000000 * n^24
   - 752902102022542070422923926458337877174355061465216481203/54858440486545321043175068539316832105922560000000 * n^25
   + 24990276016004332532181513229852654837023995611735929270423877/1479326420770302763580519691998352523776334233600000000 * n^26
   + 1273703517934435922639076948106483178914355724092343511679304023/12119166110998363411723475629310149719087906816000000000 * n^27
   - 387147736345336231749751695652681175080211230836264638568453074861881/968987437728821283747116150252959580864281690767360000000000 * n^28
   - 26472588474688318840378923145456844687860042284441254323438583079847087/823916175623134897266119332329373632186314946206760960000000000 * n^29
   + 489733176366105123100315909250683812497390264686335645655218001765029594209/157573968587924549102145322307992707155632733462043033600000000000 * n^30;
alpha[22]
   = 2439323846938124516749950544509820877337338687175781/60135445319372132184782814534632535490560000000 * n^22
   - 34073601205416895076590748626649694428085903921401/78848923058617306186341102973731471360000000 * n^23
   + 114050797567384263375075461734480044074661222373269471907217/91493073281158730512537813173716671122112512000000000 * n^24
   + 137273833008580661426413574856400098350445610433824603561993/35055769925661361419206064286668615837548544000000000 * n^25
   - 45059179088074031893922072777375249940924991766835661888221084641/1351036625382288628601140188130286029427907231744000000000 * n^26
   + 206898006671113514273360240583654940027344524273411544491451421031/4644188399751617160816419396697858226158431109120000000000 * n^27
   + 2440824507911814657571898799746797396009020312235697337059397039885469/9362683813899260196205901503742882183935397115985920000000000 * n^28
   - 696311481675417712820466561405304148537325788366564328711011454870887/663190103484530930564584689848454154695423962382336000000000 * n^29
   - 6924245472208385163375477930704649011923426449727911613839020300441563381/3208778996699554454443686563362760582078339299590694502400000000000 * n^30;
alpha[23]
   = 7474565215206746325580483864591180104671541156913/84105517929191793265430509838646902784000000 * n^23
   - 16782060552985470049913293468183373087712600299046298630661/17138376408101110027167409206815767742801510400000000 * n^24
   + 6503735528674785551831538506800050725715065676154256817241867/2193712180236942083477428378472418271078593331200000000 * n^25
   + 43999179965065941867057377378097709899255133565469268235339039/4935852405533119687824213851562941109926834995200000000 * n^26
   - 320196265269217417773345496488501328010142269670188589023798556437/3948681924426495750259371081250352887941467996160000000000 * n^27
   + 123832182350468652680214620379816199199842965715033754557125222024173/1057259585265194237131946607004781985746328055971840000000000 * n^28
   + 223366335034930390488779600823060385213901770612295015887755022091478569/346358240132877632084425708454766578530497071136374784000000000 * n^29
   - 5683975145729510214638167363294386038771152028333168572495195332205249204543/2065161006792282881303388286661545724488088786650634649600000000000 * n^30;
alpha[24]
   = 39494178711472476796003427487122912293893944185276935843160849/201821520581798671679923410819462480939230586470400000000 * n^24
   - 76348957557716638341723622087037389639067389665177807014579/34276752816202220054334818413631535485603020800000000 * n^25
   + 4701748482852793217057834734347787548724108110072753226999643/665345672247687928615132123580645541557903032320000000 * n^26
   + 679403733200977595115362734887022205196905112342852746889825923/33505525877837670103112284999324825937176952832000000000 * n^27
   - 1551880057739501281928982393705767292741074023417989103820403149655498881/7867890886969072136238806216750253141927340875196661760000000000 * n^28
   + 40509752985115825377187326802004288703338863504362380792112685460851409119/131940842100618072972160918314487643508961228036012769280000000000 * n^29
   + 930119149078652355869135614976346780332901622265792177140238904719349791424829/584599423461200077168959145762652943547397441144179654656000000000000 * n^30;
alpha[25]
   = 8740098043964194699013511747075939410275887707894105297617/20190228149439643025202422050766554715809382400000000 * n^25
   - 560970870667805373435462259322216583674714967329353232405989/110325175245152335101998949063117245411386982400000000 * n^26
   + 37599914809270379883026138747614917048973558104768871252051312999/2227899902526348973090063625929131283095402577920000000000 * n^27
   + 62112464645162326712991624734748037976412787406014636486771832698244341/1348054580849226799204709254809580010308671550814945280000000000 * n^28
   - 337728148943314333204134420372420356729249456410758236907291010482662683997/703684491203296389184858231010600765381126549525401436160000000000 * n^29
   + 9318731629311992919328873307373838077895502043140333484055412345740103859247/11610794104854390421550160811674912628788588067169123696640000000000 * n^30;
alpha[26]
   = 981053882391585426104317525561993317308039476510023968359/1020137843340108279168122377301889080377737216000000 * n^26
   - 804535427693867223518181752525105894684868959294094526147221449/69088598041109651665505696484929975427905303347200000000 * n^27
   + 1850220524749669257030657681847129002392911081379585567459419325323237/45823979891138552002269970273380595222214183119277260800000000 * n^28
   + 4964057679773584492591452849477564911024827566211763096636472333282359/47482084426673170660246844197746340444070617376882688000000000 * n^29
   - 4451537474316831472817032033079424859226655324781227836739835901181143999400077/3810722167747081984508770727934330298679331468199097008128000000000000 * n^30;
alpha[27]
   = 219796242799180006558858282267295702822729406335181729959735197/102474606956438773279014366383959253494644552499200000000 * n^27
   - 1991862922927036259097631233677478784353889919238496520767270708775317/74463967323100147003688701694243467236098047568825548800000000 * n^28
   + 6916252182087743491582730686935092456222021350509646835638283740939656053/71485408630176141123541153626473728546654125666072526848000000000 * n^29
   + 4178831185325638216557225776185254600956561244767568179257086044280129070299149/17648407039378673440756244433745867195758653862097068018892800000000000 * n^30;
alpha[28]
   = 215719482708468448409738976464239418783926747463596671692384366197697/44929100822557395094481533143462725012487441496072519680000000 * n^28
   - 278069851593691889742988308687280247895937313870882245850732354899927/4512967716551524060829618284499604074915033185989427200000000 * n^29
   + 10456333895529602975165309445620837322364136333954987435106098028819923116751/45038779803274177894987830782750235833811918467990185574400000000000 * n^30;
alpha[29]
   = 27323334865827529185376977771399500293634233810796735936299404584293/2533595911046469648185048861473461936794404595643187200000000 * n^29
   - 52262641147658201267292303345886757439639836488719164781023668387608491790413/367286072424459165080994152236686477795330009828475136901120000000000 * n^30;
alpha[30]
   = 138503251037159093918050273397984791664345186887370360837473296764761046660471/5699690220901306106942517947753261728997763363224497107763200000000000 * n^30;

Krueger, p. 18, Eq. (26*)
beta[1]
   = 1/2 * n
   - 2/3 * n^2
   + 37/96 * n^3
   - 1/360 * n^4
   - 81/512 * n^5
   + 96199/604800 * n^6
   - 5406467/38707200 * n^7
   + 7944359/67737600 * n^8
   - 7378753979/97542144000 * n^9
   + 25123531261/804722688000 * n^10
   - 9280258847/6437781504000 * n^11
   - 1628053924171/99584432640000 * n^12
   + 171201246542931467/6186450514083840000 * n^13
   - 5718183564876629179/180953677536952320000 * n^14
   + 644468750008654952687/23162070724729896960000 * n^15
   - 212771552062192641437497/10336074060910716518400000 * n^16
   + 490410367787088228908921/33923525122989018316800000 * n^17
   - 17113867364186490261786648857/1602504922403597489012736000000 * n^18
   + 395980314414341959891853827859/51280157516915119648407552000000 * n^19
   - 19481411440513215539899023606263/5115195712312283184928653312000000 * n^20
   - 135570116300721989060886034459593007/108032933444035420865693157949440000000 * n^21
   + 11080348232555971953029572642513796537/1863568101909611009933206974627840000000 * n^22
   - 250868515348150853528597220771122960249/29817089630553776158931311594045440000000 * n^23
   + 961059950401200029458005065879527529605493/118813647905349159549301543874372567040000000 * n^24
   - 4018789334131226157542250009395235956239124497/659019700381670004966792563356519838515200000000 * n^25
   + 2391844895236730308938558863293259934461956219/570305509945675965836647410596988321792000000000 * n^26
   - 1573270095968198180509050797007198841027307027401/474494184274802403576090645616694283730944000000000 * n^27
   + 2061253330556904530218418240686914940538061818436749/670816153018501898055698150240601543624622080000000000 * n^28
   - 2710857345655764890042245118743890636519888766789337/1100826507517541576296530297830730738255790080000000000 * n^29
   + 455119247458368582897233478322666951033511063680152518561/460521387375865357577946377396084237894154190848000000000000 * n^30;
beta[2]
   = 1/48 * n^2
   + 1/15 * n^3
   - 437/1440 * n^4
   + 46/105 * n^5
   - 1118711/3870720 * n^6
   + 51841/1209600 * n^7
   + 24749483/348364800 * n^8
   - 115295683/1397088000 * n^9
   + 5487737251099/51502252032000 * n^10
   - 5845886411021/41845579776000 * n^11
   + 6339155669701909/46867049349120000 * n^12
   - 3825933403819459/36248733480960000 * n^13
   + 1576089193435485637/19579096132485120000 * n^14
   - 796020536210393262877/13672055636125286400000 * n^15
   + 2472784862443506933077081/82688592487285732147200000 * n^16
   - 1031884087773262337231/259769057086380441600000 * n^17
   - 3043575175820301204619799099/301647985393618350872985600000 * n^18
   + 1240087853302816440305681741/76309758209695118524416000000 * n^19
   - 162802157643900956474519187209659/7107429831844435583269286707200000 * n^20
   + 12816799444007020333086273455167501/404420161004689889308421652480000000 * n^21
   - 8434093090274924630876141677262180833/219243306107013059992141997015040000000 * n^22
   + 4577121708190925068719017020286339507/116473006369350688120825435914240000000 * n^23
   - 3765607524414111763649498176471170518355049/111925900200691237256588410896148070400000000 * n^24
   + 1131301743028144854789954188008691387730629/46411581213027015448945915575926784000000000 * n^25
   - 460026540064989874633511523684594620842417879/29318721223109392213055526792924758016000000000 * n^26
   + 604271886240145180390884566623502375996747842517/59723660347088844200115576054184610365440000000000 * n^27
   - 935636652514721565914189601103950324131311023910747/134163230603700379611139630048120308724924416000000000 * n^28
   + 13991916555135286064709925920796585055379160510097/3716480422922153591658662648136502628843520000000000 * n^29
   + 551187495544637127580837409130179426064488050021383801799/558977683987257261611852154632488454271525086822400000000000 * n^30;
beta[3]
   = 17/480 * n^3
   - 37/840 * n^4
   - 209/4480 * n^5
   + 5569/90720 * n^6
   + 9261899/58060800 * n^7
   - 6457463/17740800 * n^8
   + 2473691167/9289728000 * n^9
   - 852549456029/20922789888000 * n^10
   - 2673218294321/191294078976000 * n^11
   - 1619588070701683/35150287011840000 * n^12
   + 799518679601909/34085126799360000 * n^13
   + 29003748875152374779/473263464327413760000 * n^14
   - 1018892483578870404121/11218096932205363200000 * n^15
   + 481644368636077473383677/6234457370073130598400000 * n^16
   - 723295134325860384163989341/8379110705378287524249600000 * n^17
   + 18449123896439664237491327/175105254678958021017600000 * n^18
   - 9545551652020360064000248463489/99543835179894055788085248000000 * n^19
   + 1624734283470807394728668252816369/22704289740614169224332443648000000 * n^20
   - 2700625783869782207997557873010304073/43592236301979204910718291804160000000 * n^21
   + 115833584495328576175632817607784109681/1863568101909611009933206974627840000000 * n^22
   - 80331805706465175347621476210358062805003/1550488660788796360264428202890362880000000 * n^23
   + 521874000525184838244754419829212765128887/18500148793502683844064200148123648000000000 * n^24
   - 381143434387098814023111575357004480524467771/143265152256884783688433165947069530112000000000 * n^25
   - 3524924454475074760191004058569251720124879785757/215005177249519839120416073795064597315584000000000 * n^26
   + 38831080481512203835364300143596202089804731885903/1433367848330132260802773825300430648770560000000000 * n^27
   - 8744571180068348778510935237066929988537179992179467/279936740778874830534781728081174105704890368000000000 * n^28
   + 924277626444402405054252433779774364643696474585704740403/27948884199362863080592607731624422713576254341120000000000 * n^29
   - 126306569153879537470902727265265301493989903234598946584327/3458674419671154306223335206788522310805061474713600000000000 * n^30;
beta[4]
   = 4397/161280 * n^4
   - 11/504 * n^5
   - 830251/7257600 * n^6
   + 466511/2494800 * n^7
   + 324154477/7664025600 * n^8
   - 937932223/3891888000 * n^9
   - 89112264211/5230697472000 * n^10
   + 12003335387/32691859200 * n^11
   - 537877266968267441/2249618368757760000 * n^12
   - 63357208977773989/597554879201280000 * n^13
   + 887398150788484759/8825425908203520000 * n^14
   + 2384026112354539199/18578524426076160000 * n^15
   - 367013781018742745596861/2656100181332931379200000 * n^16
   - 116368807092865455691/7292981549216563200000 * n^17
   + 13509292858664313453220237223/388843106171461155422208000000 * n^18
   + 12614093798238667596568634093/279480982560737705459712000000 * n^19
   - 42830094113304502651660706556769109/1538549516540442526260645593088000000 * n^20
   - 1668094745107834360626912832785989/31436708871619618925998768128000000 * n^21
   + 324878397379290831787720619212058141009/5100291647331566974554040141086720000000 * n^22
   - 83347374922531563076841834327924641529/3028298165603117891141461333770240000000 * n^23
   + 61194082538219225945927920756047806920251343/1628013093828236178277649613034881024000000000 * n^24
   - 98047007466353520331537046826194116951241/1156259299593917740254012509257728000000000 * n^25
   + 1493069566723126691789414021618816357112902099/14163713916305654751015551633403464908800000000 * n^26
   - 428919341299773794465717432164006775623731672469/4733778760465280548815978897476564287488000000000 * n^27
   + 17024219401413321980501656137013731587720179574723869633/238879352131306522056347074629268570201506447360000000000 * n^28
   - 1999391624298578429684484594521785906724957573844027707/33592408893464979664173807369740892684586844160000000000 * n^29
   + 11744245649394563850890264467671937396646650052934109768653353/235189860537638492823186794061619517134744180280524800000000000 * n^30;
beta[5]
   = 4583/161280 * n^5
   - 108847/3991680 * n^6
   - 8005831/63866880 * n^7
   + 22894433/124540416 * n^8
   + 112731569449/557941063680 * n^9
   - 5391039814733/10461394944000 * n^10
   + 4863559943251/167382319104000 * n^11
   + 37588208648677/67596705792000 * n^12
   - 940430600213372183/7648702453776384000 * n^13
   - 3291872437542629663/5190190950776832000 * n^14
   + 189272332747364970877559/523171247838304665600000 * n^15
   + 502532269819919668347149/1208525582506483777536000 * n^16
   - 949451228897166389540897/2708180577045341798400000 * n^17
   - 1784576325496520253476120683753/7154713153554885259768627200000 * n^18
   + 524830142025358848902662672939/2071953130441233740385484800000 * n^19
   + 2016209403231616185652826723458583/12019918097972207236411293696000000 * n^20
   - 16096897691007333935470338878197156361/100005718575128764206941963550720000000 * n^21
   - 76250060255013791707276485885487883543/490412658397266055245580782796800000000 * n^22
   + 9252161795915253082728155240170650043693/58289047398075051137760458755276800000000 * n^23
   + 7020751793938461613149395590976276678732551/107300863002315566295572360859117158400000000 * n^24
   - 579414190481675218910106244870862973300742643/8393311950403350963564771338313164390400000000 * n^25
   - 14173007029062232289088502554662276328011078147/150540045053305816210793863075031112744960000000 * n^26
   + 772937441939971334194668845837513587924053359303309/7321000085750240746251238393754144640860160000000000 * n^27
   + 49025366795674025628029223704689793073534968814712031/2399457778104641404583843383552920906041917440000000000 * n^28
   - 669686609255507094686692239475289306509135059892997117053/9137135219022474468655275604569522810207621611520000000000 * n^29
   + 40227222695357598417206145371640258351589316954641039386851/1130720483354031215496090356065478447763193174425600000000000 * n^30;
beta[6]
   = 20648693/638668800 * n^6
   - 16363163/518918400 * n^7
   - 2204645983/12915302400 * n^8
   + 4543317553/18162144000 * n^9
   + 54894890298749/167382319104000 * n^10
   - 132058444054073/177843714048000 * n^11
   - 21678380925301381/85364982743040000 * n^12
   + 12818665941423773/9855505820160000 * n^13
   - 4808615626581842484821/26158562391915233280000 * n^14
   - 17463465220672744627/12110445551812608000 * n^15
   + 165202773463857304705337/353370053364468940800000 * n^16
   + 812997634361998476236143/536189976806503219200000 * n^17
   - 154619327801320908736885805799083/176116016087504867932766208000000 * n^18
   - 161959155482489360388164840926603/143094263071097705195372544000000 * n^19
   + 9349367148014299101273724109539769/10684371642641961987921149952000000 * n^20
   + 131732029936307954433180838298519269/162769724243373639659736268800000000 * n^21
   - 8489365993766826694602346374698947667527/12000686229015451704833035626086400000000 * n^22
   - 235155180584267064004207367582121161331463/369771144431538605655167910228787200000000 * n^23
   + 10739171442634029743650624432194704913120097/17833938449138321267962165239742464000000000 * n^24
   + 1762807308141499286674865995442897164018384597/4035617016594442070601857542605766656000000000 * n^25
   - 558496189945509263731011585527531303192423984003189/1264536378447768856170668449830261347057664000000000 * n^26
   - 97808507187022352611022156010465649331807161947569/289789586727613696205778186419434892034048000000000 * n^27
   + 32615652758302709344528899560237170963687405836157/90059147187314916442820962074212161290240000000000 * n^28
   + 943749252435341852900014209629694019211039392602319/4138675144863930994107684407508081919918080000000000 * n^29
   - 2396490245787484054215780490518037472472963419615505648060407/7617485361542947135973661346125328490194143490867200000000000 * n^30;
beta[7]
   = 219941297/5535129600 * n^7
   - 497323811/12454041600 * n^8
   - 79431132943/332107776000 * n^9
   + 4346429528407/12703122432000 * n^10
   + 947319776978297/1625999671296000 * n^11
   - 139564766909992667/115852476579840000 * n^12
   - 3704835620812833323/5560918875832320000 * n^13
   + 498841790610177443141/204363768686837760000 * n^14
   + 39982484505071686289633/174390415946101555200000 * n^15
   - 356813950170946951528704559/99271744277318310297600000 * n^16
   + 15060663961223625760663/21138232235891097600000 * n^17
   + 38394769836703949013594096271/9359907317575726399488000000 * n^18
   - 175303180605302340156213620047457/109024200435122061101236224000000 * n^19
   - 4999297133725717096793715285507829/1226522254895123187388907520000000 * n^20
   + 130827473840213685129346417144165899127/55558732541738202337189979750400000000 * n^21
   + 36940598630244479002168059481052336008621/10875621895045253107504938536140800000000 * n^22
   - 526486046546475419696035545214440337907/215492198539596346402574633533440000000 * n^23
   - 181704492729012922104603484325333564859103969/66558805997676949017930223841181696000000000 * n^24
   + 16251647159655239438323473490445618080618846399/7202872969057694555540376223685699174400000000 * n^25
   + 341205978466077200076092703065430429896507462203/161292905414256231654421996151819049369600000000 * n^26
   - 897269639413978000885629059505489580735895982361633/465305593801127068287908304050096166666240000000000 * n^27
   - 399121663633099371655729890858867495172854098268708589/248291717908219414909110750124171815494772326400000000 * n^28
   + 40132241906468687661336733055001237954868039321697804833/25223285628771496117750933345947613002643537920000000000 * n^29
   + 1896891499373733290268263706761724164585169669418091941816783/1593777443203777332318298787597055335894786569666560000000000 * n^30;
beta[8]
   = 191773887257/3719607091200 * n^8
   - 17822319343/336825216000 * n^9
   - 497155444501631/1422749712384000 * n^10
   + 4081516004323/8281937664000 * n^11
   + 3016420810780677019/2994340933140480000 * n^12
   - 41961075720314059/21502921789440000 * n^13
   - 14085528104367162867569/8992005822220861440000 * n^14
   + 10746171896356804622543/2308215780257587200000 * n^15
   + 13662158833536453560398591327/11118435359059650753331200000 * n^16
   - 57341614923409542539239823/7238564686887793459200000 * n^17
   + 144453057736406779924709655689/542023723754157974224896000000 * n^18
   + 887382930255915812302412329/81992895194724433920000000 * n^19
   - 2060398135313747799783225762752903/741970252961247360272302080000000 * n^20
   - 10832617062792890567329480261903684747/885060375573344165649815961600000000 * n^21
   + 10495965053853858396700728872356351447/2011024758699196210707274137600000000 * n^22
   + 2827633829976426948425669998692889423/232406442150553432674163438387200000 * n^23
   - 413070973425124733081767504737914466664159819031/59317777392239837516214863018588110848000000000 * n^24
   - 192169586323003861221251799348718483715643402161/17652874435161653033977716034322300928000000000 * n^25
   + 1383590112272607978551162261646356694508727283546677/183025002143756018656280959843853616021504000000000 * n^26
   + 42340030181859331179384696226318556087021301196292587/4618521538471343283279589846059743591792640000000000 * n^27
   - 41375761937244157344578465659087922365834839154673258123/5675239266473586626493960002838212925594796032000000000 * n^28
   - 20325331939679357943380416802660356668728866279500649633/2734164750775035223701517188867368206341242880000000000 * n^29
   + 26392423128042468212590130065257380662845826882235929755361/4017520183960092210271288782654341375876703191040000000000 * n^30;
beta[9]
   = 11025641854267/158083301376000 * n^9
   - 492293158444691/6758061133824000 * n^10
   - 3340781295639871/6360528125952000 * n^11
   + 230755947172792843/315376186245120000 * n^12
   + 2325760279413600365521/1332149010699386880000 * n^13
   - 348782269044368632301/108224036583505920000 * n^14
   - 136098374245460277375071/40852569661447864320000 * n^15
   + 239596529464231037411713/27496921887512985600000 * n^16
   + 35364463403763955482475445281/9177121248747648240844800000 * n^17
   - 184592588983229841779643912853103/10840474475083159484497920000000 * n^18
   - 104873550118556639023307009752009/57815863867110183917322240000000 * n^19
   + 7665339074386065543669975721317792709/290481354034328341546606264320000000 * n^20
   - 138062270900799459529491732714711746071/42901861518916185828421848268800000000 * n^21
   - 17357777314150207521711937000950161082441881/505716418119604269498979641930547200000000 * n^22
   + 4926642534361691999909217208854551999460491/475968393524333430116686721816985600000000 * n^23
   + 10015652615289525910183306384331679276443744239/259601094634730191676142882857680896000000000 * n^24
   - 116738227431164324545575763544019189664534311289453/6778703783102074765047442957179763556352000000000 * n^25
   - 84974069676491141925432663367251874389066142853087/2178869073139952603050963807664924000256000000000 * n^26
   + 3976320059916609695369389466291419325879319135434479/178432977000364290589635917840602808451072000000000 * n^27
   + 1586328506886857290329263116615881138694586692983247121/43790426438839402982206481503381272574033920000000000 * n^28
   - 80406545804397163817501103989422456991161536019523815972843/3266415488925908747248745868300215883842338160640000000000 * n^29
   - 96019711772725383787880372103741416386264796387585150918847311/3025517346617622977139150860513074962408965721292800000000000 * n^30;
beta[10]
   = 7028504530429621/72085985427456000 * n^10
   - 1396721719354981/13516122267648000 * n^11
   - 242069739433316973869/299733527407362048000 * n^12
   + 19998425063839930261/17952789402003456000 * n^13
   + 2005763449529247335066903/661811628515455401984000 * n^14
   - 1210830366517042702115957/224800145555521536000000 * n^15
   - 1753821857771614575775682513/258106535121027606773760000 * n^16
   + 332272605573163585761859289/20456813245552459776000000 * n^17
   + 344973470391758976060874801536373/34689518320266110350393344000000 * n^18
   - 2237438243573786540754649786424759/62874751955482325010087936000000 * n^19
   - 1109701881606701094584605721502811981/126755499942252367220337278976000000 * n^20
   + 627358150977452113555749190570504329703/10130537221947200911437893468160000000 * n^21
   - 9310014587788716960656374062579608860273/311210103458218011999372087341875200000000 * n^22
   - 446788868484797840813986816673961950907461/4958004099211806563715486685593600000000 * n^23
   + 1592669172541355914905142337333376652510632300857/95325521949872926383479666585340425011200000000 * n^24
   + 112875421374453323075239925362172217825744049933/992974186977842983161246526930629427200000000 * n^25
   - 11164164940636962806588613537158861808945650584917881/292840003430009629850049535750165785634406400000000 * n^26
   - 36738853303604438684911490335783868504502367676508134849/287806815871056339337001809354459811193815040000000000 * n^27
   + 216582649507727909201718946529683408391594400595766366243093/3674717425041647340654839101837742869322630430720000000000 * n^28
   + 4070973538524250670523695550641268121153963563101596930691/31101124040066025669604758023366313347131637760000000000 * n^29
   - 2373100737803367912157154987764399515404306692774646531223199381/31685418030031833360584561739191475969955713735720960000000000 * n^30;
beta[11]
   = 20180430688893997/144171970854912000 * n^11
   - 39227670225311092139/261131482210959360000 * n^12
   - 15850794471105785046511/12534311146126049280000 * n^13
   + 250199410574189500301/144626667070685184000 * n^14
   + 137588598842474725924656737/26071367183942182502400000 * n^15
   - 2668119315218475090518868331/293302880819349553152000000 * n^16
   - 147889032611857077276756370409/10949974217255716651008000000 * n^17
   + 107809340048140291312939137043109/3572429088379677557391360000000 * n^18
   + 6793119291340068971080115425271339/288802688407957090955427840000000 * n^19
   - 6754847041326342703335830346240936391/92384494472017791155888455680000000 * n^20
   - 64145623999655583749753779305277081997/2304645453495497585824314163200000000 * n^21
   + 2737268880658025692322671196199068915388587/19450631466138625749960755458867200000000 * n^22
   + 63226986025671434632048293692546868186915331/3847688551847059057446782170772275200000000 * n^23
   - 1090700244153262995408297323217157326170412252281/4814420300498632645630286191178809344000000000 * n^24
   + 55625038880876569156054733788858925319816102829/3136997842858837560953670640406102016000000000 * n^25
   + 6071056974043791221702396204511472430847588724030069/19238423520792536051938623619950522138624000000000 * n^26
   - 1146269064361582904187395791106052397722761459105729423/15595948667522482559438244214573223280377856000000000 * n^27
   - 106019806434003656675170902610826150161372006096027080991357/271427991622394405843823342749378734665876111360000000000 * n^28
   + 261700017996377874094049879699967368736409082839966183897/1848807094916266706471338222217990529865482240000000000 * n^29
   + 5564919878581209713189603625962524384371461254179337341860987383/12686544328430714529140303040105962058283049444966400000000000 * n^30;
beta[12]
   = 170866240186706518133/831839653739888640000 * n^12
   - 213377450872182833497/957482101440184320000 * n^13
   - 6175888888953945958057483/3072696846678900080640000 * n^14
   + 1699533901862334396426791/622363365936119808000000 * n^15
   + 1110507543583378006712775869269/120449716389812883161088000000 * n^16
   - 410039885606415108766607293/26460299485682270208000000 * n^17
   - 1868368333536354056091172181516467/70734095949917615636348928000000 * n^18
   + 38905214964730326413906323913167/694966079629641887907840000000 * n^19
   + 2767874903566891102867927978915243454399/52392273309464311784406075310080000000 * n^20
   - 20032373737511717465214006054179506710383/135073829625962678819171912908800000000 * n^21
   - 100577682847890502637160841018962740658759229/1322642939697426550997331371202969600000000 * n^22
   + 135919298571923883567006460953143491460279/435079914374153470722806372106240000000 * n^23
   + 3510216107422604000609260948095627318487208075137/48884883051216885324861367479661756416000000000 * n^24
   - 101070009063831782999779504525998847565124914603267/183700224590900951884830607482166444032000000000 * n^25
   - 290915990038543653257693921668246116917159442076793/22092475361789230960742705145987138060288000000000 * n^26
   + 87749504586448696585237158790684148758827946213899707/104709128016813542574353446264834873098240000000000 * n^27
   - 24637643848282085933220710334515754322900635607050021800141/214101183307748640575968216577661209193027207168000000000 * n^28
   - 21317214475850887868873427382826252613387447653666787141648689/18832926803338442620856050396918432205278480957440000000000 * n^29
   + 3923499613488828643584115055056306377586308324262330823616543131/12820086900308932576815464124738656395738660491755520000000000 * n^30;
beta[13]
   = 18814610183483742537419/61278854492171796480000 * n^13
   - 46368551984271450700489/137877422607386542080000 * n^14
   - 23268635133649915499415221/7193604657776689152000000 * n^15
   + 445607162860807165073496089/101984636074370531328000000 * n^16
   + 133255376497039560923384901787/8246409857103065776128000000 * n^17
   - 17940677571433980181912441444683151/674694453676137256839020544000000 * n^18
   - 2757949059159666555325445738852023379/53975556294090980547121643520000000 * n^19
   + 24878591848279833324547251174969715273/239776028921827240507405762560000000 * n^20
   + 15564548980094931213936099440270052236488729/135655686122812979589469884225945600000000 * n^21
   - 30311212070549573455862406697198244599608233/101741764592109734692102413169459200000000 * n^22
   - 62329425035966782423701548637355352965648981/325573646694751151014727722142269440000000 * n^23
   + 623169776009883975758448302456707372300199400409/915354591546065160435157184588808192000000000 * n^24
   + 9796262122721002376057350329922999007473366798297439/42296704966160578933387743185479648935936000000000 * n^25
   - 6972722553962255796263966532090565610961098085631862003/5361107354460853379806896448759545502629888000000000 * n^26
   - 204621385793344479983894287397851209945711725896319703509/1286665765070604811153655147702290920631173120000000000 * n^27
   + 16994612718512721017891137595235443147803252876143561437699/7912994455184219588594979158369089161881714688000000000 * n^28
   - 2017139943063547149336991050682980115243753114376812382829593/20257265805271602146803146645424868254417189601280000000000 * n^29
   - 38559351426567355385426086606064720807546966166200767527984103843/12275103449081224916667438321865150759482563588259840000000000 * n^30;
beta[14]
   = 8913139575903156465851797/19119002601557600501760000 * n^14
   - 267685764482874813822622157/519797883229847263641600000 * n^15
   - 1312607511537430955013430449229/249502983950326686547968000000 * n^16
   + 394441446207451421108383701253/55778311315818225598464000000 * n^17
   + 23930383074197527389616417665944303/842355620435993694012702720000000 * n^18
   - 3163985271870363313136985965093069527/68915219196919734091414241280000000 * n^19
   - 11031130611852394131866851413708829814267/112469637729373006037188041768960000000 * n^20
   + 82762604768504677943482108437799827136297/430547831932756038736110472396800000000 * n^21
   + 5150460631556395571372500982024919497071310731/21162287035158824815957301939247513600000000 * n^22
   - 29066497085581091842637088116335089148411714769/48937788768804782386901260734509875200000000 * n^23
   - 18574016067923889310355562046347950371431867757801/40573875779227237760776317990793641984000000000 * n^24
   + 2915644146751542300994700670854893964155460634998359/1994459581272638906178160881234949963776000000000 * n^25
   + 44136416359780678842389174803925334595468092209791307/67329448721643370547025387111579849326592000000000 * n^26
   - 19779807925985904471082228799863307496144797516514281/6575618800968119560003273400983467589632000000000 * n^27
   - 9437414987664054735309211086890504857237214217749919547327367/14401649908435279651242862068231742274624720732160000000000 * n^28
   + 10935173238809263052452436833453551042581316812365555123043/2044824288298806744648942931549704531015106560000000000 * n^29
   + 9844133982291098741335196902427881991238566220082170652715161789559/44842293877181429376249317540178305362708067588977459200000000000 * n^30;
beta[15]
   = 602749854274775522930992007/840077387038136991744000000 * n^15
   - 432388677389347815771203181653/541421475172208909809090560000 * n^16
   - 509985088489059649186381056338807/59064160927877335615537152000000 * n^17
   + 557542563821291613858429695152674917/48240653437843813863989968896000000 * n^18
   + 228594885325983207294554048445139632797/4563985299162962563827920535552000000 * n^19
   - 4879838474674757743673587551351918389761/61233469430436414398024600518656000000 * n^20
   - 2751159808671003044739048717767661132425533/14696032663304739455525904124477440000000 * n^21
   + 128125601507169052141729932672077247523358897/359836682123564576374273975989043200000000 * n^22
   + 30192393359192032330697554623405270813965905808153/59508351142866615382471933053164008243200000000 * n^23
   - 4779918733110943106587948891017151456334707858595371/4061444965500646499853709430878443562598400000000 * n^24
   - 43635999640355928220666371208517025763949804332853/41311582611576823901881341954262617292800000000 * n^25
   + 1093615732500524413310474447806551664943154712853580337/352628986416409072575533830586857805787955200000000 * n^26
   + 12242342315633438381845240050057352332923530458934703251/7112724086411810733447920053364873798615040000000000 * n^27
   - 201490867217252848518061423700123290704826593788569337593504193/29489092669653191666830622330188805609945856737280000000000 * n^28
   - 177101515631733926913192960801449153246340895052913001485847913/83263320479020776471051168932297804075141242552320000000000 * n^29
   + 3188424179872321062468258619737006762022989524905745242529616829657/245231294640835941901363455297850107452309744627220480000000000 * n^30;
beta[16]
   = 258111286167289650792323028754789/231006496073475801518545305600000 * n^16
   - 5263782718468783726282279549/4203582881771808305971200000 * n^17
   - 5480008133286071057255185152124708229/383668354827295829561557647360000000 * n^18
   + 3254656358469551348762078052918542501/170852314259030174101631139840000000 * n^19
   + 3903418284121815685136619157954211820691189/44088097989914218366577712373432320000000 * n^20
   - 1475869269349982196110739285641411486418113/10620179854341315622157391652454400000000 * n^21
   - 165406053235626113240302780087909075941876233947/464908993303645432675561976977843814400000000 * n^22
   + 31141324189381440915034448751509805569920381009/47217319632401489256111763286812262400000000 * n^23
   + 3425331498104147467678431771772144489569980472050747/3281975729697492121093906610810863484928000000000 * n^24
   - 181114801957939134097279485499338367321177700348427827/78055895430715549919063478124695087218688000000000 * n^25
   - 20329880662120223623532772221831681492746536794968375279/8563846812969934619691535885680832426278912000000000 * n^26
   + 15514402521245792750246961997116209460024931536101177881/2381963776692158394304324203418114597060608000000000 * n^27
   + 58528872092571805627208033537162293354868952581483996308205593/13610350462916857692383364152394833358436549263360000000000 * n^28
   - 2739294316618535857897844520835697665418072257962762663947501/179187195041295435475533295409133367421546004480000000000 * n^29
   - 28963918619355858559987610778078259702157647632421717394029814967389/4700266480616022219776132893208793726169270105355059200000000000 * n^30;
beta[17]
   = 5972486266662395092991359700731/3397154354021702963508019200000 * n^17
   - 14169262403755308738265442730293527/7146763472273157609479995392000000 * n^18
   - 1407123059162889531671157095700694121/59145628736053718147420651520000000 * n^19
   + 31616271318862027601140911742786459816003/999546339232123823261872155525120000000 * n^20
   + 33847994330735322699501662950595147934349517/215760061865017024098184001381990400000000 * n^21
   - 86502185255596416338989303038079495440176441813/355518641938081801457782688277174681600000000 * n^22
   - 1381419926651852376155125702746693024900887647/2049837214778129305702530815291817984000000 * n^23
   + 2039800582062773533252062008847436810010590704673393/1669644822047391442119004879672622186496000000000 * n^24
   + 6658940828673534449931395737435432548555706698080023117/3134479879256969534004745160772069384781824000000000 * n^25
   - 1381470469487772782735900360391332279866899387998419366549/303260928318111802414959094304697712977641472000000000 * n^26
   - 1395295684620560872662304928419977863449010608559002595498087/266869616919938386125164002988133987420324495360000000000 * n^27
   + 3800355884806913283793161651067966638660881579408061104605403/280213097765935305431422203137540686791340720128000000000 * n^28
   + 14254272866295825003590094337320088635299910217415520581006075573/1374912266371522565316844943394866303189511800094720000000000 * n^29
   - 702046212944594816164772022402471437675208441448777951843503358652627/20791767020136757113362658445253016953407594818982379520000000000 * n^30;
beta[18]
   = 32561519486094387080527719588034341533/11663517986749793218671352479744000000 * n^18
   - 729907719647457582367271201256463879/230528934567170058275021389824000000 * n^19
   - 2367236104332471655932050118751689811238261/59375350358064550788705233330503680000000 * n^20
   + 277337936278972764824727659347223162007380783/5246368848044609917345751476312473600000000 * n^21
   + 2072215526282883572284838680097819963389051894913/7438543892858326922808991631645501030400000000 * n^22
   - 21187399770302239981520985962108187969123956327017/49559298686168603123214906745838150615040000000 * n^23
   - 117781246505279918774486020036924169110810872979542077/92510690880848059163334492592231214481408000000000 * n^24
   + 15346233021039229146148984542248316965482710596146903/6780613138425795245494403150226037879603200000000 * n^25
   + 23577648358032142021574052998960694124312121496108401309501/5499131500168427350457924910058518528661232025600000000 * n^26
   - 25523104372278110417409133482492688317169934216303321881481/2864130989671055911696835890655478400344391680000000000 * n^27
   - 4904614526502535650801519867527379473641587091534278367071269/432842750524368215007154889587272725078179640770560000000 * n^28
   + 21605254007739675177136169588021592098439361907000904630780859/770695057717401985738931667124429059082325852160000000000 * n^29
   + 587901467817860255311504068569140875259033445501764848866062463918953/24168207818278623653139500414994959877465238422064988160000000000 * n^30;
beta[19]
   = 428624286990709813412232185601376712413/95900036779942744242408898166784000000 * n^19
   - 7696493507391194218978151080255673578313/1510425579284098221817940146126848000000 * n^20
   - 527610184507500637130291508233596994938727387/7854213012277310753453288759859609600000000 * n^21
   + 11361451298084078444421426214576116338438506193/127861967714573279471658686134773350400000000 * n^22
   + 413731746541624122896290630838483865650422207002637/834682925240734368390987903087800431411200000000 * n^23
   - 193620425636569480838170976533462900238070466349524697/256949550508766977723998435166460382806016000000000 * n^24
   - 132662492287173341243380190879466905201764211256445800247/55272703309441429874851218942474144568049664000000000 * n^25
   + 13146789691243844636190690725166722508695370878744595367/3135216364191005476094501914804205679280128000000000 * n^26
   + 37750506608225008520506075562486792560657544757045773087576929/4393516640660880377892173691299384803425131692032000000000 * n^27
   - 708261955363343231843730776055545581965081551994723487001141417/40755647785077903505447137531132451137035761090560000000000 * n^28
   - 41215834581264644962808643579846154211341882270808962207078377401/1700549382091093699207676640514703059208080384327680000000000 * n^29
   + 205978745011375578132532475847110147598943760061270638697653240745727/3577530762574138369708149732482806560808999108529356800000000000 * n^30;
beta[20]
   = 4413022171315891282875633078306076423077823/612225834803154479243538405896749056000000 * n^20
   - 20372356369389063598321199048537111545322489/2467109651840332692314561267713966080000000 * n^21
   - 8350441420653344994230757754481656794198878169653/73421183238768300923281343327167630540800000000 * n^22
   + 3602842136240118426653037995310224523478929843329/23998309048482544305160371509809014374400000000 * n^23
   + 556742892772424708949943649093699359972707482370822028429/630108817727632300573303895944205248075766169600000000 * n^24
   - 19669578953730635368229268600445326314943118813499628227/14768175415491382044686810061192310501775769600000000 * n^25
   - 58913853325627285400915530112249848640529228986228560671583/13043252526961988621867390646045048635168359710720000000 * n^26
   + 6202219939216563039972447651959676151814355411005403328908487/798219881207309199515322083807444382620980346880000000000 * n^27
   + 4029539464888473312146356584746881268371745066400450670075103971919/235404621606609970647462666379821037767518556059074560000000000 * n^28
   - 96689844226844260169337694369507826490314199510140141134776628313/2860820054246996171062914348365880667313593563217920000000000 * n^29
   - 1267431993370297356535644841552515784699654333219083107594851764271651/24717485268694046917983579969881208965589448386202828800000000000 * n^30;
beta[21]
   = 6364309775760426912861320334716314963236880099/543860616583468895728009950571612078080000000 * n^21
   - 163511162729184839208619679935376666925954633509/12142734151027065152696529857954646589440000000 * n^22
   - 293082088716477537348152181351392414509711063444079/1515413222048177731056526926272739894362112000000 * n^23
   + 3584068349124466527596686906788906996841447765124034119/14064928967134649566368390534468867144548352000000000 * n^24
   + 65325328354812776334115933271141213585155594697569614279619/41407150879244408323388541733476344873550348288000000000 * n^25
   - 295262389665020199502850268061912716873799689551659695461801/125108748728002748005666808237574956296512838041600000000 * n^26
   - 198220070520799681801810036957883626038127951175197474869802841/23353633095893846294391137537680658508682396434432000000000 * n^27
   + 9203041943910402313157326557559771543787851843067288847306443759/639119373821137442471502141656207383123249625825280000000000 * n^28
   + 223639420140739590352779061494286234859561093634481454398610059052269/6591329404985079178128954658634989057490519569654087680000000000 * n^29
   - 7514702451752062815378233648033968164404526829002371317311008928464377/114599249882126944801560234405812877931369260699667660800000000000 * n^30;
beta[22]
   = 4597258274619973879852787439286345056927543926539/240541781277488528739131258138530141962240000000 * n^22
   - 90547738027796418205837133798540945489664737617/4100143999048099921689737354634036510720000000 * n^23
   - 120833998747258442540330733531559589117031890572073705423/365972293124634922050151252694866684488450048000000000 * n^24
   + 700385303317244963533430016841479945264946535743006370213/1612565416580422625283478957186756328527233024000000000 * n^25
   + 41927528317378886896874815834318257768184011744864991769792173/14861402879205174914612542069433146323706979549184000000000 * n^26
   - 1883738571943229874285781147684391885621206162239253551981097/449437587072737144595137360970760473499203010560000000000 * n^27
   - 1193194903894549620369066288907357112160028172942643483767868101/74901470511194081569647212029943057471483176927887360000000 * n^28
   + 16593315611956986881113970672924159996956254881446619306408644351/621740722016747747404298146732925770026959964733440000000000 * n^29
   + 11172709187913729666978241526344191734961305583177742422182451010341965837/166856507828376831631071701294863550268073643578716114124800000000000 * n^30;
beta[23]
   = 105692798364122771092494104410403169316822970007103/3367584937884839402347837613939421987471360000000 * n^23
   - 4991587424316475527559827056175081831817518759624141283/137107011264808880217339273654526141942412083200000000 * n^24
   - 1094971199704775675327145588577419573356229203017369297031/1935628394326713603068319157475663180363464704000000000 * n^25
   + 55016459854774144990504572561411573956468991982011620879183/74037786082996795317363207773444116648902524928000000000 * n^26
   + 239397211441168562919535061028225053930721123237942287411752901/47384183093117949003112452975004234655297615953920000000000 * n^27
   - 3785206531097832093379025924494221733602175663051851724063493677/507484600927293233823334371362295353158237466866483200000000 * n^28
   - 2878530207214341630613762260409649820059076958972834659710423583641/96377945080452906319144544961326352286747011098817331200000000 * n^29
   + 4793620231717494054901024202427349307198672366940440795548189424277463/96899050172071924049425843362418567717916189402962329600000000000 * n^30;
beta[24]
   = 674454707484204643577912579775944698106967657841301509703/13020743263341849785801510375449192318660037836800000000 * n^24
   - 14426118473738594318758580084527169080893428452291501/239224795864861496358580131547117377080524800000000 * n^25
   - 8831250255802996377564597692702488675170603573810490306068589/9081968426180940225596553486875811642265376391168000000000 * n^26
   + 8524975532343064334059520385109401209472880856691153037771/6682542557352665505329874016485837860046372864000000000 * n^27
   + 3849014409982539112685345447510980453367887363991057306125975552515257/424866107896329895356895535704513669664076407260619735040000000000 * n^28
   - 7018181262756669326759909066253824968190524410099850934366975116824761/527763368402472291888643673257950574035844912144051077120000000000 * n^29
   - 850361604060552572056063294333220546778996672875303006775383312452755647779/15199585009991202006392937789828976532232333469748671021056000000000000 * n^30;
beta[25]
   = 199227752516955126043105919223151730212773157895262123371/2319787592894237605516361043901867597002650419200000000 * n^25
   - 1168128087731386349278531921296393465205853015166911689601/11643549264334538750764812162661296977263303065600000000 * n^26
   - 27390759516798680521492333486028666245475773964938356987895799/16337932618526559135993799923480296076032952238080000000000 * n^27
   + 16623553892978221252992741635428809183176541795604885967233054812289/7566499905411789131019980978608610380442220962638725120000000000 * n^28
   + 1391206775167565949946814294410548218174156897307634862471204069769203/85538095796791963737570611176977111081466475155984220160000000000 * n^29
   - 309601436775289074939542822961271536740569529708755160589227851116770297/13036681100187385736477373542933235232324028706996910817280000000000 * n^30;
beta[26]
   = 20988866881167764922693397699209941026240719371894993737321/146779287695853579403580662414154531592167699251200000000 * n^26
   - 20776782371826844247557167727961747229906685936639469810900161/123982629575591320352462040782956155904259153461248000000000 * n^27
   - 56519161473334888467049876826142477266800694645666348046158762501/19499565911122788086072327775906636264771992816713728000000000 * n^28
   + 713184336250531653186104175190769152673340166708863511978540935479/187949917522247967196810424949412597591112860450160640000000000 * n^29
   + 222786377756937595153775101581958876025910578503920819534055082789529097879/7621444335494163969017541455868660597358662936398194016256000000000000 * n^30;
beta[27]
   = 1159063206283901297028135487345019691847337244400674181558705769/4849098401178682751562959817288951875366580224262144000000000 * n^27
   - 836866364429699038099446680535614249403163042061868319644600230131/2978558692924005880147548067769738689443921902753021952000000000 * n^28
   - 276258332981610143691601963914139654258026350011955431757944008776431/54988775869366262402723964328056714266657019743132712960000000000 * n^29
   + 231942644768785218497452105692225263551992039422426853153865797716482578787/35296814078757346881512488867491734391517307724194136037785600000000000 * n^30;
beta[28]
   = 4820642953919212694667891843709465549522940845258602976903974801919/12021570220089681390145058868115702097935828940841025536000000000 * n^28
   - 1407966726686721532660580475865160144206500909159825439202238905333/2978558692924005880147548067769738689443921902753021952000000000 * n^29
   - 2269078966250518419628311750199082816400532696920651885729048451938814396007/259963837024498554809869759278034361232762393397239351135436800000000000 * n^30;
beta[29]
   = 2257448691193994841515777396189088185825275740674810644118087064739/3344346602581339935604264497144969756568614066249007104000000000 * n^29
   - 190079826774799091739713735364123004573671877623337777048243884284125889/238239614545595134106590801450823661272646492861713602314240000000000 * n^30;
beta[30]
   = 46619651201884945136956267547124218081125978370322440448000334604980392416839/40900977025187772623419508793077406167287949894498991245308723200000000000 * n^30;
    
geographiclib-1.21/man/0002755000175000017500000000000011757437426014651 5ustar frankiefrankiegeographiclib-1.21/man/GeoConvert.usage0000644000175000017500000003003211745620415017733 0ustar frankiefrankieint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " GeoConvert [ -g | -d | -: | -u | -m | -c ] [ -p prec ] [ -z zone | -s |\n" " -t ] [ -n ] [ -w ] [ --comment-delimiter commentdelim ] [ --version |\n" " -h | --help ] [ --input-file infile | --input-string instring ] [\n" " --line-separator linesep ] [ --output-file outfile ]\n" "\n" "For full documentation type:\n" " GeoConvert --help\n" "or visit:\n" " http://geographiclib.sf.net/html/GeoConvert.1.html\n"; else ( retval ? std::cerr : std::cout ) << "Man page:\n" "NAME\n" " GeoConvert -- convert geographic coordinates\n" "\n" "SYNOPSIS\n" " GeoConvert [ -g | -d | -: | -u | -m | -c ] [ -p prec ] [ -z zone | -s |\n" " -t ] [ -n ] [ -w ] [ --comment-delimiter commentdelim ] [ --version |\n" " -h | --help ] [ --input-file infile | --input-string instring ] [\n" " --line-separator linesep ] [ --output-file outfile ]\n" "\n" "DESCRIPTION\n" " GeoConvert reads from standard input interpreting each line as a\n" " geographic coordinate and prints the coordinate in the format specified\n" " by the options on standard output. The input is interpreted in one of\n" " three different ways depending on how many space or comma delimited\n" " tokens there are on the line. The options -g, -d, -u, and -m govern\n" " the format of output. In all cases, the WGS84 model of the earth is\n" " used (a = 6378137 m, f = 1/298.257223563).\n" "\n" " geographic\n" " 2 tokens (output options -g, -d, or -:) given as latitude longitude\n" " using decimal degrees or degrees minutes seconds. d, ', and \" are\n" " used to denote degrees, minutes, and seconds, with the least\n" " significant designator optional. (See QUOTING for how to quote the\n" " characters ' and \" when entering coordinates on the command line.)\n" " Various unicode characters (encoded with UTF-8) may also be used to\n" " denote degrees, minutes, and seconds, e.g., the degree, prime, and\n" " double prime symbols. Alternatively, : (colon) may be used to\n" " separate the various components. Latitude is given first (unless\n" " the -w option is given); however, on input, either may be given\n" " first by appending or prepending N or S to the latitude and E or W\n" " to the longitude. For example, the following are all equivalent\n" "\n" " 33.3 44.4\n" " E44.4 N33.3\n" " 33d18'N 44d24'E\n" " 44d24 33d18N\n" " 33:18 44:24\n" "\n" " UTM/UPS\n" " 3 tokens (output option -u) given as zone+hemisphere easting\n" " northing or easting northing zone+hemisphere, where hemisphere is\n" " either N or S. The zone is absent for a UPS specification. For\n" " example,\n" "\n" " 38N 444140.54 3684706.36\n" " 444140.54 3684706.36 38N\n" " S 2173854.98 2985980.58\n" " 2173854.98 2985980.58 S\n" "\n" " MRGS\n" " 1 token (output option -m) is used to specify the center of an MGRS\n" " grid square. For example,\n" "\n" " 38SMB4484\n" " 38SMB44140847064\n" "\n" "OPTIONS\n" " -g output latitude and longitude using decimal degrees. Default\n" " output mode.\n" "\n" " -d output latitude and longitude using degrees, minutes, and seconds\n" " (DMS).\n" "\n" " -: like -d, except use : as a separator instead of the d, ', and \"\n" " delimiters.\n" "\n" " -u output UTM or UPS.\n" "\n" " -m output MGRS.\n" "\n" " -c output meridian convergence and scale for the corresponding UTM or\n" " UPS projection. Convergence is the bearing of grid north given as\n" " degrees clockwise from true north.\n" "\n" " -p set the output precision to prec (default 0); prec is the precision\n" " relative to 1 m. See PRECISION.\n" "\n" " -z set the zone to zone for output. Use either 0 < zone <= 60 for a\n" " UTM zone or zone = 0 for UPS. Alternatively use a zone+hemisphere\n" " designation (hemisphere is ignored), e.g., 38N. See ZONE.\n" "\n" " -s use the standard UPS and UTM zones.\n" "\n" " -t similar to -s but forces UPS regions to the closest UTM zone.\n" "\n" " -n on input, MGRS coordinates refer to the south-west corner of the\n" " MGRS square instead of the center; see MGRS.\n" "\n" " -w on input and output, longitude precedes latitude (except that on\n" " input this can be overridden by a hemisphere designator, N, S,E,\n" " W).\n" "\n" " --comment-delimiter\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\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\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\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "PRECISION\n" " prec gives precision of the output with prec = 0 giving 1 m precision,\n" " prec = 3 giving 1 mm precision, etc. prec is the number of digits\n" " after the decimal point for UTM/UPS. The number of digits per\n" " coordinate for MGRS is 5 + prec. For decimal degrees, the number of\n" " digits after the decimal point is 5 + prec. For DMS (degree, minute,\n" " seconds) output, the number of digits after the decimal point in the\n" " seconds components is 1 + prec; if this is negative then use minutes\n" " (prec = -2 or -3) or degrees (prec <= -4) as the least significant\n" " component. Print convergence, resp. scale, with 5 + prec, resp. 7 +\n" " prec, digits after the decimal point. The minimum value of prec is -5\n" " and the maximum is 9 for UTM/UPS, 9 for decimal degrees, 10 for DMS, 6\n" " for MGRS, and 8 for convergence and scale.\n" "\n" "MGRS\n" " MGRS coordinates represent a square patch of the earth, thus\n" " \"38SMB4488\" is in zone \"38N\" with 444km <= easting < 445km and 3688km\n" " <= northing < 3689km. Consistent with this representation, coordinates\n" " are truncated (instead of rounded) to the requested precision.\n" " Similarly, on input an MGRS coordinate represents the center of the\n" " square (\"38N 444500 3688500\" in the example above). However, if the -n\n" " option is given then the south-west corner of the square is returned\n" " instead (\"38N 444000 3688000\" in the example above).\n" "\n" "ZONE\n" " If the input is geographic, GeoConvert uses the standard rules of\n" " selecting UTM vs UPS and for assigning the UTM zone (with the Norway\n" " and Svalbard exceptions). If the input is UTM/UPS, or MGRS, then the\n" " choice between UTM and UPS and the UTM zone mirrors the input. The -z\n" " zone, -s, -t options allow these rules to be overridden with zone = 0\n" " being used to indicate UPS. For example, the point\n" "\n" " 79.9S 6.1E\n" "\n" " corresponds to possible MGRS coordinates\n" "\n" " 32CMS4324728161 (standard UTM zone = 32)\n" " 31CEM6066227959 (neighboring UTM zone = 31)\n" " BBZ1945517770 (neighboring UPS zone)\n" "\n" " then\n" "\n" " echo 79.9S 6.1E | GeoConvert -p -3 -m => 32CMS4328\n" " echo 31CEM6066227959 | GeoConvert -p -3 -m => 31CEM6027\n" " echo 31CEM6066227959 | GeoConvert -p -3 -m -s => 32CMS4328\n" " echo 31CEM6066227959 | GeoConvert -p -3 -m -z 0 => BBZ1917\n" "\n" " NOTE: the letter in the zone specification for UTM is a hemisphere\n" " designator N or S and not an MGRS latitude band letter. Convert the\n" " MGRS latitude band letter to a hemisphere as follows: replace C thru M\n" " by S; replace N thru X by N.\n" "\n" "QUOTING\n" " Unfortunately the characters ' and \" have special meanings in many\n" " shells and have to be entered with care.\n" "\n" " Unix shells (sh, bash, tsch)\n" " The special characters can be quoted by preceding them with a \\\n" " (backslash). Alternatively you can quote a ' with a pair of \"s.\n" " The two alternatives are illustrated by\n" "\n" " echo 30d30\\'30\\\" \"30d30'30\" | GeoConvert -d -p -1\n" " => 30d30'30\"N 030d30'30\"E\n" "\n" " Alternatively use colon separators, e.g., 30:30:30, which need no\n" " quoting.\n" "\n" " Windows command shell (cmd)\n" " The ' character needs no quoting and the \" character can be quoted\n" " by a ^. However this quoting is usually unnecessary because the\n" " trailing designator can be omitted. Thus\n" "\n" " echo 30d30'30^\" 30d30'30 | GeoConvert -d -p -1\n" " => 30d30'30\"N 030d30'30\"E\n" "\n" " Alternatively use colon separators, e.g., 30:30:30, which need no\n" " quoting.\n" "\n" " Input from a file\n" " No quoting need be done if the input from a file. Thus each line\n" " of the file \"input.txt\" should just contain the plain coordinates.\n" "\n" " GeoConvert -d -p -1 < input.txt\n" "\n" "EXAMPLES\n" " echo 38SMB4488 | GeoConvert => 33.33424 44.40363\n" " echo 38SMB4488 | GeoConvert -: -p 1 => 33:20:03.25N 044:2413.06E\n" " echo 38SMB4488 | GeoConvert -u => 38N 444500 3688500\n" " echo E44d24 N33d20 | GeoConvert -m -p -3 => 38SMB4488\n" "\n" "ERRORS\n" " An illegal line of input will print an error message to standard output\n" " beginning with \"ERROR:\" and causes GeoConvert to return an exit code of\n" " 1. However, an error does not cause GeoConvert to terminate; following\n" " lines will be converted.\n" "\n" "ABBREVIATIONS\n" " UTM Universal Transverse Mercator,\n" " .\n" "\n" " UPS Universal Polar Stereographic,\n" " .\n" "\n" " MGRS\n" " Military Grid Reference System,\n" " .\n" "\n" " WGS84\n" " World Geodetic System 1984, .\n" "\n" "SEE ALSO\n" " The algorithms for the transverse Mercator projection are described in\n" " C. F. F. Karney, Transverse Mercator with an accuracy of a few\n" " nanometers, J. Geod 85(8), 475-485 (Aug. 2011); DOI\n" " http://dx.doi.org/10.1007/s00190-011-0445-3\n" " ; preprint\n" " .\n" "\n" "AUTHOR\n" " GeoConvert was written by Charles Karney.\n" "\n" "HISTORY\n" " GeoConvert was added to GeographicLib, ,\n" " in 2009-01.\n" ; return retval; } geographiclib-1.21/man/MagneticField.1.html0000644000175000017500000003072711745620415020365 0ustar frankiefrankie MagneticField -- compute the earth's magnetic field


NAME

MagneticField -- compute the earth's magnetic field


SYNOPSIS

MagneticField [ -n name ] [ -d dir ] [ -t time | -c time lat h ] [ -r ] [ -T tguard ] [ -H hguard ] [ -p prec ] [ -v ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

MagneticField reads in times and positions on standard input and prints out the geomagnetic field on standard output and, optionally, its rate of change.

The input line is of the form time lat lon h. time is a date of the form 2012-07-03 or a fractional year such as 2012.5. lat and lon are the latitude and longitude expressed as decimal degrees or degrees, minutes, and seconds; see GeoConvert(1) for details. h is the height above the ellipsoid in meters; this is optional and defaults to zero. Alternatively, time can be given on the command line as the argument to the -t option, in which case it should not be included on the input lines. Finally, the magnetic field can be computed at various points on a circle of latitude (constant time, lat, and h) via the -c option; in this case only the longitude should be given on the input lines.

The output consists of the following 7 items:

  the declination (the direction of the horizontal component of
    the magnetic field measured clockwise from north) in degrees,
  the inclination (the direction of the magnetic field measured
    down from the horizontal) in degrees,
  the horizontal field in nanotesla (nT),
  the north component of the field in nT,
  the east component of the field in nT,
  the vertical component of the field in nT (down is positive),
  the total field in nT.

If the -r option is given, a second line is printed giving the rates of change of these quantities in degrees/yr and nT/yr.

The WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.


OPTIONS

-n

use magnetic field model name instead of the default wmm2010. See MODELS.

-d

read magnetic models from dir instead of the default. See MODELS.

-t

evaluate the field at time instead of reading the time from the input lines.

-c

evaluate the field on a circle of latitude given by time, lat, h instead of reading these quantities from the input lines. In this case, MagneticField can calculate the field considerably more quickly.

-r

toggle whether to report the rates of change of the field.

-T

signal an error if time lies tguard years (default 50 yr) beyond the range for the model.

-H

signal an error if h lies hguard meters (default 500000 m) beyond the range for the model.

-p

set the output precision to prec (default 1). Fields are printed with precision with prec decimal places; angles use prec + 1 places.

-v

print information about the magnetic model on standard error before processing the input.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage, the default magnetic path and name, and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


MODELS

MagneticField computes the geomagnetic field using one of the following models

    wmm2010, the World Magnetic Model 2010, which approximates the
      main magnetic field for the period 2010–2015.  See
      http://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml
    igrf11, the International Geomagnetic Reference Field (11th
      generation) which approximates the main magnetic field for
      the period 1900–2015.  See
      http://ngdc.noaa.gov/IAGA/vmod/igrf.html
    emm2010, the Enhanced Magnetic Model 2010, which approximates the
      main and crustal magnetic fields for the period 2010–2015.  See
      http://ngdc.noaa.gov/geomag/EMM/index.html

These models approximate the magnetic field due to the earth's core and (in the case of emm2010) its crust. They neglect magnetic fields due to the ionosphere, the magnetosphere, nearby magnetized materials, electrical machinery, etc.

By default, the wmm2010 magnetic model is used. This may changed by setting the environment variable MAGNETIC_NAME or with the -n option.

The magnetic models will be loaded from a directory specified at compile time. This may changed by setting the environment variables MAGNETIC_PATH or GEOGRAPHICLIB_DATA, or with the -d option. The -h option prints the default magnetic path and name. Use the -v option to ascertain the full path name of the data file.

Instructions for downloading and installing magnetic models are available at http://geographiclib.sf.net/html/magnetic.html#magneticinst.


ENVIRONMENT

MAGNETIC_NAME

Override the compile-time default magnetic name of wmm2010. The -h option reports the value of MAGNETIC_NAME, if defined, otherwise it reports the compile-time value. If the -n name option is used, then name takes precedence.

MAGNETIC_PATH

Override the compile-time default magnetic path. This is typically /usr/local/share/GeographicLib/magnetic on Unix-like systems and C:/Documents and Settings/All Users/Application Data/GeographicLib/magnetic on Windows systems. The -h option reports the value of MAGNETIC_PATH, if defined, otherwise it reports the compile-time value. If the -d dir option is used, then dir takes precedence.

GEOGRAPHICLIB_DATA

Another way of overriding the compile-time default magnetic path. If it is set (and if MAGNETIC_PATH is not set), then $GEOGRAPHICLIB_DATA/magnetic is used.


ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes MagneticField to return an exit code of 1. However, an error does not cause MagneticField to terminate; following lines will be converted. If time or h are outside the recommended ranges for the model (but inside the ranges increase by tguard and hguard), a warning is printed on standard error and the field (which may be inaccurate) is returned in the normal way.


EXAMPLES

The magnetic field from WMM2010 in Timbuktu on 2012-01-01

    echo 2012-01-01 16:46:33N 3:00:34W 300 | MagneticField -r
    => -2.55 12.43 33771.0 33737.6 -1500.5 7446.0 34582.1
       0.10 -0.07 34.3 36.8 54.4 -35.3 25.9

The first two numbers returned are the declination and inclination of the field. The second line gives the annual change.


SEE ALSO

GeoConvert(1).


AUTHOR

MagneticField was written by Charles Karney.


HISTORY

MagneticField was added to GeographicLib, http://geographiclib.sf.net, in version 1.15.

geographiclib-1.21/man/TransverseMercatorProj.1.html0000644000175000017500000002067711745620415022361 0ustar frankiefrankie TransverseMercatorProj -- perform transverse Mercator projection


NAME

TransverseMercatorProj -- perform transverse Mercator projection


SYNOPSIS

TransverseMercatorProj [ -s | -t ] [ -l lon0 ] [ -k k1 ] [ -r ] [ -e a f ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

Perform the transverse Mercator projections. Convert geodetic coordinates to transverse Mercator coordinates. The central meridian is given by lon0. The longitude of origin is the equator. The scale on the central meridian is k0. By default an implementation of the exact transverse Mercator projection is used.

Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) latitude and longitude (decimal degrees or degrees, minutes, seconds). For each set of geodetic coordinates, the corresponding projected easting, x, and northing, y, (meters) are printed on standard output together with the meridian convergence gamma (degrees) and scale k. The meridian convergence is the bearing of the y axis measured clockwise from true north.


OPTIONS

-s

use the sixth-order Krueger series approximation to the transverse Mercator projection instead of the exact projection.

-t

use exact algorithm with the EXTENDED DOMAIN.

-l

specify the longitude of origin lon0 (degrees, default 0).

-k

specify the scale k0 on the central meridian (default 0.9996).

-r

perform the reverse projection. x and y are given on standard input and each line of standard output gives latitude, longitude, gamma, and k.

-e

specify the ellipsoid via a f; the equatorial radius is a and the flattening is f. Setting f = 0 results in a sphere. Specify f < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563. If the exact algorithm is used, f must be positive.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


EXTENDED DOMAIN

The exact transverse Mercator projection has a branch point on the equator at longitudes (relative to lon0) of +/- (1 - e) 90, where e is the eccentricity of the ellipsoid. The standard convention for handling this branch point is to map positive (negative) latitudes into positive (negative) northings y; i.e., a branch cut is placed on the equator. With the extended domain, the northern sheet of the projection is extended into the south hemisphere by pushing the branch cut south from the branch points. See the reference below for details.


EXAMPLES

   echo 0 90 | TransverseMercatorProj
   => 25953592.84 9997964.94 90 18.40
   echo 260e5 100e5 | TransverseMercatorProj -r
   => -0.02 90.00 90.01 18.48


ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes TransverseMercatorProj to return an exit code of 1. However, an error does not cause TransverseMercatorProj to terminate; following lines will be converted.


AUTHOR

TransverseMercatorProj was written by Charles Karney.


SEE ALSO

The algorithms for the transverse Mercator projection are described in C. F. F. Karney, Transverse Mercator with an accuracy of a few nanometers, J. Geod 85(8), 475-485 (Aug. 2011); DOI http://dx.doi.org/10.1007/s00190-011-0445-3; preprint http://arxiv.org/abs/1002.1417. The explanation of the extended domain of the projection with the -t option is given in Section 5 of this paper.


HISTORY

TransverseMercatorProj was added to GeographicLib, http://geographiclib.sf.net, in 2009-01. Prior to version 1.9 it was called TransverseMercatorTest (and its interface was slightly different).

geographiclib-1.21/man/GeodesicProj.pod0000644000175000017500000001106611745620415017721 0ustar frankiefrankie=for comment $Id: c2031e302eb69c8ce23ee8dd7152e58cf10df751 $ =head1 NAME GeodesicProj -- perform projections based on geodesics =head1 SYNOPSIS B ( B<-z> | B<-c> | B<-g> ) I I [ B<-r> ] [ B<-e> I I ] [ B<--comment-delimiter> I ] [ B<--version> | B<-h> | B<--help> ] [ B<--input-file> I | B<--input-string> I ] [ B<--line-separator> I ] [ B<--output-file> I ] =head1 DESCRIPTION Perform projections based on geodesics. Convert geodetic coordinates to either azimuthal equidistant, Cassini-Soldner, or gnomonic coordinates. The center of the projection (I, I) is specified by either the B<-c> option (for Cassini-Soldner), the B<-z> option (for azimuthal equidistant), or the B<-g> option (for gnomonic). At least one of these options must be given (the last one given is used). Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) I and I (decimal degrees or degrees, minutes, seconds). For each set of geodetic coordinates, the corresponding projected coordinates I, I (meters) are printed on standard output together with the azimuth I (degrees) and reciprocal scale I. For Cassini-Soldner, I is the bearing of the easting direction and the scale in the easting direction is 1 and the scale in the northing direction is 1/I. For azimuthal equidistant and gnomonic, I is the bearing of the radial direction and the scale in the azimuthal direction is 1/I. For azimuthal equidistant and gnomonic, the scales in the radial direction are 1 and 1/I^2, respectively. =head1 OPTIONS =over =item B<-z> use the azimuthal equidistant projection centered at latitude = I, longitude = I. =item B<-c> use the Cassini-Soldner projection centered at latitude = I, longitude = I. =item B<-g> use the ellipsoidal gnomonic projection centered at latitude = I, longitude = I. =item B<-r> perform the reverse projection. I and I are given on standard input and each line of standard output gives I, I, I, and I. =item B<-e> specify the ellipsoid via I I; the equatorial radius is I and the flattening is I. Setting I = 0 results in a sphere. Specify I E 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for I. (Also, if I E 1, the flattening is set to 1/I.) By default, the WGS84 ellipsoid is used, I = 6378137 m, I = 1/298.257223563. =item B<--comment-delimiter> set the comment delimiter to I (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). =item B<--version> print version and exit. =item B<-h> print usage and exit. =item B<--help> print full documentation and exit. =item B<--input-file> read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> read input from the string I instead of from standard input. All occurrences of the line separator character (default is a semicolon) in I are converted to newlines before the reading begins. =item B<--line-separator> set the line separator character to I. By default this is a semicolon. =item B<--output-file> write output to the file I instead of to standard output; a file name of "-" stands for standard output. =back =head1 EXAMPLES echo 48.648 -2.007 | GeodesicProj -c 48.836 2.337 => -319919 -11791 86.7 0.999 echo -319919 -11791 | GeodesicProj -c 48.836 2.337 -r => 48.648 -2.007 86.7 0.999 =head1 ERRORS An illegal line of input will print an error message to standard output beginning with C and causes B to return an exit code of 1. However, an error does not cause B to terminate; following lines will be converted. =head1 SEE ALSO The ellipsoidal gnomonic projection is derived in Section 13 of C. F. F. Karney, I, Feb. 2011; preprint L. See also Section 8 of C. F. F. Karney, I, Sept. 2011; preprint L. =head1 AUTHOR B was written by Charles Karney. =head1 HISTORY B was added to GeographicLib, L, in 2009-08. Prior to version 1.9 it was called EquidistantTest. geographiclib-1.21/man/GeoConvert.1.html0000644000175000017500000003742611745620415017750 0ustar frankiefrankie GeoConvert -- convert geographic coordinates


NAME

GeoConvert -- convert geographic coordinates


SYNOPSIS

GeoConvert [ -g | -d | -: | -u | -m | -c ] [ -p prec ] [ -z zone | -s | -t ] [ -n ] [ -w ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

GeoConvert reads from standard input interpreting each line as a geographic coordinate and prints the coordinate in the format specified by the options on standard output. The input is interpreted in one of three different ways depending on how many space or comma delimited tokens there are on the line. The options -g, -d, -u, and -m govern the format of output. In all cases, the WGS84 model of the earth is used (a = 6378137 m, f = 1/298.257223563).

geographic

2 tokens (output options -g, -d, or -:) given as latitude longitude using decimal degrees or degrees minutes seconds. d, ', and " are used to denote degrees, minutes, and seconds, with the least significant designator optional. (See QUOTING for how to quote the characters ' and " when entering coordinates on the command line.) Various unicode characters (encoded with UTF-8) may also be used to denote degrees, minutes, and seconds, e.g., the degree, prime, and double prime symbols. Alternatively, : (colon) may be used to separate the various components. Latitude is given first (unless the -w option is given); however, on input, either may be given first by appending or prepending N or S to the latitude and E or W to the longitude. For example, the following are all equivalent

    33.3 44.4
    E44.4 N33.3
    33d18'N 44d24'E
    44d24 33d18N
    33:18 44:24
UTM/UPS

3 tokens (output option -u) given as zone+hemisphere easting northing or easting northing zone+hemisphere, where hemisphere is either N or S. The zone is absent for a UPS specification. For example,

    38N 444140.54 3684706.36
    444140.54 3684706.36 38N
    S 2173854.98 2985980.58
    2173854.98 2985980.58 S
MRGS

1 token (output option -m) is used to specify the center of an MGRS grid square. For example,

    38SMB4484
    38SMB44140847064


OPTIONS

-g

output latitude and longitude using decimal degrees. Default output mode.

-d

output latitude and longitude using degrees, minutes, and seconds (DMS).

-:

like -d, except use : as a separator instead of the d, ', and " delimiters.

-u

output UTM or UPS.

-m

output MGRS.

-c

output meridian convergence and scale for the corresponding UTM or UPS projection. Convergence is the bearing of grid north given as degrees clockwise from true north.

-p

set the output precision to prec (default 0); prec is the precision relative to 1 m. See PRECISION.

-z

set the zone to zone for output. Use either 0 < zone <= 60 for a UTM zone or zone = 0 for UPS. Alternatively use a zone+hemisphere designation (hemisphere is ignored), e.g., 38N. See ZONE.

-s

use the standard UPS and UTM zones.

-t

similar to -s but forces UPS regions to the closest UTM zone.

-n

on input, MGRS coordinates refer to the south-west corner of the MGRS square instead of the center; see MGRS.

-w

on input and output, longitude precedes latitude (except that on input this can be overridden by a hemisphere designator, N, S,E, W).

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


PRECISION

prec gives precision of the output with prec = 0 giving 1 m precision, prec = 3 giving 1 mm precision, etc. prec is the number of digits after the decimal point for UTM/UPS. The number of digits per coordinate for MGRS is 5 + prec. For decimal degrees, the number of digits after the decimal point is 5 + prec. For DMS (degree, minute, seconds) output, the number of digits after the decimal point in the seconds components is 1 + prec; if this is negative then use minutes (prec = -2 or -3) or degrees (prec <= -4) as the least significant component. Print convergence, resp. scale, with 5 + prec, resp. 7 + prec, digits after the decimal point. The minimum value of prec is -5 and the maximum is 9 for UTM/UPS, 9 for decimal degrees, 10 for DMS, 6 for MGRS, and 8 for convergence and scale.


MGRS

MGRS coordinates represent a square patch of the earth, thus 38SMB4488 is in zone 38N with 444km <= easting < 445km and 3688km <= northing < 3689km. Consistent with this representation, coordinates are truncated (instead of rounded) to the requested precision. Similarly, on input an MGRS coordinate represents the center of the square (38N 444500 3688500 in the example above). However, if the -n option is given then the south-west corner of the square is returned instead (38N 444000 3688000 in the example above).


ZONE

If the input is geographic, GeoConvert uses the standard rules of selecting UTM vs UPS and for assigning the UTM zone (with the Norway and Svalbard exceptions). If the input is UTM/UPS, or MGRS, then the choice between UTM and UPS and the UTM zone mirrors the input. The -z zone, -s, -t options allow these rules to be overridden with zone = 0 being used to indicate UPS. For example, the point

   79.9S 6.1E

corresponds to possible MGRS coordinates

   32CMS4324728161 (standard UTM zone = 32)
   31CEM6066227959 (neighboring UTM zone = 31)
     BBZ1945517770 (neighboring UPS zone)

then

   echo 79.9S 6.1E      | GeoConvert -p -3 -m       => 32CMS4328
   echo 31CEM6066227959 | GeoConvert -p -3 -m       => 31CEM6027
   echo 31CEM6066227959 | GeoConvert -p -3 -m -s    => 32CMS4328
   echo 31CEM6066227959 | GeoConvert -p -3 -m -z 0  =>   BBZ1917

NOTE: the letter in the zone specification for UTM is a hemisphere designator N or S and not an MGRS latitude band letter. Convert the MGRS latitude band letter to a hemisphere as follows: replace C thru M by S; replace N thru X by N.


QUOTING

Unfortunately the characters ' and " have special meanings in many shells and have to be entered with care.

Unix shells (sh, bash, tsch)

The special characters can be quoted by preceding them with a \ (backslash). Alternatively you can quote a ' with a pair of "s. The two alternatives are illustrated by

   echo 30d30\'30\" "30d30'30" | GeoConvert -d -p -1
   => 30d30'30"N 030d30'30"E

Alternatively use colon separators, e.g., 30:30:30, which need no quoting.

Windows command shell (cmd)

The ' character needs no quoting and the " character can be quoted by a ^. However this quoting is usually unnecessary because the trailing designator can be omitted. Thus

   echo 30d30'30^" 30d30'30 | GeoConvert -d -p -1
   => 30d30'30"N 030d30'30"E

Alternatively use colon separators, e.g., 30:30:30, which need no quoting.

Input from a file

No quoting need be done if the input from a file. Thus each line of the file input.txt should just contain the plain coordinates.

  GeoConvert -d -p -1 < input.txt


EXAMPLES

   echo 38SMB4488 | GeoConvert         => 33.33424 44.40363
   echo 38SMB4488 | GeoConvert -: -p 1 => 33:20:03.25N 044:2413.06E
   echo 38SMB4488 | GeoConvert -u      => 38N 444500 3688500
   echo E44d24 N33d20 | GeoConvert -m -p -3 => 38SMB4488


ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes GeoConvert to return an exit code of 1. However, an error does not cause GeoConvert to terminate; following lines will be converted.


ABBREVIATIONS

UTM

Universal Transverse Mercator, http://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system.

UPS

Universal Polar Stereographic, http://en.wikipedia.org/wiki/Universal_Polar_Stereographic.

MGRS

Military Grid Reference System, http://en.wikipedia.org/wiki/Military_grid_reference_system.

WGS84

World Geodetic System 1984, http://en.wikipedia.org/wiki/WGS84.


SEE ALSO

The algorithms for the transverse Mercator projection are described in C. F. F. Karney, Transverse Mercator with an accuracy of a few nanometers, J. Geod 85(8), 475-485 (Aug. 2011); DOI http://dx.doi.org/10.1007/s00190-011-0445-3; preprint http://arxiv.org/abs/1002.1417.


AUTHOR

GeoConvert was written by Charles Karney.


HISTORY

GeoConvert was added to GeographicLib, http://geographiclib.sf.net, in 2009-01.

geographiclib-1.21/man/Geod.10000644000175000017500000003302711745620415015601 0ustar frankiefrankie.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "GEOD 1" .TH GEOD 1 "2012-04-24" "GeographicLib 1.21" "GeographicLib Utilities" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Geod \-\- perform geodesic calculations .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBGeod\fR [ \fB\-i\fR | \fB\-l\fR \fIlat1\fR \fIlon1\fR \fIazi1\fR ] [ \fB\-a\fR ] [ \fB\-e\fR \fIa\fR \fIf\fR ] [ \fB\-d\fR | \fB\-:\fR ] [ \fB\-b\fR ] [ \fB\-f\fR ] [ \fB\-p\fR \fIprec\fR ] [ \fB\-\-comment\-delimiter\fR \fIcommentdelim\fR ] [ \fB\-\-version\fR | \fB\-h\fR | \fB\-\-help\fR ] [ \fB\-\-input\-file\fR \fIinfile\fR | \fB\-\-input\-string\fR \fIinstring\fR ] [ \fB\-\-line\-separator\fR \fIlinesep\fR ] [ \fB\-\-output\-file\fR \fIoutfile\fR ] .SH "DESCRIPTION" .IX Header "DESCRIPTION" The shortest path between two points on the ellipsoid at (\fIlat1\fR, \&\fIlon1\fR) and (\fIlat2\fR, \fIlon2\fR) is called the geodesic. Its length is \&\fIs12\fR and the geodesic from point 1 to point 2 has azimuths \fIazi1\fR and \&\fIazi2\fR at the two end points. .PP \&\fBGeod\fR operates in one of three modes: .IP "1." 4 By default, \fBGeod\fR accepts lines on the standard input containing \&\fIlat1\fR \fIlon1\fR \fIazi1\fR \fIs12\fR and prints \fIlat2\fR \fIlon2\fR \fIazi2\fR on standard output. This is the direct geodesic calculation. .IP "2." 4 Command line arguments \fB\-l\fR \fIlat1\fR \fIlon1\fR \fIazi1\fR specify a geodesic line. \&\fBGeod\fR then accepts a sequence of \fIs12\fR values (one per line) on standard input and prints \fIlat2\fR \fIlon2\fR \fIazi2\fR for each. This generates a sequence of points on a single geodesic. .IP "3." 4 With the \fB\-i\fR command line argument, \fBGeod\fR performs the inverse geodesic calculation. It reads lines containing \fIlat1\fR \fIlon1\fR \fIlat2\fR \&\fIlon2\fR and prints the corresponding values of \fIazi1\fR \fIazi2\fR \fIs12\fR. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-i\fR" 4 .IX Item "-i" perform an inverse geodesic calculation (see 3 above). .IP "\fB\-l\fR" 4 .IX Item "-l" line mode (see 2 above); generate a sequence of points along the geodesic specified by \fIlat1\fR \fIlon1\fR \fIazi1\fR. .IP "\fB\-a\fR" 4 .IX Item "-a" arc mode; on input \fIand\fR output \fIs12\fR is replaced by \fIa12\fR the arc length (in degrees) on the auxiliary sphere. See \*(L"\s-1AUXILIARY\s0 \s-1SPHERE\s0\*(R". .IP "\fB\-e\fR" 4 .IX Item "-e" specify the ellipsoid via \fIa\fR \fIf\fR; the equatorial radius is \fIa\fR and the flattening is \fIf\fR. Setting \fIf\fR = 0 results in a sphere. Specify \&\fIf\fR < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for \fIf\fR. (Also, if \fIf\fR > 1, the flattening is set to 1/\fIf\fR.) By default, the \s-1WGS84\s0 ellipsoid is used, \fIa\fR = 6378137 m, \&\fIf\fR = 1/298.257223563. .IP "\fB\-d\fR" 4 .IX Item "-d" output angles as degrees, minutes, seconds instead of decimal degrees. .IP "\fB\-:\fR" 4 .IX Item "-:" like \fB\-d\fR, except use : as a separator instead of the d, ', and " delimiters. .IP "\fB\-b\fR" 4 .IX Item "-b" report the \fIback\fR azimuth at point 2 instead of the forward azimuth. .IP "\fB\-f\fR" 4 .IX Item "-f" full output; each line of output consists of 12 quantities: \fIlat1\fR \&\fIlon1\fR \fIazi1\fR \fIlat2\fR \fIlon2\fR \fIazi2\fR \fIs12\fR \fIa12\fR \fIm12\fR \fIM12\fR \&\fIM21\fR \fIS12\fR. \fIa12\fR is described in \*(L"\s-1AUXILIARY\s0 \s-1SPHERE\s0\*(R". The four quantities \fIm12\fR, \fIM12\fR, \fIM21\fR, and \fIS12\fR are described in \&\*(L"\s-1ADDITIONAL\s0 \s-1QUANTITIES\s0\*(R". .IP "\fB\-p\fR" 4 .IX Item "-p" set the output precision to \fIprec\fR (default 3); \fIprec\fR is the precision relative to 1 m. See \s-1PRECISION\s0. .IP "\fB\-\-comment\-delimiter\fR" 4 .IX Item "--comment-delimiter" set the comment delimiter to \fIcommentdelim\fR (e.g., \*(L"#\*(R" or \*(L"//\*(R"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). .IP "\fB\-\-version\fR" 4 .IX Item "--version" print version and exit. .IP "\fB\-h\fR" 4 .IX Item "-h" print usage and exit. .IP "\fB\-\-help\fR" 4 .IX Item "--help" print full documentation and exit. .IP "\fB\-\-input\-file\fR" 4 .IX Item "--input-file" read input from the file \fIinfile\fR instead of from standard input; a file name of \*(L"\-\*(R" stands for standard input. .IP "\fB\-\-input\-string\fR" 4 .IX Item "--input-string" read input from the string \fIinstring\fR instead of from standard input. All occurrences of the line separator character (default is a semicolon) in \fIinstring\fR are converted to newlines before the reading begins. .IP "\fB\-\-line\-separator\fR" 4 .IX Item "--line-separator" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR" 4 .IX Item "--output-file" write output to the file \fIoutfile\fR instead of to standard output; a file name of \*(L"\-\*(R" stands for standard output. .SH "INPUT" .IX Header "INPUT" \&\fBGeod\fR measures all angles in degrees and all lengths (\fIs12\fR) in meters. On input angles (latitude, longitude, azimuth, arc length) can be as decimal degrees or degrees (d), minutes ('), seconds (\*(L"). A decimal point can only appear in the least significant component and the designator (d, ', or \*(R") for this component is optional; thus \f(CW\*(C`40d30\*(C'\fR, \&\f(CW\*(C`40d30\*(Aq\*(C'\fR, \f(CW\*(C`40.5d\*(C'\fR, and \f(CW40.5\fR are all equivalent. By default, latitude precedes longitude for each point; however on input either may be given first by appending (or prepending) \fIN\fR or \fIS\fR to the latitude and \fIE\fR or \fIW\fR to the longitude. Azimuths are measured clockwise from north; however this may be overridden with \fIE\fR or \fIW\fR. .SH "AUXILIARY SPHERE" .IX Header "AUXILIARY SPHERE" Geodesics on the ellipsoid can be transferred to the \fIauxiliary sphere\fR on which the distance is measured in terms of the arc length \fIa12\fR (measured in degrees) instead of \fIs12\fR. In terms of \fIa12\fR, 180 degrees is the distance from one equator crossing to the next or from the minimum latitude to the maximum latitude. Geodesics with \fIa12\fR > 180 degrees do not correspond to shortest paths. With the \fB\-a\fR flag, \fIs12\fR (on both input and output) is replaced by \fIa12\fR. The \&\fB\-a\fR flag does \fInot\fR affect the full output given by the \fB\-f\fR flag (which always includes both \fIs12\fR and \fIa12\fR). .SH "ADDITIONAL QUANTITIES" .IX Header "ADDITIONAL QUANTITIES" The \fB\-f\fR flag reports four additional quantities. .PP The reduced length of the geodesic, \fIm12\fR, is defined such that if the initial azimuth is perturbed by d\fIazi1\fR (radians) then the second point is displaced by \fIm12\fR d\fIazi1\fR in the direction perpendicular to the geodesic. \fIm12\fR is given in meters. On a curved surface the reduced length obeys a symmetry relation, \fIm12\fR + \fIm21\fR = 0. On a flat surface, we have \fIm12\fR = \fIs12\fR. .PP \&\fIM12\fR and \fIM21\fR are geodesic scales. If two geodesics are parallel at point 1 and separated by a small distance \fIdt\fR, then they are separated by a distance \fIM12\fR \fIdt\fR at point 2. \fIM21\fR is defined similarly (with the geodesics being parallel to one another at point 2). \fIM12\fR and \fIM21\fR are dimensionless quantities. On a flat surface, we have \&\fIM12\fR = \fIM21\fR = 1. .PP If points 1, 2, and 3 lie on a single geodesic, then the following addition rules hold, \&\fIm13\fR = \fIm12\fR \fIM23\fR + \fIm23\fR \fIM21\fR, \&\fIM13\fR = \fIM12\fR \fIM23\fR \- (1 \- \fIM12\fR \fIM21\fR) \fIm23\fR / \fIm12\fR, and \&\fIM31\fR = \fIM32\fR \fIM21\fR \- (1 \- \fIM23\fR \fIM32\fR) \fIm12\fR / \fIm23\fR. .PP Finally, \fIS12\fR is the area between the geodesic from point 1 to point 2 and the equator; i.e., it is the area, measured counter-clockwise, of the quadrilateral with corners (\fIlat1\fR,\fIlon1\fR), (0,\fIlon1\fR), (0,\fIlon2\fR), and (\fIlat2\fR,\fIlon2\fR). It is given in meters^2. .SH "PRECISION" .IX Header "PRECISION" \&\fIprec\fR gives precision of the output with \fIprec\fR = 0 giving 1 m precision, \fIprec\fR = 3 giving 1 mm precision, etc. \fIprec\fR is the number of digits after the decimal point for lengths. For decimal degrees, the number of digits after the decimal point is 5 + \fIprec\fR. For \s-1DMS\s0 (degree, minute, seconds) output, the number of digits after the decimal point in the seconds component is 1 + \fIprec\fR. The minimum value of \fIprec\fR is 0 and the maximum is 10. .SH "ERRORS" .IX Header "ERRORS" An illegal line of input will print an error message to standard output beginning with \f(CW\*(C`ERROR:\*(C'\fR and causes \fBGeod\fR to return an exit code of 1. However, an error does not cause \fBGeod\fR to terminate; following lines will be converted. .SH "EXAMPLES" .IX Header "EXAMPLES" Route from \s-1JFK\s0 Airport to Singapore Changi Airport: .PP .Vb 2 \& echo 40:38:23N 073:46:44W 01:21:33N 103:59:22E | \& Geod \-i \-: \-p 0 \& \& 003:18:29.9 177:29:09.2 15347628 .Ve .PP Waypoints on the route at intervals of 2000km: .PP .Vb 2 \& for ((i = 0; i <= 16; i += 2)); do echo ${i}000000;done | \& Geod \-l 40:38:23N 073:46:44W 003:18:29.9 \-: \-p 0 \& \& 40:38:23.0N 073:46:44.0W 003:18:29.9 \& 58:34:45.1N 071:49:36.7W 004:48:48.8 \& 76:22:28.4N 065:32:17.8W 010:41:38.4 \& 84:50:28.0N 075:04:39.2E 150:55:00.9 \& 67:26:20.3N 098:00:51.2E 173:27:20.3 \& 49:33:03.2N 101:06:52.6E 176:07:54.3 \& 31:34:16.5N 102:30:46.3E 177:03:08.4 \& 13:31:56.0N 103:26:50.7E 177:24:55.0 \& 04:32:05.7S 104:14:48.7E 177:28:43.6 .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" The algorithms are described in C. F. F. Karney, \fIGeodesics on an ellipsoid of revolution\fR, Feb. 2011; preprint . See also C. F. F. Karney, \&\fIAlgorithms for geodesics\fR, Sept. 2011; preprint . .SH "AUTHOR" .IX Header "AUTHOR" \&\fBGeod\fR was written by Charles Karney. .SH "HISTORY" .IX Header "HISTORY" \&\fBGeod\fR was added to GeographicLib, , in 2009\-03. geographiclib-1.21/man/CartConvert.1.html0000644000175000017500000001542611745620415020123 0ustar frankiefrankie CartConvert -- convert geodetic coordinates to geocentric or local cartesian


NAME

CartConvert -- convert geodetic coordinates to geocentric or local cartesian


SYNOPSIS

CartConvert [ -r ] [ -l lat0 lon0 h0 ] [ -e a f ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

Convert geodetic coordinates to either geocentric or local cartesian coordinates. Geocentric coordinates have the origin at the center of the earth, with the z axis going thru the north pole, and the x axis thru latitude = 0, longitude = 0. By default, the conversion is to geocentric coordinates. Specifying -l lat0 lon0 h0 causes a local coordinate system to be used with the origin at latitude = lat0, longitude = lon0, height = h0, z normal to the ellipsoid and y due north.

Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) latitude, longitude (decimal degrees or degrees, minutes and seconds), and height above the ellipsoid (meters). For each set of geodetic coordinates, the corresponding cartesian coordinates x, y, z (meters) are printed on standard output.


OPTIONS

-r

perform the reverse projection. x, y, z are given on standard input and each line of standard output gives latitude, longitude, height.

-e

specify the ellipsoid via a f; the equatorial radius is a and the flattening is f. Setting f = 0 results in a sphere. Specify f < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


EXAMPLES

   echo 33.3 44.4 6000 | CartConvert
   => 3816209.60 3737108.55 3485109.57
   echo 33.3 44.4 6000 | CartConvert -l 33 44 20
   => 37288.97 33374.29 5783.64
   echo 30000 30000 0 | CartConvert -r
   => 6.483 45 -6335709.73


ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes CartConvert to return an exit code of 1. However, an error does not cause CartConvert to terminate; following lines will be converted.


SEE ALSO

The algorithm for converting geocentric to geodetic coordinates is given in Appendix B of C. F. F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011; preprint http://arxiv.org/abs/1102.1215.


AUTHOR

CartConvert was written by Charles Karney.


HISTORY

CartConvert was added to GeographicLib, http://geographiclib.sf.net, in 2009-02. Prior to 2009-03 it was called ECEFConvert.

geographiclib-1.21/man/TransverseMercatorProj.usage0000644000175000017500000001453111745620415022352 0ustar frankiefrankieint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " TransverseMercatorProj [ -s | -t ] [ -l lon0 ] [ -k k1 ] [ -r ] [ -e a\n" " f ] [ --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" " TransverseMercatorProj --help\n" "or visit:\n" " http://geographiclib.sf.net/html/TransverseMercatorProj.1.html\n"; else ( retval ? std::cerr : std::cout ) << "Man page:\n" "NAME\n" " TransverseMercatorProj -- perform transverse Mercator projection\n" "\n" "SYNOPSIS\n" " TransverseMercatorProj [ -s | -t ] [ -l lon0 ] [ -k k1 ] [ -r ] [ -e a\n" " f ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [\n" " --input-file infile | --input-string instring ] [ --line-separator\n" " linesep ] [ --output-file outfile ]\n" "\n" "DESCRIPTION\n" " Perform the transverse Mercator projections. Convert geodetic\n" " coordinates to transverse Mercator coordinates. The central meridian\n" " is given by lon0. The longitude of origin is the equator. The scale\n" " on the central meridian is k0. By default an implementation of the\n" " exact transverse Mercator projection is used.\n" "\n" " Geodetic coordinates are provided on standard input as a set of lines\n" " containing (blank separated) latitude and longitude (decimal degrees or\n" " degrees, minutes, seconds). For each set of geodetic coordinates, the\n" " corresponding projected easting, x, and northing, y, (meters) are\n" " printed on standard output together with the meridian convergence gamma\n" " (degrees) and scale k. The meridian convergence is the bearing of the\n" " y axis measured clockwise from true north.\n" "\n" "OPTIONS\n" " -s use the sixth-order Krueger series approximation to the transverse\n" " Mercator projection instead of the exact projection.\n" "\n" " -t use exact algorithm with the EXTENDED DOMAIN.\n" "\n" " -l specify the longitude of origin lon0 (degrees, default 0).\n" "\n" " -k specify the scale k0 on the central meridian (default 0.9996).\n" "\n" " -r perform the reverse projection. x and y are given on standard\n" " input and each line of standard output gives latitude, longitude,\n" " gamma, and k.\n" "\n" " -e specify the ellipsoid via a f; the equatorial radius is a and the\n" " flattening is f. Setting f = 0 results in a sphere. Specify f < 0\n" " for a prolate ellipsoid. A simple fraction, e.g., 1/297, is\n" " allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By\n" " default, the WGS84 ellipsoid is used, a = 6378137 m, f =\n" " 1/298.257223563. If the exact algorithm is used, f must be\n" " positive.\n" "\n" " --comment-delimiter\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\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\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\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "EXTENDED DOMAIN\n" " The exact transverse Mercator projection has a branch point on the\n" " equator at longitudes (relative to lon0) of +/- (1 - e) 90, where e is\n" " the eccentricity of the ellipsoid. The standard convention for\n" " handling this branch point is to map positive (negative) latitudes into\n" " positive (negative) northings y; i.e., a branch cut is placed on the\n" " equator. With the extended domain, the northern sheet of the\n" " projection is extended into the south hemisphere by pushing the branch\n" " cut south from the branch points. See the reference below for details.\n" "\n" "EXAMPLES\n" " echo 0 90 | TransverseMercatorProj\n" " => 25953592.84 9997964.94 90 18.40\n" " echo 260e5 100e5 | TransverseMercatorProj -r\n" " => -0.02 90.00 90.01 18.48\n" "\n" "ERRORS\n" " An illegal line of input will print an error message to standard output\n" " beginning with \"ERROR:\" and causes TransverseMercatorProj to return an\n" " exit code of 1. However, an error does not cause\n" " TransverseMercatorProj to terminate; following lines will be converted.\n" "\n" "AUTHOR\n" " TransverseMercatorProj was written by Charles Karney.\n" "\n" "SEE ALSO\n" " The algorithms for the transverse Mercator projection are described in\n" " C. F. F. Karney, Transverse Mercator with an accuracy of a few\n" " nanometers, J. Geod 85(8), 475-485 (Aug. 2011); DOI\n" " http://dx.doi.org/10.1007/s00190-011-0445-3\n" " ; preprint\n" " . The explanation of the extended\n" " domain of the projection with the -t option is given in Section 5 of\n" " this paper.\n" "\n" "HISTORY\n" " TransverseMercatorProj was added to GeographicLib,\n" " , in 2009-01. Prior to version 1.9 it was\n" " called TransverseMercatorTest (and its interface was slightly\n" " different).\n" ; return retval; } geographiclib-1.21/man/GeodesicProj.10000644000175000017500000002174711745620415017306 0ustar frankiefrankie.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "GEODESICPROJ 1" .TH GEODESICPROJ 1 "2012-04-24" "GeographicLib 1.21" "GeographicLib Utilities" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" GeodesicProj \-\- perform projections based on geodesics .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBGeodesicProj\fR ( \fB\-z\fR | \fB\-c\fR | \fB\-g\fR ) \fIlat0\fR \fIlon0\fR [ \fB\-r\fR ] [ \fB\-e\fR \fIa\fR \fIf\fR ] [ \fB\-\-comment\-delimiter\fR \fIcommentdelim\fR ] [ \fB\-\-version\fR | \fB\-h\fR | \fB\-\-help\fR ] [ \fB\-\-input\-file\fR \fIinfile\fR | \fB\-\-input\-string\fR \fIinstring\fR ] [ \fB\-\-line\-separator\fR \fIlinesep\fR ] [ \fB\-\-output\-file\fR \fIoutfile\fR ] .SH "DESCRIPTION" .IX Header "DESCRIPTION" Perform projections based on geodesics. Convert geodetic coordinates to either azimuthal equidistant, Cassini-Soldner, or gnomonic coordinates. The center of the projection (\fIlat0\fR, \fIlon0\fR) is specified by either the \fB\-c\fR option (for Cassini-Soldner), the \fB\-z\fR option (for azimuthal equidistant), or the \fB\-g\fR option (for gnomonic). At least one of these options must be given (the last one given is used). .PP Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) \fIlatitude\fR and \fIlongitude\fR (decimal degrees or degrees, minutes, seconds). For each set of geodetic coordinates, the corresponding projected coordinates \fIx\fR, \fIy\fR (meters) are printed on standard output together with the azimuth \fIazi\fR (degrees) and reciprocal scale \fIrk\fR. For Cassini-Soldner, \fIazi\fR is the bearing of the easting direction and the scale in the easting direction is 1 and the scale in the northing direction is 1/\fIrk\fR. For azimuthal equidistant and gnomonic, \fIazi\fR is the bearing of the radial direction and the scale in the azimuthal direction is 1/\fIrk\fR. For azimuthal equidistant and gnomonic, the scales in the radial direction are 1 and 1/\fIrk\fR^2, respectively. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-z\fR" 4 .IX Item "-z" use the azimuthal equidistant projection centered at latitude = \fIlat0\fR, longitude = \fIlon0\fR. .IP "\fB\-c\fR" 4 .IX Item "-c" use the Cassini-Soldner projection centered at latitude = \fIlat0\fR, longitude = \fIlon0\fR. .IP "\fB\-g\fR" 4 .IX Item "-g" use the ellipsoidal gnomonic projection centered at latitude = \fIlat0\fR, longitude = \fIlon0\fR. .IP "\fB\-r\fR" 4 .IX Item "-r" perform the reverse projection. \fIx\fR and \fIy\fR are given on standard input and each line of standard output gives \fIlatitude\fR, \fIlongitude\fR, \&\fIazi\fR, and \fIrk\fR. .IP "\fB\-e\fR" 4 .IX Item "-e" specify the ellipsoid via \fIa\fR \fIf\fR; the equatorial radius is \fIa\fR and the flattening is \fIf\fR. Setting \fIf\fR = 0 results in a sphere. Specify \&\fIf\fR < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for \fIf\fR. (Also, if \fIf\fR > 1, the flattening is set to 1/\fIf\fR.) By default, the \s-1WGS84\s0 ellipsoid is used, \fIa\fR = 6378137 m, \&\fIf\fR = 1/298.257223563. .IP "\fB\-\-comment\-delimiter\fR" 4 .IX Item "--comment-delimiter" set the comment delimiter to \fIcommentdelim\fR (e.g., \*(L"#\*(R" or \*(L"//\*(R"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). .IP "\fB\-\-version\fR" 4 .IX Item "--version" print version and exit. .IP "\fB\-h\fR" 4 .IX Item "-h" print usage and exit. .IP "\fB\-\-help\fR" 4 .IX Item "--help" print full documentation and exit. .IP "\fB\-\-input\-file\fR" 4 .IX Item "--input-file" read input from the file \fIinfile\fR instead of from standard input; a file name of \*(L"\-\*(R" stands for standard input. .IP "\fB\-\-input\-string\fR" 4 .IX Item "--input-string" read input from the string \fIinstring\fR instead of from standard input. All occurrences of the line separator character (default is a semicolon) in \fIinstring\fR are converted to newlines before the reading begins. .IP "\fB\-\-line\-separator\fR" 4 .IX Item "--line-separator" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR" 4 .IX Item "--output-file" write output to the file \fIoutfile\fR instead of to standard output; a file name of \*(L"\-\*(R" stands for standard output. .SH "EXAMPLES" .IX Header "EXAMPLES" .Vb 4 \& echo 48.648 \-2.007 | GeodesicProj \-c 48.836 2.337 \& => \-319919 \-11791 86.7 0.999 \& echo \-319919 \-11791 | GeodesicProj \-c 48.836 2.337 \-r \& => 48.648 \-2.007 86.7 0.999 .Ve .SH "ERRORS" .IX Header "ERRORS" An illegal line of input will print an error message to standard output beginning with \f(CW\*(C`ERROR:\*(C'\fR and causes \fBGeodesicProj\fR to return an exit code of 1. However, an error does not cause \fBGeodesicProj\fR to terminate; following lines will be converted. .SH "SEE ALSO" .IX Header "SEE ALSO" The ellipsoidal gnomonic projection is derived in Section 13 of C. F. F. Karney, \fIGeodesics on an ellipsoid of revolution\fR, Feb. 2011; preprint . See also Section 8 of C. F. F. Karney, \fIAlgorithms for geodesics\fR, Sept. 2011; preprint . .SH "AUTHOR" .IX Header "AUTHOR" \&\fBGeodesicProj\fR was written by Charles Karney. .SH "HISTORY" .IX Header "HISTORY" \&\fBGeodesicProj\fR was added to GeographicLib, , in 2009\-08. Prior to version 1.9 it was called EquidistantTest. geographiclib-1.21/man/Geod.pod0000644000175000017500000002064311745620415016223 0ustar frankiefrankie=for comment $Id: ac7d3addc8d0f5133f329b9818891b021e90938f $ =head1 NAME Geod -- perform geodesic calculations =head1 SYNOPSIS B [ B<-i> | B<-l> I I I ] [ B<-a> ] [ B<-e> I I ] [ B<-d> | B<-:> ] [ B<-b> ] [ B<-f> ] [ B<-p> I ] [ B<--comment-delimiter> I ] [ B<--version> | B<-h> | B<--help> ] [ B<--input-file> I | B<--input-string> I ] [ B<--line-separator> I ] [ B<--output-file> I ] =head1 DESCRIPTION The shortest path between two points on the ellipsoid at (I, I) and (I, I) is called the geodesic. Its length is I and the geodesic from point 1 to point 2 has azimuths I and I at the two end points. B operates in one of three modes: =over =item 1. By default, B accepts lines on the standard input containing I I I I and prints I I I on standard output. This is the direct geodesic calculation. =item 2. Command line arguments B<-l> I I I specify a geodesic line. B then accepts a sequence of I values (one per line) on standard input and prints I I I for each. This generates a sequence of points on a single geodesic. =item 3. With the B<-i> command line argument, B performs the inverse geodesic calculation. It reads lines containing I I I I and prints the corresponding values of I I I. =back =head1 OPTIONS =over =item B<-i> perform an inverse geodesic calculation (see 3 above). =item B<-l> line mode (see 2 above); generate a sequence of points along the geodesic specified by I I I. =item B<-a> arc mode; on input I output I is replaced by I the arc length (in degrees) on the auxiliary sphere. See L. =item B<-e> specify the ellipsoid via I I; the equatorial radius is I and the flattening is I. Setting I = 0 results in a sphere. Specify I E 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for I. (Also, if I E 1, the flattening is set to 1/I.) By default, the WGS84 ellipsoid is used, I = 6378137 m, I = 1/298.257223563. =item B<-d> output angles as degrees, minutes, seconds instead of decimal degrees. =item B<-:> like B<-d>, except use : as a separator instead of the d, ', and " delimiters. =item B<-b> report the I azimuth at point 2 instead of the forward azimuth. =item B<-f> full output; each line of output consists of 12 quantities: I I I I I I I I I I I I. I is described in L. The four quantities I, I, I, and I are described in L. =item B<-p> set the output precision to I (default 3); I is the precision relative to 1 m. See L. =item B<--comment-delimiter> set the comment delimiter to I (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). =item B<--version> print version and exit. =item B<-h> print usage and exit. =item B<--help> print full documentation and exit. =item B<--input-file> read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> read input from the string I instead of from standard input. All occurrences of the line separator character (default is a semicolon) in I are converted to newlines before the reading begins. =item B<--line-separator> set the line separator character to I. By default this is a semicolon. =item B<--output-file> write output to the file I instead of to standard output; a file name of "-" stands for standard output. =back =head1 INPUT B measures all angles in degrees and all lengths (I) in meters. On input angles (latitude, longitude, azimuth, arc length) can be as decimal degrees or degrees (d), minutes ('), seconds ("). A decimal point can only appear in the least significant component and the designator (d, ', or ") for this component is optional; thus C<40d30>, C<40d30'>, C<40.5d>, and C<40.5> are all equivalent. By default, latitude precedes longitude for each point; however on input either may be given first by appending (or prepending) I or I to the latitude and I or I to the longitude. Azimuths are measured clockwise from north; however this may be overridden with I or I. =head1 AUXILIARY SPHERE Geodesics on the ellipsoid can be transferred to the I on which the distance is measured in terms of the arc length I (measured in degrees) instead of I. In terms of I, 180 degrees is the distance from one equator crossing to the next or from the minimum latitude to the maximum latitude. Geodesics with I E 180 degrees do not correspond to shortest paths. With the B<-a> flag, I (on both input and output) is replaced by I. The B<-a> flag does I affect the full output given by the B<-f> flag (which always includes both I and I). =head1 ADDITIONAL QUANTITIES The B<-f> flag reports four additional quantities. The reduced length of the geodesic, I, is defined such that if the initial azimuth is perturbed by dI (radians) then the second point is displaced by I dI in the direction perpendicular to the geodesic. I is given in meters. On a curved surface the reduced length obeys a symmetry relation, I + I = 0. On a flat surface, we have I = I. I and I are geodesic scales. If two geodesics are parallel at point 1 and separated by a small distance I
, then they are separated by a distance I I
at point 2. I is defined similarly (with the geodesics being parallel to one another at point 2). I and I are dimensionless quantities. On a flat surface, we have I = I = 1. If points 1, 2, and 3 lie on a single geodesic, then the following addition rules hold, I = I I + I I, I = I I - (1 - I I) I / I, and I = I I - (1 - I I) I / I. Finally, I is the area between the geodesic from point 1 to point 2 and the equator; i.e., it is the area, measured counter-clockwise, of the quadrilateral with corners (I,I), (0,I), (0,I), and (I,I). It is given in meters^2. =head1 PRECISION I gives precision of the output with I = 0 giving 1 m precision, I = 3 giving 1 mm precision, etc. I is the number of digits after the decimal point for lengths. For decimal degrees, the number of digits after the decimal point is 5 + I. For DMS (degree, minute, seconds) output, the number of digits after the decimal point in the seconds component is 1 + I. The minimum value of I is 0 and the maximum is 10. =head1 ERRORS An illegal line of input will print an error message to standard output beginning with C and causes B to return an exit code of 1. However, an error does not cause B to terminate; following lines will be converted. =head1 EXAMPLES Route from JFK Airport to Singapore Changi Airport: echo 40:38:23N 073:46:44W 01:21:33N 103:59:22E | Geod -i -: -p 0 003:18:29.9 177:29:09.2 15347628 Waypoints on the route at intervals of 2000km: for ((i = 0; i <= 16; i += 2)); do echo ${i}000000;done | Geod -l 40:38:23N 073:46:44W 003:18:29.9 -: -p 0 40:38:23.0N 073:46:44.0W 003:18:29.9 58:34:45.1N 071:49:36.7W 004:48:48.8 76:22:28.4N 065:32:17.8W 010:41:38.4 84:50:28.0N 075:04:39.2E 150:55:00.9 67:26:20.3N 098:00:51.2E 173:27:20.3 49:33:03.2N 101:06:52.6E 176:07:54.3 31:34:16.5N 102:30:46.3E 177:03:08.4 13:31:56.0N 103:26:50.7E 177:24:55.0 04:32:05.7S 104:14:48.7E 177:28:43.6 =head1 SEE ALSO The algorithms are described in C. F. F. Karney, I, Feb. 2011; preprint L. See also C. F. F. Karney, I, Sept. 2011; preprint L. =head1 AUTHOR B was written by Charles Karney. =head1 HISTORY B was added to GeographicLib, L, in 2009-03. geographiclib-1.21/man/Planimeter.usage0000644000175000017500000001565511745620415017776 0ustar frankiefrankieint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " Planimeter [ -r ] [ -s ] [ -l ] [ -e a f ] [ --comment-delimiter\n" " commentdelim ] [ --version | -h | --help ] [ --input-file infile |\n" " --input-string instring ] [ --line-separator linesep ] [ --output-file\n" " outfile ]\n" "\n" "For full documentation type:\n" " Planimeter --help\n" "or visit:\n" " http://geographiclib.sf.net/html/Planimeter.1.html\n"; else ( retval ? std::cerr : std::cout ) << "Man page:\n" "NAME\n" " Planimeter -- compute the area of geodesic polygons\n" "\n" "SYNOPSIS\n" " Planimeter [ -r ] [ -s ] [ -l ] [ -e a f ] [ --comment-delimiter\n" " commentdelim ] [ --version | -h | --help ] [ --input-file infile |\n" " --input-string instring ] [ --line-separator linesep ] [ --output-file\n" " outfile ]\n" "\n" "DESCRIPTION\n" " Measure the area of a geodesic polygon. Reads polygon vertices from\n" " standard input, one per line. Vertices may be given as latitude and\n" " longitude, UTM/UPS, or MGRS coordinates, interpreted in the same way as\n" " GeoConvert(1). (MGRS coordinates signify the center of the\n" " corresponding MGRS square.) The end of input, a blank line, or a line\n" " which can't be interpreted as a vertex signals the end of one polygon\n" " and the start of the next. For each polygon print a summary line with\n" " the number of points, the perimeter (in meters), and the area (in\n" " meters^2).\n" "\n" " By default, polygons traversed in a counter-clockwise direction return\n" " a positive area and those traversed in a clockwise direction return a\n" " negative area. This sign convention is reversed if the -r option is\n" " given.\n" "\n" " Of course, encircling an area in the clockwise direction is equivalent\n" " to encircling the rest of the ellipsoid in the counter-clockwise\n" " direction. The default interpretation used by Planimeter is the one\n" " that results in a smaller magnitude of area; i.e., the magnitude of the\n" " area is less than or equal to one half the total area of the ellipsoid.\n" " If the -s option is given, then the interpretation used is the one that\n" " results in a positive area; i.e., the area is positive and less than\n" " the total area of the ellipsoid.\n" "\n" " Only simple polygons are supported for the area computation. Polygons\n" " may include one or both poles. There is no need to close the polygon.\n" "\n" "OPTIONS\n" " -r toggle whether counter-clockwise traversal of the polygon returns a\n" " positive (the default) or negative result.\n" "\n" " -s toggle whether to return a signed result (the default) or not.\n" "\n" " -l toggle whether the vertices represent a polygon (the default) or a\n" " polyline. For a polyline, the number of points and the length of\n" " the path joining them is returned; the path is not closed and the\n" " area is not reported.\n" "\n" " -e specify the ellipsoid via a f; the equatorial radius is a and the\n" " flattening is f. Setting f = 0 results in a sphere. Specify f < 0\n" " for a prolate ellipsoid. A simple fraction, e.g., 1/297, is\n" " allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By\n" " default, the WGS84 ellipsoid is used, a = 6378137 m, f =\n" " 1/298.257223563. If entering vertices as UTM/UPS or MGRS\n" " coordinates, use the default ellipsoid, since the conversion of\n" " these coordinates to latitude and longitude uses the WGS84\n" " parameters.\n" "\n" " --comment-delimiter\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. For a given polygon, the last such string found\n" " will be appended to the output line (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\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\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\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "EXAMPLES\n" " Example (the area of the 100km MGRS square 18SWK)\n" "\n" " Planimeter < 4 400139.53295860 10007388597.1913\n" "\n" " The following code takes the output from gdalinfo and reports the area\n" " covered by the data (assuming the edges of the image are geodesics).\n" "\n" " #! /bin/sh\n" " egrep '^((Upper|Lower) (Left|Right)|Center) ' |\n" " sed -e 's/d /d/g' -e \"s/' /'/g\" | tr -s '(),\\r\\t' ' ' | awk '{\n" " if ($1 $2 == \"UpperLeft\")\n" " ul = $6 \" \" $5;\n" " else if ($1 $2 == \"LowerLeft\")\n" " ll = $6 \" \" $5;\n" " else if ($1 $2 == \"UpperRight\")\n" " ur = $6 \" \" $5;\n" " else if ($1 $2 == \"LowerRight\")\n" " lr = $6 \" \" $5;\n" " else if ($1 == \"Center\") {\n" " printf \"%s\\n%s\\n%s\\n%s\\n\\n\", ul, ll, lr, ur;\n" " ul = ll = ur = lr = \"\";\n" " }\n" " }\n" " ' | Planimeter | cut -f3 -d' '\n" "\n" "SEE ALSO\n" " GeoConvert(1). The algorithm for the area of geodesic polygon is given\n" " in Section 15 of C. F. F. Karney, Geodesics on an ellipsoid of\n" " revolution, Feb. 2011; preprint . See\n" " also Section 6 of C. F. F. Karney, Algorithms for geodesics, Sept.\n" " 2011; preprint .\n" "\n" "AUTHOR\n" " Planimeter was written by Charles Karney.\n" "\n" "HISTORY\n" " Planimeter was added to GeographicLib, ,\n" " in version 1.4.\n" ; return retval; } geographiclib-1.21/man/Geod.usage0000644000175000017500000002364611745620415016553 0ustar frankiefrankieint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " Geod [ -i | -l lat1 lon1 azi1 ] [ -a ] [ -e a f ] [ -d | -: ] [ -b ] [\n" " -f ] [ -p prec ] [ --comment-delimiter commentdelim ] [ --version | -h\n" " | --help ] [ --input-file infile | --input-string instring ] [\n" " --line-separator linesep ] [ --output-file outfile ]\n" "\n" "For full documentation type:\n" " Geod --help\n" "or visit:\n" " http://geographiclib.sf.net/html/Geod.1.html\n"; else ( retval ? std::cerr : std::cout ) << "Man page:\n" "NAME\n" " Geod -- perform geodesic calculations\n" "\n" "SYNOPSIS\n" " Geod [ -i | -l lat1 lon1 azi1 ] [ -a ] [ -e a f ] [ -d | -: ] [ -b ] [\n" " -f ] [ -p prec ] [ --comment-delimiter commentdelim ] [ --version | -h\n" " | --help ] [ --input-file infile | --input-string instring ] [\n" " --line-separator linesep ] [ --output-file outfile ]\n" "\n" "DESCRIPTION\n" " The shortest path between two points on the ellipsoid at (lat1, lon1)\n" " and (lat2, lon2) is called the geodesic. Its length is s12 and the\n" " geodesic from point 1 to point 2 has azimuths azi1 and azi2 at the two\n" " end points.\n" "\n" " Geod operates in one of three modes:\n" "\n" " 1. By default, Geod accepts lines on the standard input containing\n" " lat1 lon1 azi1 s12 and prints lat2 lon2 azi2 on standard output.\n" " This is the direct geodesic calculation.\n" "\n" " 2. Command line arguments -l lat1 lon1 azi1 specify a geodesic line.\n" " Geod then accepts a sequence of s12 values (one per line) on\n" " standard input and prints lat2 lon2 azi2 for each. This generates\n" " a sequence of points on a single geodesic.\n" "\n" " 3. With the -i command line argument, Geod performs the inverse\n" " geodesic calculation. It reads lines containing lat1 lon1 lat2\n" " lon2 and prints the corresponding values of azi1 azi2 s12.\n" "\n" "OPTIONS\n" " -i perform an inverse geodesic calculation (see 3 above).\n" "\n" " -l line mode (see 2 above); generate a sequence of points along the\n" " geodesic specified by lat1 lon1 azi1.\n" "\n" " -a arc mode; on input and output s12 is replaced by a12 the arc length\n" " (in degrees) on the auxiliary sphere. See \"AUXILIARY SPHERE\".\n" "\n" " -e specify the ellipsoid via a f; the equatorial radius is a and the\n" " flattening is f. Setting f = 0 results in a sphere. Specify f < 0\n" " for a prolate ellipsoid. A simple fraction, e.g., 1/297, is\n" " allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By\n" " default, the WGS84 ellipsoid is used, a = 6378137 m, f =\n" " 1/298.257223563.\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" " -b report the back azimuth at point 2 instead of the forward azimuth.\n" "\n" " -f full output; each line of output consists of 12 quantities: lat1\n" " lon1 azi1 lat2 lon2 azi2 s12 a12 m12 M12 M21 S12. a12 is described\n" " in \"AUXILIARY SPHERE\". The four quantities m12, M12, M21, and S12\n" " are described in \"ADDITIONAL QUANTITIES\".\n" "\n" " -p set the output precision to prec (default 3); prec is the precision\n" " relative to 1 m. See PRECISION.\n" "\n" " --comment-delimiter\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\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\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\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file\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" " Geod measures all angles in degrees and all lengths (s12) in meters.\n" " On input angles (latitude, longitude, azimuth, arc length) can be as\n" " decimal degrees or degrees (d), minutes ('), seconds (\"). A decimal\n" " point can only appear in the least significant component and the\n" " designator (d, ', or \") for this component is optional; thus \"40d30\",\n" " \"40d30'\", \"40.5d\", and 40.5 are all equivalent. By default, latitude\n" " precedes longitude for each point; however on input either may be given\n" " first by appending (or prepending) N or S to the latitude and E or W to\n" " the longitude. Azimuths are measured clockwise from north; however\n" " this may be overridden with E or W.\n" "\n" "AUXILIARY SPHERE\n" " Geodesics on the ellipsoid can be transferred to the auxiliary sphere\n" " on which the distance is measured in terms of the arc length a12\n" " (measured in degrees) instead of s12. In terms of a12, 180 degrees is\n" " the distance from one equator crossing to the next or from the minimum\n" " latitude to the maximum latitude. Geodesics with a12 > 180 degrees do\n" " not correspond to shortest paths. With the -a flag, s12 (on both input\n" " and output) is replaced by a12. The -a flag does not affect the full\n" " output given by the -f flag (which always includes both s12 and a12).\n" "\n" "ADDITIONAL QUANTITIES\n" " The -f flag reports four additional quantities.\n" "\n" " The reduced length of the geodesic, m12, is defined such that if the\n" " initial azimuth is perturbed by dazi1 (radians) then the second point\n" " is displaced by m12 dazi1 in the direction perpendicular to the\n" " geodesic. m12 is given in meters. On a curved surface the reduced\n" " length obeys a symmetry relation, m12 + m21 = 0. On a flat surface, we\n" " have m12 = s12.\n" "\n" " M12 and M21 are geodesic scales. If two geodesics are parallel at\n" " point 1 and separated by a small distance dt, then they are separated\n" " by a distance M12 dt at point 2. M21 is defined similarly (with the\n" " geodesics being parallel to one another at point 2). M12 and M21 are\n" " dimensionless quantities. On a flat surface, we have M12 = M21 = 1.\n" "\n" " If points 1, 2, and 3 lie on a single geodesic, then the following\n" " addition rules hold, m13 = m12 M23 + m23 M21, M13 = M12 M23 - (1 - M12\n" " M21) m23 / m12, and M31 = M32 M21 - (1 - M23 M32) m12 / m23.\n" "\n" " Finally, S12 is the area between the geodesic from point 1 to point 2\n" " and the equator; i.e., it is the area, measured counter-clockwise, of\n" " the quadrilateral with corners (lat1,lon1), (0,lon1), (0,lon2), and\n" " (lat2,lon2). It is given in meters^2.\n" "\n" "PRECISION\n" " prec gives precision of the output with prec = 0 giving 1 m precision,\n" " prec = 3 giving 1 mm precision, etc. prec is the number of digits\n" " after the decimal point for lengths. For decimal degrees, the number\n" " of digits after the decimal point is 5 + prec. For DMS (degree,\n" " minute, seconds) output, the number of digits after the decimal point\n" " in the seconds component is 1 + prec. The minimum value of prec is 0\n" " and the maximum is 10.\n" "\n" "ERRORS\n" " An illegal line of input will print an error message to standard output\n" " beginning with \"ERROR:\" and causes Geod to return an exit code of 1.\n" " However, an error does not cause Geod to terminate; following lines\n" " will be converted.\n" "\n" "EXAMPLES\n" " Route from JFK Airport to Singapore Changi Airport:\n" "\n" " echo 40:38:23N 073:46:44W 01:21:33N 103:59:22E |\n" " Geod -i -: -p 0\n" "\n" " 003:18:29.9 177:29:09.2 15347628\n" "\n" " Waypoints on the route at intervals of 2000km:\n" "\n" " for ((i = 0; i <= 16; i += 2)); do echo ${i}000000;done |\n" " Geod -l 40:38:23N 073:46:44W 003:18:29.9 -: -p 0\n" "\n" " 40:38:23.0N 073:46:44.0W 003:18:29.9\n" " 58:34:45.1N 071:49:36.7W 004:48:48.8\n" " 76:22:28.4N 065:32:17.8W 010:41:38.4\n" " 84:50:28.0N 075:04:39.2E 150:55:00.9\n" " 67:26:20.3N 098:00:51.2E 173:27:20.3\n" " 49:33:03.2N 101:06:52.6E 176:07:54.3\n" " 31:34:16.5N 102:30:46.3E 177:03:08.4\n" " 13:31:56.0N 103:26:50.7E 177:24:55.0\n" " 04:32:05.7S 104:14:48.7E 177:28:43.6\n" "\n" "SEE ALSO\n" " The algorithms are described in C. F. F. Karney, Geodesics on an\n" " ellipsoid of revolution, Feb. 2011; preprint\n" " . See also C. F. F. Karney, Algorithms\n" " for geodesics, Sept. 2011; preprint .\n" "\n" "AUTHOR\n" " Geod was written by Charles Karney.\n" "\n" "HISTORY\n" " Geod was added to GeographicLib, , in\n" " 2009-03.\n" ; return retval; } geographiclib-1.21/man/GeoConvert.pod0000644000175000017500000002341511745620415017420 0ustar frankiefrankie=for comment $Id: fc3aaeb4b0e207d3d40e1fa301ea4573c37b7321 $ =head1 NAME GeoConvert -- convert geographic coordinates =head1 SYNOPSIS B [ B<-g> | B<-d> | B<-:> | B<-u> | B<-m> | B<-c> ] [ B<-p> I ] [ B<-z> I | B<-s> | B<-t> ] [ B<-n> ] [ B<-w> ] [ B<--comment-delimiter> I ] [ B<--version> | B<-h> | B<--help> ] [ B<--input-file> I | B<--input-string> I ] [ B<--line-separator> I ] [ B<--output-file> I ] =head1 DESCRIPTION B reads from standard input interpreting each line as a geographic coordinate and prints the coordinate in the format specified by the options on standard output. The input is interpreted in one of three different ways depending on how many space or comma delimited tokens there are on the line. The options B<-g>, B<-d>, B<-u>, and B<-m> govern the format of output. In all cases, the WGS84 model of the earth is used (I = 6378137 m, I = 1/298.257223563). =over =item B 2 tokens (output options B<-g>, B<-d>, or B<-:>) given as I I using decimal degrees or degrees minutes seconds. d, ', and " are used to denote degrees, minutes, and seconds, with the least significant designator optional. (See L for how to quote the characters ' and " when entering coordinates on the command line.) Various unicode characters (encoded with UTF-8) may also be used to denote degrees, minutes, and seconds, e.g., the degree, prime, and double prime symbols. Alternatively, : (colon) may be used to separate the various components. Latitude is given first (unless the B<-w> option is given); however, on input, either may be given first by appending or prepending I or I to the latitude and I or I to the longitude. For example, the following are all equivalent 33.3 44.4 E44.4 N33.3 33d18'N 44d24'E 44d24 33d18N 33:18 44:24 =item B 3 tokens (output option B<-u>) given as I+I I I or I I I+I, where I is either I or I. The I is absent for a UPS specification. For example, 38N 444140.54 3684706.36 444140.54 3684706.36 38N S 2173854.98 2985980.58 2173854.98 2985980.58 S =item B 1 token (output option B<-m>) is used to specify the center of an MGRS grid square. For example, 38SMB4484 38SMB44140847064 =back =head1 OPTIONS =over =item B<-g> output latitude and longitude using decimal degrees. Default output mode. =item B<-d> output latitude and longitude using degrees, minutes, and seconds (DMS). =item B<-:> like B<-d>, except use : as a separator instead of the d, ', and " delimiters. =item B<-u> output UTM or UPS. =item B<-m> output MGRS. =item B<-c> output meridian convergence and scale for the corresponding UTM or UPS projection. Convergence is the bearing of grid north given as degrees clockwise from true north. =item B<-p> set the output precision to I (default 0); I is the precision relative to 1 m. See L. =item B<-z> set the zone to I for output. Use either 0 E I E= 60 for a UTM zone or I = 0 for UPS. Alternatively use a I+I designation (I is ignored), e.g., 38N. See L. =item B<-s> use the standard UPS and UTM zones. =item B<-t> similar to B<-s> but forces UPS regions to the closest UTM zone. =item B<-n> on input, MGRS coordinates refer to the south-west corner of the MGRS square instead of the center; see L. =item B<-w> on input and output, longitude precedes latitude (except that on input this can be overridden by a hemisphere designator, I, I,I, I). =item B<--comment-delimiter> set the comment delimiter to I (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). =item B<--version> print version and exit. =item B<-h> print usage and exit. =item B<--help> print full documentation and exit. =item B<--input-file> read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> read input from the string I instead of from standard input. All occurrences of the line separator character (default is a semicolon) in I are converted to newlines before the reading begins. =item B<--line-separator> set the line separator character to I. By default this is a semicolon. =item B<--output-file> write output to the file I instead of to standard output; a file name of "-" stands for standard output. =back =head1 PRECISION I gives precision of the output with I = 0 giving 1 m precision, I = 3 giving 1 mm precision, etc. I is the number of digits after the decimal point for UTM/UPS. The number of digits per coordinate for MGRS is 5 + I. For decimal degrees, the number of digits after the decimal point is 5 + I. For DMS (degree, minute, seconds) output, the number of digits after the decimal point in the seconds components is 1 + I; if this is negative then use minutes (I = -2 or -3) or degrees (I E= -4) as the least significant component. Print convergence, resp. scale, with 5 + I, resp. 7 + I, digits after the decimal point. The minimum value of I is -5 and the maximum is 9 for UTM/UPS, 9 for decimal degrees, 10 for DMS, 6 for MGRS, and 8 for convergence and scale. =head1 MGRS MGRS coordinates represent a square patch of the earth, thus C<38SMB4488> is in zone C<38N> with 444km E= I E 445km and 3688km E= I E 3689km. Consistent with this representation, coordinates are I (instead of I) to the requested precision. Similarly, on input an MGRS coordinate represents the I
of the square (C<38N 444500 3688500> in the example above). However, if the B<-n> option is given then the south-west corner of the square is returned instead (C<38N 444000 3688000> in the example above). =head1 ZONE If the input is B, B uses the standard rules of selecting UTM vs UPS and for assigning the UTM zone (with the Norway and Svalbard exceptions). If the input is B, or B, then the choice between UTM and UPS and the UTM zone mirrors the input. The B<-z> I, B<-s>, B<-t> options allow these rules to be overridden with I = 0 being used to indicate UPS. For example, the point 79.9S 6.1E corresponds to possible MGRS coordinates 32CMS4324728161 (standard UTM zone = 32) 31CEM6066227959 (neighboring UTM zone = 31) BBZ1945517770 (neighboring UPS zone) then echo 79.9S 6.1E | GeoConvert -p -3 -m => 32CMS4328 echo 31CEM6066227959 | GeoConvert -p -3 -m => 31CEM6027 echo 31CEM6066227959 | GeoConvert -p -3 -m -s => 32CMS4328 echo 31CEM6066227959 | GeoConvert -p -3 -m -z 0 => BBZ1917 B: the letter in the zone specification for UTM is a hemisphere designator I or I and I an MGRS latitude band letter. Convert the MGRS latitude band letter to a hemisphere as follows: replace I thru I by I; replace I thru I by I. =head1 QUOTING Unfortunately the characters ' and " have special meanings in many shells and have to be entered with care. =over =item Unix shells (sh, bash, tsch) The special characters can be quoted by preceding them with a \ (backslash). Alternatively you can quote a ' with a pair of "s. The two alternatives are illustrated by echo 30d30\'30\" "30d30'30" | GeoConvert -d -p -1 => 30d30'30"N 030d30'30"E Alternatively use colon separators, e.g., 30:30:30, which need no quoting. =item Windows command shell (cmd) The ' character needs no quoting and the " character can be quoted by a ^. However this quoting is usually unnecessary because the trailing designator can be omitted. Thus echo 30d30'30^" 30d30'30 | GeoConvert -d -p -1 => 30d30'30"N 030d30'30"E Alternatively use colon separators, e.g., 30:30:30, which need no quoting. =item Input from a file No quoting need be done if the input from a file. Thus each line of the file C should just contain the plain coordinates. GeoConvert -d -p -1 < input.txt =back =head1 EXAMPLES echo 38SMB4488 | GeoConvert => 33.33424 44.40363 echo 38SMB4488 | GeoConvert -: -p 1 => 33:20:03.25N 044:2413.06E echo 38SMB4488 | GeoConvert -u => 38N 444500 3688500 echo E44d24 N33d20 | GeoConvert -m -p -3 => 38SMB4488 =head1 ERRORS An illegal line of input will print an error message to standard output beginning with C and causes B to return an exit code of 1. However, an error does not cause B to terminate; following lines will be converted. =head1 ABBREVIATIONS =over =item B Universal Transverse Mercator, L. =item B Universal Polar Stereographic, L. =item B Military Grid Reference System, L. =item B World Geodetic System 1984, L. =back =head1 SEE ALSO The algorithms for the transverse Mercator projection are described in C. F. F. Karney, I, J. Geod B<85>(8), 475-485 (Aug. 2011); DOI L; preprint L. =head1 AUTHOR B was written by Charles Karney. =head1 HISTORY B was added to GeographicLib, L, in 2009-01. geographiclib-1.21/man/ConicProj.usage0000644000175000017500000001400211745620415017545 0ustar frankiefrankieint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " ConicProj ( -c | -a ) lat1 lat2 [ -l lon0 ] [ -k k1 ] [ -r ] [ -e a f ]\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" " ConicProj --help\n" "or visit:\n" " http://geographiclib.sf.net/html/ConicProj.1.html\n"; else ( retval ? std::cerr : std::cout ) << "Man page:\n" "NAME\n" " ConicProj -- perform conic projections\n" "\n" "SYNOPSIS\n" " ConicProj ( -c | -a ) lat1 lat2 [ -l lon0 ] [ -k k1 ] [ -r ] [ -e a f ]\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" " Perform one of two conic projections geodesics. Convert geodetic\n" " coordinates to either Lambert conformal conic or Albers equal area\n" " coordinates. The standard latitudes lat1 and lat2 are specified by\n" " that the -c option (for Lambert conformal conic) or the -a option (for\n" " Albers equal area). At least one of these options must be given (the\n" " last one given is used). Specify lat1 = lat2, to obtain the case with\n" " a single standard parallel. The central meridian is given by lon0.\n" " The longitude of origin is given by the latitude of minimum (azimuthal)\n" " scale for Lambert conformal conic (Albers equal area). The (azimuthal)\n" " scale on the standard parallels is k1.\n" "\n" " Geodetic coordinates are provided on standard input as a set of lines\n" " containing (blank separated) latitude and longitude (decimal degrees or\n" " degrees, minutes, seconds). For each set of geodetic coordinates, the\n" " corresponding projected easting, x, and northing, y, (meters) are\n" " printed on standard output together with the meridian convergence gamma\n" " (degrees) and (azimuthal) scale k. For Albers equal area, the radial\n" " scale is 1/k. The meridian convergence is the bearing of the y axis\n" " measured clockwise from true north.\n" "\n" " Special cases of the Lambert conformal projection are the Mercator\n" " projection (the standard latitudes equal and opposite) and the polar\n" " stereographic projection (both standard latitudes correspond to the\n" " same pole). Special cases of the Albers equal area projection are the\n" " cylindrical equal area projection (the standard latitudes equal and\n" " opposite), the Lambert azimuthal equal area projection (both standard\n" " latitude corresponds to the same pole), and the Lambert equal area\n" " conic projection (one standard parallel is at a pole).\n" "\n" "OPTIONS\n" " -c use the Lambert conformal conic projection with standard parallels\n" " lat1 and lat2.\n" "\n" " -a use the Albers equal area projection with standard parallels lat1\n" " and lat2.\n" "\n" " -l specify the longitude of origin lon0 (degrees, default 0).\n" "\n" " -k specify the (azimuthal) scale k1 on the standard parallels (default\n" " 1).\n" "\n" " -r perform the reverse projection. x and y are given on standard\n" " input and each line of standard output gives latitude, longitude,\n" " gamma, and k.\n" "\n" " -e specify the ellipsoid via a f; the equatorial radius is a and the\n" " flattening is f. Setting f = 0 results in a sphere. Specify f < 0\n" " for a prolate ellipsoid. A simple fraction, e.g., 1/297, is\n" " allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By\n" " default, the WGS84 ellipsoid is used, a = 6378137 m, f =\n" " 1/298.257223563.\n" "\n" " --comment-delimiter\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\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\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\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "EXAMPLES\n" " echo 39.95N 75.17W | ConicProj -c 40d58 39d56 -l 77d45W\n" " => 220445 -52372 1.67 1.0\n" " echo 220445 -52372 | ConicProj -c 40d58 39d56 -l 77d45W -r\n" " => 39.95 -75.17 1.67 1.0\n" "\n" "ERRORS\n" " An illegal line of input will print an error message to standard output\n" " beginning with \"ERROR:\" and causes ConicProj to return an exit code of\n" " 1. However, an error does not cause ConicProj to terminate; following\n" " lines will be converted.\n" "\n" "AUTHOR\n" " ConicProj was written by Charles Karney.\n" "\n" "HISTORY\n" " ConicProj was added to GeographicLib, , in\n" " version 1.9.\n" ; return retval; } geographiclib-1.21/man/MagneticField.usage0000644000175000017500000002310111745620415020352 0ustar frankiefrankieint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " MagneticField [ -n name ] [ -d dir ] [ -t time | -c time lat h ] [ -r ]\n" " [ -T tguard ] [ -H hguard ] [ -p prec ] [ -v ] [ --comment-delimiter\n" " commentdelim ] [ --version | -h | --help ] [ --input-file infile |\n" " --input-string instring ] [ --line-separator linesep ] [ --output-file\n" " outfile ]\n" "\n" "For full documentation type:\n" " MagneticField --help\n" "or visit:\n" " http://geographiclib.sf.net/html/MagneticField.1.html\n"; else ( retval ? std::cerr : std::cout ) << "Man page:\n" "NAME\n" " MagneticField -- compute the earth's magnetic field\n" "\n" "SYNOPSIS\n" " MagneticField [ -n name ] [ -d dir ] [ -t time | -c time lat h ] [ -r ]\n" " [ -T tguard ] [ -H hguard ] [ -p prec ] [ -v ] [ --comment-delimiter\n" " commentdelim ] [ --version | -h | --help ] [ --input-file infile |\n" " --input-string instring ] [ --line-separator linesep ] [ --output-file\n" " outfile ]\n" "\n" "DESCRIPTION\n" " MagneticField reads in times and positions on standard input and prints\n" " out the geomagnetic field on standard output and, optionally, its rate\n" " of change.\n" "\n" " The input line is of the form time lat lon h. time is a date of the\n" " form 2012-07-03 or a fractional year such as 2012.5. lat and lon are\n" " the latitude and longitude expressed as decimal degrees or degrees,\n" " minutes, and seconds; see GeoConvert(1) for details. h is the height\n" " above the ellipsoid in meters; this is optional and defaults to zero.\n" " Alternatively, time can be given on the command line as the argument to\n" " the -t option, in which case it should not be included on the input\n" " lines. Finally, the magnetic field can be computed at various points\n" " on a circle of latitude (constant time, lat, and h) via the -c option;\n" " in this case only the longitude should be given on the input lines.\n" "\n" " The output consists of the following 7 items:\n" "\n" " the declination (the direction of the horizontal component of\n" " the magnetic field measured clockwise from north) in degrees,\n" " the inclination (the direction of the magnetic field measured\n" " down from the horizontal) in degrees,\n" " the horizontal field in nanotesla (nT),\n" " the north component of the field in nT,\n" " the east component of the field in nT,\n" " the vertical component of the field in nT (down is positive),\n" " the total field in nT.\n" "\n" " If the -r option is given, a second line is printed giving the rates of\n" " change of these quantities in degrees/yr and nT/yr.\n" "\n" " The WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.\n" "\n" "OPTIONS\n" " -n use magnetic field model name instead of the default \"wmm2010\".\n" " See MODELS.\n" "\n" " -d read magnetic models from dir instead of the default. See MODELS.\n" "\n" " -t evaluate the field at time instead of reading the time from the\n" " input lines.\n" "\n" " -c evaluate the field on a circle of latitude given by time, lat, h\n" " instead of reading these quantities from the input lines. In this\n" " case, MagneticField can calculate the field considerably more\n" " quickly.\n" "\n" " -r toggle whether to report the rates of change of the field.\n" "\n" " -T signal an error if time lies tguard years (default 50 yr) beyond\n" " the range for the model.\n" "\n" " -H signal an error if h lies hguard meters (default 500000 m) beyond\n" " the range for the model.\n" "\n" " -p set the output precision to prec (default 1). Fields are printed\n" " with precision with prec decimal places; angles use prec + 1\n" " places.\n" "\n" " -v print information about the magnetic model on standard error before\n" " processing the input.\n" "\n" " --comment-delimiter\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, the default magnetic path and name, and exit.\n" "\n" " --help\n" " print full documentation and exit.\n" "\n" " --input-file\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\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\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "MODELS\n" " MagneticField computes the geomagnetic field using one of the following\n" " models\n" "\n" " wmm2010, the World Magnetic Model 2010, which approximates the\n" " main magnetic field for the period 2010aXX2015. See\n" " http://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml\n" " igrf11, the International Geomagnetic Reference Field (11th\n" " generation) which approximates the main magnetic field for\n" " the period 1900aXX2015. See\n" " http://ngdc.noaa.gov/IAGA/vmod/igrf.html\n" " emm2010, the Enhanced Magnetic Model 2010, which approximates the\n" " main and crustal magnetic fields for the period 2010aXX2015. See\n" " http://ngdc.noaa.gov/geomag/EMM/index.html\n" "\n" " These models approximate the magnetic field due to the earth's core and\n" " (in the case of emm2010) its crust. They neglect magnetic fields due\n" " to the ionosphere, the magnetosphere, nearby magnetized materials,\n" " electrical machinery, etc.\n" "\n" " By default, the \"wmm2010\" magnetic model is used. This may changed by\n" " setting the environment variable \"MAGNETIC_NAME\" or with the -n option.\n" "\n" " The magnetic models will be loaded from a directory specified at\n" " compile time. This may changed by setting the environment variables\n" " \"MAGNETIC_PATH\" or \"GEOGRAPHICLIB_DATA\", or with the -d option. The -h\n" " option prints the default magnetic path and name. Use the -v option to\n" " ascertain the full path name of the data file.\n" "\n" " Instructions for downloading and installing magnetic models are\n" " available at\n" " .\n" "\n" "ENVIRONMENT\n" " MAGNETIC_NAME\n" " Override the compile-time default magnetic name of \"wmm2010\". The\n" " -h option reports the value of MAGNETIC_NAME, if defined, otherwise\n" " it reports the compile-time value. If the -n name option is used,\n" " then name takes precedence.\n" "\n" " MAGNETIC_PATH\n" " Override the compile-time default magnetic path. This is typically\n" " \"/usr/local/share/GeographicLib/magnetic\" on Unix-like systems and\n" " \"C:/Documents and Settings/All Users/Application\n" " Data/GeographicLib/magnetic\" on Windows systems. The -h option\n" " reports the value of MAGNETIC_PATH, if defined, otherwise it\n" " reports the compile-time value. If the -d dir option is used, then\n" " dir takes precedence.\n" "\n" " GEOGRAPHICLIB_DATA\n" " Another way of overriding the compile-time default magnetic path.\n" " If it is set (and if MAGNETIC_PATH is not set), then\n" " $GEOGRAPHICLIB_DATA/magnetic is used.\n" "\n" "ERRORS\n" " An illegal line of input will print an error message to standard output\n" " beginning with \"ERROR:\" and causes MagneticField to return an exit code\n" " of 1. However, an error does not cause MagneticField to terminate;\n" " following lines will be converted. If time or h are outside the\n" " recommended ranges for the model (but inside the ranges increase by\n" " tguard and hguard), a warning is printed on standard error and the\n" " field (which may be inaccurate) is returned in the normal way.\n" "\n" "EXAMPLES\n" " The magnetic field from WMM2010 in Timbuktu on 2012-01-01\n" "\n" " echo 2012-01-01 16:46:33N 3:00:34W 300 | MagneticField -r\n" " => -2.55 12.43 33771.0 33737.6 -1500.5 7446.0 34582.1\n" " 0.10 -0.07 34.3 36.8 54.4 -35.3 25.9\n" "\n" " The first two numbers returned are the declination and inclination of\n" " the field. The second line gives the annual change.\n" "\n" "SEE ALSO\n" " GeoConvert(1).\n" "\n" "AUTHOR\n" " MagneticField was written by Charles Karney.\n" "\n" "HISTORY\n" " MagneticField was added to GeographicLib,\n" " , in version 1.15.\n" ; return retval; } geographiclib-1.21/man/CartConvert.usage0000644000175000017500000001167311745620415020124 0ustar frankiefrankieint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " CartConvert [ -r ] [ -l lat0 lon0 h0 ] [ -e a f ] [ --comment-delimiter\n" " commentdelim ] [ --version | -h | --help ] [ --input-file infile |\n" " --input-string instring ] [ --line-separator linesep ] [ --output-file\n" " outfile ]\n" "\n" "For full documentation type:\n" " CartConvert --help\n" "or visit:\n" " http://geographiclib.sf.net/html/CartConvert.1.html\n"; else ( retval ? std::cerr : std::cout ) << "Man page:\n" "NAME\n" " CartConvert -- convert geodetic coordinates to geocentric or local\n" " cartesian\n" "\n" "SYNOPSIS\n" " CartConvert [ -r ] [ -l lat0 lon0 h0 ] [ -e a f ] [ --comment-delimiter\n" " commentdelim ] [ --version | -h | --help ] [ --input-file infile |\n" " --input-string instring ] [ --line-separator linesep ] [ --output-file\n" " outfile ]\n" "\n" "DESCRIPTION\n" " Convert geodetic coordinates to either geocentric or local cartesian\n" " coordinates. Geocentric coordinates have the origin at the center of\n" " the earth, with the z axis going thru the north pole, and the x axis\n" " thru latitude = 0, longitude = 0. By default, the conversion is to\n" " geocentric coordinates. Specifying -l lat0 lon0 h0 causes a local\n" " coordinate system to be used with the origin at latitude = lat0,\n" " longitude = lon0, height = h0, z normal to the ellipsoid and y due\n" " north.\n" "\n" " Geodetic coordinates are provided on standard input as a set of lines\n" " containing (blank separated) latitude, longitude (decimal degrees or\n" " degrees, minutes and seconds), and height above the ellipsoid (meters).\n" " For each set of geodetic coordinates, the corresponding cartesian\n" " coordinates x, y, z (meters) are printed on standard output.\n" "\n" "OPTIONS\n" " -r perform the reverse projection. x, y, z are given on standard\n" " input and each line of standard output gives latitude, longitude,\n" " height.\n" "\n" " -e specify the ellipsoid via a f; the equatorial radius is a and the\n" " flattening is f. Setting f = 0 results in a sphere. Specify f < 0\n" " for a prolate ellipsoid. A simple fraction, e.g., 1/297, is\n" " allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By\n" " default, the WGS84 ellipsoid is used, a = 6378137 m, f =\n" " 1/298.257223563.\n" "\n" " --comment-delimiter\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\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\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\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "EXAMPLES\n" " echo 33.3 44.4 6000 | CartConvert\n" " => 3816209.60 3737108.55 3485109.57\n" " echo 33.3 44.4 6000 | CartConvert -l 33 44 20\n" " => 37288.97 33374.29 5783.64\n" " echo 30000 30000 0 | CartConvert -r\n" " => 6.483 45 -6335709.73\n" "\n" "ERRORS\n" " An illegal line of input will print an error message to standard output\n" " beginning with \"ERROR:\" and causes CartConvert to return an exit code\n" " of 1. However, an error does not cause CartConvert to terminate;\n" " following lines will be converted.\n" "\n" "SEE ALSO\n" " The algorithm for converting geocentric to geodetic coordinates is\n" " given in Appendix B of C. F. F. Karney, Geodesics on an ellipsoid of\n" " revolution, Feb. 2011; preprint .\n" "\n" "AUTHOR\n" " CartConvert was written by Charles Karney.\n" "\n" "HISTORY\n" " CartConvert was added to GeographicLib, ,\n" " in 2009-02. Prior to 2009-03 it was called ECEFConvert.\n" ; return retval; } geographiclib-1.21/man/ConicProj.1.html0000644000175000017500000001761111745620415017555 0ustar frankiefrankie ConicProj -- perform conic projections


NAME

ConicProj -- perform conic projections


SYNOPSIS

ConicProj ( -c | -a ) lat1 lat2 [ -l lon0 ] [ -k k1 ] [ -r ] [ -e a f ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

Perform one of two conic projections geodesics. Convert geodetic coordinates to either Lambert conformal conic or Albers equal area coordinates. The standard latitudes lat1 and lat2 are specified by that the -c option (for Lambert conformal conic) or the -a option (for Albers equal area). At least one of these options must be given (the last one given is used). Specify lat1 = lat2, to obtain the case with a single standard parallel. The central meridian is given by lon0. The longitude of origin is given by the latitude of minimum (azimuthal) scale for Lambert conformal conic (Albers equal area). The (azimuthal) scale on the standard parallels is k1.

Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) latitude and longitude (decimal degrees or degrees, minutes, seconds). For each set of geodetic coordinates, the corresponding projected easting, x, and northing, y, (meters) are printed on standard output together with the meridian convergence gamma (degrees) and (azimuthal) scale k. For Albers equal area, the radial scale is 1/k. The meridian convergence is the bearing of the y axis measured clockwise from true north.

Special cases of the Lambert conformal projection are the Mercator projection (the standard latitudes equal and opposite) and the polar stereographic projection (both standard latitudes correspond to the same pole). Special cases of the Albers equal area projection are the cylindrical equal area projection (the standard latitudes equal and opposite), the Lambert azimuthal equal area projection (both standard latitude corresponds to the same pole), and the Lambert equal area conic projection (one standard parallel is at a pole).


OPTIONS

-c

use the Lambert conformal conic projection with standard parallels lat1 and lat2.

-a

use the Albers equal area projection with standard parallels lat1 and lat2.

-l

specify the longitude of origin lon0 (degrees, default 0).

-k

specify the (azimuthal) scale k1 on the standard parallels (default 1).

-r

perform the reverse projection. x and y are given on standard input and each line of standard output gives latitude, longitude, gamma, and k.

-e

specify the ellipsoid via a f; the equatorial radius is a and the flattening is f. Setting f = 0 results in a sphere. Specify f < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


EXAMPLES

   echo 39.95N 75.17W | ConicProj -c 40d58 39d56 -l 77d45W
   => 220445 -52372 1.67 1.0
   echo 220445 -52372 | ConicProj -c 40d58 39d56 -l 77d45W -r
   => 39.95 -75.17 1.67 1.0


ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes ConicProj to return an exit code of 1. However, an error does not cause ConicProj to terminate; following lines will be converted.


AUTHOR

ConicProj was written by Charles Karney.


HISTORY

ConicProj was added to GeographicLib, http://geographiclib.sf.net, in version 1.9.

geographiclib-1.21/man/CMakeLists.txt0000644000175000017500000000630411745620415017377 0ustar frankiefrankie# $Id: c8cbcc51270dab8273fb82cf8944118b40cea1fa $ # The man pages are maintained as .pod (plain old documentatoin) files. # In maintainer mode, there are used to create real man pages (extension # .1), usage files (extension .usage) for including in the tool itself, # and html versions of the man pages (extension .1.html) for use from # the doxygen generated documentation # Only the maintainer tries to generate the derived files and the .usage # files are in the build tree. For non-maintainers, the .usages files # are in the source tree. if (MAINTAINER) add_custom_target (distrib-man) add_custom_target (man ALL) set (MANDIR ${CMAKE_CURRENT_BINARY_DIR}) else () set (MANDIR ${CMAKE_CURRENT_SOURCE_DIR}) endif () set (MANPAGES) set (USAGE) set (HTMLMAN) # Loop over the tools building up lists of the derived files. Also in # maintainer mode, specify how the derived files are created. The sed # replacements for the .1.html files glue in a style sheet and implement # cross-referencing between the tools. The .usage files are generated # by a shell script makeusage.sh. foreach (TOOL ${TOOLS}) set (MANPAGES ${MANPAGES} ${MANDIR}/${TOOL}.1) set (USAGE ${USAGE} ${MANDIR}/${TOOL}.usage) set (HTMLMAN ${HTMLMAN} ${MANDIR}/${TOOL}.1.html) if (MAINTAINER) add_custom_command (OUTPUT ${TOOL}.1 COMMAND pod2man --center=\"GeographicLib Utilities\" --release=\"GeographicLib ${GeographicLib_VERSION}\" ${CMAKE_CURRENT_SOURCE_DIR}/${TOOL}.pod > ${TOOL}.1 COMMENT "Building man page for ${TOOL}" MAIN_DEPENDENCY ${TOOL}.pod) add_custom_command (OUTPUT ${TOOL}.1.html COMMAND pod2html --noindex ${CMAKE_CURRENT_SOURCE_DIR}/${TOOL}.pod | sed -e 's%%%' -e 's%\\\([^<>]*\\\)\(\\\(.\\\)\)%&%'g > ${TOOL}.1.html COMMENT "Building html version of man page for ${TOOL}" MAIN_DEPENDENCY ${TOOL}.pod) add_custom_command (OUTPUT ${TOOL}.usage COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/makeusage.sh ${CMAKE_CURRENT_SOURCE_DIR}/${TOOL}.pod > ${TOOL}.usage COMMENT "Building usage code for ${TOOL}" MAIN_DEPENDENCY ${TOOL}.pod) endif () endforeach () # Add the extra maintainer tasks into the dependency list. The # distrib-man target copies the derived documentation files into the # source tree. if (MAINTAINER) add_custom_target (manpages ALL DEPENDS ${MANPAGES} COMMENT "Building all the man pages") add_custom_target (usage ALL DEPENDS ${USAGE} COMMENT "Converting the man pages to online usage") add_custom_target (htmlman ALL DEPENDS ${HTMLMAN} COMMENT "Building html versions of the man pages") add_dependencies (man manpages usage htmlman) add_dependencies (distrib-man man) add_custom_command (TARGET distrib-man COMMAND for f in ${MANPAGES} ${USAGE} ${HTMLMAN}\; do cmp "$$f" ${CMAKE_CURRENT_SOURCE_DIR}/`basename "$$f"` >/dev/null 2>&1|| install -m 644 "$$f" ${CMAKE_CURRENT_SOURCE_DIR}\; done COMMENT "Installing man documentation page in source tree") endif () # Install the man pages. install (FILES ${MANPAGES} DESTINATION share/man/man1) geographiclib-1.21/man/Gravity.10000644000175000017500000003140611745620415016347 0ustar frankiefrankie.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "GRAVITY 1" .TH GRAVITY 1 "2012-04-24" "GeographicLib 1.21" "GeographicLib Utilities" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Gravity \-\- compute the earth's gravity field .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBGravity\fR [ \fB\-n\fR \fIname\fR ] [ \fB\-d\fR \fIdir\fR ] [ \fB\-G\fR | \fB\-D\fR | \fB\-A\fR | \fB\-H\fR ] [ \fB\-c\fR \fIlat\fR \fIh\fR ] [ \fB\-p\fR \fIprec\fR ] [ \fB\-v\fR ] [ \fB\-\-comment\-delimiter\fR \fIcommentdelim\fR ] [ \fB\-\-version\fR | \fB\-h\fR | \fB\-\-help\fR ] [ \fB\-\-input\-file\fR \fIinfile\fR | \fB\-\-input\-string\fR \fIinstring\fR ] [ \fB\-\-line\-separator\fR \fIlinesep\fR ] [ \fB\-\-output\-file\fR \fIoutfile\fR ] .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBGravity\fR reads in positions on standard input and prints out the gravitational field on standard output. .PP The input line is of the form \fIlat\fR \fIlon\fR \fIh\fR. \fIlat\fR and \fIlon\fR are the latitude and longitude expressed as decimal degrees or degrees, minutes, and seconds; see \fIGeoConvert\fR\|(1) for details. \fIh\fR is the height above the ellipsoid in meters; this quantity is optional and defaults to 0. Alternatively, the gravity field can be computed at various points on a circle of latitude (constant \fIlat\fR and \fIh\fR) via the \fB\-c\fR option; in this case only the longitude should be given on the input lines. The quantities printed out are governed by the \fB\-G\fR (default), \fB\-D\fR, \&\fB\-A\fR, or \fB\-H\fR options. .PP All the supported gravity models use \s-1WGS84\s0 as the reference ellipsoid \&\fIa\fR = 6378137 m, \fIf\fR = 1/298.257223563, \fIomega\fR = 7292115e\-11 rad/s, and \fI\s-1GM\s0\fR = 3986004.418e8 m^3/s^2. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-n\fR" 4 .IX Item "-n" use gravity field model \fIname\fR instead of the default \f(CW\*(C`egm96\*(C'\fR. See \&\s-1MODELS\s0. .IP "\fB\-d\fR" 4 .IX Item "-d" read gravity models from \fIdir\fR instead of the default. See \&\s-1MODELS\s0. .IP "\fB\-G\fR" 4 .IX Item "-G" compute the acceleration due to gravity (including the centrifugal acceleration due the the earth's rotation) \fBg\fR. The output consists of \&\fIgx\fR \fIgy\fR \fIgz\fR (all in m/s^2), where the \fIx\fR, \fIy\fR, and \fIz\fR components are in easterly, northerly, and up directions, respectively. Usually \fIgz\fR is negative. .IP "\fB\-D\fR" 4 .IX Item "-D" compute the gravity disturbance \fBdelta\fR = \fBg\fR \- \fBgamma\fR, where \&\fBgamma\fR is the \*(L"normal\*(R" gravity due to the reference ellipsoid . The output consists of \fIdeltax\fR \fIdeltay\fR \fIdeltaz\fR (all in mGal, 1 mGal = 10^\-5 m/s^2), where the \fIx\fR, \fIy\fR, and \fIz\fR components are in easterly, northerly, and up directions, respectively. Note that \fIdeltax\fR = \&\fIgx\fR, because \fIgammax\fR = 0. .IP "\fB\-A\fR" 4 .IX Item "-A" computes the gravitational anomaly. The output consists of 3 items \&\fIDg01\fR \fIxi\fR \fIeta\fR, where \fIDg01\fR is in mGal (1 mGal = 10^\-5 m/s^2) and \fIxi\fR and \fIeta\fR are in arcseconds. The gravitational anomaly compares the gravitational field \fBg\fR at \fIP\fR with the normal gravity \&\fBgamma\fR at \fIQ\fR where the \fIP\fR is vertically above \fIQ\fR and the gravitational potential at \fIP\fR equals the normal potential at \fIQ\fR. \&\fIDg01\fR gives the difference in the magnitudes of these two vectors and \&\fIxi\fR and \fIeta\fR give the difference in their directions (as northerly and easterly components). The calculation uses a spherical approximation to match the results of the \s-1NGA\s0's synthesis programs. .IP "\fB\-H\fR" 4 .IX Item "-H" compute the height of the geoid above the reference ellipsoid (in meters). In this case, \fIh\fR should be zero. The results accurately match the results of the \s-1NGA\s0's synthesis programs. \fIGeoidEval\fR\|(1) can compute geoid heights much more quickly by interpolating on a grid of precomputed results; however the results from \fIGeoidEval\fR\|(1) are only accurate to a few millimeters. .IP "\fB\-c\fR" 4 .IX Item "-c" evaluate the field on a circle of latitude given by \fIlat\fR and \fIh\fR instead of reading these quantities from the input lines. In this case, \&\fBGravity\fR can calculate the field considerably more quickly. If geoid heights are being computed (the \fB\-H\fR option), then \fIh\fR must be zero. .IP "\fB\-p\fR" 4 .IX Item "-p" set the output precision to \fIprec\fR. By default \fIprec\fR is 5 for acceleration due to gravity, 3 for the gravity disturbance and anomaly, and 4 for the geoid height. .IP "\fB\-v\fR" 4 .IX Item "-v" print information about the gravity model on standard error before processing the input. .IP "\fB\-\-comment\-delimiter\fR" 4 .IX Item "--comment-delimiter" set the comment delimiter to \fIcommentdelim\fR (e.g., \*(L"#\*(R" or \*(L"//\*(R"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). .IP "\fB\-\-version\fR" 4 .IX Item "--version" print version and exit. .IP "\fB\-h\fR" 4 .IX Item "-h" print usage, the default gravity path and name, and exit. .IP "\fB\-\-help\fR" 4 .IX Item "--help" print full documentation and exit. .IP "\fB\-\-input\-file\fR" 4 .IX Item "--input-file" read input from the file \fIinfile\fR instead of from standard input; a file name of \*(L"\-\*(R" stands for standard input. .IP "\fB\-\-input\-string\fR" 4 .IX Item "--input-string" read input from the string \fIinstring\fR instead of from standard input. All occurrences of the line separator character (default is a semicolon) in \fIinstring\fR are converted to newlines before the reading begins. .IP "\fB\-\-line\-separator\fR" 4 .IX Item "--line-separator" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR" 4 .IX Item "--output-file" write output to the file \fIoutfile\fR instead of to standard output; a file name of \*(L"\-\*(R" stands for standard output. .SH "MODELS" .IX Header "MODELS" \&\fBGravity\fR computes the gravity field using one of the following models .PP .Vb 8 \& egm84, earth gravity model 1984. See \& http://earth\-info.nga.mil/GandG/wgs84/gravitymod/wgs84_180/wgs84_180.html \& egm96, earth gravity model 1996. See \& http://earth\-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html \& egm2008, earth gravity model 2008. See \& http://earth\-info.nga.mil/GandG/wgs84/gravitymod/egm2008 \& wgs84, world geodetic system 1984. This returns the normal \& gravity for the WGS84 ellipsoid. .Ve .PP These models approximate the gravitation field above the surface of the earth. By default, the \f(CW\*(C`egm96\*(C'\fR gravity model is used. This may changed by setting the environment variable \f(CW\*(C`GRAVITY_NAME\*(C'\fR or with the \&\fB\-n\fR option. .PP The gravity models will be loaded from a directory specified at compile time. This may changed by setting the environment variables \&\f(CW\*(C`GRAVITY_PATH\*(C'\fR or \f(CW\*(C`GEOGRAPHICLIB_DATA\*(C'\fR, or with the \fB\-d\fR option. The \fB\-h\fR option prints the default gravity path and name. Use the \&\fB\-v\fR option to ascertain the full path name of the data file. .PP Instructions for downloading and installing gravity models are available at . .SH "ENVIRONMENT" .IX Header "ENVIRONMENT" .IP "\fB\s-1GRAVITY_NAME\s0\fR" 4 .IX Item "GRAVITY_NAME" Override the compile-time default gravity name of \f(CW\*(C`egm96\*(C'\fR. The \fB\-h\fR option reports the value of \fB\s-1GRAVITY_NAME\s0\fR, if defined, otherwise it reports the compile-time value. If the \fB\-n\fR \fIname\fR option is used, then \fIname\fR takes precedence. .IP "\fB\s-1GRAVITY_PATH\s0\fR" 4 .IX Item "GRAVITY_PATH" Override the compile-time default gravity path. This is typically \&\f(CW\*(C`/usr/local/share/GeographicLib/gravity\*(C'\fR on Unix-like systems and \&\f(CW\*(C`C:/Documents and Settings/All Users/Application Data/GeographicLib/gravity\*(C'\fR on Windows systems. The \fB\-h\fR option reports the value of \fB\s-1GRAVITY_PATH\s0\fR, if defined, otherwise it reports the compile-time value. If the \fB\-d\fR \fIdir\fR option is used, then \fIdir\fR takes precedence. .IP "\fB\s-1GEOGRAPHICLIB_DATA\s0\fR" 4 .IX Item "GEOGRAPHICLIB_DATA" Another way of overriding the compile-time default gravity path. If it is set (and if \fB\s-1GRAVITY_PATH\s0\fR is not set), then $\fB\s-1GEOGRAPHICLIB_DATA\s0\fR/gravity is used. .SH "ERRORS" .IX Header "ERRORS" An illegal line of input will print an error message to standard output beginning with \f(CW\*(C`ERROR:\*(C'\fR and causes \fBGravity\fR to return an exit code of 1. However, an error does not cause \fBGravity\fR to terminate; following lines will be converted. .SH "EXAMPLES" .IX Header "EXAMPLES" The gravity field from \s-1EGM2008\s0 at the top of Mount Everest .PP .Vb 2 \& echo 27:59:17N 86:55:32E 8820 | Gravity \-n egm2008 \& => \-0.00001 0.00103 \-9.76782 .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIGeoConvert\fR\|(1), \fIGeoidEval\fR\|(1). .SH "AUTHOR" .IX Header "AUTHOR" \&\fBGravity\fR was written by Charles Karney. .SH "HISTORY" .IX Header "HISTORY" \&\fBGravity\fR was added to GeographicLib, , in version 1.16. geographiclib-1.21/man/GeodesicProj.1.html0000644000175000017500000001736611745620415020253 0ustar frankiefrankie GeodesicProj -- perform projections based on geodesics


NAME

GeodesicProj -- perform projections based on geodesics


SYNOPSIS

GeodesicProj ( -z | -c | -g ) lat0 lon0 [ -r ] [ -e a f ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

Perform projections based on geodesics. Convert geodetic coordinates to either azimuthal equidistant, Cassini-Soldner, or gnomonic coordinates. The center of the projection (lat0, lon0) is specified by either the -c option (for Cassini-Soldner), the -z option (for azimuthal equidistant), or the -g option (for gnomonic). At least one of these options must be given (the last one given is used).

Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) latitude and longitude (decimal degrees or degrees, minutes, seconds). For each set of geodetic coordinates, the corresponding projected coordinates x, y (meters) are printed on standard output together with the azimuth azi (degrees) and reciprocal scale rk. For Cassini-Soldner, azi is the bearing of the easting direction and the scale in the easting direction is 1 and the scale in the northing direction is 1/rk. For azimuthal equidistant and gnomonic, azi is the bearing of the radial direction and the scale in the azimuthal direction is 1/rk. For azimuthal equidistant and gnomonic, the scales in the radial direction are 1 and 1/rk^2, respectively.


OPTIONS

-z

use the azimuthal equidistant projection centered at latitude = lat0, longitude = lon0.

-c

use the Cassini-Soldner projection centered at latitude = lat0, longitude = lon0.

-g

use the ellipsoidal gnomonic projection centered at latitude = lat0, longitude = lon0.

-r

perform the reverse projection. x and y are given on standard input and each line of standard output gives latitude, longitude, azi, and rk.

-e

specify the ellipsoid via a f; the equatorial radius is a and the flattening is f. Setting f = 0 results in a sphere. Specify f < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


EXAMPLES

   echo 48.648 -2.007 | GeodesicProj -c 48.836 2.337
   => -319919 -11791 86.7 0.999
   echo -319919 -11791 | GeodesicProj -c 48.836 2.337 -r
   => 48.648 -2.007 86.7 0.999


ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes GeodesicProj to return an exit code of 1. However, an error does not cause GeodesicProj to terminate; following lines will be converted.


SEE ALSO

The ellipsoidal gnomonic projection is derived in Section 13 of C. F. F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011; preprint http://arxiv.org/abs/1102.1215. See also Section 8 of C. F. F. Karney, Algorithms for geodesics, Sept. 2011; preprint http://arxiv.org/abs/1109.4448.


AUTHOR

GeodesicProj was written by Charles Karney.


HISTORY

GeodesicProj was added to GeographicLib, http://geographiclib.sf.net, in 2009-08. Prior to version 1.9 it was called EquidistantTest.

geographiclib-1.21/man/Planimeter.10000644000175000017500000002352211745620415017022 0ustar frankiefrankie.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "PLANIMETER 1" .TH PLANIMETER 1 "2012-04-24" "GeographicLib 1.21" "GeographicLib Utilities" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Planimeter \-\- compute the area of geodesic polygons .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBPlanimeter\fR [ \fB\-r\fR ] [ \fB\-s\fR ] [ \fB\-l\fR ] [ \fB\-e\fR \fIa\fR \fIf\fR ] [ \fB\-\-comment\-delimiter\fR \fIcommentdelim\fR ] [ \fB\-\-version\fR | \fB\-h\fR | \fB\-\-help\fR ] [ \fB\-\-input\-file\fR \fIinfile\fR | \fB\-\-input\-string\fR \fIinstring\fR ] [ \fB\-\-line\-separator\fR \fIlinesep\fR ] [ \fB\-\-output\-file\fR \fIoutfile\fR ] .SH "DESCRIPTION" .IX Header "DESCRIPTION" Measure the area of a geodesic polygon. Reads polygon vertices from standard input, one per line. Vertices may be given as latitude and longitude, \s-1UTM/UPS\s0, or \s-1MGRS\s0 coordinates, interpreted in the same way as \&\fIGeoConvert\fR\|(1). (\s-1MGRS\s0 coordinates signify the center of the corresponding \s-1MGRS\s0 square.) The end of input, a blank line, or a line which can't be interpreted as a vertex signals the end of one polygon and the start of the next. For each polygon print a summary line with the number of points, the perimeter (in meters), and the area (in meters^2). .PP By default, polygons traversed in a counter-clockwise direction return a positive area and those traversed in a clockwise direction return a negative area. This sign convention is reversed if the \fB\-r\fR option is given. .PP Of course, encircling an area in the clockwise direction is equivalent to encircling the rest of the ellipsoid in the counter-clockwise direction. The default interpretation used by \fBPlanimeter\fR is the one that results in a smaller magnitude of area; i.e., the magnitude of the area is less than or equal to one half the total area of the ellipsoid. If the \fB\-s\fR option is given, then the interpretation used is the one that results in a positive area; i.e., the area is positive and less than the total area of the ellipsoid. .PP Only simple polygons are supported for the area computation. Polygons may include one or both poles. There is no need to close the polygon. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-r\fR" 4 .IX Item "-r" toggle whether counter-clockwise traversal of the polygon returns a positive (the default) or negative result. .IP "\fB\-s\fR" 4 .IX Item "-s" toggle whether to return a signed result (the default) or not. .IP "\fB\-l\fR" 4 .IX Item "-l" toggle whether the vertices represent a polygon (the default) or a polyline. For a polyline, the number of points and the length of the path joining them is returned; the path is not closed and the area is not reported. .IP "\fB\-e\fR" 4 .IX Item "-e" specify the ellipsoid via \fIa\fR \fIf\fR; the equatorial radius is \fIa\fR and the flattening is \fIf\fR. Setting \fIf\fR = 0 results in a sphere. Specify \&\fIf\fR < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for \fIf\fR. (Also, if \fIf\fR > 1, the flattening is set to 1/\fIf\fR.) By default, the \s-1WGS84\s0 ellipsoid is used, \fIa\fR = 6378137 m, \&\fIf\fR = 1/298.257223563. If entering vertices as \s-1UTM/UPS\s0 or \s-1MGRS\s0 coordinates, use the default ellipsoid, since the conversion of these coordinates to latitude and longitude uses the \s-1WGS84\s0 parameters. .IP "\fB\-\-comment\-delimiter\fR" 4 .IX Item "--comment-delimiter" set the comment delimiter to \fIcommentdelim\fR (e.g., \*(L"#\*(R" or \*(L"//\*(R"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing. For a given polygon, the last such string found will be appended to the output line (separated by a space). .IP "\fB\-\-version\fR" 4 .IX Item "--version" print version and exit. .IP "\fB\-h\fR" 4 .IX Item "-h" print usage and exit. .IP "\fB\-\-help\fR" 4 .IX Item "--help" print full documentation and exit. .IP "\fB\-\-input\-file\fR" 4 .IX Item "--input-file" read input from the file \fIinfile\fR instead of from standard input; a file name of \*(L"\-\*(R" stands for standard input. .IP "\fB\-\-input\-string\fR" 4 .IX Item "--input-string" read input from the string \fIinstring\fR instead of from standard input. All occurrences of the line separator character (default is a semicolon) in \fIinstring\fR are converted to newlines before the reading begins. .IP "\fB\-\-line\-separator\fR" 4 .IX Item "--line-separator" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR" 4 .IX Item "--output-file" write output to the file \fIoutfile\fR instead of to standard output; a file name of \*(L"\-\*(R" stands for standard output. .SH "EXAMPLES" .IX Header "EXAMPLES" Example (the area of the 100km \s-1MGRS\s0 square 18SWK) .PP .Vb 7 \& Planimeter < 4 400139.53295860 10007388597.1913 .Ve .PP The following code takes the output from gdalinfo and reports the area covered by the data (assuming the edges of the image are geodesics). .PP .Vb 10 \& #! /bin/sh \& egrep \*(Aq^((Upper|Lower) (Left|Right)|Center) \*(Aq | \& sed \-e \*(Aqs/d /d/g\*(Aq \-e "s/\*(Aq /\*(Aq/g" | tr \-s \*(Aq(),\er\et\*(Aq \*(Aq \*(Aq | awk \*(Aq{ \& if ($1 $2 == "UpperLeft") \& ul = $6 " " $5; \& else if ($1 $2 == "LowerLeft") \& ll = $6 " " $5; \& else if ($1 $2 == "UpperRight") \& ur = $6 " " $5; \& else if ($1 $2 == "LowerRight") \& lr = $6 " " $5; \& else if ($1 == "Center") { \& printf "%s\en%s\en%s\en%s\en\en", ul, ll, lr, ur; \& ul = ll = ur = lr = ""; \& } \& } \& \*(Aq | Planimeter | cut \-f3 \-d\*(Aq \*(Aq .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIGeoConvert\fR\|(1). The algorithm for the area of geodesic polygon is given in Section 15 of C. F. F. Karney, \fIGeodesics on an ellipsoid of revolution\fR, Feb. 2011; preprint . See also Section 6 of C. F. F. Karney, \fIAlgorithms for geodesics\fR, Sept. 2011; preprint . .SH "AUTHOR" .IX Header "AUTHOR" \&\fBPlanimeter\fR was written by Charles Karney. .SH "HISTORY" .IX Header "HISTORY" \&\fBPlanimeter\fR was added to GeographicLib, , in version 1.4. geographiclib-1.21/man/Planimeter.1.html0000644000175000017500000002065111745620415017765 0ustar frankiefrankie Planimeter -- compute the area of geodesic polygons


NAME

Planimeter -- compute the area of geodesic polygons


SYNOPSIS

Planimeter [ -r ] [ -s ] [ -l ] [ -e a f ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

Measure the area of a geodesic polygon. Reads polygon vertices from standard input, one per line. Vertices may be given as latitude and longitude, UTM/UPS, or MGRS coordinates, interpreted in the same way as GeoConvert(1). (MGRS coordinates signify the center of the corresponding MGRS square.) The end of input, a blank line, or a line which can't be interpreted as a vertex signals the end of one polygon and the start of the next. For each polygon print a summary line with the number of points, the perimeter (in meters), and the area (in meters^2).

By default, polygons traversed in a counter-clockwise direction return a positive area and those traversed in a clockwise direction return a negative area. This sign convention is reversed if the -r option is given.

Of course, encircling an area in the clockwise direction is equivalent to encircling the rest of the ellipsoid in the counter-clockwise direction. The default interpretation used by Planimeter is the one that results in a smaller magnitude of area; i.e., the magnitude of the area is less than or equal to one half the total area of the ellipsoid. If the -s option is given, then the interpretation used is the one that results in a positive area; i.e., the area is positive and less than the total area of the ellipsoid.

Only simple polygons are supported for the area computation. Polygons may include one or both poles. There is no need to close the polygon.


OPTIONS

-r

toggle whether counter-clockwise traversal of the polygon returns a positive (the default) or negative result.

-s

toggle whether to return a signed result (the default) or not.

-l

toggle whether the vertices represent a polygon (the default) or a polyline. For a polyline, the number of points and the length of the path joining them is returned; the path is not closed and the area is not reported.

-e

specify the ellipsoid via a f; the equatorial radius is a and the flattening is f. Setting f = 0 results in a sphere. Specify f < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563. If entering vertices as UTM/UPS or MGRS coordinates, use the default ellipsoid, since the conversion of these coordinates to latitude and longitude uses the WGS84 parameters.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing. For a given polygon, the last such string found will be appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


EXAMPLES

Example (the area of the 100km MGRS square 18SWK)

   Planimeter <<EOF
   18N 500000 4400000
   18N 600000 4400000
   18N 600000 4500000
   18N 500000 4500000
   EOF
   => 4 400139.53295860 10007388597.1913

The following code takes the output from gdalinfo and reports the area covered by the data (assuming the edges of the image are geodesics).

   #! /bin/sh
   egrep '^((Upper|Lower) (Left|Right)|Center) ' |
   sed -e 's/d /d/g' -e "s/' /'/g" | tr -s '(),\r\t' ' ' | awk '{
       if ($1 $2 == "UpperLeft")
           ul = $6 " " $5;
       else if ($1 $2 == "LowerLeft")
           ll = $6 " " $5;
       else if ($1 $2 == "UpperRight")
           ur = $6 " " $5;
       else if ($1 $2 == "LowerRight")
           lr = $6 " " $5;
       else if ($1 == "Center") {
           printf "%s\n%s\n%s\n%s\n\n", ul, ll, lr, ur;
           ul = ll = ur = lr = "";
       }
   }
   ' | Planimeter | cut -f3 -d' '


SEE ALSO

GeoConvert(1). The algorithm for the area of geodesic polygon is given in Section 15 of C. F. F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011; preprint http://arxiv.org/abs/1102.1215. See also Section 6 of C. F. F. Karney, Algorithms for geodesics, Sept. 2011; preprint http://arxiv.org/abs/1109.4448.


AUTHOR

Planimeter was written by Charles Karney.


HISTORY

Planimeter was added to GeographicLib, http://geographiclib.sf.net, in version 1.4.

geographiclib-1.21/man/CartConvert.10000644000175000017500000002036611745620415017157 0ustar frankiefrankie.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "CARTCONVERT 1" .TH CARTCONVERT 1 "2012-04-24" "GeographicLib 1.21" "GeographicLib Utilities" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" CartConvert \-\- convert geodetic coordinates to geocentric or local cartesian .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBCartConvert\fR [ \fB\-r\fR ] [ \fB\-l\fR \fIlat0\fR \fIlon0\fR \fIh0\fR ] [ \fB\-e\fR \fIa\fR \fIf\fR ] [ \fB\-\-comment\-delimiter\fR \fIcommentdelim\fR ] [ \fB\-\-version\fR | \fB\-h\fR | \fB\-\-help\fR ] [ \fB\-\-input\-file\fR \fIinfile\fR | \fB\-\-input\-string\fR \fIinstring\fR ] [ \fB\-\-line\-separator\fR \fIlinesep\fR ] [ \fB\-\-output\-file\fR \fIoutfile\fR ] .SH "DESCRIPTION" .IX Header "DESCRIPTION" Convert geodetic coordinates to either geocentric or local cartesian coordinates. Geocentric coordinates have the origin at the center of the earth, with the \fIz\fR axis going thru the north pole, and the \fIx\fR axis thru \fIlatitude\fR = 0, \fIlongitude\fR = 0. By default, the conversion is to geocentric coordinates. Specifying \fB\-l\fR \fIlat0\fR \&\fIlon0\fR \fIh0\fR causes a local coordinate system to be used with the origin at \fIlatitude\fR = \fIlat0\fR, \fIlongitude\fR = \fIlon0\fR, \fIheight\fR = \&\fIh0\fR, \fIz\fR normal to the ellipsoid and \fIy\fR due north. .PP Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) \fIlatitude\fR, \fIlongitude\fR (decimal degrees or degrees, minutes and seconds), and \fIheight\fR above the ellipsoid (meters). For each set of geodetic coordinates, the corresponding cartesian coordinates \fIx\fR, \fIy\fR, \fIz\fR (meters) are printed on standard output. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-r\fR" 4 .IX Item "-r" perform the reverse projection. \fIx\fR, \fIy\fR, \fIz\fR are given on standard input and each line of standard output gives \fIlatitude\fR, \fIlongitude\fR, \&\fIheight\fR. .IP "\fB\-e\fR" 4 .IX Item "-e" specify the ellipsoid via \fIa\fR \fIf\fR; the equatorial radius is \fIa\fR and the flattening is \fIf\fR. Setting \fIf\fR = 0 results in a sphere. Specify \&\fIf\fR < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for \fIf\fR. (Also, if \fIf\fR > 1, the flattening is set to 1/\fIf\fR.) By default, the \s-1WGS84\s0 ellipsoid is used, \fIa\fR = 6378137 m, \&\fIf\fR = 1/298.257223563. .IP "\fB\-\-comment\-delimiter\fR" 4 .IX Item "--comment-delimiter" set the comment delimiter to \fIcommentdelim\fR (e.g., \*(L"#\*(R" or \*(L"//\*(R"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). .IP "\fB\-\-version\fR" 4 .IX Item "--version" print version and exit. .IP "\fB\-h\fR" 4 .IX Item "-h" print usage and exit. .IP "\fB\-\-help\fR" 4 .IX Item "--help" print full documentation and exit. .IP "\fB\-\-input\-file\fR" 4 .IX Item "--input-file" read input from the file \fIinfile\fR instead of from standard input; a file name of \*(L"\-\*(R" stands for standard input. .IP "\fB\-\-input\-string\fR" 4 .IX Item "--input-string" read input from the string \fIinstring\fR instead of from standard input. All occurrences of the line separator character (default is a semicolon) in \fIinstring\fR are converted to newlines before the reading begins. .IP "\fB\-\-line\-separator\fR" 4 .IX Item "--line-separator" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR" 4 .IX Item "--output-file" write output to the file \fIoutfile\fR instead of to standard output; a file name of \*(L"\-\*(R" stands for standard output. .SH "EXAMPLES" .IX Header "EXAMPLES" .Vb 6 \& echo 33.3 44.4 6000 | CartConvert \& => 3816209.60 3737108.55 3485109.57 \& echo 33.3 44.4 6000 | CartConvert \-l 33 44 20 \& => 37288.97 33374.29 5783.64 \& echo 30000 30000 0 | CartConvert \-r \& => 6.483 45 \-6335709.73 .Ve .SH "ERRORS" .IX Header "ERRORS" An illegal line of input will print an error message to standard output beginning with \f(CW\*(C`ERROR:\*(C'\fR and causes \fBCartConvert\fR to return an exit code of 1. However, an error does not cause \fBCartConvert\fR to terminate; following lines will be converted. .SH "SEE ALSO" .IX Header "SEE ALSO" The algorithm for converting geocentric to geodetic coordinates is given in Appendix B of C. F. F. Karney, \fIGeodesics on an ellipsoid of revolution\fR, Feb. 2011; preprint . .SH "AUTHOR" .IX Header "AUTHOR" \&\fBCartConvert\fR was written by Charles Karney. .SH "HISTORY" .IX Header "HISTORY" \&\fBCartConvert\fR was added to GeographicLib, , in 2009\-02. Prior to 2009\-03 it was called ECEFConvert. geographiclib-1.21/man/Makefile.am0000644000175000017500000000540711745620415016676 0ustar frankiefrankie# # Makefile.am # # Copyright (C) 2011, Charles Karney # $Id: 1744bf09577749b0b2bb5775499fe4f0259cc02f $ MANPAGES = \ CartConvert.1 \ ConicProj.1 \ GeodesicProj.1 \ GeoConvert.1 \ Geod.1 \ GeoidEval.1 \ Gravity.1 \ MagneticField.1 \ Planimeter.1 \ TransverseMercatorProj.1 USAGE = \ CartConvert.usage \ ConicProj.usage \ GeodesicProj.usage \ GeoConvert.usage \ Geod.usage \ GeoidEval.usage \ Gravity.usage \ MagneticField.usage \ Planimeter.usage \ TransverseMercatorProj.usage HTMLMAN = \ CartConvert.1.html \ ConicProj.1.html \ GeodesicProj.1.html \ GeoConvert.1.html \ Geod.1.html \ GeoidEval.1.html \ Gravity.1.html \ MagneticField.1.html \ Planimeter.1.html \ TransverseMercatorProj.1.html POD2MAN = pod2man --center="GeographicLib Utilities" \ --release="$(PACKAGE_STRING)" PODFIX= sed -e 's%%%' -e 's%\([^<>]*\)(\(.\))%&%'g man1_MANS = $(MANPAGES) SUFFIXES = .pod .1 .usage all: man man: manpages usage htmlman manpages: $(MANPAGES) usage: $(USAGE) htmlman: $(HTMLMAN) .pod.usage: sh $(srcdir)/makeusage.sh $< > $*.usage .pod.1: pod2html --noindex $^ | $(PODFIX) > $*.1.html $(POD2MAN) $^ > $@ CartConvert.1.html: CartConvert.pod pod2html --noindex $^ | $(PODFIX) > $@ ConicProj.1.html: ConicProj.pod pod2html --noindex $^ | $(PODFIX) > $@ GeodesicProj.1.html: GeodesicProj.pod pod2html --noindex $^ | $(PODFIX) > $@ GeoConvert.1.html: GeoConvert.pod pod2html --noindex $^ | $(PODFIX) > $@ Geod.1.html: Geod.pod pod2html --noindex $^ | $(PODFIX) > $@ GeoidEval.1.html: GeoidEval.pod pod2html --noindex $^ | $(PODFIX) > $@ Gravity.1.html: Gravity.pod pod2html --noindex $^ | $(PODFIX) > $@ MagneticField.1.html: MagneticField.pod pod2html --noindex $^ | $(PODFIX) > $@ Planimeter.1.html: Planimeter.pod pod2html --noindex $^ | $(PODFIX) > $@ TransverseMercatorProj.1.html: TransverseMercatorProj.pod pod2html --noindex $^ | $(PODFIX) > $@ EXTRA_DIST = Makefile.mk CMakeLists.txt makeusage.sh \ GeoConvert.pod TransverseMercatorProj.pod \ CartConvert.pod ConicProj.pod Geod.pod GeodesicProj.pod \ GeoidEval.pod Gravity.pod MagneticField.pod Planimeter.pod \ GeoConvert.1 TransverseMercatorProj.1 \ CartConvert.1 ConicProj.1 Geod.1 GeodesicProj.1 \ GeoidEval.1 Gravity.1 MagneticField.1 Planimeter.1 \ GeoConvert.usage TransverseMercatorProj.usage \ CartConvert.usage ConicProj.usage Geod.usage GeodesicProj.usage \ GeoidEval.usage Gravity.usage MagneticField.usage Planimeter.usage \ GeoConvert.1.html TransverseMercatorProj.1.html \ CartConvert.1.html ConicProj.1.html Geod.1.html GeodesicProj.1.html \ GeoidEval.1.html Gravity.1.html MagneticField.1.html Planimeter.1.html maintainer-clean-local: rm -rf *.usage *.1.html *.1 geographiclib-1.21/man/Makefile.in0000644000175000017500000003746411745620415016717 0ustar frankiefrankie# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Makefile.am # # Copyright (C) 2011, Charles Karney # $Id: 1744bf09577749b0b2bb5775499fe4f0259cc02f $ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = man DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" NROFF = nroff MANS = $(man1_MANS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POW_LIB = @POW_LIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MANPAGES = \ CartConvert.1 \ ConicProj.1 \ GeodesicProj.1 \ GeoConvert.1 \ Geod.1 \ GeoidEval.1 \ Gravity.1 \ MagneticField.1 \ Planimeter.1 \ TransverseMercatorProj.1 USAGE = \ CartConvert.usage \ ConicProj.usage \ GeodesicProj.usage \ GeoConvert.usage \ Geod.usage \ GeoidEval.usage \ Gravity.usage \ MagneticField.usage \ Planimeter.usage \ TransverseMercatorProj.usage HTMLMAN = \ CartConvert.1.html \ ConicProj.1.html \ GeodesicProj.1.html \ GeoConvert.1.html \ Geod.1.html \ GeoidEval.1.html \ Gravity.1.html \ MagneticField.1.html \ Planimeter.1.html \ TransverseMercatorProj.1.html POD2MAN = pod2man --center="GeographicLib Utilities" \ --release="$(PACKAGE_STRING)" PODFIX = sed -e 's%%%' -e 's%\([^<>]*\)(\(.\))%&%'g man1_MANS = $(MANPAGES) SUFFIXES = .pod .1 .usage EXTRA_DIST = Makefile.mk CMakeLists.txt makeusage.sh \ GeoConvert.pod TransverseMercatorProj.pod \ CartConvert.pod ConicProj.pod Geod.pod GeodesicProj.pod \ GeoidEval.pod Gravity.pod MagneticField.pod Planimeter.pod \ GeoConvert.1 TransverseMercatorProj.1 \ CartConvert.1 ConicProj.1 Geod.1 GeodesicProj.1 \ GeoidEval.1 Gravity.1 MagneticField.1 Planimeter.1 \ GeoConvert.usage TransverseMercatorProj.usage \ CartConvert.usage ConicProj.usage Geod.usage GeodesicProj.usage \ GeoidEval.usage Gravity.usage MagneticField.usage Planimeter.usage \ GeoConvert.1.html TransverseMercatorProj.1.html \ CartConvert.1.html ConicProj.1.html Geod.1.html GeodesicProj.1.html \ GeoidEval.1.html Gravity.1.html MagneticField.1.html Planimeter.1.html all: all-am .SUFFIXES: .SUFFIXES: .pod .1 .usage $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu man/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-man1: $(man1_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man1dir)" && rm -f $$files; } tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) installdirs: for dir in "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic \ maintainer-clean-local mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-man1 \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic \ maintainer-clean-local mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ uninstall-man uninstall-man1 all: man man: manpages usage htmlman manpages: $(MANPAGES) usage: $(USAGE) htmlman: $(HTMLMAN) .pod.usage: sh $(srcdir)/makeusage.sh $< > $*.usage .pod.1: pod2html --noindex $^ | $(PODFIX) > $*.1.html $(POD2MAN) $^ > $@ CartConvert.1.html: CartConvert.pod pod2html --noindex $^ | $(PODFIX) > $@ ConicProj.1.html: ConicProj.pod pod2html --noindex $^ | $(PODFIX) > $@ GeodesicProj.1.html: GeodesicProj.pod pod2html --noindex $^ | $(PODFIX) > $@ GeoConvert.1.html: GeoConvert.pod pod2html --noindex $^ | $(PODFIX) > $@ Geod.1.html: Geod.pod pod2html --noindex $^ | $(PODFIX) > $@ GeoidEval.1.html: GeoidEval.pod pod2html --noindex $^ | $(PODFIX) > $@ Gravity.1.html: Gravity.pod pod2html --noindex $^ | $(PODFIX) > $@ MagneticField.1.html: MagneticField.pod pod2html --noindex $^ | $(PODFIX) > $@ Planimeter.1.html: Planimeter.pod pod2html --noindex $^ | $(PODFIX) > $@ TransverseMercatorProj.1.html: TransverseMercatorProj.pod pod2html --noindex $^ | $(PODFIX) > $@ maintainer-clean-local: rm -rf *.usage *.1.html *.1 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: geographiclib-1.21/man/Makefile.mk0000644000175000017500000000207411745620415016705 0ustar frankiefrankie# $Id: 6d0f3921b8c739428669640b67932b7bf9f925d0 $ PROGRAMS = CartConvert \ ConicProj \ GeoConvert \ Geod \ GeodesicProj \ GeoidEval \ Gravity \ MagneticField \ Planimeter \ TransverseMercatorProj PODSRC = $(addsuffix .pod,$(PROGRAMS)) MANPAGES = $(addsuffix .1,$(PROGRAMS)) USAGE = $(addsuffix .usage,$(PROGRAMS)) HTMLMAN = $(addsuffix .1.html,$(PROGRAMS)) PREFIX = /usr/local DEST = $(PREFIX)/share/man/man1 VERSION:=$(shell grep '\bVERSION=' ../configure | cut -f2 -d\' | head -1) %.1: %.pod pod2man --center="GeographicLib Utilities" \ --release="GeographicLib $(VERSION)" $^ > $@ %.1.html: %.pod pod2html --noindex $^ | sed -e 's%%%' -e 's%\([^<>]*\)(\(.\))%&%'g > $@ %.usage: %.pod sh makeusage.sh $< > $@ all: $(MANPAGES) $(USAGE) $(HTMLMAN) INSTALL = install -b install: test -d $(DEST) || mkdir -p $(DEST) $(INSTALL) -m 644 $(MANPAGES) $(DEST)/ maintainer-clean: rm -f *.1 *.usage *.1.html .PHONY: all install clean geographiclib-1.21/man/Gravity.usage0000644000175000017500000002264411745620415017317 0ustar frankiefrankieint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " Gravity [ -n name ] [ -d dir ] [ -G | -D | -A | -H ] [ -c lat h ] [ -p\n" " prec ] [ -v ] [ --comment-delimiter commentdelim ] [ --version | -h |\n" " --help ] [ --input-file infile | --input-string instring ] [\n" " --line-separator linesep ] [ --output-file outfile ]\n" "\n" "For full documentation type:\n" " Gravity --help\n" "or visit:\n" " http://geographiclib.sf.net/html/Gravity.1.html\n"; else ( retval ? std::cerr : std::cout ) << "Man page:\n" "NAME\n" " Gravity -- compute the earth's gravity field\n" "\n" "SYNOPSIS\n" " Gravity [ -n name ] [ -d dir ] [ -G | -D | -A | -H ] [ -c lat h ] [ -p\n" " prec ] [ -v ] [ --comment-delimiter commentdelim ] [ --version | -h |\n" " --help ] [ --input-file infile | --input-string instring ] [\n" " --line-separator linesep ] [ --output-file outfile ]\n" "\n" "DESCRIPTION\n" " Gravity reads in positions on standard input and prints out the\n" " gravitational field on standard output.\n" "\n" " The input line is of the form lat lon h. lat and lon are the latitude\n" " and longitude expressed as decimal degrees or degrees, minutes, and\n" " seconds; see GeoConvert(1) for details. h is the height above the\n" " ellipsoid in meters; this quantity is optional and defaults to 0.\n" " Alternatively, the gravity field can be computed at various points on a\n" " circle of latitude (constant lat and h) via the -c option; in this case\n" " only the longitude should be given on the input lines. The quantities\n" " printed out are governed by the -G (default), -D, -A, or -H options.\n" "\n" " All the supported gravity models use WGS84 as the reference ellipsoid a\n" " = 6378137 m, f = 1/298.257223563, omega = 7292115e-11 rad/s, and GM =\n" " 3986004.418e8 m^3/s^2.\n" "\n" "OPTIONS\n" " -n use gravity field model name instead of the default \"egm96\". See\n" " MODELS.\n" "\n" " -d read gravity models from dir instead of the default. See MODELS.\n" "\n" " -G compute the acceleration due to gravity (including the centrifugal\n" " acceleration due the the earth's rotation) g. The output consists\n" " of gx gy gz (all in m/s^2), where the x, y, and z components are in\n" " easterly, northerly, and up directions, respectively. Usually gz\n" " is negative.\n" "\n" " -D compute the gravity disturbance delta = g - gamma, where gamma is\n" " the \"normal\" gravity due to the reference ellipsoid . The output\n" " consists of deltax deltay deltaz (all in mGal, 1 mGal = 10^-5\n" " m/s^2), where the x, y, and z components are in easterly,\n" " northerly, and up directions, respectively. Note that deltax = gx,\n" " because gammax = 0.\n" "\n" " -A computes the gravitational anomaly. The output consists of 3 items\n" " Dg01 xi eta, where Dg01 is in mGal (1 mGal = 10^-5 m/s^2) and xi\n" " and eta are in arcseconds. The gravitational anomaly compares the\n" " gravitational field g at P with the normal gravity gamma at Q where\n" " the P is vertically above Q and the gravitational potential at P\n" " equals the normal potential at Q. Dg01 gives the difference in the\n" " magnitudes of these two vectors and xi and eta give the difference\n" " in their directions (as northerly and easterly components). The\n" " calculation uses a spherical approximation to match the results of\n" " the NGA's synthesis programs.\n" "\n" " -H compute the height of the geoid above the reference ellipsoid (in\n" " meters). In this case, h should be zero. The results accurately\n" " match the results of the NGA's synthesis programs. GeoidEval(1)\n" " can compute geoid heights much more quickly by interpolating on a\n" " grid of precomputed results; however the results from GeoidEval(1)\n" " are only accurate to a few millimeters.\n" "\n" " -c evaluate the field on a circle of latitude given by lat and h\n" " instead of reading these quantities from the input lines. In this\n" " case, Gravity can calculate the field considerably more quickly.\n" " If geoid heights are being computed (the -H option), then h must be\n" " zero.\n" "\n" " -p set the output precision to prec. By default prec is 5 for\n" " acceleration due to gravity, 3 for the gravity disturbance and\n" " anomaly, and 4 for the geoid height.\n" "\n" " -v print information about the gravity model on standard error before\n" " processing the input.\n" "\n" " --comment-delimiter\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, the default gravity path and name, and exit.\n" "\n" " --help\n" " print full documentation and exit.\n" "\n" " --input-file\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\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\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "MODELS\n" " Gravity computes the gravity field using one of the following models\n" "\n" " egm84, earth gravity model 1984. See\n" " http://earth-info.nga.mil/GandG/wgs84/gravitymod/wgs84_180/wgs84_180.html\n" " egm96, earth gravity model 1996. See\n" " http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html\n" " egm2008, earth gravity model 2008. See\n" " http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008\n" " wgs84, world geodetic system 1984. This returns the normal\n" " gravity for the WGS84 ellipsoid.\n" "\n" " These models approximate the gravitation field above the surface of the\n" " earth. By default, the \"egm96\" gravity model is used. This may\n" " changed by setting the environment variable \"GRAVITY_NAME\" or with the\n" " -n option.\n" "\n" " The gravity models will be loaded from a directory specified at compile\n" " time. This may changed by setting the environment variables\n" " \"GRAVITY_PATH\" or \"GEOGRAPHICLIB_DATA\", or with the -d option. The -h\n" " option prints the default gravity path and name. Use the -v option to\n" " ascertain the full path name of the data file.\n" "\n" " Instructions for downloading and installing gravity models are\n" " available at\n" " .\n" "\n" "ENVIRONMENT\n" " GRAVITY_NAME\n" " Override the compile-time default gravity name of \"egm96\". The -h\n" " option reports the value of GRAVITY_NAME, if defined, otherwise it\n" " reports the compile-time value. If the -n name option is used,\n" " then name takes precedence.\n" "\n" " GRAVITY_PATH\n" " Override the compile-time default gravity path. This is typically\n" " \"/usr/local/share/GeographicLib/gravity\" on Unix-like systems and\n" " \"C:/Documents and Settings/All Users/Application\n" " Data/GeographicLib/gravity\" on Windows systems. The -h option\n" " reports the value of GRAVITY_PATH, if defined, otherwise it reports\n" " the compile-time value. If the -d dir option is used, then dir\n" " takes precedence.\n" "\n" " GEOGRAPHICLIB_DATA\n" " Another way of overriding the compile-time default gravity path.\n" " If it is set (and if GRAVITY_PATH is not set), then\n" " $GEOGRAPHICLIB_DATA/gravity is used.\n" "\n" "ERRORS\n" " An illegal line of input will print an error message to standard output\n" " beginning with \"ERROR:\" and causes Gravity to return an exit code of 1.\n" " However, an error does not cause Gravity to terminate; following lines\n" " will be converted.\n" "\n" "EXAMPLES\n" " The gravity field from EGM2008 at the top of Mount Everest\n" "\n" " echo 27:59:17N 86:55:32E 8820 | Gravity -n egm2008\n" " => -0.00001 0.00103 -9.76782\n" "\n" "SEE ALSO\n" " GeoConvert(1), GeoidEval(1).\n" "\n" "AUTHOR\n" " Gravity was written by Charles Karney.\n" "\n" "HISTORY\n" " Gravity was added to GeographicLib, , in\n" " version 1.16.\n" ; return retval; } geographiclib-1.21/man/makeusage.sh0000644000175000017500000000170111745620415017131 0ustar frankiefrankie#! /bin/sh # Convert a pod file into a usage function for the GeographicLib utilities. # $Id: b30e390f45730799e56eb08d7450008f1b1bb540 $ SOURCE=$1 NAME=`basename $SOURCE .pod` ( cat</dev/null | col -b -x | sed -e 1,/SYNOPSIS/d -e '/^$/,$d' -e 's/ / /g' -e 's/$/\\n\\/' -e 's/"/\\"/g' cat </dev/null | col -b -x | head --lines -4 | tail --lines +5 | sed -e 's/\\/\\\\/g' -e 's/$/\\n\\/' -e 's/"/\\"/g' cat < [ B<-n> I ] [ B<-d> I ] [ B<-G> | B<-D> | B<-A> | B<-H> ] [ B<-c> I I ] [ B<-p> I ] [ B<-v> ] [ B<--comment-delimiter> I ] [ B<--version> | B<-h> | B<--help> ] [ B<--input-file> I | B<--input-string> I ] [ B<--line-separator> I ] [ B<--output-file> I ] =head1 DESCRIPTION B reads in positions on standard input and prints out the gravitational field on standard output. The input line is of the form I I I. I and I are the latitude and longitude expressed as decimal degrees or degrees, minutes, and seconds; see GeoConvert(1) for details. I is the height above the ellipsoid in meters; this quantity is optional and defaults to 0. Alternatively, the gravity field can be computed at various points on a circle of latitude (constant I and I) via the B<-c> option; in this case only the longitude should be given on the input lines. The quantities printed out are governed by the B<-G> (default), B<-D>, B<-A>, or B<-H> options. All the supported gravity models use WGS84 as the reference ellipsoid I = 6378137 m, I = 1/298.257223563, I = 7292115e-11 rad/s, and I = 3986004.418e8 m^3/s^2. =head1 OPTIONS =over =item B<-n> use gravity field model I instead of the default C. See L. =item B<-d> read gravity models from I instead of the default. See L. =item B<-G> compute the acceleration due to gravity (including the centrifugal acceleration due the the earth's rotation) B. The output consists of I I I (all in m/s^2), where the I, I, and I components are in easterly, northerly, and up directions, respectively. Usually I is negative. =item B<-D> compute the gravity disturbance B = B - B, where B is the "normal" gravity due to the reference ellipsoid . The output consists of I I I (all in mGal, 1 mGal = 10^-5 m/s^2), where the I, I, and I components are in easterly, northerly, and up directions, respectively. Note that I = I, because I = 0. =item B<-A> computes the gravitational anomaly. The output consists of 3 items I I I, where I is in mGal (1 mGal = 10^-5 m/s^2) and I and I are in arcseconds. The gravitational anomaly compares the gravitational field B at I

with the normal gravity B at I where the I

is vertically above I and the gravitational potential at I

equals the normal potential at I. I gives the difference in the magnitudes of these two vectors and I and I give the difference in their directions (as northerly and easterly components). The calculation uses a spherical approximation to match the results of the NGA's synthesis programs. =item B<-H> compute the height of the geoid above the reference ellipsoid (in meters). In this case, I should be zero. The results accurately match the results of the NGA's synthesis programs. GeoidEval(1) can compute geoid heights much more quickly by interpolating on a grid of precomputed results; however the results from GeoidEval(1) are only accurate to a few millimeters. =item B<-c> evaluate the field on a circle of latitude given by I and I instead of reading these quantities from the input lines. In this case, B can calculate the field considerably more quickly. If geoid heights are being computed (the B<-H> option), then I must be zero. =item B<-p> set the output precision to I. By default I is 5 for acceleration due to gravity, 3 for the gravity disturbance and anomaly, and 4 for the geoid height. =item B<-v> print information about the gravity model on standard error before processing the input. =item B<--comment-delimiter> set the comment delimiter to I (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). =item B<--version> print version and exit. =item B<-h> print usage, the default gravity path and name, and exit. =item B<--help> print full documentation and exit. =item B<--input-file> read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> read input from the string I instead of from standard input. All occurrences of the line separator character (default is a semicolon) in I are converted to newlines before the reading begins. =item B<--line-separator> set the line separator character to I. By default this is a semicolon. =item B<--output-file> write output to the file I instead of to standard output; a file name of "-" stands for standard output. =back =head1 MODELS B computes the gravity field using one of the following models egm84, earth gravity model 1984. See http://earth-info.nga.mil/GandG/wgs84/gravitymod/wgs84_180/wgs84_180.html egm96, earth gravity model 1996. See http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html egm2008, earth gravity model 2008. See http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008 wgs84, world geodetic system 1984. This returns the normal gravity for the WGS84 ellipsoid. These models approximate the gravitation field above the surface of the earth. By default, the C gravity model is used. This may changed by setting the environment variable C or with the B<-n> option. The gravity models will be loaded from a directory specified at compile time. This may changed by setting the environment variables C or C, or with the B<-d> option. The B<-h> option prints the default gravity path and name. Use the B<-v> option to ascertain the full path name of the data file. Instructions for downloading and installing gravity models are available at L. =head1 ENVIRONMENT =over =item B Override the compile-time default gravity name of C. The B<-h> option reports the value of B, if defined, otherwise it reports the compile-time value. If the B<-n> I option is used, then I takes precedence. =item B Override the compile-time default gravity path. This is typically C on Unix-like systems and C on Windows systems. The B<-h> option reports the value of B, if defined, otherwise it reports the compile-time value. If the B<-d> I

option is used, then I takes precedence. =item B Another way of overriding the compile-time default gravity path. If it is set (and if B is not set), then $B/gravity is used. =back =head1 ERRORS An illegal line of input will print an error message to standard output beginning with C and causes B to return an exit code of 1. However, an error does not cause B to terminate; following lines will be converted. =head1 EXAMPLES The gravity field from EGM2008 at the top of Mount Everest echo 27:59:17N 86:55:32E 8820 | Gravity -n egm2008 => -0.00001 0.00103 -9.76782 =head1 SEE ALSO GeoConvert(1), GeoidEval(1). =head1 AUTHOR B was written by Charles Karney. =head1 HISTORY B was added to GeographicLib, L, in version 1.16. geographiclib-1.21/man/TransverseMercatorProj.10000644000175000017500000002310511745620415021403 0ustar frankiefrankie.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "TRANSVERSEMERCATORPROJ 1" .TH TRANSVERSEMERCATORPROJ 1 "2012-04-24" "GeographicLib 1.21" "GeographicLib Utilities" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" TransverseMercatorProj \-\- perform transverse Mercator projection .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBTransverseMercatorProj\fR [ \fB\-s\fR | \fB\-t\fR ] [ \fB\-l\fR \fIlon0\fR ] [ \fB\-k\fR \fIk1\fR ] [ \fB\-r\fR ] [ \fB\-e\fR \fIa\fR \fIf\fR ] [ \fB\-\-comment\-delimiter\fR \fIcommentdelim\fR ] [ \fB\-\-version\fR | \fB\-h\fR | \fB\-\-help\fR ] [ \fB\-\-input\-file\fR \fIinfile\fR | \fB\-\-input\-string\fR \fIinstring\fR ] [ \fB\-\-line\-separator\fR \fIlinesep\fR ] [ \fB\-\-output\-file\fR \fIoutfile\fR ] .SH "DESCRIPTION" .IX Header "DESCRIPTION" Perform the transverse Mercator projections. Convert geodetic coordinates to transverse Mercator coordinates. The central meridian is given by \fIlon0\fR. The longitude of origin is the equator. The scale on the central meridian is \fIk0\fR. By default an implementation of the exact transverse Mercator projection is used. .PP Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) \fIlatitude\fR and \fIlongitude\fR (decimal degrees or degrees, minutes, seconds). For each set of geodetic coordinates, the corresponding projected easting, \fIx\fR, and northing, \&\fIy\fR, (meters) are printed on standard output together with the meridian convergence \fIgamma\fR (degrees) and scale \fIk\fR. The meridian convergence is the bearing of the \fIy\fR axis measured clockwise from true north. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-s\fR" 4 .IX Item "-s" use the sixth-order Krueger series approximation to the transverse Mercator projection instead of the exact projection. .IP "\fB\-t\fR" 4 .IX Item "-t" use exact algorithm with the \s-1EXTENDED\s0 \s-1DOMAIN\s0. .IP "\fB\-l\fR" 4 .IX Item "-l" specify the longitude of origin \fIlon0\fR (degrees, default 0). .IP "\fB\-k\fR" 4 .IX Item "-k" specify the scale \fIk0\fR on the central meridian (default 0.9996). .IP "\fB\-r\fR" 4 .IX Item "-r" perform the reverse projection. \fIx\fR and \fIy\fR are given on standard input and each line of standard output gives \fIlatitude\fR, \fIlongitude\fR, \&\fIgamma\fR, and \fIk\fR. .IP "\fB\-e\fR" 4 .IX Item "-e" specify the ellipsoid via \fIa\fR \fIf\fR; the equatorial radius is \fIa\fR and the flattening is \fIf\fR. Setting \fIf\fR = 0 results in a sphere. Specify \&\fIf\fR < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for \fIf\fR. (Also, if \fIf\fR > 1, the flattening is set to 1/\fIf\fR.) By default, the \s-1WGS84\s0 ellipsoid is used, \fIa\fR = 6378137 m, \&\fIf\fR = 1/298.257223563. If the exact algorithm is used, \fIf\fR must be positive. .IP "\fB\-\-comment\-delimiter\fR" 4 .IX Item "--comment-delimiter" set the comment delimiter to \fIcommentdelim\fR (e.g., \*(L"#\*(R" or \*(L"//\*(R"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). .IP "\fB\-\-version\fR" 4 .IX Item "--version" print version and exit. .IP "\fB\-h\fR" 4 .IX Item "-h" print usage and exit. .IP "\fB\-\-help\fR" 4 .IX Item "--help" print full documentation and exit. .IP "\fB\-\-input\-file\fR" 4 .IX Item "--input-file" read input from the file \fIinfile\fR instead of from standard input; a file name of \*(L"\-\*(R" stands for standard input. .IP "\fB\-\-input\-string\fR" 4 .IX Item "--input-string" read input from the string \fIinstring\fR instead of from standard input. All occurrences of the line separator character (default is a semicolon) in \fIinstring\fR are converted to newlines before the reading begins. .IP "\fB\-\-line\-separator\fR" 4 .IX Item "--line-separator" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR" 4 .IX Item "--output-file" write output to the file \fIoutfile\fR instead of to standard output; a file name of \*(L"\-\*(R" stands for standard output. .SH "EXTENDED DOMAIN" .IX Header "EXTENDED DOMAIN" The exact transverse Mercator projection has a \fIbranch point\fR on the equator at longitudes (relative to \fIlon0\fR) of +/\- (1 \- \fIe\fR) 90, where \&\fIe\fR is the eccentricity of the ellipsoid. The standard convention for handling this branch point is to map positive (negative) latitudes into positive (negative) northings \fIy\fR; i.e., a branch cut is placed on the equator. With the \fIextended\fR domain, the northern sheet of the projection is extended into the south hemisphere by pushing the branch cut south from the branch points. See the reference below for details. .SH "EXAMPLES" .IX Header "EXAMPLES" .Vb 4 \& echo 0 90 | TransverseMercatorProj \& => 25953592.84 9997964.94 90 18.40 \& echo 260e5 100e5 | TransverseMercatorProj \-r \& => \-0.02 90.00 90.01 18.48 .Ve .SH "ERRORS" .IX Header "ERRORS" An illegal line of input will print an error message to standard output beginning with \f(CW\*(C`ERROR:\*(C'\fR and causes \fBTransverseMercatorProj\fR to return an exit code of 1. However, an error does not cause \fBTransverseMercatorProj\fR to terminate; following lines will be converted. .SH "AUTHOR" .IX Header "AUTHOR" \&\fBTransverseMercatorProj\fR was written by Charles Karney. .SH "SEE ALSO" .IX Header "SEE ALSO" The algorithms for the transverse Mercator projection are described in C. F. F. Karney, \fITransverse Mercator with an accuracy of a few nanometers\fR, J. Geod \fB85\fR(8), 475\-485 (Aug. 2011); \s-1DOI\s0 http://dx.doi.org/10.1007/s00190\-011\-0445\-3 ; preprint . The explanation of the extended domain of the projection with the \fB\-t\fR option is given in Section 5 of this paper. .SH "HISTORY" .IX Header "HISTORY" \&\fBTransverseMercatorProj\fR was added to GeographicLib, , in 2009\-01. Prior to version 1.9 it was called TransverseMercatorTest (and its interface was slightly different). geographiclib-1.21/man/GeoidEval.pod0000644000175000017500000002343111745620415017202 0ustar frankiefrankie=for comment $Id: a3894e4de1e548a59e099d2a170ab330b25dbb21 $ =head1 NAME GeoidEval -- look up geoid heights =head1 SYNOPSIS B [ B<-n> I ] [ B<-d> I ] [ B<-l> ] [ B<-a> | B<-c> I I I I ] [ B<-g> ] [ B<-z> I ] [ B<--msltohae> ] [ B<--haetomsl> ] [ B<-v> ] [ B<--comment-delimiter> I ] [ B<--version> | B<-h> | B<--help> ] [ B<--input-file> I | B<--input-string> I ] [ B<--line-separator> I ] [ B<--output-file> I ] =head1 DESCRIPTION B reads in positions on standard input and prints out the corresponding geoid heights on standard output. Optionally, it also prints the northerly and easterly gradients of the geoid height. Positions are given as latitude and longitude, UTM/UPS, or MGRS, in any of the formats accepted by GeoConvert(1). (MGRS coordinates signify the I
of the corresponding MGRS square.) If the B<-z> option is specified then the specified zone is prepended to each line of input (which must be in UTM/UPS coordinates). This allows a file with UTM eastings and northings in a single zone to be used as standard input. More accurate results for the geoid height are provided by Gravity(1). This utility can also compute the direction of gravity accurately. =head1 OPTIONS =over =item B<-n> use geoid I instead of the default C. See L. =item B<-d> read geoid data from I instead of the default. See L. =item B<-l> use bilinear interpolation instead of cubic. See L. =item B<-a> cache the entire data set in memory. See L. =item B<-c> cache the data bounded by I I I I in memory. See L. =item B<-g> print the northerly and easterly gradients after the geoid height (i.e., the rate at which the geoid height changes per unit distance along the WGS84 ellipsoid in the specified directions). As a result of the way that the geoid data is stored, the calculation of gradients can result in large quantization errors. This is particularly acute at high latitudes and for the easterly gradient. =item B<-z> prefix each line of input by I, e.g., C<38N>. This should be used when the input consists of UTM/UPS eastings and northings. =item B<--msltohae> standard input should include a final token on each line which is treated as a height (in meters) above the geoid and the output echoes the input line with the height converted to height above ellipsoid (HAE). If B<-z> I is specified then the I token is treated as the height; this makes it possible to convert LIDAR data where each line consists of: easting northing height intensity. =item B<--haetomsl> this is similar to B<--msltohae> except that the height token is treated as a height (in meters) above the ellipsoid and the output echoes the input line with the height converted to height above the geoid (MSL). =item B<-v> print information about the geoid on standard error before processing the input. =item B<--comment-delimiter> set the comment delimiter to I (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). =item B<--version> print version and exit. =item B<-h> print usage, the default geoid path and name, and exit. =item B<--help> print full documentation and exit. =item B<--input-file> read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> read input from the string I instead of from standard input. All occurrences of the line separator character (default is a semicolon) in I are converted to newlines before the reading begins. =item B<--line-separator> set the line separator character to I. By default this is a semicolon. =item B<--output-file> write output to the file I instead of to standard output; a file name of "-" stands for standard output. =back =head1 GEOIDS B computes geoid heights by interpolating on the data in a regularly spaced table (see L). The following geoid tables are available (however, some may not be installed): bilinear error cubic error name geoid grid max rms max rms egm84-30 EGM84 30' 1.546 m 70 mm 0.274 m 14 mm egm84-15 EGM84 15' 0.413 m 18 mm 0.021 m 1.2 mm egm96-15 EGM96 15' 1.152 m 40 mm 0.169 m 7.0 mm egm96-5 EGM96 5' 0.140 m 4.6 mm .0032 m 0.7 mm egm2008-5 EGM2008 5' 0.478 m 12 mm 0.294 m 4.5 mm egm2008-2_5 EGM2008 2.5' 0.135 m 3.2 mm 0.031 m 0.8 mm egm2008-1 EGM2008 1' 0.025 m 0.8 mm .0022 m 0.7 mm By default, the C geoid is used. This may changed by setting the environment variable C or with the B<-n> option. The errors listed here are estimates of the quantization and interpolation errors in the reported heights compared to the specified geoid. The geoid data will be loaded from a directory specified at compile time. This may changed by setting the environment variables C or C, or with the B<-d> option. The B<-h> option prints the default geoid path and name. Use the B<-v> option to ascertain the full path name of the data file. Instructions for downloading and installing geoid data are available at L. B: all the geoids above apply to the WGS84 ellipsoid (I = 6378137 m, I = 1/298.257223563) only. =head1 INTERPOLATION Cubic interpolation is used to compute the geoid height unless B<-l> is specified in which case bilinear interpolation is used. The cubic interpolation is based on a least-squares fit of a cubic polynomial to a 12-point stencil . 1 1 . 1 2 2 1 1 2 2 1 . 1 1 . The cubic is constrained to be independent of longitude when evaluating the height at one of the poles. Cubic interpolation is considerably more accurate than bilinear; however it results in small discontinuities in the returned height on cell boundaries. The gradients are computed by differentiating the interpolated results. =head1 CACHE By default, the data file is randomly read to compute the geoid heights at the input positions. Usually this is sufficient for interactive use. If many heights are to be computed, use B<-c> I I I I to notify B to read a rectangle of data into memory; heights within the this rectangle can then be computed without any disk access. If B<-a> is specified all the geoid data is read; in the case of C, this requires about 0.5 GB of RAM. The evaluation of heights outside the cached area causes the necessary data to be read from disk. Use the B<-v> option to verify the size of the cache. Regardless of whether any cache is requested (with the B<-a> or B<-c> options), the data for the last grid cell in cached. This allows the geoid height along a continuous path to be returned with little disk overhead. =head1 ENVIRONMENT =over =item B Override the compile-time default geoid name of C. The B<-h> option reports the value of B, if defined, otherwise it reports the compile-time value. If the B<-n> I option is used, then I takes precedence. =item B Override the compile-time default geoid path. This is typically C on Unix-like systems and C on Windows systems. The B<-h> option reports the value of B, if defined, otherwise it reports the compile-time value. If the B<-d> I option is used, then I takes precedence. =item B Another way of overriding the compile-time default magnetic path. If it is set (and if B is not set), then $B/magnetic is used. =back =head1 ERRORS An illegal line of input will print an error message to standard output beginning with C and causes B to return an exit code of 1. However, an error does not cause B to terminate; following lines will be converted. =head1 ABBREVIATIONS The geoid is usually approximated by an "earth gravity model". The models published by the NGA are: =over =item B An earth gravity model published by the NGA in 1984, L. =item B An earth gravity model published by the NGA in 1996, L. =item B An earth gravity model published by the NGA in 2008, L. =item B World Geodetic System 1984, L. =item B Height above the WGS84 ellipsoid. =item B Mean sea level, used as a convenient short hand for the geoid. (However, typically, the geoid differs by a few meters from mean sea level.) =back =head1 EXAMPLES The height of the EGM96 geoid at Timbuktu echo 16:46:33N 3:00:34W | GeoidEval => 28.7068 -0.02e-6 -1.73e-6 The first number returned is the height of the geoid and the 2nd and 3rd are its slopes in the northerly and easterly directions. Convert a point in UTM zone 18N from MSL to HAE echo 531595 4468135 23 | GeoidEval --msltohae -z 18N => 531595 4468135 -10.842 =head1 SEE ALSO GeoConvert(1), Gravity(1). =head1 AUTHOR B was written by Charles Karney. =head1 HISTORY B was added to GeographicLib, L, in 2009-09. geographiclib-1.21/man/GeoConvert.10000644000175000017500000003666011745620415017004 0ustar frankiefrankie.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "GEOCONVERT 1" .TH GEOCONVERT 1 "2012-04-24" "GeographicLib 1.21" "GeographicLib Utilities" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" GeoConvert \-\- convert geographic coordinates .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBGeoConvert\fR [ \fB\-g\fR | \fB\-d\fR | \fB\-:\fR | \fB\-u\fR | \fB\-m\fR | \fB\-c\fR ] [ \fB\-p\fR \fIprec\fR ] [ \fB\-z\fR \fIzone\fR | \fB\-s\fR | \fB\-t\fR ] [ \fB\-n\fR ] [ \fB\-w\fR ] [ \fB\-\-comment\-delimiter\fR \fIcommentdelim\fR ] [ \fB\-\-version\fR | \fB\-h\fR | \fB\-\-help\fR ] [ \fB\-\-input\-file\fR \fIinfile\fR | \fB\-\-input\-string\fR \fIinstring\fR ] [ \fB\-\-line\-separator\fR \fIlinesep\fR ] [ \fB\-\-output\-file\fR \fIoutfile\fR ] .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBGeoConvert\fR reads from standard input interpreting each line as a geographic coordinate and prints the coordinate in the format specified by the options on standard output. The input is interpreted in one of three different ways depending on how many space or comma delimited tokens there are on the line. The options \fB\-g\fR, \fB\-d\fR, \fB\-u\fR, and \fB\-m\fR govern the format of output. In all cases, the \s-1WGS84\s0 model of the earth is used (\fIa\fR = 6378137 m, \fIf\fR = 1/298.257223563). .IP "\fBgeographic\fR" 4 .IX Item "geographic" 2 tokens (output options \fB\-g\fR, \fB\-d\fR, or \fB\-:\fR) given as \fIlatitude\fR \&\fIlongitude\fR using decimal degrees or degrees minutes seconds. d, ', and " are used to denote degrees, minutes, and seconds, with the least significant designator optional. (See \s-1QUOTING\s0 for how to quote the characters ' and " when entering coordinates on the command line.) Various unicode characters (encoded with \s-1UTF\-8\s0) may also be used to denote degrees, minutes, and seconds, e.g., the degree, prime, and double prime symbols. Alternatively, : (colon) may be used to separate the various components. Latitude is given first (unless the \fB\-w\fR option is given); however, on input, either may be given first by appending or prepending \fIN\fR or \fIS\fR to the latitude and \fIE\fR or \fIW\fR to the longitude. For example, the following are all equivalent .Sp .Vb 5 \& 33.3 44.4 \& E44.4 N33.3 \& 33d18\*(AqN 44d24\*(AqE \& 44d24 33d18N \& 33:18 44:24 .Ve .IP "\fB\s-1UTM/UPS\s0\fR" 4 .IX Item "UTM/UPS" 3 tokens (output option \fB\-u\fR) given as \fIzone\fR+\fIhemisphere\fR \fIeasting\fR \&\fInorthing\fR or \fIeasting\fR \fInorthing\fR \fIzone\fR+\fIhemisphere\fR, where \&\fIhemisphere\fR is either \fIN\fR or \fIS\fR. The \fIzone\fR is absent for a \s-1UPS\s0 specification. For example, .Sp .Vb 4 \& 38N 444140.54 3684706.36 \& 444140.54 3684706.36 38N \& S 2173854.98 2985980.58 \& 2173854.98 2985980.58 S .Ve .IP "\fB\s-1MRGS\s0\fR" 4 .IX Item "MRGS" 1 token (output option \fB\-m\fR) is used to specify the center of an \s-1MGRS\s0 grid square. For example, .Sp .Vb 2 \& 38SMB4484 \& 38SMB44140847064 .Ve .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-g\fR" 4 .IX Item "-g" output latitude and longitude using decimal degrees. Default output mode. .IP "\fB\-d\fR" 4 .IX Item "-d" output latitude and longitude using degrees, minutes, and seconds (\s-1DMS\s0). .IP "\fB\-:\fR" 4 .IX Item "-:" like \fB\-d\fR, except use : as a separator instead of the d, ', and " delimiters. .IP "\fB\-u\fR" 4 .IX Item "-u" output \s-1UTM\s0 or \s-1UPS\s0. .IP "\fB\-m\fR" 4 .IX Item "-m" output \s-1MGRS\s0. .IP "\fB\-c\fR" 4 .IX Item "-c" output meridian convergence and scale for the corresponding \s-1UTM\s0 or \&\s-1UPS\s0 projection. Convergence is the bearing of grid north given as degrees clockwise from true north. .IP "\fB\-p\fR" 4 .IX Item "-p" set the output precision to \fIprec\fR (default 0); \fIprec\fR is the precision relative to 1 m. See \s-1PRECISION\s0. .IP "\fB\-z\fR" 4 .IX Item "-z" set the zone to \fIzone\fR for output. Use either 0 < \fIzone\fR <= 60 for a \s-1UTM\s0 zone or \fIzone\fR = 0 for \s-1UPS\s0. Alternatively use a \&\fIzone\fR+\fIhemisphere\fR designation (\fIhemisphere\fR is ignored), e.g., 38N. See \s-1ZONE\s0. .IP "\fB\-s\fR" 4 .IX Item "-s" use the standard \s-1UPS\s0 and \s-1UTM\s0 zones. .IP "\fB\-t\fR" 4 .IX Item "-t" similar to \fB\-s\fR but forces \s-1UPS\s0 regions to the closest \s-1UTM\s0 zone. .IP "\fB\-n\fR" 4 .IX Item "-n" on input, \s-1MGRS\s0 coordinates refer to the south-west corner of the \s-1MGRS\s0 square instead of the center; see \s-1MGRS\s0. .IP "\fB\-w\fR" 4 .IX Item "-w" on input and output, longitude precedes latitude (except that on input this can be overridden by a hemisphere designator, \fIN\fR, \fIS\fR,\fIE\fR, \&\fIW\fR). .IP "\fB\-\-comment\-delimiter\fR" 4 .IX Item "--comment-delimiter" set the comment delimiter to \fIcommentdelim\fR (e.g., \*(L"#\*(R" or \*(L"//\*(R"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). .IP "\fB\-\-version\fR" 4 .IX Item "--version" print version and exit. .IP "\fB\-h\fR" 4 .IX Item "-h" print usage and exit. .IP "\fB\-\-help\fR" 4 .IX Item "--help" print full documentation and exit. .IP "\fB\-\-input\-file\fR" 4 .IX Item "--input-file" read input from the file \fIinfile\fR instead of from standard input; a file name of \*(L"\-\*(R" stands for standard input. .IP "\fB\-\-input\-string\fR" 4 .IX Item "--input-string" read input from the string \fIinstring\fR instead of from standard input. All occurrences of the line separator character (default is a semicolon) in \fIinstring\fR are converted to newlines before the reading begins. .IP "\fB\-\-line\-separator\fR" 4 .IX Item "--line-separator" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR" 4 .IX Item "--output-file" write output to the file \fIoutfile\fR instead of to standard output; a file name of \*(L"\-\*(R" stands for standard output. .SH "PRECISION" .IX Header "PRECISION" \&\fIprec\fR gives precision of the output with \fIprec\fR = 0 giving 1 m precision, \fIprec\fR = 3 giving 1 mm precision, etc. \fIprec\fR is the number of digits after the decimal point for \s-1UTM/UPS\s0. The number of digits per coordinate for \s-1MGRS\s0 is 5 + \fIprec\fR. For decimal degrees, the number of digits after the decimal point is 5 + \fIprec\fR. For \s-1DMS\s0 (degree, minute, seconds) output, the number of digits after the decimal point in the seconds components is 1 + \fIprec\fR; if this is negative then use minutes (\fIprec\fR = \-2 or \-3) or degrees (\fIprec\fR <= \-4) as the least significant component. Print convergence, resp. scale, with 5 + \fIprec\fR, resp. 7 + \&\fIprec\fR, digits after the decimal point. The minimum value of \fIprec\fR is \&\-5 and the maximum is 9 for \s-1UTM/UPS\s0, 9 for decimal degrees, 10 for \s-1DMS\s0, 6 for \s-1MGRS\s0, and 8 for convergence and scale. .SH "MGRS" .IX Header "MGRS" \&\s-1MGRS\s0 coordinates represent a square patch of the earth, thus \f(CW\*(C`38SMB4488\*(C'\fR is in zone \f(CW\*(C`38N\*(C'\fR with 444km <= \fIeasting\fR < 445km and 3688km <= \&\fInorthing\fR < 3689km. Consistent with this representation, coordinates are \fItruncated\fR (instead of \fIrounded\fR) to the requested precision. Similarly, on input an \s-1MGRS\s0 coordinate represents the \&\fIcenter\fR of the square (\f(CW\*(C`38N 444500 3688500\*(C'\fR in the example above). However, if the \fB\-n\fR option is given then the south-west corner of the square is returned instead (\f(CW\*(C`38N 444000 3688000\*(C'\fR in the example above). .SH "ZONE" .IX Header "ZONE" If the input is \fBgeographic\fR, \fBGeoConvert\fR uses the standard rules of selecting \s-1UTM\s0 vs \s-1UPS\s0 and for assigning the \s-1UTM\s0 zone (with the Norway and Svalbard exceptions). If the input is \fB\s-1UTM/UPS\s0\fR, or \fB\s-1MGRS\s0\fR, then the choice between \s-1UTM\s0 and \s-1UPS\s0 and the \s-1UTM\s0 zone mirrors the input. The \fB\-z\fR \&\fIzone\fR, \fB\-s\fR, \fB\-t\fR options allow these rules to be overridden with \&\fIzone\fR = 0 being used to indicate \s-1UPS\s0. For example, the point .PP .Vb 1 \& 79.9S 6.1E .Ve .PP corresponds to possible \s-1MGRS\s0 coordinates .PP .Vb 3 \& 32CMS4324728161 (standard UTM zone = 32) \& 31CEM6066227959 (neighboring UTM zone = 31) \& BBZ1945517770 (neighboring UPS zone) .Ve .PP then .PP .Vb 4 \& echo 79.9S 6.1E | GeoConvert \-p \-3 \-m => 32CMS4328 \& echo 31CEM6066227959 | GeoConvert \-p \-3 \-m => 31CEM6027 \& echo 31CEM6066227959 | GeoConvert \-p \-3 \-m \-s => 32CMS4328 \& echo 31CEM6066227959 | GeoConvert \-p \-3 \-m \-z 0 => BBZ1917 .Ve .PP \&\fB\s-1NOTE\s0\fR: the letter in the zone specification for \s-1UTM\s0 is a hemisphere designator \fIN\fR or \fIS\fR and \fInot\fR an \s-1MGRS\s0 latitude band letter. Convert the \s-1MGRS\s0 latitude band letter to a hemisphere as follows: replace \fIC\fR thru \fIM\fR by \fIS\fR; replace \fIN\fR thru \fIX\fR by \fIN\fR. .SH "QUOTING" .IX Header "QUOTING" Unfortunately the characters ' and " have special meanings in many shells and have to be entered with care. .IP "Unix shells (sh, bash, tsch)" 4 .IX Item "Unix shells (sh, bash, tsch)" The special characters can be quoted by preceding them with a \e (backslash). Alternatively you can quote a ' with a pair of "s. The two alternatives are illustrated by .Sp .Vb 2 \& echo 30d30\e\*(Aq30\e" "30d30\*(Aq30" | GeoConvert \-d \-p \-1 \& => 30d30\*(Aq30"N 030d30\*(Aq30"E .Ve .Sp Alternatively use colon separators, e.g., 30:30:30, which need no quoting. .IP "Windows command shell (cmd)" 4 .IX Item "Windows command shell (cmd)" The ' character needs no quoting and the " character can be quoted by a ^. However this quoting is usually unnecessary because the trailing designator can be omitted. Thus .Sp .Vb 2 \& echo 30d30\*(Aq30^" 30d30\*(Aq30 | GeoConvert \-d \-p \-1 \& => 30d30\*(Aq30"N 030d30\*(Aq30"E .Ve .Sp Alternatively use colon separators, e.g., 30:30:30, which need no quoting. .IP "Input from a file" 4 .IX Item "Input from a file" No quoting need be done if the input from a file. Thus each line of the file \f(CW\*(C`input.txt\*(C'\fR should just contain the plain coordinates. .Sp .Vb 1 \& GeoConvert \-d \-p \-1 < input.txt .Ve .SH "EXAMPLES" .IX Header "EXAMPLES" .Vb 4 \& echo 38SMB4488 | GeoConvert => 33.33424 44.40363 \& echo 38SMB4488 | GeoConvert \-: \-p 1 => 33:20:03.25N 044:2413.06E \& echo 38SMB4488 | GeoConvert \-u => 38N 444500 3688500 \& echo E44d24 N33d20 | GeoConvert \-m \-p \-3 => 38SMB4488 .Ve .SH "ERRORS" .IX Header "ERRORS" An illegal line of input will print an error message to standard output beginning with \f(CW\*(C`ERROR:\*(C'\fR and causes \fBGeoConvert\fR to return an exit code of 1. However, an error does not cause \fBGeoConvert\fR to terminate; following lines will be converted. .SH "ABBREVIATIONS" .IX Header "ABBREVIATIONS" .IP "\fB\s-1UTM\s0\fR" 4 .IX Item "UTM" Universal Transverse Mercator, . .IP "\fB\s-1UPS\s0\fR" 4 .IX Item "UPS" Universal Polar Stereographic, . .IP "\fB\s-1MGRS\s0\fR" 4 .IX Item "MGRS" Military Grid Reference System, . .IP "\fB\s-1WGS84\s0\fR" 4 .IX Item "WGS84" World Geodetic System 1984, . .SH "SEE ALSO" .IX Header "SEE ALSO" The algorithms for the transverse Mercator projection are described in C. F. F. Karney, \fITransverse Mercator with an accuracy of a few nanometers\fR, J. Geod \fB85\fR(8), 475\-485 (Aug. 2011); \s-1DOI\s0 http://dx.doi.org/10.1007/s00190\-011\-0445\-3 ; preprint . .SH "AUTHOR" .IX Header "AUTHOR" \&\fBGeoConvert\fR was written by Charles Karney. .SH "HISTORY" .IX Header "HISTORY" \&\fBGeoConvert\fR was added to GeographicLib, , in 2009\-01. geographiclib-1.21/man/GeodesicProj.usage0000644000175000017500000001333611745620415020245 0ustar frankiefrankieint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " GeodesicProj ( -z | -c | -g ) lat0 lon0 [ -r ] [ -e a f ] [\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" " GeodesicProj --help\n" "or visit:\n" " http://geographiclib.sf.net/html/GeodesicProj.1.html\n"; else ( retval ? std::cerr : std::cout ) << "Man page:\n" "NAME\n" " GeodesicProj -- perform projections based on geodesics\n" "\n" "SYNOPSIS\n" " GeodesicProj ( -z | -c | -g ) lat0 lon0 [ -r ] [ -e a f ] [\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" " Perform projections based on geodesics. Convert geodetic coordinates\n" " to either azimuthal equidistant, Cassini-Soldner, or gnomonic\n" " coordinates. The center of the projection (lat0, lon0) is specified by\n" " either the -c option (for Cassini-Soldner), the -z option (for\n" " azimuthal equidistant), or the -g option (for gnomonic). At least one\n" " of these options must be given (the last one given is used).\n" "\n" " Geodetic coordinates are provided on standard input as a set of lines\n" " containing (blank separated) latitude and longitude (decimal degrees or\n" " degrees, minutes, seconds). For each set of geodetic coordinates, the\n" " corresponding projected coordinates x, y (meters) are printed on\n" " standard output together with the azimuth azi (degrees) and reciprocal\n" " scale rk. For Cassini-Soldner, azi is the bearing of the easting\n" " direction and the scale in the easting direction is 1 and the scale in\n" " the northing direction is 1/rk. For azimuthal equidistant and\n" " gnomonic, azi is the bearing of the radial direction and the scale in\n" " the azimuthal direction is 1/rk. For azimuthal equidistant and\n" " gnomonic, the scales in the radial direction are 1 and 1/rk^2,\n" " respectively.\n" "\n" "OPTIONS\n" " -z use the azimuthal equidistant projection centered at latitude =\n" " lat0, longitude = lon0.\n" "\n" " -c use the Cassini-Soldner projection centered at latitude = lat0,\n" " longitude = lon0.\n" "\n" " -g use the ellipsoidal gnomonic projection centered at latitude =\n" " lat0, longitude = lon0.\n" "\n" " -r perform the reverse projection. x and y are given on standard\n" " input and each line of standard output gives latitude, longitude,\n" " azi, and rk.\n" "\n" " -e specify the ellipsoid via a f; the equatorial radius is a and the\n" " flattening is f. Setting f = 0 results in a sphere. Specify f < 0\n" " for a prolate ellipsoid. A simple fraction, e.g., 1/297, is\n" " allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By\n" " default, the WGS84 ellipsoid is used, a = 6378137 m, f =\n" " 1/298.257223563.\n" "\n" " --comment-delimiter\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\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\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\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "EXAMPLES\n" " echo 48.648 -2.007 | GeodesicProj -c 48.836 2.337\n" " => -319919 -11791 86.7 0.999\n" " echo -319919 -11791 | GeodesicProj -c 48.836 2.337 -r\n" " => 48.648 -2.007 86.7 0.999\n" "\n" "ERRORS\n" " An illegal line of input will print an error message to standard output\n" " beginning with \"ERROR:\" and causes GeodesicProj to return an exit code\n" " of 1. However, an error does not cause GeodesicProj to terminate;\n" " following lines will be converted.\n" "\n" "SEE ALSO\n" " The ellipsoidal gnomonic projection is derived in Section 13 of C. F.\n" " F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011; preprint\n" " . See also Section 8 of C. F. F.\n" " Karney, Algorithms for geodesics, Sept. 2011; preprint\n" " .\n" "\n" "AUTHOR\n" " GeodesicProj was written by Charles Karney.\n" "\n" "HISTORY\n" " GeodesicProj was added to GeographicLib, ,\n" " in 2009-08. Prior to version 1.9 it was called EquidistantTest.\n" ; return retval; } geographiclib-1.21/man/MagneticField.pod0000644000175000017500000001737011745620415020043 0ustar frankiefrankie=for comment $Id: fe9a4ece2e3919b375542db7836d269d1dfdb9b6 $ =head1 NAME MagneticField -- compute the earth's magnetic field =head1 SYNOPSIS B [ B<-n> I ] [ B<-d> I ] [ B<-t> I = 6378137 m, I = 1/298.257223563. =head1 OPTIONS =over =item B<-n> use magnetic field model I instead of the default C. See L. =item B<-d> read magnetic models from I instead of the default. See L. =item B<-t> evaluate the field at I option is used, then I takes precedence. =item B Another way of overriding the compile-time default magnetic path. If it is set (and if B is not set), then $B/magnetic is used. =back =head1 ERRORS An illegal line of input will print an error message to standard output beginning with C and causes B to return an exit code of 1. However, an error does not cause B to terminate; following lines will be converted. If I I ] [ B<--comment-delimiter> I ] [ B<--version> | B<-h> | B<--help> ] [ B<--input-file> I | B<--input-string> I ] [ B<--line-separator> I ] [ B<--output-file> I ] =head1 DESCRIPTION Perform the transverse Mercator projections. Convert geodetic coordinates to transverse Mercator coordinates. The central meridian is given by I. The longitude of origin is the equator. The scale on the central meridian is I. By default an implementation of the exact transverse Mercator projection is used. Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) I and I (decimal degrees or degrees, minutes, seconds). For each set of geodetic coordinates, the corresponding projected easting, I, and northing, I, (meters) are printed on standard output together with the meridian convergence I (degrees) and scale I. The meridian convergence is the bearing of the I axis measured clockwise from true north. =head1 OPTIONS =over =item B<-s> use the sixth-order Krueger series approximation to the transverse Mercator projection instead of the exact projection. =item B<-t> use exact algorithm with the L. =item B<-l> specify the longitude of origin I (degrees, default 0). =item B<-k> specify the scale I on the central meridian (default 0.9996). =item B<-r> perform the reverse projection. I and I are given on standard input and each line of standard output gives I, I, I, and I. =item B<-e> specify the ellipsoid via I I; the equatorial radius is I and the flattening is I. Setting I = 0 results in a sphere. Specify I E 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for I. (Also, if I E 1, the flattening is set to 1/I.) By default, the WGS84 ellipsoid is used, I = 6378137 m, I = 1/298.257223563. If the exact algorithm is used, I must be positive. =item B<--comment-delimiter> set the comment delimiter to I (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). =item B<--version> print version and exit. =item B<-h> print usage and exit. =item B<--help> print full documentation and exit. =item B<--input-file> read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> read input from the string I instead of from standard input. All occurrences of the line separator character (default is a semicolon) in I are converted to newlines before the reading begins. =item B<--line-separator> set the line separator character to I. By default this is a semicolon. =item B<--output-file> write output to the file I instead of to standard output; a file name of "-" stands for standard output. =back =head1 EXTENDED DOMAIN The exact transverse Mercator projection has a I on the equator at longitudes (relative to I) of +/- (1 - I) 90, where I is the eccentricity of the ellipsoid. The standard convention for handling this branch point is to map positive (negative) latitudes into positive (negative) northings I; i.e., a branch cut is placed on the equator. With the I domain, the northern sheet of the projection is extended into the south hemisphere by pushing the branch cut south from the branch points. See the reference below for details. =head1 EXAMPLES echo 0 90 | TransverseMercatorProj => 25953592.84 9997964.94 90 18.40 echo 260e5 100e5 | TransverseMercatorProj -r => -0.02 90.00 90.01 18.48 =head1 ERRORS An illegal line of input will print an error message to standard output beginning with C and causes B to return an exit code of 1. However, an error does not cause B to terminate; following lines will be converted. =head1 AUTHOR B was written by Charles Karney. =head1 SEE ALSO The algorithms for the transverse Mercator projection are described in C. F. F. Karney, I, J. Geod B<85>(8), 475-485 (Aug. 2011); DOI L; preprint L. The explanation of the extended domain of the projection with the B<-t> option is given in Section 5 of this paper. =head1 HISTORY B was added to GeographicLib, L, in 2009-01. Prior to version 1.9 it was called TransverseMercatorTest (and its interface was slightly different). geographiclib-1.21/man/ConicProj.pod0000644000175000017500000001145211745620415017231 0ustar frankiefrankie=for comment $Id: 79921d487c55a107062161cc0d60c48527eb8e05 $ =head1 NAME ConicProj -- perform conic projections =head1 SYNOPSIS B ( B<-c> | B<-a> ) I I [ B<-l> I ] [ B<-k> I ] [ B<-r> ] [ B<-e> I I ] [ B<--comment-delimiter> I ] [ B<--version> | B<-h> | B<--help> ] [ B<--input-file> I | B<--input-string> I ] [ B<--line-separator> I ] [ B<--output-file> I ] =head1 DESCRIPTION Perform one of two conic projections geodesics. Convert geodetic coordinates to either Lambert conformal conic or Albers equal area coordinates. The standard latitudes I and I are specified by that the B<-c> option (for Lambert conformal conic) or the B<-a> option (for Albers equal area). At least one of these options must be given (the last one given is used). Specify I = I, to obtain the case with a single standard parallel. The central meridian is given by I. The longitude of origin is given by the latitude of minimum (azimuthal) scale for Lambert conformal conic (Albers equal area). The (azimuthal) scale on the standard parallels is I. Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) I and I (decimal degrees or degrees, minutes, seconds). For each set of geodetic coordinates, the corresponding projected easting, I, and northing, I, (meters) are printed on standard output together with the meridian convergence I (degrees) and (azimuthal) scale I. For Albers equal area, the radial scale is 1/I. The meridian convergence is the bearing of the I axis measured clockwise from true north. Special cases of the Lambert conformal projection are the Mercator projection (the standard latitudes equal and opposite) and the polar stereographic projection (both standard latitudes correspond to the same pole). Special cases of the Albers equal area projection are the cylindrical equal area projection (the standard latitudes equal and opposite), the Lambert azimuthal equal area projection (both standard latitude corresponds to the same pole), and the Lambert equal area conic projection (one standard parallel is at a pole). =head1 OPTIONS =over =item B<-c> use the Lambert conformal conic projection with standard parallels I and I. =item B<-a> use the Albers equal area projection with standard parallels I and I. =item B<-l> specify the longitude of origin I (degrees, default 0). =item B<-k> specify the (azimuthal) scale I on the standard parallels (default 1). =item B<-r> perform the reverse projection. I and I are given on standard input and each line of standard output gives I, I, I, and I. =item B<-e> specify the ellipsoid via I I; the equatorial radius is I and the flattening is I. Setting I = 0 results in a sphere. Specify I E 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for I. (Also, if I E 1, the flattening is set to 1/I.) By default, the WGS84 ellipsoid is used, I = 6378137 m, I = 1/298.257223563. =item B<--comment-delimiter> set the comment delimiter to I (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). =item B<--version> print version and exit. =item B<-h> print usage and exit. =item B<--help> print full documentation and exit. =item B<--input-file> read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> read input from the string I instead of from standard input. All occurrences of the line separator character (default is a semicolon) in I are converted to newlines before the reading begins. =item B<--line-separator> set the line separator character to I. By default this is a semicolon. =item B<--output-file> write output to the file I instead of to standard output; a file name of "-" stands for standard output. =back =head1 EXAMPLES echo 39.95N 75.17W | ConicProj -c 40d58 39d56 -l 77d45W => 220445 -52372 1.67 1.0 echo 220445 -52372 | ConicProj -c 40d58 39d56 -l 77d45W -r => 39.95 -75.17 1.67 1.0 =head1 ERRORS An illegal line of input will print an error message to standard output beginning with C and causes B to return an exit code of 1. However, an error does not cause B to terminate; following lines will be converted. =head1 AUTHOR B was written by Charles Karney. =head1 HISTORY B was added to GeographicLib, L, in version 1.9. geographiclib-1.21/man/Geod.1.html0000644000175000017500000003246011745620415016544 0ustar frankiefrankie Geod -- perform geodesic calculations


NAME

Geod -- perform geodesic calculations


SYNOPSIS

Geod [ -i | -l lat1 lon1 azi1 ] [ -a ] [ -e a f ] [ -d | -: ] [ -b ] [ -f ] [ -p prec ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

The shortest path between two points on the ellipsoid at (lat1, lon1) and (lat2, lon2) is called the geodesic. Its length is s12 and the geodesic from point 1 to point 2 has azimuths azi1 and azi2 at the two end points.

Geod operates in one of three modes:

  1. By default, Geod accepts lines on the standard input containing lat1 lon1 azi1 s12 and prints lat2 lon2 azi2 on standard output. This is the direct geodesic calculation.

  2. Command line arguments -l lat1 lon1 azi1 specify a geodesic line. Geod then accepts a sequence of s12 values (one per line) on standard input and prints lat2 lon2 azi2 for each. This generates a sequence of points on a single geodesic.

  3. With the -i command line argument, Geod performs the inverse geodesic calculation. It reads lines containing lat1 lon1 lat2 lon2 and prints the corresponding values of azi1 azi2 s12.


OPTIONS

-i

perform an inverse geodesic calculation (see 3 above).

-l

line mode (see 2 above); generate a sequence of points along the geodesic specified by lat1 lon1 azi1.

-a

arc mode; on input and output s12 is replaced by a12 the arc length (in degrees) on the auxiliary sphere. See AUXILIARY SPHERE.

-e

specify the ellipsoid via a f; the equatorial radius is a and the flattening is f. Setting f = 0 results in a sphere. Specify f < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.

-d

output angles as degrees, minutes, seconds instead of decimal degrees.

-:

like -d, except use : as a separator instead of the d, ', and " delimiters.

-b

report the back azimuth at point 2 instead of the forward azimuth.

-f

full output; each line of output consists of 12 quantities: lat1 lon1 azi1 lat2 lon2 azi2 s12 a12 m12 M12 M21 S12. a12 is described in AUXILIARY SPHERE. The four quantities m12, M12, M21, and S12 are described in ADDITIONAL QUANTITIES.

-p

set the output precision to prec (default 3); prec is the precision relative to 1 m. See PRECISION.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


INPUT

Geod measures all angles in degrees and all lengths (s12) in meters. On input angles (latitude, longitude, azimuth, arc length) can be as decimal degrees or degrees (d), minutes ('), seconds ("). A decimal point can only appear in the least significant component and the designator (d, ', or ") for this component is optional; thus 40d30, 40d30', 40.5d, and 40.5 are all equivalent. By default, latitude precedes longitude for each point; however on input either may be given first by appending (or prepending) N or S to the latitude and E or W to the longitude. Azimuths are measured clockwise from north; however this may be overridden with E or W.


AUXILIARY SPHERE

Geodesics on the ellipsoid can be transferred to the auxiliary sphere on which the distance is measured in terms of the arc length a12 (measured in degrees) instead of s12. In terms of a12, 180 degrees is the distance from one equator crossing to the next or from the minimum latitude to the maximum latitude. Geodesics with a12 > 180 degrees do not correspond to shortest paths. With the -a flag, s12 (on both input and output) is replaced by a12. The -a flag does not affect the full output given by the -f flag (which always includes both s12 and a12).


ADDITIONAL QUANTITIES

The -f flag reports four additional quantities.

The reduced length of the geodesic, m12, is defined such that if the initial azimuth is perturbed by dazi1 (radians) then the second point is displaced by m12 dazi1 in the direction perpendicular to the geodesic. m12 is given in meters. On a curved surface the reduced length obeys a symmetry relation, m12 + m21 = 0. On a flat surface, we have m12 = s12.

M12 and M21 are geodesic scales. If two geodesics are parallel at point 1 and separated by a small distance dt, then they are separated by a distance M12 dt at point 2. M21 is defined similarly (with the geodesics being parallel to one another at point 2). M12 and M21 are dimensionless quantities. On a flat surface, we have M12 = M21 = 1.

If points 1, 2, and 3 lie on a single geodesic, then the following addition rules hold, m13 = m12 M23 + m23 M21, M13 = M12 M23 - (1 - M12 M21) m23 / m12, and M31 = M32 M21 - (1 - M23 M32) m12 / m23.

Finally, S12 is the area between the geodesic from point 1 to point 2 and the equator; i.e., it is the area, measured counter-clockwise, of the quadrilateral with corners (lat1,lon1), (0,lon1), (0,lon2), and (lat2,lon2). It is given in meters^2.


PRECISION

prec gives precision of the output with prec = 0 giving 1 m precision, prec = 3 giving 1 mm precision, etc. prec is the number of digits after the decimal point for lengths. For decimal degrees, the number of digits after the decimal point is 5 + prec. For DMS (degree, minute, seconds) output, the number of digits after the decimal point in the seconds component is 1 + prec. The minimum value of prec is 0 and the maximum is 10.


ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes Geod to return an exit code of 1. However, an error does not cause Geod to terminate; following lines will be converted.


EXAMPLES

Route from JFK Airport to Singapore Changi Airport:

   echo 40:38:23N 073:46:44W 01:21:33N 103:59:22E |
   Geod -i -: -p 0
   003:18:29.9 177:29:09.2 15347628

Waypoints on the route at intervals of 2000km:

   for ((i = 0; i <= 16; i += 2)); do echo ${i}000000;done |
   Geod -l 40:38:23N 073:46:44W 003:18:29.9 -: -p 0
   40:38:23.0N 073:46:44.0W 003:18:29.9
   58:34:45.1N 071:49:36.7W 004:48:48.8
   76:22:28.4N 065:32:17.8W 010:41:38.4
   84:50:28.0N 075:04:39.2E 150:55:00.9
   67:26:20.3N 098:00:51.2E 173:27:20.3
   49:33:03.2N 101:06:52.6E 176:07:54.3
   31:34:16.5N 102:30:46.3E 177:03:08.4
   13:31:56.0N 103:26:50.7E 177:24:55.0
   04:32:05.7S 104:14:48.7E 177:28:43.6


SEE ALSO

The algorithms are described in C. F. F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011; preprint http://arxiv.org/abs/1102.1215. See also C. F. F. Karney, Algorithms for geodesics, Sept. 2011; preprint http://arxiv.org/abs/1109.4448.


AUTHOR

Geod was written by Charles Karney.


HISTORY

Geod was added to GeographicLib, http://geographiclib.sf.net, in 2009-03.

geographiclib-1.21/man/Gravity.1.html0000644000175000017500000003146511745620415017317 0ustar frankiefrankie Gravity -- compute the earth's gravity field


NAME

Gravity -- compute the earth's gravity field


SYNOPSIS

Gravity [ -n name ] [ -d dir ] [ -G | -D | -A | -H ] [ -c lat h ] [ -p prec ] [ -v ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

Gravity reads in positions on standard input and prints out the gravitational field on standard output.

The input line is of the form lat lon h. lat and lon are the latitude and longitude expressed as decimal degrees or degrees, minutes, and seconds; see GeoConvert(1) for details. h is the height above the ellipsoid in meters; this quantity is optional and defaults to 0. Alternatively, the gravity field can be computed at various points on a circle of latitude (constant lat and h) via the -c option; in this case only the longitude should be given on the input lines. The quantities printed out are governed by the -G (default), -D, -A, or -H options.

All the supported gravity models use WGS84 as the reference ellipsoid a = 6378137 m, f = 1/298.257223563, omega = 7292115e-11 rad/s, and GM = 3986004.418e8 m^3/s^2.


OPTIONS

-n

use gravity field model name instead of the default egm96. See MODELS.

-d

read gravity models from dir instead of the default. See MODELS.

-G

compute the acceleration due to gravity (including the centrifugal acceleration due the the earth's rotation) g. The output consists of gx gy gz (all in m/s^2), where the x, y, and z components are in easterly, northerly, and up directions, respectively. Usually gz is negative.

-D

compute the gravity disturbance delta = g - gamma, where gamma is the "normal" gravity due to the reference ellipsoid . The output consists of deltax deltay deltaz (all in mGal, 1 mGal = 10^-5 m/s^2), where the x, y, and z components are in easterly, northerly, and up directions, respectively. Note that deltax = gx, because gammax = 0.

-A

computes the gravitational anomaly. The output consists of 3 items Dg01 xi eta, where Dg01 is in mGal (1 mGal = 10^-5 m/s^2) and xi and eta are in arcseconds. The gravitational anomaly compares the gravitational field g at P with the normal gravity gamma at Q where the P is vertically above Q and the gravitational potential at P equals the normal potential at Q. Dg01 gives the difference in the magnitudes of these two vectors and xi and eta give the difference in their directions (as northerly and easterly components). The calculation uses a spherical approximation to match the results of the NGA's synthesis programs.

-H

compute the height of the geoid above the reference ellipsoid (in meters). In this case, h should be zero. The results accurately match the results of the NGA's synthesis programs. GeoidEval(1) can compute geoid heights much more quickly by interpolating on a grid of precomputed results; however the results from GeoidEval(1) are only accurate to a few millimeters.

-c

evaluate the field on a circle of latitude given by lat and h instead of reading these quantities from the input lines. In this case, Gravity can calculate the field considerably more quickly. If geoid heights are being computed (the -H option), then h must be zero.

-p

set the output precision to prec. By default prec is 5 for acceleration due to gravity, 3 for the gravity disturbance and anomaly, and 4 for the geoid height.

-v

print information about the gravity model on standard error before processing the input.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage, the default gravity path and name, and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


MODELS

Gravity computes the gravity field using one of the following models

    egm84, earth gravity model 1984.  See
      http://earth-info.nga.mil/GandG/wgs84/gravitymod/wgs84_180/wgs84_180.html
    egm96, earth gravity model 1996.  See
      http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html
    egm2008, earth gravity model 2008.  See
      http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008
    wgs84, world geodetic system 1984.  This returns the normal
      gravity for the WGS84 ellipsoid.

These models approximate the gravitation field above the surface of the earth. By default, the egm96 gravity model is used. This may changed by setting the environment variable GRAVITY_NAME or with the -n option.

The gravity models will be loaded from a directory specified at compile time. This may changed by setting the environment variables GRAVITY_PATH or GEOGRAPHICLIB_DATA, or with the -d option. The -h option prints the default gravity path and name. Use the -v option to ascertain the full path name of the data file.

Instructions for downloading and installing gravity models are available at http://geographiclib.sf.net/html/gravity.html#gravityinst.


ENVIRONMENT

GRAVITY_NAME

Override the compile-time default gravity name of egm96. The -h option reports the value of GRAVITY_NAME, if defined, otherwise it reports the compile-time value. If the -n name option is used, then name takes precedence.

GRAVITY_PATH

Override the compile-time default gravity path. This is typically /usr/local/share/GeographicLib/gravity on Unix-like systems and C:/Documents and Settings/All Users/Application Data/GeographicLib/gravity on Windows systems. The -h option reports the value of GRAVITY_PATH, if defined, otherwise it reports the compile-time value. If the -d dir option is used, then dir takes precedence.

GEOGRAPHICLIB_DATA

Another way of overriding the compile-time default gravity path. If it is set (and if GRAVITY_PATH is not set), then $GEOGRAPHICLIB_DATA/gravity is used.


ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes Gravity to return an exit code of 1. However, an error does not cause Gravity to terminate; following lines will be converted.


EXAMPLES

The gravity field from EGM2008 at the top of Mount Everest

    echo 27:59:17N 86:55:32E 8820 | Gravity -n egm2008
    => -0.00001 0.00103 -9.76782


SEE ALSO

GeoConvert(1), GeoidEval(1).


AUTHOR

Gravity was written by Charles Karney.


HISTORY

Gravity was added to GeographicLib, http://geographiclib.sf.net, in version 1.16.

geographiclib-1.21/man/GeoidEval.usage0000644000175000017500000003036411745620415017527 0ustar frankiefrankieint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " GeoidEval [ -n name ] [ -d dir ] [ -l ] [ -a | -c south west north east\n" " ] [ -g ] [ -z zone ] [ --msltohae ] [ --haetomsl ] [ -v ] [\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" " GeoidEval --help\n" "or visit:\n" " http://geographiclib.sf.net/html/GeoidEval.1.html\n"; else ( retval ? std::cerr : std::cout ) << "Man page:\n" "NAME\n" " GeoidEval -- look up geoid heights\n" "\n" "SYNOPSIS\n" " GeoidEval [ -n name ] [ -d dir ] [ -l ] [ -a | -c south west north east\n" " ] [ -g ] [ -z zone ] [ --msltohae ] [ --haetomsl ] [ -v ] [\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" " GeoidEval reads in positions on standard input and prints out the\n" " corresponding geoid heights on standard output. Optionally, it also\n" " prints the northerly and easterly gradients of the geoid height.\n" "\n" " Positions are given as latitude and longitude, UTM/UPS, or MGRS, in any\n" " of the formats accepted by GeoConvert(1). (MGRS coordinates signify\n" " the center of the corresponding MGRS square.) If the -z option is\n" " specified then the specified zone is prepended to each line of input\n" " (which must be in UTM/UPS coordinates). This allows a file with UTM\n" " eastings and northings in a single zone to be used as standard input.\n" "\n" " More accurate results for the geoid height are provided by Gravity(1).\n" " This utility can also compute the direction of gravity accurately.\n" "\n" "OPTIONS\n" " -n use geoid name instead of the default \"egm96-5\". See GEOIDS.\n" "\n" " -d read geoid data from dir instead of the default. See GEOIDS.\n" "\n" " -l use bilinear interpolation instead of cubic. See INTERPOLATION.\n" "\n" " -a cache the entire data set in memory. See CACHE.\n" "\n" " -c cache the data bounded by south west north east in memory. See\n" " CACHE.\n" "\n" " -g print the northerly and easterly gradients after the geoid height\n" " (i.e., the rate at which the geoid height changes per unit distance\n" " along the WGS84 ellipsoid in the specified directions). As a\n" " result of the way that the geoid data is stored, the calculation of\n" " gradients can result in large quantization errors. This is\n" " particularly acute at high latitudes and for the easterly gradient.\n" "\n" " -z prefix each line of input by zone, e.g., \"38N\". This should be\n" " used when the input consists of UTM/UPS eastings and northings.\n" "\n" " --msltohae\n" " standard input should include a final token on each line which is\n" " treated as a height (in meters) above the geoid and the output\n" " echoes the input line with the height converted to height above\n" " ellipsoid (HAE). If -z zone is specified then the third token is\n" " treated as the height; this makes it possible to convert LIDAR data\n" " where each line consists of: easting northing height intensity.\n" "\n" " --haetomsl\n" " this is similar to --msltohae except that the height token is\n" " treated as a height (in meters) above the ellipsoid and the output\n" " echoes the input line with the height converted to height above the\n" " geoid (MSL).\n" "\n" " -v print information about the geoid on standard error before\n" " processing the input.\n" "\n" " --comment-delimiter\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, the default geoid path and name, and exit.\n" "\n" " --help\n" " print full documentation and exit.\n" "\n" " --input-file\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\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\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "GEOIDS\n" " GeoidEval computes geoid heights by interpolating on the data in a\n" " regularly spaced table (see INTERPOLATION). The following geoid tables\n" " are available (however, some may not be installed):\n" "\n" " bilinear error cubic error\n" " name geoid grid max rms max rms\n" " egm84-30 EGM84 30' 1.546 m 70 mm 0.274 m 14 mm\n" " egm84-15 EGM84 15' 0.413 m 18 mm 0.021 m 1.2 mm\n" " egm96-15 EGM96 15' 1.152 m 40 mm 0.169 m 7.0 mm\n" " egm96-5 EGM96 5' 0.140 m 4.6 mm .0032 m 0.7 mm\n" " egm2008-5 EGM2008 5' 0.478 m 12 mm 0.294 m 4.5 mm\n" " egm2008-2_5 EGM2008 2.5' 0.135 m 3.2 mm 0.031 m 0.8 mm\n" " egm2008-1 EGM2008 1' 0.025 m 0.8 mm .0022 m 0.7 mm\n" "\n" " By default, the \"egm96-5\" geoid is used. This may changed by setting\n" " the environment variable \"GEOID_NAME\" or with the -n option. The\n" " errors listed here are estimates of the quantization and interpolation\n" " errors in the reported heights compared to the specified geoid.\n" "\n" " The geoid data will be loaded from a directory specified at compile\n" " time. This may changed by setting the environment variables\n" " \"GEOID_PATH\" or \"GEOGRAPHICLIB_DATA\", or with the -d option. The -h\n" " option prints the default geoid path and name. Use the -v option to\n" " ascertain the full path name of the data file.\n" "\n" " Instructions for downloading and installing geoid data are available at\n" " .\n" "\n" " NOTE: all the geoids above apply to the WGS84 ellipsoid (a = 6378137 m,\n" " f = 1/298.257223563) only.\n" "\n" "INTERPOLATION\n" " Cubic interpolation is used to compute the geoid height unless -l is\n" " specified in which case bilinear interpolation is used. The cubic\n" " interpolation is based on a least-squares fit of a cubic polynomial to\n" " a 12-point stencil\n" "\n" " . 1 1 .\n" " 1 2 2 1\n" " 1 2 2 1\n" " . 1 1 .\n" "\n" " The cubic is constrained to be independent of longitude when evaluating\n" " the height at one of the poles. Cubic interpolation is considerably\n" " more accurate than bilinear; however it results in small\n" " discontinuities in the returned height on cell boundaries. The\n" " gradients are computed by differentiating the interpolated results.\n" "\n" "CACHE\n" " By default, the data file is randomly read to compute the geoid heights\n" " at the input positions. Usually this is sufficient for interactive\n" " use. If many heights are to be computed, use -c south west north east\n" " to notify GeoidEval to read a rectangle of data into memory; heights\n" " within the this rectangle can then be computed without any disk access.\n" " If -a is specified all the geoid data is read; in the case of\n" " \"egm2008-1\", this requires about 0.5 GB of RAM. The evaluation of\n" " heights outside the cached area causes the necessary data to be read\n" " from disk. Use the -v option to verify the size of the cache.\n" "\n" " Regardless of whether any cache is requested (with the -a or -c\n" " options), the data for the last grid cell in cached. This allows the\n" " geoid height along a continuous path to be returned with little disk\n" " overhead.\n" "\n" "ENVIRONMENT\n" " GEOID_NAME\n" " Override the compile-time default geoid name of \"egm96-5\". The -h\n" " option reports the value of GEOID_NAME, if defined, otherwise it\n" " reports the compile-time value. If the -n name option is used,\n" " then name takes precedence.\n" "\n" " GEOID_PATH\n" " Override the compile-time default geoid path. This is typically\n" " \"/usr/local/share/GeographicLib/geoids\" on Unix-like systems and\n" " \"C:/Documents and Settings/All Users/Application\n" " Data/GeographicLib/geoids\" on Windows systems. The -h option\n" " reports the value of GEOID_PATH, if defined, otherwise it reports\n" " the compile-time value. If the -d dir option is used, then dir\n" " takes precedence.\n" "\n" " GEOGRAPHICLIB_DATA\n" " Another way of overriding the compile-time default magnetic path.\n" " If it is set (and if MAGNETIC_PATH is not set), then\n" " $GEOGRAPHICLIB_DATA/magnetic is used.\n" "\n" "ERRORS\n" " An illegal line of input will print an error message to standard output\n" " beginning with \"ERROR:\" and causes GeoidEval to return an exit code of\n" " 1. However, an error does not cause GeoidEval to terminate; following\n" " lines will be converted.\n" "\n" "ABBREVIATIONS\n" " The geoid is usually approximated by an \"earth gravity model\". The\n" " models published by the NGA are:\n" "\n" " EGM84\n" " An earth gravity model published by the NGA in 1984,\n" " http://earth-info.nga.mil/GandG/wgs84/gravitymod/wgs84_180/wgs84_180.html\n" " .\n" "\n" " EGM96\n" " An earth gravity model published by the NGA in 1996,\n" " http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html\n" " .\n" "\n" " EGM2008\n" " An earth gravity model published by the NGA in 2008,\n" " http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008\n" " .\n" "\n" " WGS84\n" " World Geodetic System 1984, .\n" "\n" " HAE Height above the WGS84 ellipsoid.\n" "\n" " MSL Mean sea level, used as a convenient short hand for the geoid.\n" " (However, typically, the geoid differs by a few meters from mean\n" " sea level.)\n" "\n" "EXAMPLES\n" " The height of the EGM96 geoid at Timbuktu\n" "\n" " echo 16:46:33N 3:00:34W | GeoidEval\n" " => 28.7068 -0.02e-6 -1.73e-6\n" "\n" " The first number returned is the height of the geoid and the 2nd and\n" " 3rd are its slopes in the northerly and easterly directions.\n" "\n" " Convert a point in UTM zone 18N from MSL to HAE\n" "\n" " echo 531595 4468135 23 | GeoidEval --msltohae -z 18N\n" " => 531595 4468135 -10.842\n" "\n" "SEE ALSO\n" " GeoConvert(1), Gravity(1).\n" "\n" "AUTHOR\n" " GeoidEval was written by Charles Karney.\n" "\n" "HISTORY\n" " GeoidEval was added to GeographicLib, , in\n" " 2009-09.\n" ; return retval; } geographiclib-1.21/man/GeoidEval.1.html0000644000175000017500000003715711745620415017535 0ustar frankiefrankie GeoidEval -- look up geoid heights


NAME

GeoidEval -- look up geoid heights


SYNOPSIS

GeoidEval [ -n name ] [ -d dir ] [ -l ] [ -a | -c south west north east ] [ -g ] [ -z zone ] [ --msltohae ] [ --haetomsl ] [ -v ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]


DESCRIPTION

GeoidEval reads in positions on standard input and prints out the corresponding geoid heights on standard output. Optionally, it also prints the northerly and easterly gradients of the geoid height.

Positions are given as latitude and longitude, UTM/UPS, or MGRS, in any of the formats accepted by GeoConvert(1). (MGRS coordinates signify the center of the corresponding MGRS square.) If the -z option is specified then the specified zone is prepended to each line of input (which must be in UTM/UPS coordinates). This allows a file with UTM eastings and northings in a single zone to be used as standard input.

More accurate results for the geoid height are provided by Gravity(1). This utility can also compute the direction of gravity accurately.


OPTIONS

-n

use geoid name instead of the default egm96-5. See GEOIDS.

-d

read geoid data from dir instead of the default. See GEOIDS.

-l

use bilinear interpolation instead of cubic. See INTERPOLATION.

-a

cache the entire data set in memory. See CACHE.

-c

cache the data bounded by south west north east in memory. See CACHE.

-g

print the northerly and easterly gradients after the geoid height (i.e., the rate at which the geoid height changes per unit distance along the WGS84 ellipsoid in the specified directions). As a result of the way that the geoid data is stored, the calculation of gradients can result in large quantization errors. This is particularly acute at high latitudes and for the easterly gradient.

-z

prefix each line of input by zone, e.g., 38N. This should be used when the input consists of UTM/UPS eastings and northings.

--msltohae

standard input should include a final token on each line which is treated as a height (in meters) above the geoid and the output echoes the input line with the height converted to height above ellipsoid (HAE). If -z zone is specified then the third token is treated as the height; this makes it possible to convert LIDAR data where each line consists of: easting northing height intensity.

--haetomsl

this is similar to --msltohae except that the height token is treated as a height (in meters) above the ellipsoid and the output echoes the input line with the height converted to height above the geoid (MSL).

-v

print information about the geoid on standard error before processing the input.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage, the default geoid path and name, and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.


GEOIDS

GeoidEval computes geoid heights by interpolating on the data in a regularly spaced table (see INTERPOLATION). The following geoid tables are available (however, some may not be installed):

                                  bilinear error    cubic error
   name         geoid    grid     max      rms      max      rms
   egm84-30     EGM84    30'      1.546 m  70 mm    0.274 m  14 mm
   egm84-15     EGM84    15'      0.413 m  18 mm    0.021 m  1.2 mm
   egm96-15     EGM96    15'      1.152 m  40 mm    0.169 m  7.0 mm
   egm96-5      EGM96     5'      0.140 m  4.6 mm   .0032 m  0.7 mm
   egm2008-5    EGM2008   5'      0.478 m  12 mm    0.294 m  4.5 mm
   egm2008-2_5  EGM2008   2.5'    0.135 m  3.2 mm   0.031 m  0.8 mm
   egm2008-1    EGM2008   1'      0.025 m  0.8 mm   .0022 m  0.7 mm

By default, the egm96-5 geoid is used. This may changed by setting the environment variable GEOID_NAME or with the -n option. The errors listed here are estimates of the quantization and interpolation errors in the reported heights compared to the specified geoid.

The geoid data will be loaded from a directory specified at compile time. This may changed by setting the environment variables GEOID_PATH or GEOGRAPHICLIB_DATA, or with the -d option. The -h option prints the default geoid path and name. Use the -v option to ascertain the full path name of the data file.

Instructions for downloading and installing geoid data are available at http://geographiclib.sf.net/html/geoid.html#geoidinst.

NOTE: all the geoids above apply to the WGS84 ellipsoid (a = 6378137 m, f = 1/298.257223563) only.


INTERPOLATION

Cubic interpolation is used to compute the geoid height unless -l is specified in which case bilinear interpolation is used. The cubic interpolation is based on a least-squares fit of a cubic polynomial to a 12-point stencil

   . 1 1 .
   1 2 2 1
   1 2 2 1
   . 1 1 .

The cubic is constrained to be independent of longitude when evaluating the height at one of the poles. Cubic interpolation is considerably more accurate than bilinear; however it results in small discontinuities in the returned height on cell boundaries. The gradients are computed by differentiating the interpolated results.


CACHE

By default, the data file is randomly read to compute the geoid heights at the input positions. Usually this is sufficient for interactive use. If many heights are to be computed, use -c south west north east to notify GeoidEval to read a rectangle of data into memory; heights within the this rectangle can then be computed without any disk access. If -a is specified all the geoid data is read; in the case of egm2008-1, this requires about 0.5 GB of RAM. The evaluation of heights outside the cached area causes the necessary data to be read from disk. Use the -v option to verify the size of the cache.

Regardless of whether any cache is requested (with the -a or -c options), the data for the last grid cell in cached. This allows the geoid height along a continuous path to be returned with little disk overhead.


ENVIRONMENT

GEOID_NAME

Override the compile-time default geoid name of egm96-5. The -h option reports the value of GEOID_NAME, if defined, otherwise it reports the compile-time value. If the -n name option is used, then name takes precedence.

GEOID_PATH

Override the compile-time default geoid path. This is typically /usr/local/share/GeographicLib/geoids on Unix-like systems and C:/Documents and Settings/All Users/Application Data/GeographicLib/geoids on Windows systems. The -h option reports the value of GEOID_PATH, if defined, otherwise it reports the compile-time value. If the -d dir option is used, then dir takes precedence.

GEOGRAPHICLIB_DATA

Another way of overriding the compile-time default magnetic path. If it is set (and if MAGNETIC_PATH is not set), then $GEOGRAPHICLIB_DATA/magnetic is used.


ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes GeoidEval to return an exit code of 1. However, an error does not cause GeoidEval to terminate; following lines will be converted.


ABBREVIATIONS

The geoid is usually approximated by an "earth gravity model". The models published by the NGA are:

EGM84

An earth gravity model published by the NGA in 1984, http://earth-info.nga.mil/GandG/wgs84/gravitymod/wgs84_180/wgs84_180.html.

EGM96

An earth gravity model published by the NGA in 1996, http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html.

EGM2008

An earth gravity model published by the NGA in 2008, http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008.

WGS84

World Geodetic System 1984, http://en.wikipedia.org/wiki/WGS84.

HAE

Height above the WGS84 ellipsoid.

MSL

Mean sea level, used as a convenient short hand for the geoid. (However, typically, the geoid differs by a few meters from mean sea level.)


EXAMPLES

The height of the EGM96 geoid at Timbuktu

    echo 16:46:33N 3:00:34W | GeoidEval
    => 28.7068 -0.02e-6 -1.73e-6

The first number returned is the height of the geoid and the 2nd and 3rd are its slopes in the northerly and easterly directions.

Convert a point in UTM zone 18N from MSL to HAE

   echo 531595 4468135 23 | GeoidEval --msltohae -z 18N
   => 531595 4468135 -10.842


SEE ALSO

GeoConvert(1), Gravity(1).


AUTHOR

GeoidEval was written by Charles Karney.


HISTORY

GeoidEval was added to GeographicLib, http://geographiclib.sf.net, in 2009-09.

geographiclib-1.21/man/CartConvert.pod0000644000175000017500000000760311745620415017600 0ustar frankiefrankie=for comment $Id: f3d0184303d2278f369eeb6f8fae2726c6bbfaf4 $ =head1 NAME CartConvert -- convert geodetic coordinates to geocentric or local cartesian =head1 SYNOPSIS B [ B<-r> ] [ B<-l> I I I ] [ B<-e> I I ] [ B<--comment-delimiter> I ] [ B<--version> | B<-h> | B<--help> ] [ B<--input-file> I | B<--input-string> I ] [ B<--line-separator> I ] [ B<--output-file> I ] =head1 DESCRIPTION Convert geodetic coordinates to either geocentric or local cartesian coordinates. Geocentric coordinates have the origin at the center of the earth, with the I axis going thru the north pole, and the I axis thru I = 0, I = 0. By default, the conversion is to geocentric coordinates. Specifying B<-l> I I I causes a local coordinate system to be used with the origin at I = I, I = I, I = I, I normal to the ellipsoid and I due north. Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) I, I (decimal degrees or degrees, minutes and seconds), and I above the ellipsoid (meters). For each set of geodetic coordinates, the corresponding cartesian coordinates I, I, I (meters) are printed on standard output. =head1 OPTIONS =over =item B<-r> perform the reverse projection. I, I, I are given on standard input and each line of standard output gives I, I, I. =item B<-e> specify the ellipsoid via I I; the equatorial radius is I and the flattening is I. Setting I = 0 results in a sphere. Specify I E 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for I. (Also, if I E 1, the flattening is set to 1/I.) By default, the WGS84 ellipsoid is used, I = 6378137 m, I = 1/298.257223563. =item B<--comment-delimiter> set the comment delimiter to I (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). =item B<--version> print version and exit. =item B<-h> print usage and exit. =item B<--help> print full documentation and exit. =item B<--input-file> read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> read input from the string I instead of from standard input. All occurrences of the line separator character (default is a semicolon) in I are converted to newlines before the reading begins. =item B<--line-separator> set the line separator character to I. By default this is a semicolon. =item B<--output-file> write output to the file I instead of to standard output; a file name of "-" stands for standard output. =back =head1 EXAMPLES echo 33.3 44.4 6000 | CartConvert => 3816209.60 3737108.55 3485109.57 echo 33.3 44.4 6000 | CartConvert -l 33 44 20 => 37288.97 33374.29 5783.64 echo 30000 30000 0 | CartConvert -r => 6.483 45 -6335709.73 =head1 ERRORS An illegal line of input will print an error message to standard output beginning with C and causes B to return an exit code of 1. However, an error does not cause B to terminate; following lines will be converted. =head1 SEE ALSO The algorithm for converting geocentric to geodetic coordinates is given in Appendix B of C. F. F. Karney, I, Feb. 2011; preprint L. =head1 AUTHOR B was written by Charles Karney. =head1 HISTORY B was added to GeographicLib, L, in 2009-02. Prior to 2009-03 it was called ECEFConvert. geographiclib-1.21/man/ConicProj.10000644000175000017500000002234011745620415016605 0ustar frankiefrankie.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "CONICPROJ 1" .TH CONICPROJ 1 "2012-04-24" "GeographicLib 1.21" "GeographicLib Utilities" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" ConicProj \-\- perform conic projections .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBConicProj\fR ( \fB\-c\fR | \fB\-a\fR ) \fIlat1\fR \fIlat2\fR [ \fB\-l\fR \fIlon0\fR ] [ \fB\-k\fR \fIk1\fR ] [ \fB\-r\fR ] [ \fB\-e\fR \fIa\fR \fIf\fR ] [ \fB\-\-comment\-delimiter\fR \fIcommentdelim\fR ] [ \fB\-\-version\fR | \fB\-h\fR | \fB\-\-help\fR ] [ \fB\-\-input\-file\fR \fIinfile\fR | \fB\-\-input\-string\fR \fIinstring\fR ] [ \fB\-\-line\-separator\fR \fIlinesep\fR ] [ \fB\-\-output\-file\fR \fIoutfile\fR ] .SH "DESCRIPTION" .IX Header "DESCRIPTION" Perform one of two conic projections geodesics. Convert geodetic coordinates to either Lambert conformal conic or Albers equal area coordinates. The standard latitudes \fIlat1\fR and \fIlat2\fR are specified by that the \fB\-c\fR option (for Lambert conformal conic) or the \fB\-a\fR option (for Albers equal area). At least one of these options must be given (the last one given is used). Specify \fIlat1\fR = \fIlat2\fR, to obtain the case with a single standard parallel. The central meridian is given by \fIlon0\fR. The longitude of origin is given by the latitude of minimum (azimuthal) scale for Lambert conformal conic (Albers equal area). The (azimuthal) scale on the standard parallels is \fIk1\fR. .PP Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) \fIlatitude\fR and \fIlongitude\fR (decimal degrees or degrees, minutes, seconds). For each set of geodetic coordinates, the corresponding projected easting, \fIx\fR, and northing, \&\fIy\fR, (meters) are printed on standard output together with the meridian convergence \fIgamma\fR (degrees) and (azimuthal) scale \fIk\fR. For Albers equal area, the radial scale is 1/\fIk\fR. The meridian convergence is the bearing of the \fIy\fR axis measured clockwise from true north. .PP Special cases of the Lambert conformal projection are the Mercator projection (the standard latitudes equal and opposite) and the polar stereographic projection (both standard latitudes correspond to the same pole). Special cases of the Albers equal area projection are the cylindrical equal area projection (the standard latitudes equal and opposite), the Lambert azimuthal equal area projection (both standard latitude corresponds to the same pole), and the Lambert equal area conic projection (one standard parallel is at a pole). .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-c\fR" 4 .IX Item "-c" use the Lambert conformal conic projection with standard parallels \&\fIlat1\fR and \fIlat2\fR. .IP "\fB\-a\fR" 4 .IX Item "-a" use the Albers equal area projection with standard parallels \fIlat1\fR and \&\fIlat2\fR. .IP "\fB\-l\fR" 4 .IX Item "-l" specify the longitude of origin \fIlon0\fR (degrees, default 0). .IP "\fB\-k\fR" 4 .IX Item "-k" specify the (azimuthal) scale \fIk1\fR on the standard parallels (default 1). .IP "\fB\-r\fR" 4 .IX Item "-r" perform the reverse projection. \fIx\fR and \fIy\fR are given on standard input and each line of standard output gives \fIlatitude\fR, \fIlongitude\fR, \&\fIgamma\fR, and \fIk\fR. .IP "\fB\-e\fR" 4 .IX Item "-e" specify the ellipsoid via \fIa\fR \fIf\fR; the equatorial radius is \fIa\fR and the flattening is \fIf\fR. Setting \fIf\fR = 0 results in a sphere. Specify \&\fIf\fR < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for \fIf\fR. (Also, if \fIf\fR > 1, the flattening is set to 1/\fIf\fR.) By default, the \s-1WGS84\s0 ellipsoid is used, \fIa\fR = 6378137 m, \&\fIf\fR = 1/298.257223563. .IP "\fB\-\-comment\-delimiter\fR" 4 .IX Item "--comment-delimiter" set the comment delimiter to \fIcommentdelim\fR (e.g., \*(L"#\*(R" or \*(L"//\*(R"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). .IP "\fB\-\-version\fR" 4 .IX Item "--version" print version and exit. .IP "\fB\-h\fR" 4 .IX Item "-h" print usage and exit. .IP "\fB\-\-help\fR" 4 .IX Item "--help" print full documentation and exit. .IP "\fB\-\-input\-file\fR" 4 .IX Item "--input-file" read input from the file \fIinfile\fR instead of from standard input; a file name of \*(L"\-\*(R" stands for standard input. .IP "\fB\-\-input\-string\fR" 4 .IX Item "--input-string" read input from the string \fIinstring\fR instead of from standard input. All occurrences of the line separator character (default is a semicolon) in \fIinstring\fR are converted to newlines before the reading begins. .IP "\fB\-\-line\-separator\fR" 4 .IX Item "--line-separator" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR" 4 .IX Item "--output-file" write output to the file \fIoutfile\fR instead of to standard output; a file name of \*(L"\-\*(R" stands for standard output. .SH "EXAMPLES" .IX Header "EXAMPLES" .Vb 4 \& echo 39.95N 75.17W | ConicProj \-c 40d58 39d56 \-l 77d45W \& => 220445 \-52372 1.67 1.0 \& echo 220445 \-52372 | ConicProj \-c 40d58 39d56 \-l 77d45W \-r \& => 39.95 \-75.17 1.67 1.0 .Ve .SH "ERRORS" .IX Header "ERRORS" An illegal line of input will print an error message to standard output beginning with \f(CW\*(C`ERROR:\*(C'\fR and causes \fBConicProj\fR to return an exit code of 1. However, an error does not cause \fBConicProj\fR to terminate; following lines will be converted. .SH "AUTHOR" .IX Header "AUTHOR" \&\fBConicProj\fR was written by Charles Karney. .SH "HISTORY" .IX Header "HISTORY" \&\fBConicProj\fR was added to GeographicLib, , in version 1.9. geographiclib-1.21/man/Planimeter.pod0000644000175000017500000001255611745620415017451 0ustar frankiefrankie=for comment $Id: 501af1a00d02bb4b2b99db921909290b647be941 $ =head1 NAME Planimeter -- compute the area of geodesic polygons =head1 SYNOPSIS B [ B<-r> ] [ B<-s> ] [ B<-l> ] [ B<-e> I I ] [ B<--comment-delimiter> I ] [ B<--version> | B<-h> | B<--help> ] [ B<--input-file> I | B<--input-string> I ] [ B<--line-separator> I ] [ B<--output-file> I ] =head1 DESCRIPTION Measure the area of a geodesic polygon. Reads polygon vertices from standard input, one per line. Vertices may be given as latitude and longitude, UTM/UPS, or MGRS coordinates, interpreted in the same way as GeoConvert(1). (MGRS coordinates signify the center of the corresponding MGRS square.) The end of input, a blank line, or a line which can't be interpreted as a vertex signals the end of one polygon and the start of the next. For each polygon print a summary line with the number of points, the perimeter (in meters), and the area (in meters^2). By default, polygons traversed in a counter-clockwise direction return a positive area and those traversed in a clockwise direction return a negative area. This sign convention is reversed if the B<-r> option is given. Of course, encircling an area in the clockwise direction is equivalent to encircling the rest of the ellipsoid in the counter-clockwise direction. The default interpretation used by B is the one that results in a smaller magnitude of area; i.e., the magnitude of the area is less than or equal to one half the total area of the ellipsoid. If the B<-s> option is given, then the interpretation used is the one that results in a positive area; i.e., the area is positive and less than the total area of the ellipsoid. Only simple polygons are supported for the area computation. Polygons may include one or both poles. There is no need to close the polygon. =head1 OPTIONS =over =item B<-r> toggle whether counter-clockwise traversal of the polygon returns a positive (the default) or negative result. =item B<-s> toggle whether to return a signed result (the default) or not. =item B<-l> toggle whether the vertices represent a polygon (the default) or a polyline. For a polyline, the number of points and the length of the path joining them is returned; the path is not closed and the area is not reported. =item B<-e> specify the ellipsoid via I I; the equatorial radius is I and the flattening is I. Setting I = 0 results in a sphere. Specify I E 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for I. (Also, if I E 1, the flattening is set to 1/I.) By default, the WGS84 ellipsoid is used, I = 6378137 m, I = 1/298.257223563. If entering vertices as UTM/UPS or MGRS coordinates, use the default ellipsoid, since the conversion of these coordinates to latitude and longitude uses the WGS84 parameters. =item B<--comment-delimiter> set the comment delimiter to I (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing. For a given polygon, the last such string found will be appended to the output line (separated by a space). =item B<--version> print version and exit. =item B<-h> print usage and exit. =item B<--help> print full documentation and exit. =item B<--input-file> read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> read input from the string I instead of from standard input. All occurrences of the line separator character (default is a semicolon) in I are converted to newlines before the reading begins. =item B<--line-separator> set the line separator character to I. By default this is a semicolon. =item B<--output-file> write output to the file I instead of to standard output; a file name of "-" stands for standard output. =back =head1 EXAMPLES Example (the area of the 100km MGRS square 18SWK) Planimeter < 4 400139.53295860 10007388597.1913 The following code takes the output from gdalinfo and reports the area covered by the data (assuming the edges of the image are geodesics). #! /bin/sh egrep '^((Upper|Lower) (Left|Right)|Center) ' | sed -e 's/d /d/g' -e "s/' /'/g" | tr -s '(),\r\t' ' ' | awk '{ if ($1 $2 == "UpperLeft") ul = $6 " " $5; else if ($1 $2 == "LowerLeft") ll = $6 " " $5; else if ($1 $2 == "UpperRight") ur = $6 " " $5; else if ($1 $2 == "LowerRight") lr = $6 " " $5; else if ($1 == "Center") { printf "%s\n%s\n%s\n%s\n\n", ul, ll, lr, ur; ul = ll = ur = lr = ""; } } ' | Planimeter | cut -f3 -d' ' =head1 SEE ALSO GeoConvert(1). The algorithm for the area of geodesic polygon is given in Section 15 of C. F. F. Karney, I, Feb. 2011; preprint L. See also Section 6 of C. F. F. Karney, I, Sept. 2011; preprint L. =head1 AUTHOR B was written by Charles Karney. =head1 HISTORY B was added to GeographicLib, L, in version 1.4. geographiclib-1.21/man/MagneticField.10000644000175000017500000003135011745620415017413 0ustar frankiefrankie.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "MAGNETICFIELD 1" .TH MAGNETICFIELD 1 "2012-04-24" "GeographicLib 1.21" "GeographicLib Utilities" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" MagneticField \-\- compute the earth's magnetic field .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBMagneticField\fR [ \fB\-n\fR \fIname\fR ] [ \fB\-d\fR \fIdir\fR ] [ \fB\-t\fR \fItime\fR | \fB\-c\fR \fItime\fR \fIlat\fR \fIh\fR ] [ \fB\-r\fR ] [ \fB\-T\fR \fItguard\fR ] [ \fB\-H\fR \fIhguard\fR ] [ \fB\-p\fR \fIprec\fR ] [ \fB\-v\fR ] [ \fB\-\-comment\-delimiter\fR \fIcommentdelim\fR ] [ \fB\-\-version\fR | \fB\-h\fR | \fB\-\-help\fR ] [ \fB\-\-input\-file\fR \fIinfile\fR | \fB\-\-input\-string\fR \fIinstring\fR ] [ \fB\-\-line\-separator\fR \fIlinesep\fR ] [ \fB\-\-output\-file\fR \fIoutfile\fR ] .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBMagneticField\fR reads in times and positions on standard input and prints out the geomagnetic field on standard output and, optionally, its rate of change. .PP The input line is of the form \fItime\fR \fIlat\fR \fIlon\fR \fIh\fR. \fItime\fR is a date of the form 2012\-07\-03 or a fractional year such as 2012.5. \fIlat\fR and \fIlon\fR are the latitude and longitude expressed as decimal degrees or degrees, minutes, and seconds; see \fIGeoConvert\fR\|(1) for details. \fIh\fR is the height above the ellipsoid in meters; this is optional and defaults to zero. Alternatively, \fItime\fR can be given on the command line as the argument to the \fB\-t\fR option, in which case it should not be included on the input lines. Finally, the magnetic field can be computed at various points on a circle of latitude (constant \fItime\fR, \&\fIlat\fR, and \fIh\fR) via the \fB\-c\fR option; in this case only the longitude should be given on the input lines. .PP The output consists of the following 7 items: .PP .Vb 9 \& the declination (the direction of the horizontal component of \& the magnetic field measured clockwise from north) in degrees, \& the inclination (the direction of the magnetic field measured \& down from the horizontal) in degrees, \& the horizontal field in nanotesla (nT), \& the north component of the field in nT, \& the east component of the field in nT, \& the vertical component of the field in nT (down is positive), \& the total field in nT. .Ve .PP If the \fB\-r\fR option is given, a second line is printed giving the rates of change of these quantities in degrees/yr and nT/yr. .PP The \s-1WGS84\s0 ellipsoid is used, \fIa\fR = 6378137 m, \fIf\fR = 1/298.257223563. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-n\fR" 4 .IX Item "-n" use magnetic field model \fIname\fR instead of the default \f(CW\*(C`wmm2010\*(C'\fR. See \&\s-1MODELS\s0. .IP "\fB\-d\fR" 4 .IX Item "-d" read magnetic models from \fIdir\fR instead of the default. See \&\s-1MODELS\s0. .IP "\fB\-t\fR" 4 .IX Item "-t" evaluate the field at \fItime\fR instead of reading the time from the input lines. .IP "\fB\-c\fR" 4 .IX Item "-c" evaluate the field on a circle of latitude given by \fItime\fR, \fIlat\fR, \&\fIh\fR instead of reading these quantities from the input lines. In this case, \fBMagneticField\fR can calculate the field considerably more quickly. .IP "\fB\-r\fR" 4 .IX Item "-r" toggle whether to report the rates of change of the field. .IP "\fB\-T\fR" 4 .IX Item "-T" signal an error if \fItime\fR lies \fItguard\fR years (default 50 yr) beyond the range for the model. .IP "\fB\-H\fR" 4 .IX Item "-H" signal an error if \fIh\fR lies \fIhguard\fR meters (default 500000 m) beyond the range for the model. .IP "\fB\-p\fR" 4 .IX Item "-p" set the output precision to \fIprec\fR (default 1). Fields are printed with precision with \fIprec\fR decimal places; angles use \fIprec\fR + 1 places. .IP "\fB\-v\fR" 4 .IX Item "-v" print information about the magnetic model on standard error before processing the input. .IP "\fB\-\-comment\-delimiter\fR" 4 .IX Item "--comment-delimiter" set the comment delimiter to \fIcommentdelim\fR (e.g., \*(L"#\*(R" or \*(L"//\*(R"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). .IP "\fB\-\-version\fR" 4 .IX Item "--version" print version and exit. .IP "\fB\-h\fR" 4 .IX Item "-h" print usage, the default magnetic path and name, and exit. .IP "\fB\-\-help\fR" 4 .IX Item "--help" print full documentation and exit. .IP "\fB\-\-input\-file\fR" 4 .IX Item "--input-file" read input from the file \fIinfile\fR instead of from standard input; a file name of \*(L"\-\*(R" stands for standard input. .IP "\fB\-\-input\-string\fR" 4 .IX Item "--input-string" read input from the string \fIinstring\fR instead of from standard input. All occurrences of the line separator character (default is a semicolon) in \fIinstring\fR are converted to newlines before the reading begins. .IP "\fB\-\-line\-separator\fR" 4 .IX Item "--line-separator" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR" 4 .IX Item "--output-file" write output to the file \fIoutfile\fR instead of to standard output; a file name of \*(L"\-\*(R" stands for standard output. .SH "MODELS" .IX Header "MODELS" \&\fBMagneticField\fR computes the geomagnetic field using one of the following models .PP .Vb 10 \& wmm2010, the World Magnetic Model 2010, which approximates the \& main magnetic field for the period 2010a\*^XX2015. See \& http://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml \& igrf11, the International Geomagnetic Reference Field (11th \& generation) which approximates the main magnetic field for \& the period 1900a\*^XX2015. See \& http://ngdc.noaa.gov/IAGA/vmod/igrf.html \& emm2010, the Enhanced Magnetic Model 2010, which approximates the \& main and crustal magnetic fields for the period 2010a\*^XX2015. See \& http://ngdc.noaa.gov/geomag/EMM/index.html .Ve .PP These models approximate the magnetic field due to the earth's core and (in the case of emm2010) its crust. They neglect magnetic fields due to the ionosphere, the magnetosphere, nearby magnetized materials, electrical machinery, etc. .PP By default, the \f(CW\*(C`wmm2010\*(C'\fR magnetic model is used. This may changed by setting the environment variable \f(CW\*(C`MAGNETIC_NAME\*(C'\fR or with the \fB\-n\fR option. .PP The magnetic models will be loaded from a directory specified at compile time. This may changed by setting the environment variables \&\f(CW\*(C`MAGNETIC_PATH\*(C'\fR or \f(CW\*(C`GEOGRAPHICLIB_DATA\*(C'\fR, or with the \fB\-d\fR option. The \fB\-h\fR option prints the default magnetic path and name. Use the \&\fB\-v\fR option to ascertain the full path name of the data file. .PP Instructions for downloading and installing magnetic models are available at . .SH "ENVIRONMENT" .IX Header "ENVIRONMENT" .IP "\fB\s-1MAGNETIC_NAME\s0\fR" 4 .IX Item "MAGNETIC_NAME" Override the compile-time default magnetic name of \f(CW\*(C`wmm2010\*(C'\fR. The \fB\-h\fR option reports the value of \fB\s-1MAGNETIC_NAME\s0\fR, if defined, otherwise it reports the compile-time value. If the \fB\-n\fR \fIname\fR option is used, then \fIname\fR takes precedence. .IP "\fB\s-1MAGNETIC_PATH\s0\fR" 4 .IX Item "MAGNETIC_PATH" Override the compile-time default magnetic path. This is typically \&\f(CW\*(C`/usr/local/share/GeographicLib/magnetic\*(C'\fR on Unix-like systems and \&\f(CW\*(C`C:/Documents and Settings/All Users/Application Data/GeographicLib/magnetic\*(C'\fR on Windows systems. The \fB\-h\fR option reports the value of \fB\s-1MAGNETIC_PATH\s0\fR, if defined, otherwise it reports the compile-time value. If the \fB\-d\fR \fIdir\fR option is used, then \fIdir\fR takes precedence. .IP "\fB\s-1GEOGRAPHICLIB_DATA\s0\fR" 4 .IX Item "GEOGRAPHICLIB_DATA" Another way of overriding the compile-time default magnetic path. If it is set (and if \fB\s-1MAGNETIC_PATH\s0\fR is not set), then $\fB\s-1GEOGRAPHICLIB_DATA\s0\fR/magnetic is used. .SH "ERRORS" .IX Header "ERRORS" An illegal line of input will print an error message to standard output beginning with \f(CW\*(C`ERROR:\*(C'\fR and causes \fBMagneticField\fR to return an exit code of 1. However, an error does not cause \fBMagneticField\fR to terminate; following lines will be converted. If \fItime\fR or \fIh\fR are outside the recommended ranges for the model (but inside the ranges increase by \fItguard\fR and \fIhguard\fR), a warning is printed on standard error and the field (which may be inaccurate) is returned in the normal way. .SH "EXAMPLES" .IX Header "EXAMPLES" The magnetic field from \s-1WMM2010\s0 in Timbuktu on 2012\-01\-01 .PP .Vb 3 \& echo 2012\-01\-01 16:46:33N 3:00:34W 300 | MagneticField \-r \& => \-2.55 12.43 33771.0 33737.6 \-1500.5 7446.0 34582.1 \& 0.10 \-0.07 34.3 36.8 54.4 \-35.3 25.9 .Ve .PP The first two numbers returned are the declination and inclination of the field. The second line gives the annual change. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIGeoConvert\fR\|(1). .SH "AUTHOR" .IX Header "AUTHOR" \&\fBMagneticField\fR was written by Charles Karney. .SH "HISTORY" .IX Header "HISTORY" \&\fBMagneticField\fR was added to GeographicLib, , in version 1.15. geographiclib-1.21/man/GeoidEval.10000644000175000017500000003660411745620415016566 0ustar frankiefrankie.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "GEOIDEVAL 1" .TH GEOIDEVAL 1 "2012-04-24" "GeographicLib 1.21" "GeographicLib Utilities" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" GeoidEval \-\- look up geoid heights .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBGeoidEval\fR [ \fB\-n\fR \fIname\fR ] [ \fB\-d\fR \fIdir\fR ] [ \fB\-l\fR ] [ \fB\-a\fR | \fB\-c\fR \fIsouth\fR \fIwest\fR \fInorth\fR \fIeast\fR ] [ \fB\-g\fR ] [ \fB\-z\fR \fIzone\fR ] [ \fB\-\-msltohae\fR ] [ \fB\-\-haetomsl\fR ] [ \fB\-v\fR ] [ \fB\-\-comment\-delimiter\fR \fIcommentdelim\fR ] [ \fB\-\-version\fR | \fB\-h\fR | \fB\-\-help\fR ] [ \fB\-\-input\-file\fR \fIinfile\fR | \fB\-\-input\-string\fR \fIinstring\fR ] [ \fB\-\-line\-separator\fR \fIlinesep\fR ] [ \fB\-\-output\-file\fR \fIoutfile\fR ] .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBGeoidEval\fR reads in positions on standard input and prints out the corresponding geoid heights on standard output. Optionally, it also prints the northerly and easterly gradients of the geoid height. .PP Positions are given as latitude and longitude, \s-1UTM/UPS\s0, or \s-1MGRS\s0, in any of the formats accepted by \fIGeoConvert\fR\|(1). (\s-1MGRS\s0 coordinates signify the \&\fIcenter\fR of the corresponding \s-1MGRS\s0 square.) If the \fB\-z\fR option is specified then the specified zone is prepended to each line of input (which must be in \s-1UTM/UPS\s0 coordinates). This allows a file with \s-1UTM\s0 eastings and northings in a single zone to be used as standard input. .PP More accurate results for the geoid height are provided by \fIGravity\fR\|(1). This utility can also compute the direction of gravity accurately. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-n\fR" 4 .IX Item "-n" use geoid \fIname\fR instead of the default \f(CW\*(C`egm96\-5\*(C'\fR. See \&\s-1GEOIDS\s0. .IP "\fB\-d\fR" 4 .IX Item "-d" read geoid data from \fIdir\fR instead of the default. See \&\s-1GEOIDS\s0. .IP "\fB\-l\fR" 4 .IX Item "-l" use bilinear interpolation instead of cubic. See \&\s-1INTERPOLATION\s0. .IP "\fB\-a\fR" 4 .IX Item "-a" cache the entire data set in memory. See \s-1CACHE\s0. .IP "\fB\-c\fR" 4 .IX Item "-c" cache the data bounded by \fIsouth\fR \fIwest\fR \fInorth\fR \fIeast\fR in memory. See \s-1CACHE\s0. .IP "\fB\-g\fR" 4 .IX Item "-g" print the northerly and easterly gradients after the geoid height (i.e., the rate at which the geoid height changes per unit distance along the \&\s-1WGS84\s0 ellipsoid in the specified directions). As a result of the way that the geoid data is stored, the calculation of gradients can result in large quantization errors. This is particularly acute at high latitudes and for the easterly gradient. .IP "\fB\-z\fR" 4 .IX Item "-z" prefix each line of input by \fIzone\fR, e.g., \f(CW\*(C`38N\*(C'\fR. This should be used when the input consists of \s-1UTM/UPS\s0 eastings and northings. .IP "\fB\-\-msltohae\fR" 4 .IX Item "--msltohae" standard input should include a final token on each line which is treated as a height (in meters) above the geoid and the output echoes the input line with the height converted to height above ellipsoid (\s-1HAE\s0). If \fB\-z\fR \fIzone\fR is specified then the \fIthird\fR token is treated as the height; this makes it possible to convert \s-1LIDAR\s0 data where each line consists of: easting northing height intensity. .IP "\fB\-\-haetomsl\fR" 4 .IX Item "--haetomsl" this is similar to \fB\-\-msltohae\fR except that the height token is treated as a height (in meters) above the ellipsoid and the output echoes the input line with the height converted to height above the geoid (\s-1MSL\s0). .IP "\fB\-v\fR" 4 .IX Item "-v" print information about the geoid on standard error before processing the input. .IP "\fB\-\-comment\-delimiter\fR" 4 .IX Item "--comment-delimiter" set the comment delimiter to \fIcommentdelim\fR (e.g., \*(L"#\*(R" or \*(L"//\*(R"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). .IP "\fB\-\-version\fR" 4 .IX Item "--version" print version and exit. .IP "\fB\-h\fR" 4 .IX Item "-h" print usage, the default geoid path and name, and exit. .IP "\fB\-\-help\fR" 4 .IX Item "--help" print full documentation and exit. .IP "\fB\-\-input\-file\fR" 4 .IX Item "--input-file" read input from the file \fIinfile\fR instead of from standard input; a file name of \*(L"\-\*(R" stands for standard input. .IP "\fB\-\-input\-string\fR" 4 .IX Item "--input-string" read input from the string \fIinstring\fR instead of from standard input. All occurrences of the line separator character (default is a semicolon) in \fIinstring\fR are converted to newlines before the reading begins. .IP "\fB\-\-line\-separator\fR" 4 .IX Item "--line-separator" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR" 4 .IX Item "--output-file" write output to the file \fIoutfile\fR instead of to standard output; a file name of \*(L"\-\*(R" stands for standard output. .SH "GEOIDS" .IX Header "GEOIDS" \&\fBGeoidEval\fR computes geoid heights by interpolating on the data in a regularly spaced table (see \s-1INTERPOLATION\s0). The following geoid tables are available (however, some may not be installed): .PP .Vb 9 \& bilinear error cubic error \& name geoid grid max rms max rms \& egm84\-30 EGM84 30\*(Aq 1.546 m 70 mm 0.274 m 14 mm \& egm84\-15 EGM84 15\*(Aq 0.413 m 18 mm 0.021 m 1.2 mm \& egm96\-15 EGM96 15\*(Aq 1.152 m 40 mm 0.169 m 7.0 mm \& egm96\-5 EGM96 5\*(Aq 0.140 m 4.6 mm .0032 m 0.7 mm \& egm2008\-5 EGM2008 5\*(Aq 0.478 m 12 mm 0.294 m 4.5 mm \& egm2008\-2_5 EGM2008 2.5\*(Aq 0.135 m 3.2 mm 0.031 m 0.8 mm \& egm2008\-1 EGM2008 1\*(Aq 0.025 m 0.8 mm .0022 m 0.7 mm .Ve .PP By default, the \f(CW\*(C`egm96\-5\*(C'\fR geoid is used. This may changed by setting the environment variable \f(CW\*(C`GEOID_NAME\*(C'\fR or with the \fB\-n\fR option. The errors listed here are estimates of the quantization and interpolation errors in the reported heights compared to the specified geoid. .PP The geoid data will be loaded from a directory specified at compile time. This may changed by setting the environment variables \&\f(CW\*(C`GEOID_PATH\*(C'\fR or \f(CW\*(C`GEOGRAPHICLIB_DATA\*(C'\fR, or with the \fB\-d\fR option. The \&\fB\-h\fR option prints the default geoid path and name. Use the \fB\-v\fR option to ascertain the full path name of the data file. .PP Instructions for downloading and installing geoid data are available at . .PP \&\fB\s-1NOTE\s0\fR: all the geoids above apply to the \s-1WGS84\s0 ellipsoid (\fIa\fR = 6378137 m, \fIf\fR = 1/298.257223563) only. .SH "INTERPOLATION" .IX Header "INTERPOLATION" Cubic interpolation is used to compute the geoid height unless \fB\-l\fR is specified in which case bilinear interpolation is used. The cubic interpolation is based on a least-squares fit of a cubic polynomial to a 12\-point stencil .PP .Vb 4 \& . 1 1 . \& 1 2 2 1 \& 1 2 2 1 \& . 1 1 . .Ve .PP The cubic is constrained to be independent of longitude when evaluating the height at one of the poles. Cubic interpolation is considerably more accurate than bilinear; however it results in small discontinuities in the returned height on cell boundaries. The gradients are computed by differentiating the interpolated results. .SH "CACHE" .IX Header "CACHE" By default, the data file is randomly read to compute the geoid heights at the input positions. Usually this is sufficient for interactive use. If many heights are to be computed, use \fB\-c\fR \fIsouth\fR \fIwest\fR \fInorth\fR \&\fIeast\fR to notify \fBGeoidEval\fR to read a rectangle of data into memory; heights within the this rectangle can then be computed without any disk access. If \fB\-a\fR is specified all the geoid data is read; in the case of \f(CW\*(C`egm2008\-1\*(C'\fR, this requires about 0.5 \s-1GB\s0 of \s-1RAM\s0. The evaluation of heights outside the cached area causes the necessary data to be read from disk. Use the \fB\-v\fR option to verify the size of the cache. .PP Regardless of whether any cache is requested (with the \fB\-a\fR or \fB\-c\fR options), the data for the last grid cell in cached. This allows the geoid height along a continuous path to be returned with little disk overhead. .SH "ENVIRONMENT" .IX Header "ENVIRONMENT" .IP "\fB\s-1GEOID_NAME\s0\fR" 4 .IX Item "GEOID_NAME" Override the compile-time default geoid name of \f(CW\*(C`egm96\-5\*(C'\fR. The \fB\-h\fR option reports the value of \fB\s-1GEOID_NAME\s0\fR, if defined, otherwise it reports the compile-time value. If the \fB\-n\fR \fIname\fR option is used, then \fIname\fR takes precedence. .IP "\fB\s-1GEOID_PATH\s0\fR" 4 .IX Item "GEOID_PATH" Override the compile-time default geoid path. This is typically \&\f(CW\*(C`/usr/local/share/GeographicLib/geoids\*(C'\fR on Unix-like systems and \&\f(CW\*(C`C:/Documents and Settings/All Users/Application Data/GeographicLib/geoids\*(C'\fR on Windows systems. The \fB\-h\fR option reports the value of \fB\s-1GEOID_PATH\s0\fR, if defined, otherwise it reports the compile-time value. If the \fB\-d\fR \fIdir\fR option is used, then \fIdir\fR takes precedence. .IP "\fB\s-1GEOGRAPHICLIB_DATA\s0\fR" 4 .IX Item "GEOGRAPHICLIB_DATA" Another way of overriding the compile-time default magnetic path. If it is set (and if \fB\s-1MAGNETIC_PATH\s0\fR is not set), then $\fB\s-1GEOGRAPHICLIB_DATA\s0\fR/magnetic is used. .SH "ERRORS" .IX Header "ERRORS" An illegal line of input will print an error message to standard output beginning with \f(CW\*(C`ERROR:\*(C'\fR and causes \fBGeoidEval\fR to return an exit code of 1. However, an error does not cause \fBGeoidEval\fR to terminate; following lines will be converted. .SH "ABBREVIATIONS" .IX Header "ABBREVIATIONS" The geoid is usually approximated by an \*(L"earth gravity model\*(R". The models published by the \s-1NGA\s0 are: .IP "\fB\s-1EGM84\s0\fR" 4 .IX Item "EGM84" An earth gravity model published by the \s-1NGA\s0 in 1984, http://earth\-info.nga.mil/GandG/wgs84/gravitymod/wgs84_180/wgs84_180.html . .IP "\fB\s-1EGM96\s0\fR" 4 .IX Item "EGM96" An earth gravity model published by the \s-1NGA\s0 in 1996, http://earth\-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html . .IP "\fB\s-1EGM2008\s0\fR" 4 .IX Item "EGM2008" An earth gravity model published by the \s-1NGA\s0 in 2008, http://earth\-info.nga.mil/GandG/wgs84/gravitymod/egm2008 . .IP "\fB\s-1WGS84\s0\fR" 4 .IX Item "WGS84" World Geodetic System 1984, . .IP "\fB\s-1HAE\s0\fR" 4 .IX Item "HAE" Height above the \s-1WGS84\s0 ellipsoid. .IP "\fB\s-1MSL\s0\fR" 4 .IX Item "MSL" Mean sea level, used as a convenient short hand for the geoid. (However, typically, the geoid differs by a few meters from mean sea level.) .SH "EXAMPLES" .IX Header "EXAMPLES" The height of the \s-1EGM96\s0 geoid at Timbuktu .PP .Vb 2 \& echo 16:46:33N 3:00:34W | GeoidEval \& => 28.7068 \-0.02e\-6 \-1.73e\-6 .Ve .PP The first number returned is the height of the geoid and the 2nd and 3rd are its slopes in the northerly and easterly directions. .PP Convert a point in \s-1UTM\s0 zone 18N from \s-1MSL\s0 to \s-1HAE\s0 .PP .Vb 2 \& echo 531595 4468135 23 | GeoidEval \-\-msltohae \-z 18N \& => 531595 4468135 \-10.842 .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIGeoConvert\fR\|(1), \fIGravity\fR\|(1). .SH "AUTHOR" .IX Header "AUTHOR" \&\fBGeoidEval\fR was written by Charles Karney. .SH "HISTORY" .IX Header "HISTORY" \&\fBGeoidEval\fR was added to GeographicLib, , in 2009\-09. geographiclib-1.21/src/0002755000175000017500000000000011757437426014665 5ustar frankiefrankiegeographiclib-1.21/src/GeoCoords.cpp0000644000175000017500000001263311745620415017245 0ustar frankiefrankie/** * \file GeoCoords.cpp * \brief Implementation for GeographicLib::GeoCoords class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #include #include #include #include #include #define GEOGRAPHICLIB_GEOCOORDS_CPP \ "$Id: 084d4ec9163dc9d8989b54b12a04bf0f44a8c23f $" RCSID_DECL(GEOGRAPHICLIB_GEOCOORDS_CPP) RCSID_DECL(GEOGRAPHICLIB_GEOCOORDS_HPP) namespace GeographicLib { using namespace std; void GeoCoords::Reset(const std::string& s, bool centerp, bool swaplatlong) { vector sa; const char* spaces = " \t\n\v\f\r,"; // Include comma as a space for (string::size_type pos0 = 0, pos1; pos0 != string::npos;) { pos1 = s.find_first_not_of(spaces, pos0); if (pos1 == string::npos) break; pos0 = s.find_first_of(spaces, pos1); sa.push_back(s.substr(pos1, pos0 == string::npos ? pos0 : pos0 - pos1)); } if (sa.size() == 1) { int prec; MGRS::Reverse(sa[0], _zone, _northp, _easting, _northing, prec, centerp); UTMUPS::Reverse(_zone, _northp, _easting, _northing, _lat, _long, _gamma, _k); } else if (sa.size() == 2) { DMS::DecodeLatLon(sa[0], sa[1], _lat, _long, swaplatlong); UTMUPS::Forward( _lat, _long, _zone, _northp, _easting, _northing, _gamma, _k); } else if (sa.size() == 3) { unsigned zoneind, coordind; if (sa[0].size() > 0 && isalpha(sa[0][sa[0].size() - 1])) { zoneind = 0; coordind = 1; } else if (sa[2].size() > 0 && isalpha(sa[2][sa[2].size() - 1])) { zoneind = 2; coordind = 0; } else throw GeographicErr("Neither " + sa[0] + " nor " + sa[2] + " of the form UTM/UPS Zone + Hemisphere" + " (ex: 38N, 09S, N)"); UTMUPS::DecodeZone(sa[zoneind], _zone, _northp); for (unsigned i = 0; i < 2; ++i) (i ? _northing : _easting) = DMS::Decode(sa[coordind + i]); UTMUPS::Reverse(_zone, _northp, _easting, _northing, _lat, _long, _gamma, _k); FixHemisphere(); } else throw GeographicErr("Coordinate requires 1, 2, or 3 elements"); CopyToAlt(); } string GeoCoords::GeoRepresentation(int prec, bool swaplatlong) const { prec = max(0, min(9, prec) + 5); ostringstream os; os << fixed << setprecision(prec); real a = swaplatlong ? _long : _lat; real b = swaplatlong ? _lat : _long; if (!Math::isnan(a)) os << a; else os << "nan"; os << " "; if (!Math::isnan(b)) os << b; else os << "nan"; return os.str(); } string GeoCoords::DMSRepresentation(int prec, bool swaplatlong, char dmssep) const { prec = max(0, min(10, prec) + 5); return DMS::Encode(swaplatlong ? _long : _lat, unsigned(prec), swaplatlong ? DMS::LONGITUDE : DMS::LATITUDE, dmssep) + " " + DMS::Encode(swaplatlong ? _lat : _long, unsigned(prec), swaplatlong ? DMS::LATITUDE : DMS::LONGITUDE, dmssep); } string GeoCoords::DMSRepresentation(int prec, bool swaplatlong) const { return DMSRepresentation(prec, swaplatlong, char(0)); } string GeoCoords::MGRSRepresentation(int prec) const { // Max precision is um prec = max(0, min(6, prec) + 5); string mgrs; MGRS::Forward(_zone, _northp, _easting, _northing, _lat, prec, mgrs); return mgrs; } string GeoCoords::AltMGRSRepresentation(int prec) const { // Max precision is um prec = max(0, min(6, prec) + 5); string mgrs; MGRS::Forward(_alt_zone, _northp, _alt_easting, _alt_northing, _lat, prec, mgrs); return mgrs; } void GeoCoords::UTMUPSString(int zone, real easting, real northing, int prec, std::string& utm) const { ostringstream os; prec = max(-5, min(9, prec)); real scale = prec < 0 ? pow(real(10), -prec) : real(1); os << UTMUPS::EncodeZone(zone, _northp) << fixed << setfill('0'); if (Math::isfinite(easting)) { os << " " << setprecision(max(0, prec)) << easting / scale; if (prec < 0 && abs(easting / scale) > real(0.5)) os << setw(-prec) << 0; } else os << " nan"; if (Math::isfinite(northing)) { os << " " << setprecision(max(0, prec)) << northing / scale; if (prec < 0 && abs(northing / scale) > real(0.5)) os << setw(-prec) << 0; } else os << " nan"; utm = os.str(); } string GeoCoords::UTMUPSRepresentation(int prec) const { string utm; UTMUPSString(_zone, _easting, _northing, prec, utm); return utm; } string GeoCoords::AltUTMUPSRepresentation(int prec) const { string utm; UTMUPSString(_alt_zone, _alt_easting, _alt_northing, prec, utm); return utm; } void GeoCoords::FixHemisphere() { if (_lat == 0 || (_northp && _lat >= 0) || (!_northp && _lat < 0) || Math::isnan(_lat)) // Allow either hemisphere for equator return; if (_zone != UTMUPS::UPS) { _northing += (_northp ? 1 : -1) * UTMUPS::UTMShift(); _northp = !_northp; } else throw GeographicErr("Hemisphere mixup"); } } // namespace GeographicLib geographiclib-1.21/src/DMS.cpp0000644000175000017500000002705711745620415016012 0ustar frankiefrankie/** * \file DMS.cpp * \brief Implementation for GeographicLib::DMS class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #include #include #define GEOGRAPHICLIB_DMS_CPP "$Id: db38ddc05f7c27732da3aa820191a51200ce92ac $" RCSID_DECL(GEOGRAPHICLIB_DMS_CPP) RCSID_DECL(GEOGRAPHICLIB_DMS_HPP) RCSID_DECL(GEOGRAPHICLIB_CONSTANTS_HPP) RCSID_DECL(GEOGRAPHICLIB_MATH_HPP) namespace GeographicLib { using namespace std; const string DMS::hemispheres_ = "SNWE"; const string DMS::signs_ = "-+"; const string DMS::digits_ = "0123456789"; const string DMS::dmsindicators_ = "D'\":"; const string DMS::components_[] = {"degrees", "minutes", "seconds"}; Math::real DMS::Decode(const std::string& dms, flag& ind) { string errormsg; string dmsa = dms; replace(dmsa, "\xc2\xb0", 'd'); // degree symbol (U+00b0 = UTF-8 c2 b0) replace(dmsa, "\xc2\xba", 'd'); // alt symbol (U+00ba = UTF-8 c2 ba) replace(dmsa, "\xe2\x81\xb0", 'd'); // sup zero (U+2070 = UTF-8 e2 81 b0) replace(dmsa, "\xe2\x80\xb2", '\''); // prime (U+2032 = UTF-8 e2 80 b2) replace(dmsa, "\xc2\xb4", '\''); // acute accent (U+00b4 = UTF-8 c2 b4) replace(dmsa, "\xe2\x80\xb3", '"'); // dbl prime (U+2033 = UTF-8 e2 80 b3) replace(dmsa, "\xb0", 'd'); // bare degree symbol (b0) replace(dmsa, "\xba", 'd'); // bare alt symbol (ba) replace(dmsa, "\xb4", 'd'); // bare acute accent (b4) replace(dmsa, "''", '"'); // '' -> " do { // Executed once (provides the ability to break) int sign = 1; unsigned beg = 0, end = unsigned(dmsa.size()); while (beg < end && isspace(dmsa[beg])) ++beg; while (beg < end && isspace(dmsa[end - 1])) --end; flag ind1 = NONE; int k = -1; if (end > beg && (k = Utility::lookup(hemispheres_, dmsa[beg])) >= 0) { ind1 = (k / 2) ? LONGITUDE : LATITUDE; sign = k % 2 ? 1 : -1; ++beg; } if (end > beg && (k = Utility::lookup(hemispheres_, dmsa[end-1])) >= 0) { if (k >= 0) { if (ind1 != NONE) { if (toupper(dmsa[beg - 1]) == toupper(dmsa[end - 1])) errormsg = "Repeated hemisphere indicators " + Utility::str(dmsa[beg - 1]) + " in " + dmsa.substr(beg - 1, end - beg + 1); else errormsg = "Contradictory hemisphere indicators " + Utility::str(dmsa[beg - 1]) + " and " + Utility::str(dmsa[end - 1]) + " in " + dmsa.substr(beg - 1, end - beg + 1); break; } ind1 = (k / 2) ? LONGITUDE : LATITUDE; sign = k % 2 ? 1 : -1; --end; } } if (end > beg && (k = Utility::lookup(signs_, dmsa[beg])) >= 0) { if (k >= 0) { sign *= k ? 1 : -1; ++beg; } } if (end == beg) { errormsg = "Empty or incomplete DMS string " + dmsa; break; } real ipieces[] = {0, 0, 0}; real fpieces[] = {0, 0, 0}; unsigned npiece = 0; real icurrent = 0; real fcurrent = 0; unsigned ncurrent = 0, p = beg; bool pointseen = false; unsigned digcount = 0; while (p < end) { char x = dmsa[p++]; if ((k = Utility::lookup(digits_, x)) >= 0) { ++ncurrent; if (digcount > 0) ++digcount; // Count of decimal digits else icurrent = 10 * icurrent + k; } else if (x == '.') { if (pointseen) { errormsg = "Multiple decimal points in " + dmsa.substr(beg, end - beg); break; } pointseen = true; digcount = 1; } else if ((k = Utility::lookup(dmsindicators_, x)) >= 0) { if (k >= 3) { if (p == end) { errormsg = "Illegal for : to appear at the end of " + dmsa.substr(beg, end - beg); break; } k = npiece; } if (unsigned(k) == npiece - 1) { errormsg = "Repeated " + components_[k] + " component in " + dmsa.substr(beg, end - beg); break; } else if (unsigned(k) < npiece) { errormsg = components_[k] + " component follows " + components_[npiece - 1] + " component in " + dmsa.substr(beg, end - beg); break; } if (ncurrent == 0) { errormsg = "Missing numbers in " + components_[k] + " component of " + dmsa.substr(beg, end - beg); break; } if (digcount > 1) { istringstream s(dmsa.substr(p - digcount - 1, digcount)); s >> fcurrent; } ipieces[k] = icurrent; fpieces[k] = icurrent + fcurrent; if (p < end) { npiece = k + 1; icurrent = fcurrent = 0; ncurrent = digcount = 0; } } else if (Utility::lookup(signs_, x) >= 0) { errormsg = "Internal sign in DMS string " + dmsa.substr(beg, end - beg); break; } else { errormsg = "Illegal character " + Utility::str(x) + " in DMS string " + dmsa.substr(beg, end - beg); break; } } if (!errormsg.empty()) break; if (Utility::lookup(dmsindicators_, dmsa[p - 1]) < 0) { if (npiece >= 3) { errormsg = "Extra text following seconds in DMS string " + dmsa.substr(beg, end - beg); break; } if (ncurrent == 0) { errormsg = "Missing numbers in trailing component of " + dmsa.substr(beg, end - beg); break; } if (digcount > 1) { istringstream s(dmsa.substr(p - digcount, digcount)); s >> fcurrent; } ipieces[npiece] = icurrent; fpieces[npiece] = icurrent + fcurrent; } if (pointseen && digcount == 0) { errormsg = "Decimal point in non-terminal component of " + dmsa.substr(beg, end - beg); break; } // Note that we accept 59.999999... even though it rounds to 60. if (ipieces[1] >= 60) { errormsg = "Minutes " + Utility::str(fpieces[1]) + " not in range [0, 60)"; break; } if (ipieces[2] >= 60) { errormsg = "Seconds " + Utility::str(fpieces[2]) + " not in range [0, 60)"; break; } ind = ind1; // Assume check on range of result is made by calling routine (which // might be able to offer a better diagnostic). return real(sign) * (fpieces[0] + (fpieces[1] + fpieces[2] / 60) / 60); } while (false); real val = Utility::nummatch(dmsa); if (val == 0) throw GeographicErr(errormsg); else ind = NONE; return val; } void DMS::DecodeLatLon(const std::string& stra, const std::string& strb, real& lat, real& lon, bool swaplatlong) { real a, b; flag ia, ib; a = Decode(stra, ia); b = Decode(strb, ib); if (ia == NONE && ib == NONE) { // Default to lat, long unless swaplatlong ia = swaplatlong ? LONGITUDE : LATITUDE; ib = swaplatlong ? LATITUDE : LONGITUDE; } else if (ia == NONE) ia = flag(LATITUDE + LONGITUDE - ib); else if (ib == NONE) ib = flag(LATITUDE + LONGITUDE - ia); if (ia == ib) throw GeographicErr("Both " + stra + " and " + strb + " interpreted as " + (ia == LATITUDE ? "latitudes" : "longitudes")); real lat1 = ia == LATITUDE ? a : b, lon1 = ia == LATITUDE ? b : a; if (lat1 < -90 || lat1 > 90) throw GeographicErr("Latitude " + Utility::str(lat1) + "d not in [-90d, 90d]"); if (lon1 < -180 || lon1 > 360) throw GeographicErr("Longitude " + Utility::str(lon1) + "d not in [-180d, 360d]"); if (lon1 >= 180) lon1 -= 360; lat = lat1; lon = lon1; } Math::real DMS::DecodeAngle(const std::string& angstr) { flag ind; real ang = Decode(angstr, ind); if (ind != NONE) throw GeographicErr("Arc angle " + angstr + " includes a hemisphere, N/E/W/S"); return ang; } Math::real DMS::DecodeAzimuth(const std::string& azistr) { flag ind; real azi = Decode(azistr, ind); if (ind == LATITUDE) throw GeographicErr("Azimuth " + azistr + " has a latitude hemisphere, N/S"); if (azi < -180 || azi > 360) throw GeographicErr("Azimuth " + azistr + " not in range [-180d, 360d]"); if (azi >= 180) azi -= 360; return azi; } string DMS::Encode(real angle, component trailing, unsigned prec, flag ind, char dmssep) { // Assume check on range of input angle has been made by calling // routine (which might be able to offer a better diagnostic). if (!Math::isfinite(angle)) return angle < 0 ? string("-inf") : (angle > 0 ? string("inf") : string("nan")); // 15 - 2 * trailing = ceiling(log10(2^53/90/60^trailing)). // This suffices to give full real precision for numbers in [-90,90] prec = min(15 - 2 * unsigned(trailing), prec); real scale = 1; for (unsigned i = 0; i < unsigned(trailing); ++i) scale *= 60; for (unsigned i = 0; i < prec; ++i) scale *= 10; if (ind == AZIMUTH) angle -= floor(angle/360) * 360; int sign = angle < 0 ? -1 : 1; angle *= sign; // Break off integer part to preserve precision in manipulation of // fractional part. real idegree = floor(angle), fdegree = floor((angle - idegree) * scale + real(0.5)) / scale; if (fdegree >= 1) { idegree += 1; fdegree -= 1; } real pieces[3] = {fdegree, 0, 0}; for (unsigned i = 1; i <= unsigned(trailing); ++i) { real ip = floor(pieces[i - 1]), fp = pieces[i - 1] - ip; pieces[i] = fp * 60; pieces[i - 1] = ip; } pieces[0] += idegree; ostringstream s; s << fixed << setfill('0'); if (ind == NONE && sign < 0) s << '-'; switch (trailing) { case DEGREE: if (ind != NONE) s << setw(1 + min(int(ind), 2) + prec + (prec ? 1 : 0)); s << setprecision(prec) << pieces[0]; // Don't include degree designator (d) if it is the trailing component. break; default: if (ind != NONE) s << setw(1 + min(int(ind), 2)); s << setprecision(0) << pieces[0] << (dmssep ? dmssep : char(tolower(dmsindicators_[0]))); switch (trailing) { case MINUTE: s << setw(2 + prec + (prec ? 1 : 0)) << setprecision(prec) << pieces[1]; if (!dmssep) s << char(tolower(dmsindicators_[1])); break; case SECOND: s << setw(2) << pieces[1] << (dmssep ? dmssep : char(tolower(dmsindicators_[1]))) << setw(2 + prec + (prec ? 1 : 0)) << setprecision(prec) << pieces[2]; if (!dmssep) s << char(tolower(dmsindicators_[2])); break; default: break; } } if (ind != NONE && ind != AZIMUTH) s << hemispheres_[(ind == LATITUDE ? 0 : 2) + (sign < 0 ? 0 : 1)]; return s.str(); } string DMS::Encode(real angle, component trailing, unsigned prec, flag ind) { return Encode(angle, trailing, prec, ind, char(0)); } } // namespace GeographicLib geographiclib-1.21/src/MagneticModel.cpp0000644000175000017500000002147511745620415020075 0ustar frankiefrankie/** * \file MagneticModel.cpp * \brief Implementation for GeographicLib::MagneticModel class * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #include #include #include #include #define GEOGRAPHICLIB_MAGNETICMODEL_CPP \ "$Id: b0287ac014f10e4c6656b67f21c764432a47559a $" RCSID_DECL(GEOGRAPHICLIB_MAGNETICMODEL_CPP) RCSID_DECL(GEOGRAPHICLIB_MAGNETICMODEL_HPP) #if !defined(GEOGRAPHICLIB_DATA) # if defined(_MSC_VER) # define GEOGRAPHICLIB_DATA \ "C:/Documents and Settings/All Users/Application Data/GeographicLib" # else # define GEOGRAPHICLIB_DATA "/usr/local/share/GeographicLib" # endif #endif #if !defined(MAGNETIC_DEFAULT_NAME) # define MAGNETIC_DEFAULT_NAME "wmm2010" #endif #if defined(_MSC_VER) // Squelch warnings about unsafe use of getenv #pragma warning (disable: 4996) #endif namespace GeographicLib { using namespace std; MagneticModel::MagneticModel(const std::string& name,const std::string& path, const Geocentric& earth) : _name(name) , _dir(path) , _description("NONE") , _date("UNKNOWN") , _t0(Math::NaN()) , _dt0(1) , _tmin(Math::NaN()) , _tmax(Math::NaN()) , _a(Math::NaN()) , _hmin(Math::NaN()) , _hmax(Math::NaN()) , _Nmodels(1) , _norm(SphericalHarmonic::SCHMIDT) , _earth(earth) { if (_dir.empty()) _dir = DefaultMagneticPath(); ReadMetadata(_name); _G.resize(_Nmodels + 1); _H.resize(_Nmodels + 1); { string coeff = _filename + ".cof"; ifstream coeffstr(coeff.c_str(), ios::binary); if (!coeffstr.good()) throw GeographicErr("Error opening " + coeff); char id[idlength_ + 1]; coeffstr.read(id, idlength_); if (!coeffstr.good()) throw GeographicErr("No header in " + coeff); id[idlength_] = '\0'; if (_id != string(id)) throw GeographicErr("ID mismatch: " + _id + " vs " + id); for (int i = 0; i <= _Nmodels; ++i) { int N, M; SphericalEngine::coeff::readcoeffs(coeffstr, N, M, _G[i], _H[i]); if (!(M < 0 || _G[i][0] == 0)) throw GeographicErr("A degree 0 term is not permitted"); _harm.push_back(SphericalHarmonic(_G[i], _H[i], N, N, M, _a, _norm)); } int pos = int(coeffstr.tellg()); coeffstr.seekg(0, ios::end); if (pos != coeffstr.tellg()) throw GeographicErr("Extra data in " + coeff); } } void MagneticModel::ReadMetadata(const std::string& name) { const char* spaces = " \t\n\v\f\r"; _filename = _dir + "/" + name + ".wmm"; ifstream metastr(_filename.c_str()); if (!metastr.good()) throw GeographicErr("Cannot open " + _filename); string line; getline(metastr, line); if (!(line.size() >= 6 && line.substr(0,5) == "WMMF-")) throw GeographicErr(_filename + " does not contain WMMF-n signature"); string::size_type n = line.find_first_of(spaces, 5); if (n != string::npos) n -= 5; string version = line.substr(5, n); if (version != "1") throw GeographicErr("Unknown version in " + _filename + ": " + version); string key, val; while (getline(metastr, line)) { if (!Utility::ParseLine(line, key, val)) continue; // Process key words if (key == "Name") _name = val; else if (key == "Description") _description = val; else if (key == "ReleaseDate") _date = val; else if (key == "Radius") _a = Utility::num(val); else if (key == "Type") { if (!(val == "Linear" || val == "linear")) throw GeographicErr("Only linear models are supported"); } else if (key == "Epoch") _t0 = Utility::num(val); else if (key == "DeltaEpoch") _dt0 = Utility::num(val); else if (key == "NumModels") _Nmodels = Utility::num(val); else if (key == "MinTime") _tmin = Utility::num(val); else if (key == "MaxTime") _tmax = Utility::num(val); else if (key == "MinHeight") _hmin = Utility::num(val); else if (key == "MaxHeight") _hmax = Utility::num(val); else if (key == "Normalization") { if (val == "FULL" || val == "Full" || val == "full") _norm = SphericalHarmonic::FULL; else if (val == "SCHMIDT" || val == "Schmidt" || val == "schmidt") _norm = SphericalHarmonic::SCHMIDT; else throw GeographicErr("Unknown normalization " + val); } else if (key == "ByteOrder") { if (val == "Big" || val == "big") throw GeographicErr("Only little-endian ordering is supported"); else if (!(val == "Little" || val == "little")) throw GeographicErr("Unknown byte ordering " + val); } else if (key == "ID") _id = val; // else unrecognized keywords are skipped } // Check values if (!(Math::isfinite(_a) && _a > 0)) throw GeographicErr("Reference radius must be positive"); if (!(_t0 > 0)) throw GeographicErr("Epoch time not defined"); if (_tmin >= _tmax) throw GeographicErr("Min time exceeds max time"); if (_hmin >= _hmax) throw GeographicErr("Min height exceeds max height"); if (int(_id.size()) != idlength_) throw GeographicErr("Invalid ID"); if (!(_dt0 > 0)) { if (_Nmodels > 1) throw GeographicErr("DeltaEpoch must be positive"); else _dt0 = 1; } } void MagneticModel::Field(real t, real lat, real lon, real h, bool diffp, real& Bx, real& By, real& Bz, real& Bxt, real& Byt, real& Bzt) const throw() { t -= _t0; int n = max(min(int(floor(t / _dt0)), _Nmodels - 1), 0); bool interpolate = n + 1 < _Nmodels; t -= n * _dt0; real X, Y, Z; real M[Geocentric::dim2_]; _earth.IntForward(lat, lon, h, X, Y, Z, M); real BX0, BY0, BZ0, BX1, BY1, BZ1; // Components in geocentric basis _harm[n](X, Y, Z, BX0, BY0, BZ0); _harm[n + 1](X, Y, Z, BX1, BY1, BZ1); if (interpolate) { // Convert to a time derivative BX1 = (BX1 - BX0) / _dt0; BY1 = (BY1 - BY0) / _dt0; BZ1 = (BZ1 - BZ0) / _dt0; } BX0 += t * BX1; BY0 += t * BY1; BZ0 += t * BZ1; if (diffp) { Geocentric::Unrotate(M, BX1, BY1, BZ1, Bxt, Byt, Bzt); Bxt *= - _a; Byt *= - _a; Bzt *= - _a; } Geocentric::Unrotate(M, BX0, BY0, BZ0, Bx, By, Bz); Bx *= - _a; By *= - _a; Bz *= - _a; } MagneticCircle MagneticModel::Circle(real t, real lat, real h) const { real t1 = t - _t0; int n = max(min(int(floor(t1 / _dt0)), _Nmodels - 1), 0); bool interpolate = n + 1 < _Nmodels; t1 -= n * _dt0; real X, Y, Z, M[Geocentric::dim2_]; _earth.IntForward(lat, 0, h, X, Y, Z, M); // Y = 0, cphi = M[7], sphi = M[8]; return MagneticCircle(_a, _earth._f, lat, h, t, M[7], M[8], t1, _dt0, interpolate, _harm[n].Circle(X, Z, true), _harm[n + 1].Circle(X, Z, true)); } void MagneticModel::FieldComponents(real Bx, real By, real Bz, real Bxt, real Byt, real Bzt, real& H, real& F, real& D, real& I, real& Ht, real& Ft, real& Dt, real& It) throw() { H = Math::hypot(Bx, By); Ht = H ? (Bx * Bxt + By * Byt) / H : Math::hypot(Bxt, Byt); D = (0 - (H ? atan2(-Bx, By) : atan2(-Bxt, Byt))) / Math::degree(); Dt = (H ? (By * Bxt - Bx * Byt) / Math::sq(H) : 0) / Math::degree(); F = Math::hypot(H, Bz); Ft = F ? (H * Ht + Bz * Bzt) / F : Math::hypot(Ht, Bzt); I = (F ? atan2(-Bz, H) : atan2(-Bzt, Ht)) / Math::degree(); It = (F ? (Bz * Ht - H * Bzt) / Math::sq(F) : 0) / Math::degree(); } std::string MagneticModel::DefaultMagneticPath() { string path; char* magneticpath = getenv("MAGNETIC_PATH"); if (magneticpath) path = string(magneticpath); if (path.length()) return path; char* datapath = getenv("GEOGRAPHICLIB_DATA"); if (datapath) path = string(datapath); return (path.length() ? path : string(GEOGRAPHICLIB_DATA)) + "/magnetic"; } std::string MagneticModel::DefaultMagneticName() { string name; char* magneticname = getenv("MAGNETIC_NAME"); if (magneticname) name = string(magneticname); return name.length() ? name : string(MAGNETIC_DEFAULT_NAME); } } // namespace GeographicLib geographiclib-1.21/src/NormalGravity.cpp0000644000175000017500000001761311745620415020162 0ustar frankiefrankie/** * \file NormalGravity.cpp * \brief Implementation for GeographicLib::NormalGravity class * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #define GEOGRAPHICLIB_NORMALGRAVITY_CPP \ "$Id: ccd3d6bd4bddefb0b40cbce0006d863f08d64db4 $" RCSID_DECL(GEOGRAPHICLIB_NORMALGRAVITY_CPP) RCSID_DECL(GEOGRAPHICLIB_NORMALGRAVITY_HPP) namespace GeographicLib { using namespace std; NormalGravity::NormalGravity(real a, real GM, real omega, real f, real J2) : _a(a) , _GM(GM) , _omega(omega) , _f(f) , _J2(J2) , _omega2(Math::sq(_omega)) , _aomega2(Math::sq(_omega * _a)) { if (!(Math::isfinite(_a) && _a > 0)) throw GeographicErr("Major radius is not positive"); if (!(Math::isfinite(_GM) && _GM > 0)) throw GeographicErr("Gravitational constants is not positive"); bool flatp = _f > 0 && Math::isfinite(_f); if (_J2 > 0 && Math::isfinite(_J2) && flatp) throw GeographicErr("Cannot specify both f and J2"); if (!(_J2 > 0 && Math::isfinite(_J2)) && !flatp) throw GeographicErr("Must specify one of f and J2"); if (!(Math::isfinite(_omega) && _omega != 0)) throw GeographicErr("Angular velocity is not non-zero"); real K = 2 * _aomega2 * _a / (15 * _GM); if (flatp) { _e2 = _f * (2 - _f); _ep2 = _e2 / (1 - _e2); _q0 = qf(_ep2); _J2 = _e2 * ( 1 - K * sqrt(_e2) / _q0) / 3; // H+M, Eq 2-90 } else { _e2 = 3 * _J2; // See Moritz (1980), p 398. for (int j = 0; j < maxit_; ++j) { real e2a = _e2; real q0 = qf(_e2 / (1 - _e2)); _e2 = 3 * _J2 + K * _e2 * sqrt(_e2) / q0; if (_e2 == e2a) break; } _f = _e2 / (1 + sqrt(1 - _e2)); _ep2 = _e2 / (1 - _e2); _q0 = qf(_ep2); } _earth = Geocentric(_a, _f); _b = _a * (1 - _f); _E = a * sqrt(_e2); // H+M, Eq 2-54 _U0 = _GM / _E * atan(sqrt(_ep2)) + _aomega2 / 3; // H+M, Eq 2-61 // The approximate ratio of the centrifugal acceleration (at the equator) // to gravity. _m = _aomega2 * _b / _GM; // H+M, Eq 2-70 real Q = _m * sqrt(_ep2) * qpf(_ep2) / (3 * _q0), G = (1 - _m - Q / 2); _gammae = _GM / (_a * _b) * G; // H+M, Eq 2-73 _gammap = _GM / (_a * _a) * (1 + Q); // H+M, Eq 2-74 // k = b * gammap / (a * gammae) - 1 _k = (_m + 3 * Q / 2 - _e2 * (1 + Q)) / G; // f* = (gammap - gammae) / gammae _fstar = (_m + 3 * Q / 2 - _f * (1 + Q)) / G; } const NormalGravity NormalGravity::WGS84(Constants::WGS84_a(), Constants::WGS84_GM(), Constants::WGS84_omega(), Constants::WGS84_f(), 0); const NormalGravity NormalGravity::GRS80(Constants::GRS80_a(), Constants::GRS80_GM(), Constants::GRS80_omega(), 0, Constants::GRS80_J2()); Math::real NormalGravity::qf(real ep2) throw() { // Compute // // ((1 + 3/e'^2) * atan(e') - 3/e')/2 // // See H+M, Eq 2-57, with E/u = e'. This suffers from two levels of // cancelation. The e'^-1 and e'^1 terms drop out, so that the leading // term is O(e'^3). real ep = sqrt(ep2); if (abs(ep2) > real(0.5)) // Use the closed expression return ((1 + 3 / ep2) * atan(ep) - 3 / ep)/2; else { real ep2n = 1, q = 0; // The series expansion H+M, Eq 2-86 for (int n = 1; ; ++n) { ep2n *= -ep2; real t = (ep2n * n) / ((2 * n + 1) * (2 * n + 3)), qn = q + t; if (qn == q) break; q = qn; } q *= -2 * ep; return q; } } Math::real NormalGravity::qpf(real ep2) throw() { // Compute // // 3*(1 + 1/e'^2) * (1 - atan(e')/e') - 1 // // See H+M, Eq 2-67, with E/u = e'. This suffers from two levels of // cancelation. The e'^-2 and e'^0 terms drop out, so that the leading // term is O(e'^2). if (abs(ep2) > real(0.5)) { // Use the closed expression real ep = sqrt(ep2); return 3 * (1 + 1 / ep2) * (1 - atan(ep) / ep) - 1; } else { real ep2n = 1, qp = 0; // The series expansion H+M, Eq 2-101c for (int n = 1; ; ++n) { ep2n *= -ep2; real t = ep2n / ((2 * n + 1) * (2 * n + 3)), qpn = qp + t; if (qpn == qp) break; qp = qpn; } qp *= -6; return qp; } } Math::real NormalGravity::Jn(int n) const throw() { // Note Jn(0) = -1; Jn(2) = _J2; Jn(odd) = 0 if (n & 1 || n < 0) return 0; n /= 2; real e2n = 1; // Perhaps this should just be e2n = pow(-_e2, n); for (int j = n; j--;) e2n *= -_e2; return // H+M, Eq 2-92 -3 * e2n * (1 - n + 5 * n * _J2 / _e2) / ((2 * n + 1) * (2 * n + 3)); } Math::real NormalGravity::SurfaceGravity(real lat) const throw() { real phi = lat * Math::degree(), sphi2 = abs(lat) == 90 ? 1 : Math::sq(sin(phi)); // H+M, Eq 2-78 return _gammae * (1 + _k * sphi2) / sqrt(1 - _e2 * sphi2); } Math::real NormalGravity::V0(real X, real Y, real Z, real& GammaX, real& GammaY, real& GammaZ) const throw() { // See H+M, Sec 6-2 real p = Math::hypot(X, Y), clam = p ? X/p : 1, slam = p ? Y/p : 0, r = Math::hypot(p, Z), Q = Math::sq(r) - Math::sq(_E), t2 = Math::sq(2 * _E * Z), disc = sqrt(Math::sq(Q) + t2), // This is H+M, Eq 6-8a, but generalized to deal with Q negative // accurately. u = sqrt((Q >= 0 ? (Q + disc) : t2 / (disc - Q)) / 2), uE = Math::hypot(u, _E), // H+M, Eq 6-8b sbet = Z * uE, cbet = p * u, s = Math::hypot(cbet, sbet); cbet = s ? cbet/s : 0; sbet = s ? sbet/s : 1; real invw = uE / Math::hypot(u, _E * sbet), // H+M, Eq 2-63 ep = _E/u, ep2 = Math::sq(ep), q = qf(ep2) / _q0, qp = qpf(ep2) / _q0, // H+M, Eqs 2-62 + 6-9, but omitting last (rotational) term . Vres = (_GM / _E * atan(_E / u) + _aomega2 * q * (Math::sq(sbet) - 1/real(3)) / 2), // H+M, Eq 6-10 gamu = - invw * (_GM + (_aomega2 * _E * qp * (Math::sq(sbet) - 1/real(3)) / 2)) / Math::sq(uE), gamb = _aomega2 * q * sbet * cbet * invw / uE, t = u * invw / uE; // H+M, Eq 6-12 GammaX = t * cbet * gamu - invw * sbet * gamb; GammaY = GammaX * slam; GammaX *= clam; GammaZ = invw * sbet * gamu + t * cbet * gamb; return Vres; } Math::real NormalGravity::Phi(real X, real Y, real& fX, real& fY) const throw() { fX = _omega2 * X; fY = _omega2 * Y; // N.B. fZ = 0; return _omega2 * (Math::sq(X) + Math::sq(Y)) / 2; } Math::real NormalGravity::U(real X, real Y, real Z, real& gammaX, real& gammaY, real& gammaZ) const throw() { real fX, fY; real Ures = V0(X, Y, Z, gammaX, gammaY, gammaZ) + Phi(X, Y, fX, fY); gammaX += fX; gammaY += fY; return Ures; } Math::real NormalGravity::Gravity(real lat, real h, real& gammay, real& gammaz) const throw() { real X, Y, Z; real M[Geocentric::dim2_]; _earth.IntForward(lat, 0, h, X, Y, Z, M); real gammaX, gammaY, gammaZ, Ures = U(X, Y, Z, gammaX, gammaY, gammaZ); // gammax = M[0] * gammaX + M[3] * gammaY + M[6] * gammaZ; gammay = M[1] * gammaX + M[4] * gammaY + M[7] * gammaZ; gammaz = M[2] * gammaX + M[5] * gammaY + M[8] * gammaZ; return Ures; } } // namespace GeographicLib geographiclib-1.21/src/Gnomonic.cpp0000644000175000017500000000504411745620415017130 0ustar frankiefrankie/** * \file Gnomonic.cpp * \brief Implementation for GeographicLib::Gnomonic class * * Copyright (c) Charles Karney (2010, 2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #define GEOGRAPHICLIB_GNOMONIC_CPP \ "$Id: 1abf2f2ebdc8a805d0d205051120809f0c0e6071 $" RCSID_DECL(GEOGRAPHICLIB_GNOMONIC_CPP) RCSID_DECL(GEOGRAPHICLIB_GNOMONIC_HPP) namespace GeographicLib { using namespace std; const Math::real Gnomonic::eps0_ = numeric_limits::epsilon(); const Math::real Gnomonic::eps_ = real(0.01) * sqrt(eps0_); void Gnomonic::Forward(real lat0, real lon0, real lat, real lon, real& x, real& y, real& azi, real& rk) const throw() { real azi0, m, M, t; _earth.GenInverse(lat0, lon0, lat, lon, Geodesic::AZIMUTH | Geodesic::REDUCEDLENGTH | Geodesic::GEODESICSCALE, t, azi0, azi, m, M, t, t); rk = M; if (M <= 0) x = y = Math::NaN(); else { real rho = m/M; azi0 *= Math::degree(); x = rho * sin(azi0); y = rho * cos(azi0); } } void Gnomonic::Reverse(real lat0, real lon0, real x, real y, real& lat, real& lon, real& azi, real& rk) const throw() { real azi0 = atan2(x, y) / Math::degree(), rho = Math::hypot(x, y), s = _a * atan(rho/_a); bool little = rho <= _a; if (!little) rho = 1/rho; GeodesicLine line(_earth.Line(lat0, lon0, azi0, Geodesic::LATITUDE | Geodesic::LONGITUDE | Geodesic::AZIMUTH | Geodesic::DISTANCE_IN | Geodesic::REDUCEDLENGTH | Geodesic::GEODESICSCALE)); int count = numit_, trip = 0; real lat1, lon1, azi1, M; while (count--) { real m, t; line.Position(s, lat1, lon1, azi1, m, M, t); if (trip) break; // If little, solve rho(s) = rho with drho(s)/ds = 1/M^2 // else solve 1/rho(s) = 1/rho with d(1/rho(s))/ds = -1/m^2 real ds = little ? (m/M - rho) * M * M : (rho - M/m) * m * m; s -= ds; if (!(abs(ds) >= eps_ * _a)) ++trip; } if (trip) { lat = lat1; lon = lon1; azi = azi1; rk = M; } else lat = lon = azi = rk = Math::NaN(); return; } } // namespace GeographicLib geographiclib-1.21/src/Geodesic.cpp0000644000175000017500000013747011745620415017112 0ustar frankiefrankie/** * \file Geodesic.cpp * \brief Implementation for GeographicLib::Geodesic class * * Copyright (c) Charles Karney (2009-2012) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * This is a reformulation of the geodesic problem. The notation is as * follows: * - at a general point (no suffix or 1 or 2 as suffix) * - phi = latitude * - beta = latitude on auxiliary sphere * - omega = longitude on auxiliary sphere * - lambda = longitude * - alpha = azimuth of great circle * - sigma = arc length along great circle * - s = distance * - tau = scaled distance (= sigma at multiples of pi/2) * - at northwards equator crossing * - beta = phi = 0 * - omega = lambda = 0 * - alpha = alpha0 * - sigma = s = 0 * - a 12 suffix means a difference, e.g., s12 = s2 - s1. * - s and c prefixes mean sin and cos **********************************************************************/ #include #include #define GEOGRAPHICLIB_GEODESIC_CPP \ "$Id: dd137806b8a5ba58211a37eb87e163b8a9bd7aa7 $" RCSID_DECL(GEOGRAPHICLIB_GEODESIC_CPP) RCSID_DECL(GEOGRAPHICLIB_GEODESIC_HPP) namespace GeographicLib { using namespace std; // Underflow guard. We require // tiny_ * epsilon() > 0 // tiny_ + epsilon() == epsilon() const Math::real Geodesic::tiny_ = sqrt(numeric_limits::min()); const Math::real Geodesic::tol0_ = numeric_limits::epsilon(); // Increase multiplier in defn of tol1_ from 100 to 200 to fix inverse case // 52.784459512564 0 -52.784459512563990912 179.634407464943777557 // which otherwise failed for Visual Studio 10 (Release and Debug) const Math::real Geodesic::tol1_ = 200 * tol0_; const Math::real Geodesic::tol2_ = sqrt(numeric_limits::epsilon()); const Math::real Geodesic::xthresh_ = 1000 * tol2_; Geodesic::Geodesic(real a, real f) : _a(a) , _f(f <= 1 ? f : 1/f) , _f1(1 - _f) , _e2(_f * (2 - _f)) , _ep2(_e2 / Math::sq(_f1)) // e2 / (1 - e2) , _n(_f / ( 2 - _f)) , _b(_a * _f1) , _c2((Math::sq(_a) + Math::sq(_b) * (_e2 == 0 ? 1 : (_e2 > 0 ? Math::atanh(sqrt(_e2)) : atan(sqrt(-_e2))) / sqrt(abs(_e2))))/2) // authalic radius squared // The sig12 threshold for "really short" , _etol2(10 * tol2_ / max(real(0.1), sqrt(abs(_e2)))) { if (!(Math::isfinite(_a) && _a > 0)) throw GeographicErr("Major radius is not positive"); if (!(Math::isfinite(_b) && _b > 0)) throw GeographicErr("Minor radius is not positive"); A3coeff(); C3coeff(); C4coeff(); } const Geodesic Geodesic::WGS84(Constants::WGS84_a(), Constants::WGS84_f()); Math::real Geodesic::SinCosSeries(bool sinp, real sinx, real cosx, const real c[], int n) throw() { // Evaluate // y = sinp ? sum(c[i] * sin( 2*i * x), i, 1, n) : // sum(c[i] * cos((2*i+1) * x), i, 0, n-1) : // using Clenshaw summation. N.B. c[0] is unused for sin series // Approx operation count = (n + 5) mult and (2 * n + 2) add c += (n + sinp); // Point to one beyond last element real ar = 2 * (cosx - sinx) * (cosx + sinx), // 2 * cos(2 * x) y0 = n & 1 ? *--c : 0, y1 = 0; // accumulators for sum // Now n is even n /= 2; while (n--) { // Unroll loop x 2, so accumulators return to their original role y1 = ar * y0 - y1 + *--c; y0 = ar * y1 - y0 + *--c; } return sinp ? 2 * sinx * cosx * y0 // sin(2 * x) * y0 : cosx * (y0 - y1); // cos(x) * (y0 - y1) } GeodesicLine Geodesic::Line(real lat1, real lon1, real azi1, unsigned caps) const throw() { return GeodesicLine(*this, lat1, lon1, azi1, caps); } Math::real Geodesic::GenDirect(real lat1, real lon1, real azi1, bool arcmode, real s12_a12, unsigned outmask, real& lat2, real& lon2, real& azi2, real& s12, real& m12, real& M12, real& M21, real& S12) const throw() { return GeodesicLine(*this, lat1, lon1, azi1, // Automatically supply DISTANCE_IN if necessary outmask | (arcmode ? NONE : DISTANCE_IN)) . // Note the dot! GenPosition(arcmode, s12_a12, outmask, lat2, lon2, azi2, s12, m12, M12, M21, S12); } Math::real Geodesic::GenInverse(real lat1, real lon1, real lat2, real lon2, unsigned outmask, real& s12, real& azi1, real& azi2, real& m12, real& M12, real& M21, real& S12) const throw() { outmask &= OUT_ALL; lon1 = AngNormalize(lon1); real lon12 = AngNormalize(AngNormalize(lon2) - lon1); // If very close to being on the same meridian, then make it so. // Not sure this is necessary... lon12 = AngRound(lon12); // Make longitude difference positive. int lonsign = lon12 >= 0 ? 1 : -1; lon12 *= lonsign; if (lon12 == 180) lonsign = 1; // If really close to the equator, treat as on equator. lat1 = AngRound(lat1); lat2 = AngRound(lat2); // Swap points so that point with higher (abs) latitude is point 1 int swapp = abs(lat1) >= abs(lat2) ? 1 : -1; if (swapp < 0) { lonsign *= -1; swap(lat1, lat2); } // Make lat1 <= 0 int latsign = lat1 < 0 ? 1 : -1; lat1 *= latsign; lat2 *= latsign; // Now we have // // 0 <= lon12 <= 180 // -90 <= lat1 <= 0 // lat1 <= lat2 <= -lat1 // // longsign, swapp, latsign register the transformation to bring the // coordinates to this canonical form. In all cases, 1 means no change was // made. We make these transformations so that there are few cases to // check, e.g., on verifying quadrants in atan2. In addition, this // enforces some symmetries in the results returned. real phi, sbet1, cbet1, sbet2, cbet2, s12x, m12x; phi = lat1 * Math::degree(); // Ensure cbet1 = +epsilon at poles sbet1 = _f1 * sin(phi); cbet1 = lat1 == -90 ? tiny_ : cos(phi); SinCosNorm(sbet1, cbet1); phi = lat2 * Math::degree(); // Ensure cbet2 = +epsilon at poles sbet2 = _f1 * sin(phi); cbet2 = abs(lat2) == 90 ? tiny_ : cos(phi); SinCosNorm(sbet2, cbet2); // If cbet1 < -sbet1, then cbet2 - cbet1 is a sensitive measure of the // |bet1| - |bet2|. Alternatively (cbet1 >= -sbet1), abs(sbet2) + sbet1 is // a better measure. This logic is used in assigning calp2 in Lambda12. // Sometimes these quantities vanish and in that case we force bet2 = +/- // bet1 exactly. An example where is is necessary is the inverse problem // 48.522876735459 0 -48.52287673545898293 179.599720456223079643 // which failed with Visual Studio 10 (Release and Debug) if (cbet1 < -sbet1) { if (cbet2 == cbet1) sbet2 = sbet2 < 0 ? sbet1 : -sbet1; } else { if (abs(sbet2) == -sbet1) cbet2 = cbet1; } real lam12 = lon12 * Math::degree(), slam12 = lon12 == 180 ? 0 : sin(lam12), clam12 = cos(lam12); // lon12 == 90 isn't interesting real a12, sig12, calp1, salp1, calp2, salp2; // index zero elements of these arrays are unused real C1a[nC1_ + 1], C2a[nC2_ + 1], C3a[nC3_]; bool meridian = lat1 == -90 || slam12 == 0; if (meridian) { // Endpoints are on a single full meridian, so the geodesic might lie on // a meridian. calp1 = clam12; salp1 = slam12; // Head to the target longitude calp2 = 1; salp2 = 0; // At the target we're heading north real // tan(bet) = tan(sig) * cos(alp) ssig1 = sbet1, csig1 = calp1 * cbet1, ssig2 = sbet2, csig2 = calp2 * cbet2; // sig12 = sig2 - sig1 sig12 = atan2(max(csig1 * ssig2 - ssig1 * csig2, real(0)), csig1 * csig2 + ssig1 * ssig2); { real dummy; Lengths(_n, sig12, ssig1, csig1, ssig2, csig2, cbet1, cbet2, s12x, m12x, dummy, (outmask & GEODESICSCALE) != 0U, M12, M21, C1a, C2a); } // Add the check for sig12 since zero length geodesics might yield m12 < // 0. Test case was // // echo 20.001 0 20.001 0 | Geod -i // // In fact, we will have sig12 > pi/2 for meridional geodesic which is // not a shortest path. if (sig12 < 1 || m12x >= 0) { m12x *= _a; s12x *= _b; a12 = sig12 / Math::degree(); } else // m12 < 0, i.e., prolate and too close to anti-podal meridian = false; } real omg12; if (!meridian && sbet1 == 0 && // and sbet2 == 0 // Mimic the way Lambda12 works with calp1 = 0 (_f <= 0 || lam12 <= Math::pi() - _f * Math::pi())) { // Geodesic runs along equator calp1 = calp2 = 0; salp1 = salp2 = 1; s12x = _a * lam12; m12x = _b * sin(lam12 / _f1); if (outmask & GEODESICSCALE) M12 = M21 = cos(lam12 / _f1); a12 = lon12 / _f1; sig12 = omg12 = lam12 / _f1; } else if (!meridian) { // Now point1 and point2 belong within a hemisphere bounded by a // meridian and geodesic is neither meridional or equatorial. // Figure a starting point for Newton's method sig12 = InverseStart(sbet1, cbet1, sbet2, cbet2, lam12, salp1, calp1, salp2, calp2, C1a, C2a); if (sig12 >= 0) { // Short lines (InverseStart sets salp2, calp2) real wm = sqrt(1 - _e2 * Math::sq((cbet1 + cbet2) / 2)); s12x = sig12 * _a * wm; m12x = Math::sq(wm) * _a / _f1 * sin(sig12 * _f1 / wm); if (outmask & GEODESICSCALE) M12 = M21 = cos(sig12 * _f1 / wm); a12 = sig12 / Math::degree(); omg12 = lam12 / wm; } else { // Newton's method real ssig1, csig1, ssig2, csig2, eps; real ov = 0; unsigned numit = 0; for (unsigned trip = 0; numit < maxit_; ++numit) { real dv; real v = Lambda12(sbet1, cbet1, sbet2, cbet2, salp1, calp1, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, eps, omg12, trip < 1, dv, C1a, C2a, C3a) - lam12; if (!(abs(v) > tiny_) || !(trip < 1)) { if (!(abs(v) <= max(tol1_, ov))) numit = maxit_; break; } real dalp1 = -v/dv; real sdalp1 = sin(dalp1), cdalp1 = cos(dalp1), nsalp1 = salp1 * cdalp1 + calp1 * sdalp1; calp1 = calp1 * cdalp1 - salp1 * sdalp1; salp1 = max(real(0), nsalp1); SinCosNorm(salp1, calp1); // In some regimes we don't get quadratic convergence because slope // -> 0. So use convergence conditions based on epsilon instead of // sqrt(epsilon). The first criterion is a test on abs(v) against // 100 * epsilon. The second takes credit for an anticipated // reduction in abs(v) by v/ov (due to the latest update in alp1) and // checks this against epsilon. if (!(abs(v) >= tol1_ && Math::sq(v) >= ov * tol0_)) ++trip; ov = abs(v); } if (numit >= maxit_) { // Signal failure. if (outmask & DISTANCE) s12 = Math::NaN(); if (outmask & AZIMUTH) azi1 = azi2 = Math::NaN(); if (outmask & REDUCEDLENGTH) m12 = Math::NaN(); if (outmask & GEODESICSCALE) M12 = M21 = Math::NaN(); if (outmask & AREA) S12 = Math::NaN(); return Math::NaN(); } { real dummy; Lengths(eps, sig12, ssig1, csig1, ssig2, csig2, cbet1, cbet2, s12x, m12x, dummy, (outmask & GEODESICSCALE) != 0U, M12, M21, C1a, C2a); } m12x *= _a; s12x *= _b; a12 = sig12 / Math::degree(); omg12 = lam12 - omg12; } } if (outmask & DISTANCE) s12 = 0 + s12x; // Convert -0 to 0 if (outmask & REDUCEDLENGTH) m12 = 0 + m12x; // Convert -0 to 0 if (outmask & AREA) { real // From Lambda12: sin(alp1) * cos(bet1) = sin(alp0) salp0 = salp1 * cbet1, calp0 = Math::hypot(calp1, salp1 * sbet1); // calp0 > 0 real alp12; if (calp0 != 0 && salp0 != 0) { real // From Lambda12: tan(bet) = tan(sig) * cos(alp) ssig1 = sbet1, csig1 = calp1 * cbet1, ssig2 = sbet2, csig2 = calp2 * cbet2, k2 = Math::sq(calp0) * _ep2, // Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0). A4 = Math::sq(_a) * calp0 * salp0 * _e2; SinCosNorm(ssig1, csig1); SinCosNorm(ssig2, csig2); real C4a[nC4_]; C4f(k2, C4a); real B41 = SinCosSeries(false, ssig1, csig1, C4a, nC4_), B42 = SinCosSeries(false, ssig2, csig2, C4a, nC4_); S12 = A4 * (B42 - B41); } else // Avoid problems with indeterminate sig1, sig2 on equator S12 = 0; if (!meridian && omg12 < real(0.75) * Math::pi() && // Long difference too big sbet2 - sbet1 < real(1.75)) { // Lat difference too big // Use tan(Gamma/2) = tan(omg12/2) // * (tan(bet1/2)+tan(bet2/2))/(1+tan(bet1/2)*tan(bet2/2)) // with tan(x/2) = sin(x)/(1+cos(x)) real somg12 = sin(omg12), domg12 = 1 + cos(omg12), dbet1 = 1 + cbet1, dbet2 = 1 + cbet2; alp12 = 2 * atan2( somg12 * ( sbet1 * dbet2 + sbet2 * dbet1 ), domg12 * ( sbet1 * sbet2 + dbet1 * dbet2 ) ); } else { // alp12 = alp2 - alp1, used in atan2 so no need to normalize real salp12 = salp2 * calp1 - calp2 * salp1, calp12 = calp2 * calp1 + salp2 * salp1; // The right thing appears to happen if alp1 = +/-180 and alp2 = 0, viz // salp12 = -0 and alp12 = -180. However this depends on the sign // being attached to 0 correctly. The following ensures the correct // behavior. if (salp12 == 0 && calp12 < 0) { salp12 = tiny_ * calp1; calp12 = -1; } alp12 = atan2(salp12, calp12); } S12 += _c2 * alp12; S12 *= swapp * lonsign * latsign; // Convert -0 to 0 S12 += 0; } // Convert calp, salp to azimuth accounting for lonsign, swapp, latsign. if (swapp < 0) { swap(salp1, salp2); swap(calp1, calp2); if (outmask & GEODESICSCALE) swap(M12, M21); } salp1 *= swapp * lonsign; calp1 *= swapp * latsign; salp2 *= swapp * lonsign; calp2 *= swapp * latsign; if (outmask & AZIMUTH) { // minus signs give range [-180, 180). 0- converts -0 to +0. azi1 = 0 - atan2(-salp1, calp1) / Math::degree(); azi2 = 0 - atan2(-salp2, calp2) / Math::degree(); } // Returned value in [0, 180] return a12; } void Geodesic::Lengths(real eps, real sig12, real ssig1, real csig1, real ssig2, real csig2, real cbet1, real cbet2, real& s12b, real& m12a, real& m0, bool scalep, real& M12, real& M21, // Scratch areas of the right size real C1a[], real C2a[]) const throw() { // Return m12a = (reduced length)/_a; also calculate s12b = distance/_b, // and m0 = coefficient of secular term in expression for reduced length. C1f(eps, C1a); C2f(eps, C2a); real A1m1 = A1m1f(eps), AB1 = (1 + A1m1) * (SinCosSeries(true, ssig2, csig2, C1a, nC1_) - SinCosSeries(true, ssig1, csig1, C1a, nC1_)), A2m1 = A2m1f(eps), AB2 = (1 + A2m1) * (SinCosSeries(true, ssig2, csig2, C2a, nC2_) - SinCosSeries(true, ssig1, csig1, C2a, nC2_)), cbet1sq = Math::sq(cbet1), cbet2sq = Math::sq(cbet2), w1 = sqrt(1 - _e2 * cbet1sq), w2 = sqrt(1 - _e2 * cbet2sq), // Make sure it's OK to have repeated dummy arguments m0x = A1m1 - A2m1, J12 = m0x * sig12 + (AB1 - AB2); m0 = m0x; // Missing a factor of _a. // Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure accurate // cancellation in the case of coincident points. m12a = (w2 * (csig1 * ssig2) - w1 * (ssig1 * csig2)) - _f1 * csig1 * csig2 * J12; // Missing a factor of _b s12b = (1 + A1m1) * sig12 + AB1; if (scalep) { real csig12 = csig1 * csig2 + ssig1 * ssig2; J12 *= _f1; M12 = csig12 + (_e2 * (cbet1sq - cbet2sq) * ssig2 / (w1 + w2) - csig2 * J12) * ssig1 / w1; M21 = csig12 - (_e2 * (cbet1sq - cbet2sq) * ssig1 / (w1 + w2) - csig1 * J12) * ssig2 / w2; } } Math::real Geodesic::Astroid(real x, real y) throw() { // Solve k^4+2*k^3-(x^2+y^2-1)*k^2-2*y^2*k-y^2 = 0 for positive root k. // This solution is adapted from Geocentric::Reverse. real k; real p = Math::sq(x), q = Math::sq(y), r = (p + q - 1) / 6; if ( !(q == 0 && r <= 0) ) { real // Avoid possible division by zero when r = 0 by multiplying equations // for s and t by r^3 and r, resp. S = p * q / 4, // S = r^3 * s r2 = Math::sq(r), r3 = r * r2, // The discrimant of the quadratic equation for T3. This is zero on // the evolute curve p^(1/3)+q^(1/3) = 1 disc = S * (S + 2 * r3); real u = r; if (disc >= 0) { real T3 = S + r3; // Pick the sign on the sqrt to maximize abs(T3). This minimizes loss // of precision due to cancellation. The result is unchanged because // of the way the T is used in definition of u. T3 += T3 < 0 ? -sqrt(disc) : sqrt(disc); // T3 = (r * t)^3 // N.B. cbrt always returns the real root. cbrt(-8) = -2. real T = Math::cbrt(T3); // T = r * t // T can be zero; but then r2 / T -> 0. u += T + (T != 0 ? r2 / T : 0); } else { // T is complex, but the way u is defined the result is real. real ang = atan2(sqrt(-disc), -(S + r3)); // There are three possible cube roots. We choose the root which // avoids cancellation. Note that disc < 0 implies that r < 0. u += 2 * r * cos(ang / 3); } real v = sqrt(Math::sq(u) + q), // guaranteed positive // Avoid loss of accuracy when u < 0. uv = u < 0 ? q / (v - u) : u + v, // u+v, guaranteed positive w = (uv - q) / (2 * v); // positive? // Rearrange expression for k to avoid loss of accuracy due to // subtraction. Division by 0 not possible because uv > 0, w >= 0. k = uv / (sqrt(uv + Math::sq(w)) + w); // guaranteed positive } else { // q == 0 && r <= 0 // y = 0 with |x| <= 1. Handle this case directly. // for y small, positive root is k = abs(y)/sqrt(1-x^2) k = 0; } return k; } Math::real Geodesic::InverseStart(real sbet1, real cbet1, real sbet2, real cbet2, real lam12, real& salp1, real& calp1, // Only updated if return val >= 0 real& salp2, real& calp2, // Scratch areas of the right size real C1a[], real C2a[]) const throw() { // Return a starting point for Newton's method in salp1 and calp1 (function // value is -1). If Newton's method doesn't need to be used, return also // salp2 and calp2 and function value is sig12. real sig12 = -1, // Return value // bet12 = bet2 - bet1 in [0, pi); bet12a = bet2 + bet1 in (-pi, 0] sbet12 = sbet2 * cbet1 - cbet2 * sbet1, cbet12 = cbet2 * cbet1 + sbet2 * sbet1; #if defined(__GNUC__) && __GNUC__ == 4 && \ (__GNUC_MINOR__ < 6 || defined(__MINGW32__)) // Volatile declaration needed to fix inverse cases // 88.202499451857 0 -88.202499451857 179.981022032992859592 // 89.262080389218 0 -89.262080389218 179.992207982775375662 // 89.333123580033 0 -89.333123580032997687 179.99295812360148422 // which otherwise fail with g++ 4.4.4 x86 -O3 (Linux) // and g++ 4.4.0 (mingw) and g++ 4.6.1 (tdm mingw). real sbet12a; { volatile real xx1 = sbet2 * cbet1; volatile real xx2 = cbet2 * sbet1; sbet12a = xx1 + xx2; } #else real sbet12a = sbet2 * cbet1 + cbet2 * sbet1; #endif bool shortline = cbet12 >= 0 && sbet12 < real(0.5) && lam12 <= Math::pi() / 6; real omg12 = (!shortline ? lam12 : lam12 / sqrt(1 - _e2 * Math::sq((cbet1 + cbet2) / 2))), somg12 = sin(omg12), comg12 = cos(omg12); salp1 = cbet2 * somg12; calp1 = comg12 >= 0 ? sbet12 + cbet2 * sbet1 * Math::sq(somg12) / (1 + comg12) : sbet12a - cbet2 * sbet1 * Math::sq(somg12) / (1 - comg12); real ssig12 = Math::hypot(salp1, calp1), csig12 = sbet1 * sbet2 + cbet1 * cbet2 * comg12; if (shortline && ssig12 < _etol2) { // really short lines salp2 = cbet1 * somg12; calp2 = sbet12 - cbet1 * sbet2 * Math::sq(somg12) / (1 + comg12); SinCosNorm(salp2, calp2); // Set return value sig12 = atan2(ssig12, csig12); } else if (csig12 >= 0 || ssig12 >= 3 * abs(_f) * Math::pi() * Math::sq(cbet1)) { // Nothing to do, zeroth order spherical approximation is OK } else { // Scale lam12 and bet2 to x, y coordinate system where antipodal point // is at origin and singular point is at y = 0, x = -1. real y, lamscale, betscale; // Volatile declaration needed to fix inverse case // 56.320923501171 0 -56.320923501171 179.664747671772880215 // which otherwise fails with g++ 4.4.4 x86 -O3 volatile real x; if (_f >= 0) { // In fact f == 0 does not get here // x = dlong, y = dlat { real k2 = Math::sq(sbet1) * _ep2, eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2); lamscale = _f * cbet1 * A3f(eps) * Math::pi(); } betscale = lamscale * cbet1; x = (lam12 - Math::pi()) / lamscale; y = sbet12a / betscale; } else { // _f < 0 // x = dlat, y = dlong real cbet12a = cbet2 * cbet1 - sbet2 * sbet1, bet12a = atan2(sbet12a, cbet12a); real m12a, m0, dummy; // In the case of lon12 = 180, this repeats a calculation made in // Inverse. Lengths(_n, Math::pi() + bet12a, sbet1, -cbet1, sbet2, cbet2, cbet1, cbet2, dummy, m12a, m0, false, dummy, dummy, C1a, C2a); x = -1 + m12a/(_f1 * cbet1 * cbet2 * m0 * Math::pi()); betscale = x < -real(0.01) ? sbet12a / x : -_f * Math::sq(cbet1) * Math::pi(); lamscale = betscale / cbet1; y = (lam12 - Math::pi()) / lamscale; } if (y > -tol1_ && x > -1 - xthresh_) { // strip near cut if (_f >= 0) { salp1 = min(real(1), -real(x)); calp1 = - sqrt(1 - Math::sq(salp1)); } else { calp1 = max(real(x > -tol1_ ? 0 : -1), real(x)); salp1 = sqrt(1 - Math::sq(calp1)); } } else { // Estimate alp1, by solving the astroid problem. // // Could estimate alpha1 = theta + pi/2, directly, i.e., // calp1 = y/k; salp1 = -x/(1+k); for _f >= 0 // calp1 = x/(1+k); salp1 = -y/k; for _f < 0 (need to check) // // However, it's better to estimate omg12 from astroid and use // spherical formula to compute alp1. This reduces the mean number of // Newton iterations for astroid cases from 2.24 (min 0, max 6) to 2.12 // (min 0 max 5). The changes in the number of iterations are as // follows: // // change percent // 1 5 // 0 78 // -1 16 // -2 0.6 // -3 0.04 // -4 0.002 // // The histogram of iterations is (m = number of iterations estimating // alp1 directly, n = number of iterations estimating via omg12, total // number of trials = 148605): // // iter m n // 0 148 186 // 1 13046 13845 // 2 93315 102225 // 3 36189 32341 // 4 5396 7 // 5 455 1 // 6 56 0 // // Because omg12 is near pi, estimate work with omg12a = pi - omg12 real k = Astroid(x, y); real omg12a = lamscale * ( _f >= 0 ? -x * k/(1 + k) : -y * (1 + k)/k ), somg12 = sin(omg12a), comg12 = -cos(omg12a); // Update spherical estimate of alp1 using omg12 instead of lam12 salp1 = cbet2 * somg12; calp1 = sbet12a - cbet2 * sbet1 * Math::sq(somg12) / (1 - comg12); } } SinCosNorm(salp1, calp1); return sig12; } Math::real Geodesic::Lambda12(real sbet1, real cbet1, real sbet2, real cbet2, real salp1, real calp1, real& salp2, real& calp2, real& sig12, real& ssig1, real& csig1, real& ssig2, real& csig2, real& eps, real& domg12, bool diffp, real& dlam12, // Scratch areas of the right size real C1a[], real C2a[], real C3a[]) const throw() { if (sbet1 == 0 && calp1 == 0) // Break degeneracy of equatorial line. This case has already been // handled. calp1 = -tiny_; real // sin(alp1) * cos(bet1) = sin(alp0) salp0 = salp1 * cbet1, calp0 = Math::hypot(calp1, salp1 * sbet1); // calp0 > 0 real somg1, comg1, somg2, comg2, omg12, lam12; // tan(bet1) = tan(sig1) * cos(alp1) // tan(omg1) = sin(alp0) * tan(sig1) = tan(omg1)=tan(alp1)*sin(bet1) ssig1 = sbet1; somg1 = salp0 * sbet1; csig1 = comg1 = calp1 * cbet1; SinCosNorm(ssig1, csig1); // SinCosNorm(somg1, comg1); -- don't need to normalize! // Enforce symmetries in the case abs(bet2) = -bet1. Need to be careful // about this case, since this can yield singularities in the Newton // iteration. // sin(alp2) * cos(bet2) = sin(alp0) salp2 = cbet2 != cbet1 ? salp0 / cbet2 : salp1; // calp2 = sqrt(1 - sq(salp2)) // = sqrt(sq(calp0) - sq(sbet2)) / cbet2 // and subst for calp0 and rearrange to give (choose positive sqrt // to give alp2 in [0, pi/2]). calp2 = cbet2 != cbet1 || abs(sbet2) != -sbet1 ? sqrt(Math::sq(calp1 * cbet1) + (cbet1 < -sbet1 ? (cbet2 - cbet1) * (cbet1 + cbet2) : (sbet1 - sbet2) * (sbet1 + sbet2))) / cbet2 : abs(calp1); // tan(bet2) = tan(sig2) * cos(alp2) // tan(omg2) = sin(alp0) * tan(sig2). ssig2 = sbet2; somg2 = salp0 * sbet2; csig2 = comg2 = calp2 * cbet2; SinCosNorm(ssig2, csig2); // SinCosNorm(somg2, comg2); -- don't need to normalize! // sig12 = sig2 - sig1, limit to [0, pi] sig12 = atan2(max(csig1 * ssig2 - ssig1 * csig2, real(0)), csig1 * csig2 + ssig1 * ssig2); // omg12 = omg2 - omg1, limit to [0, pi] omg12 = atan2(max(comg1 * somg2 - somg1 * comg2, real(0)), comg1 * comg2 + somg1 * somg2); real B312, h0; real k2 = Math::sq(calp0) * _ep2; eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2); C3f(eps, C3a); B312 = (SinCosSeries(true, ssig2, csig2, C3a, nC3_-1) - SinCosSeries(true, ssig1, csig1, C3a, nC3_-1)); h0 = -_f * A3f(eps); domg12 = salp0 * h0 * (sig12 + B312); lam12 = omg12 + domg12; if (diffp) { if (calp2 == 0) dlam12 = - 2 * sqrt(1 - _e2 * Math::sq(cbet1)) / sbet1; else { real dummy; Lengths(eps, sig12, ssig1, csig1, ssig2, csig2, cbet1, cbet2, dummy, dlam12, dummy, false, dummy, dummy, C1a, C2a); dlam12 /= calp2 * cbet2; } } return lam12; } Math::real Geodesic::A3f(real eps) const throw() { // Evaluation sum(_A3c[k] * eps^k, k, 0, nA3x_-1) by Horner's method real v = 0; for (int i = nA3x_; i; ) v = eps * v + _A3x[--i]; return v; } void Geodesic::C3f(real eps, real c[]) const throw() { // Evaluation C3 coeffs by Horner's method // Elements c[1] thru c[nC3_ - 1] are set for (int j = nC3x_, k = nC3_ - 1; k; ) { real t = 0; for (int i = nC3_ - k; i; --i) t = eps * t + _C3x[--j]; c[k--] = t; } real mult = 1; for (int k = 1; k < nC3_; ) { mult *= eps; c[k++] *= mult; } } void Geodesic::C4f(real k2, real c[]) const throw() { // Evaluation C4 coeffs by Horner's method // Elements c[0] thru c[nC4_ - 1] are set for (int j = nC4x_, k = nC4_; k; ) { real t = 0; for (int i = nC4_ - k + 1; i; --i) t = k2 * t + _C4x[--j]; c[--k] = t; } real mult = 1; for (int k = 1; k < nC4_; ) { mult *= k2; c[k++] *= mult; } } // Generated by Maxima on 2010-09-04 10:26:17-04:00 // The scale factor A1-1 = mean value of I1-1 Math::real Geodesic::A1m1f(real eps) throw() { real eps2 = Math::sq(eps), t; switch (nA1_/2) { case 0: t = 0; break; case 1: t = eps2/4; break; case 2: t = eps2*(eps2+16)/64; break; case 3: t = eps2*(eps2*(eps2+4)+64)/256; break; case 4: t = eps2*(eps2*(eps2*(25*eps2+64)+256)+4096)/16384; break; default: STATIC_ASSERT(nA1_ >= 0 && nA1_ <= 8, "Bad value of nA1_"); t = 0; } return (t + eps) / (1 - eps); } // The coefficients C1[l] in the Fourier expansion of B1 void Geodesic::C1f(real eps, real c[]) throw() { real eps2 = Math::sq(eps), d = eps; switch (nC1_) { case 0: break; case 1: c[1] = -d/2; break; case 2: c[1] = -d/2; d *= eps; c[2] = -d/16; break; case 3: c[1] = d*(3*eps2-8)/16; d *= eps; c[2] = -d/16; d *= eps; c[3] = -d/48; break; case 4: c[1] = d*(3*eps2-8)/16; d *= eps; c[2] = d*(eps2-2)/32; d *= eps; c[3] = -d/48; d *= eps; c[4] = -5*d/512; break; case 5: c[1] = d*((6-eps2)*eps2-16)/32; d *= eps; c[2] = d*(eps2-2)/32; d *= eps; c[3] = d*(9*eps2-16)/768; d *= eps; c[4] = -5*d/512; d *= eps; c[5] = -7*d/1280; break; case 6: c[1] = d*((6-eps2)*eps2-16)/32; d *= eps; c[2] = d*((64-9*eps2)*eps2-128)/2048; d *= eps; c[3] = d*(9*eps2-16)/768; d *= eps; c[4] = d*(3*eps2-5)/512; d *= eps; c[5] = -7*d/1280; d *= eps; c[6] = -7*d/2048; break; case 7: c[1] = d*(eps2*(eps2*(19*eps2-64)+384)-1024)/2048; d *= eps; c[2] = d*((64-9*eps2)*eps2-128)/2048; d *= eps; c[3] = d*((72-9*eps2)*eps2-128)/6144; d *= eps; c[4] = d*(3*eps2-5)/512; d *= eps; c[5] = d*(35*eps2-56)/10240; d *= eps; c[6] = -7*d/2048; d *= eps; c[7] = -33*d/14336; break; case 8: c[1] = d*(eps2*(eps2*(19*eps2-64)+384)-1024)/2048; d *= eps; c[2] = d*(eps2*(eps2*(7*eps2-18)+128)-256)/4096; d *= eps; c[3] = d*((72-9*eps2)*eps2-128)/6144; d *= eps; c[4] = d*((96-11*eps2)*eps2-160)/16384; d *= eps; c[5] = d*(35*eps2-56)/10240; d *= eps; c[6] = d*(9*eps2-14)/4096; d *= eps; c[7] = -33*d/14336; d *= eps; c[8] = -429*d/262144; break; default: STATIC_ASSERT(nC1_ >= 0 && nC1_ <= 8, "Bad value of nC1_"); } } // The coefficients C1p[l] in the Fourier expansion of B1p void Geodesic::C1pf(real eps, real c[]) throw() { real eps2 = Math::sq(eps), d = eps; switch (nC1p_) { case 0: break; case 1: c[1] = d/2; break; case 2: c[1] = d/2; d *= eps; c[2] = 5*d/16; break; case 3: c[1] = d*(16-9*eps2)/32; d *= eps; c[2] = 5*d/16; d *= eps; c[3] = 29*d/96; break; case 4: c[1] = d*(16-9*eps2)/32; d *= eps; c[2] = d*(30-37*eps2)/96; d *= eps; c[3] = 29*d/96; d *= eps; c[4] = 539*d/1536; break; case 5: c[1] = d*(eps2*(205*eps2-432)+768)/1536; d *= eps; c[2] = d*(30-37*eps2)/96; d *= eps; c[3] = d*(116-225*eps2)/384; d *= eps; c[4] = 539*d/1536; d *= eps; c[5] = 3467*d/7680; break; case 6: c[1] = d*(eps2*(205*eps2-432)+768)/1536; d *= eps; c[2] = d*(eps2*(4005*eps2-4736)+3840)/12288; d *= eps; c[3] = d*(116-225*eps2)/384; d *= eps; c[4] = d*(2695-7173*eps2)/7680; d *= eps; c[5] = 3467*d/7680; d *= eps; c[6] = 38081*d/61440; break; case 7: c[1] = d*(eps2*((9840-4879*eps2)*eps2-20736)+36864)/73728; d *= eps; c[2] = d*(eps2*(4005*eps2-4736)+3840)/12288; d *= eps; c[3] = d*(eps2*(8703*eps2-7200)+3712)/12288; d *= eps; c[4] = d*(2695-7173*eps2)/7680; d *= eps; c[5] = d*(41604-141115*eps2)/92160; d *= eps; c[6] = 38081*d/61440; d *= eps; c[7] = 459485*d/516096; break; case 8: c[1] = d*(eps2*((9840-4879*eps2)*eps2-20736)+36864)/73728; d *= eps; c[2] = d*(eps2*((120150-86171*eps2)*eps2-142080)+115200)/368640; d *= eps; c[3] = d*(eps2*(8703*eps2-7200)+3712)/12288; d *= eps; c[4] = d*(eps2*(1082857*eps2-688608)+258720)/737280; d *= eps; c[5] = d*(41604-141115*eps2)/92160; d *= eps; c[6] = d*(533134-2200311*eps2)/860160; d *= eps; c[7] = 459485*d/516096; d *= eps; c[8] = 109167851*d/82575360; break; default: STATIC_ASSERT(nC1p_ >= 0 && nC1p_ <= 8, "Bad value of nC1p_"); } } // The scale factor A2-1 = mean value of I2-1 Math::real Geodesic::A2m1f(real eps) throw() { real eps2 = Math::sq(eps), t; switch (nA2_/2) { case 0: t = 0; break; case 1: t = eps2/4; break; case 2: t = eps2*(9*eps2+16)/64; break; case 3: t = eps2*(eps2*(25*eps2+36)+64)/256; break; case 4: t = eps2*(eps2*(eps2*(1225*eps2+1600)+2304)+4096)/16384; break; default: STATIC_ASSERT(nA2_ >= 0 && nA2_ <= 8, "Bad value of nA2_"); t = 0; } return t * (1 - eps) - eps; } // The coefficients C2[l] in the Fourier expansion of B2 void Geodesic::C2f(real eps, real c[]) throw() { real eps2 = Math::sq(eps), d = eps; switch (nC2_) { case 0: break; case 1: c[1] = d/2; break; case 2: c[1] = d/2; d *= eps; c[2] = 3*d/16; break; case 3: c[1] = d*(eps2+8)/16; d *= eps; c[2] = 3*d/16; d *= eps; c[3] = 5*d/48; break; case 4: c[1] = d*(eps2+8)/16; d *= eps; c[2] = d*(eps2+6)/32; d *= eps; c[3] = 5*d/48; d *= eps; c[4] = 35*d/512; break; case 5: c[1] = d*(eps2*(eps2+2)+16)/32; d *= eps; c[2] = d*(eps2+6)/32; d *= eps; c[3] = d*(15*eps2+80)/768; d *= eps; c[4] = 35*d/512; d *= eps; c[5] = 63*d/1280; break; case 6: c[1] = d*(eps2*(eps2+2)+16)/32; d *= eps; c[2] = d*(eps2*(35*eps2+64)+384)/2048; d *= eps; c[3] = d*(15*eps2+80)/768; d *= eps; c[4] = d*(7*eps2+35)/512; d *= eps; c[5] = 63*d/1280; d *= eps; c[6] = 77*d/2048; break; case 7: c[1] = d*(eps2*(eps2*(41*eps2+64)+128)+1024)/2048; d *= eps; c[2] = d*(eps2*(35*eps2+64)+384)/2048; d *= eps; c[3] = d*(eps2*(69*eps2+120)+640)/6144; d *= eps; c[4] = d*(7*eps2+35)/512; d *= eps; c[5] = d*(105*eps2+504)/10240; d *= eps; c[6] = 77*d/2048; d *= eps; c[7] = 429*d/14336; break; case 8: c[1] = d*(eps2*(eps2*(41*eps2+64)+128)+1024)/2048; d *= eps; c[2] = d*(eps2*(eps2*(47*eps2+70)+128)+768)/4096; d *= eps; c[3] = d*(eps2*(69*eps2+120)+640)/6144; d *= eps; c[4] = d*(eps2*(133*eps2+224)+1120)/16384; d *= eps; c[5] = d*(105*eps2+504)/10240; d *= eps; c[6] = d*(33*eps2+154)/4096; d *= eps; c[7] = 429*d/14336; d *= eps; c[8] = 6435*d/262144; break; default: STATIC_ASSERT(nC2_ >= 0 && nC2_ <= 8, "Bad value of nC2_"); } } // The scale factor A3 = mean value of I3 void Geodesic::A3coeff() throw() { switch (nA3_) { case 0: break; case 1: _A3x[0] = 1; break; case 2: _A3x[0] = 1; _A3x[1] = -1/real(2); break; case 3: _A3x[0] = 1; _A3x[1] = (_n-1)/2; _A3x[2] = -1/real(4); break; case 4: _A3x[0] = 1; _A3x[1] = (_n-1)/2; _A3x[2] = (-_n-2)/8; _A3x[3] = -1/real(16); break; case 5: _A3x[0] = 1; _A3x[1] = (_n-1)/2; _A3x[2] = (_n*(3*_n-1)-2)/8; _A3x[3] = (-3*_n-1)/16; _A3x[4] = -3/real(64); break; case 6: _A3x[0] = 1; _A3x[1] = (_n-1)/2; _A3x[2] = (_n*(3*_n-1)-2)/8; _A3x[3] = ((-_n-3)*_n-1)/16; _A3x[4] = (-2*_n-3)/64; _A3x[5] = -3/real(128); break; case 7: _A3x[0] = 1; _A3x[1] = (_n-1)/2; _A3x[2] = (_n*(3*_n-1)-2)/8; _A3x[3] = (_n*(_n*(5*_n-1)-3)-1)/16; _A3x[4] = ((-10*_n-2)*_n-3)/64; _A3x[5] = (-5*_n-3)/128; _A3x[6] = -5/real(256); break; case 8: _A3x[0] = 1; _A3x[1] = (_n-1)/2; _A3x[2] = (_n*(3*_n-1)-2)/8; _A3x[3] = (_n*(_n*(5*_n-1)-3)-1)/16; _A3x[4] = (_n*((-5*_n-20)*_n-4)-6)/128; _A3x[5] = ((-5*_n-10)*_n-6)/256; _A3x[6] = (-15*_n-20)/1024; _A3x[7] = -25/real(2048); break; default: STATIC_ASSERT(nA3_ >= 0 && nA3_ <= 8, "Bad value of nA3_"); } } // The coefficients C3[l] in the Fourier expansion of B3 void Geodesic::C3coeff() throw() { switch (nC3_) { case 0: break; case 1: break; case 2: _C3x[0] = 1/real(4); break; case 3: _C3x[0] = (1-_n)/4; _C3x[1] = 1/real(8); _C3x[2] = 1/real(16); break; case 4: _C3x[0] = (1-_n)/4; _C3x[1] = 1/real(8); _C3x[2] = 3/real(64); _C3x[3] = (2-3*_n)/32; _C3x[4] = 3/real(64); _C3x[5] = 5/real(192); break; case 5: _C3x[0] = (1-_n)/4; _C3x[1] = (1-_n*_n)/8; _C3x[2] = (3*_n+3)/64; _C3x[3] = 5/real(128); _C3x[4] = ((_n-3)*_n+2)/32; _C3x[5] = (3-2*_n)/64; _C3x[6] = 3/real(128); _C3x[7] = (5-9*_n)/192; _C3x[8] = 3/real(128); _C3x[9] = 7/real(512); break; case 6: _C3x[0] = (1-_n)/4; _C3x[1] = (1-_n*_n)/8; _C3x[2] = ((3-_n)*_n+3)/64; _C3x[3] = (2*_n+5)/128; _C3x[4] = 3/real(128); _C3x[5] = ((_n-3)*_n+2)/32; _C3x[6] = ((-3*_n-2)*_n+3)/64; _C3x[7] = (_n+3)/128; _C3x[8] = 5/real(256); _C3x[9] = (_n*(5*_n-9)+5)/192; _C3x[10] = (9-10*_n)/384; _C3x[11] = 7/real(512); _C3x[12] = (7-14*_n)/512; _C3x[13] = 7/real(512); _C3x[14] = 21/real(2560); break; case 7: _C3x[0] = (1-_n)/4; _C3x[1] = (1-_n*_n)/8; _C3x[2] = (_n*((-5*_n-1)*_n+3)+3)/64; _C3x[3] = (_n*(2*_n+2)+5)/128; _C3x[4] = (11*_n+12)/512; _C3x[5] = 21/real(1024); _C3x[6] = ((_n-3)*_n+2)/32; _C3x[7] = (_n*(_n*(2*_n-3)-2)+3)/64; _C3x[8] = ((2-9*_n)*_n+6)/256; _C3x[9] = (_n+5)/256; _C3x[10] = 27/real(2048); _C3x[11] = (_n*((5-_n)*_n-9)+5)/192; _C3x[12] = ((-6*_n-10)*_n+9)/384; _C3x[13] = (21-4*_n)/1536; _C3x[14] = 3/real(256); _C3x[15] = (_n*(10*_n-14)+7)/512; _C3x[16] = (7-10*_n)/512; _C3x[17] = 9/real(1024); _C3x[18] = (21-45*_n)/2560; _C3x[19] = 9/real(1024); _C3x[20] = 11/real(2048); break; case 8: _C3x[0] = (1-_n)/4; _C3x[1] = (1-_n*_n)/8; _C3x[2] = (_n*((-5*_n-1)*_n+3)+3)/64; _C3x[3] = (_n*((2-2*_n)*_n+2)+5)/128; _C3x[4] = (_n*(3*_n+11)+12)/512; _C3x[5] = (10*_n+21)/1024; _C3x[6] = 243/real(16384); _C3x[7] = ((_n-3)*_n+2)/32; _C3x[8] = (_n*(_n*(2*_n-3)-2)+3)/64; _C3x[9] = (_n*((-6*_n-9)*_n+2)+6)/256; _C3x[10] = ((1-2*_n)*_n+5)/256; _C3x[11] = (69*_n+108)/8192; _C3x[12] = 187/real(16384); _C3x[13] = (_n*((5-_n)*_n-9)+5)/192; _C3x[14] = (_n*(_n*(10*_n-6)-10)+9)/384; _C3x[15] = ((-77*_n-8)*_n+42)/3072; _C3x[16] = (12-_n)/1024; _C3x[17] = 139/real(16384); _C3x[18] = (_n*((20-7*_n)*_n-28)+14)/1024; _C3x[19] = ((-7*_n-40)*_n+28)/2048; _C3x[20] = (72-43*_n)/8192; _C3x[21] = 127/real(16384); _C3x[22] = (_n*(75*_n-90)+42)/5120; _C3x[23] = (9-15*_n)/1024; _C3x[24] = 99/real(16384); _C3x[25] = (44-99*_n)/8192; _C3x[26] = 99/real(16384); _C3x[27] = 429/real(114688); break; default: STATIC_ASSERT(nC3_ >= 0 && nC3_ <= 8, "Bad value of nC3_"); } } // The coefficients C4[l] in the Fourier expansion of I4 void Geodesic::C4coeff() throw() { switch (nC4_) { case 0: break; case 1: _C4x[0] = 2/real(3); break; case 2: _C4x[0] = (10-_ep2)/15; _C4x[1] = -1/real(20); _C4x[2] = 1/real(180); break; case 3: _C4x[0] = (_ep2*(4*_ep2-7)+70)/105; _C4x[1] = (4*_ep2-7)/140; _C4x[2] = 1/real(42); _C4x[3] = (7-4*_ep2)/1260; _C4x[4] = -1/real(252); _C4x[5] = 1/real(2100); break; case 4: _C4x[0] = (_ep2*((12-8*_ep2)*_ep2-21)+210)/315; _C4x[1] = ((12-8*_ep2)*_ep2-21)/420; _C4x[2] = (3-2*_ep2)/126; _C4x[3] = -1/real(72); _C4x[4] = (_ep2*(8*_ep2-12)+21)/3780; _C4x[5] = (2*_ep2-3)/756; _C4x[6] = 1/real(360); _C4x[7] = (3-2*_ep2)/6300; _C4x[8] = -1/real(1800); _C4x[9] = 1/real(17640); break; case 5: _C4x[0] = (_ep2*(_ep2*(_ep2*(64*_ep2-88)+132)-231)+2310)/3465; _C4x[1] = (_ep2*(_ep2*(64*_ep2-88)+132)-231)/4620; _C4x[2] = (_ep2*(16*_ep2-22)+33)/1386; _C4x[3] = (8*_ep2-11)/792; _C4x[4] = 1/real(110); _C4x[5] = (_ep2*((88-64*_ep2)*_ep2-132)+231)/41580; _C4x[6] = ((22-16*_ep2)*_ep2-33)/8316; _C4x[7] = (11-8*_ep2)/3960; _C4x[8] = -1/real(495); _C4x[9] = (_ep2*(16*_ep2-22)+33)/69300; _C4x[10] = (8*_ep2-11)/19800; _C4x[11] = 1/real(1925); _C4x[12] = (11-8*_ep2)/194040; _C4x[13] = -1/real(10780); _C4x[14] = 1/real(124740); break; case 6: _C4x[0] = (_ep2*(_ep2*(_ep2*((832-640*_ep2)*_ep2-1144)+1716)-3003)+ 30030)/45045; _C4x[1] = (_ep2*(_ep2*((832-640*_ep2)*_ep2-1144)+1716)-3003)/60060; _C4x[2] = (_ep2*((208-160*_ep2)*_ep2-286)+429)/18018; _C4x[3] = ((104-80*_ep2)*_ep2-143)/10296; _C4x[4] = (13-10*_ep2)/1430; _C4x[5] = -1/real(156); _C4x[6] = (_ep2*(_ep2*(_ep2*(640*_ep2-832)+1144)-1716)+3003)/540540; _C4x[7] = (_ep2*(_ep2*(160*_ep2-208)+286)-429)/108108; _C4x[8] = (_ep2*(80*_ep2-104)+143)/51480; _C4x[9] = (10*_ep2-13)/6435; _C4x[10] = 5/real(3276); _C4x[11] = (_ep2*((208-160*_ep2)*_ep2-286)+429)/900900; _C4x[12] = ((104-80*_ep2)*_ep2-143)/257400; _C4x[13] = (13-10*_ep2)/25025; _C4x[14] = -1/real(2184); _C4x[15] = (_ep2*(80*_ep2-104)+143)/2522520; _C4x[16] = (10*_ep2-13)/140140; _C4x[17] = 5/real(45864); _C4x[18] = (13-10*_ep2)/1621620; _C4x[19] = -1/real(58968); _C4x[20] = 1/real(792792); break; case 7: _C4x[0] = (_ep2*(_ep2*(_ep2*(_ep2*(_ep2*(512*_ep2-640)+832)-1144)+1716)- 3003)+30030)/45045; _C4x[1] = (_ep2*(_ep2*(_ep2*(_ep2*(512*_ep2-640)+832)-1144)+1716)- 3003)/60060; _C4x[2] = (_ep2*(_ep2*(_ep2*(128*_ep2-160)+208)-286)+429)/18018; _C4x[3] = (_ep2*(_ep2*(64*_ep2-80)+104)-143)/10296; _C4x[4] = (_ep2*(8*_ep2-10)+13)/1430; _C4x[5] = (4*_ep2-5)/780; _C4x[6] = 1/real(210); _C4x[7] = (_ep2*(_ep2*(_ep2*((640-512*_ep2)*_ep2-832)+1144)-1716)+ 3003)/540540; _C4x[8] = (_ep2*(_ep2*((160-128*_ep2)*_ep2-208)+286)-429)/108108; _C4x[9] = (_ep2*((80-64*_ep2)*_ep2-104)+143)/51480; _C4x[10] = ((10-8*_ep2)*_ep2-13)/6435; _C4x[11] = (5-4*_ep2)/3276; _C4x[12] = -1/real(840); _C4x[13] = (_ep2*(_ep2*(_ep2*(128*_ep2-160)+208)-286)+429)/900900; _C4x[14] = (_ep2*(_ep2*(64*_ep2-80)+104)-143)/257400; _C4x[15] = (_ep2*(8*_ep2-10)+13)/25025; _C4x[16] = (4*_ep2-5)/10920; _C4x[17] = 1/real(2520); _C4x[18] = (_ep2*((80-64*_ep2)*_ep2-104)+143)/2522520; _C4x[19] = ((10-8*_ep2)*_ep2-13)/140140; _C4x[20] = (5-4*_ep2)/45864; _C4x[21] = -1/real(8820); _C4x[22] = (_ep2*(8*_ep2-10)+13)/1621620; _C4x[23] = (4*_ep2-5)/294840; _C4x[24] = 1/real(41580); _C4x[25] = (5-4*_ep2)/3963960; _C4x[26] = -1/real(304920); _C4x[27] = 1/real(4684680); break; case 8: _C4x[0] = (_ep2*(_ep2*(_ep2*(_ep2*(_ep2*((8704-7168*_ep2)*_ep2-10880)+ 14144)-19448)+29172)-51051)+510510)/765765; _C4x[1] = (_ep2*(_ep2*(_ep2*(_ep2*((8704-7168*_ep2)*_ep2-10880)+14144)- 19448)+29172)-51051)/1021020; _C4x[2] = (_ep2*(_ep2*(_ep2*((2176-1792*_ep2)*_ep2-2720)+3536)-4862)+ 7293)/306306; _C4x[3] = (_ep2*(_ep2*((1088-896*_ep2)*_ep2-1360)+1768)-2431)/175032; _C4x[4] = (_ep2*((136-112*_ep2)*_ep2-170)+221)/24310; _C4x[5] = ((68-56*_ep2)*_ep2-85)/13260; _C4x[6] = (17-14*_ep2)/3570; _C4x[7] = -1/real(272); _C4x[8] = (_ep2*(_ep2*(_ep2*(_ep2*(_ep2*(7168*_ep2-8704)+10880)-14144)+ 19448)-29172)+51051)/9189180; _C4x[9] = (_ep2*(_ep2*(_ep2*(_ep2*(1792*_ep2-2176)+2720)-3536)+4862)- 7293)/1837836; _C4x[10] = (_ep2*(_ep2*(_ep2*(896*_ep2-1088)+1360)-1768)+2431)/875160; _C4x[11] = (_ep2*(_ep2*(112*_ep2-136)+170)-221)/109395; _C4x[12] = (_ep2*(56*_ep2-68)+85)/55692; _C4x[13] = (14*_ep2-17)/14280; _C4x[14] = 7/real(7344); _C4x[15] = (_ep2*(_ep2*(_ep2*((2176-1792*_ep2)*_ep2-2720)+3536)-4862)+ 7293)/15315300; _C4x[16] = (_ep2*(_ep2*((1088-896*_ep2)*_ep2-1360)+1768)-2431)/4375800; _C4x[17] = (_ep2*((136-112*_ep2)*_ep2-170)+221)/425425; _C4x[18] = ((68-56*_ep2)*_ep2-85)/185640; _C4x[19] = (17-14*_ep2)/42840; _C4x[20] = -7/real(20400); _C4x[21] = (_ep2*(_ep2*(_ep2*(896*_ep2-1088)+1360)-1768)+2431)/42882840; _C4x[22] = (_ep2*(_ep2*(112*_ep2-136)+170)-221)/2382380; _C4x[23] = (_ep2*(56*_ep2-68)+85)/779688; _C4x[24] = (14*_ep2-17)/149940; _C4x[25] = 1/real(8976); _C4x[26] = (_ep2*((136-112*_ep2)*_ep2-170)+221)/27567540; _C4x[27] = ((68-56*_ep2)*_ep2-85)/5012280; _C4x[28] = (17-14*_ep2)/706860; _C4x[29] = -7/real(242352); _C4x[30] = (_ep2*(56*_ep2-68)+85)/67387320; _C4x[31] = (14*_ep2-17)/5183640; _C4x[32] = 7/real(1283568); _C4x[33] = (17-14*_ep2)/79639560; _C4x[34] = -1/real(1516944); _C4x[35] = 1/real(26254800); break; default: STATIC_ASSERT(nC3_ >= 0 && nC4_ <= 8, "Bad value of nC4_"); } } } // namespace GeographicLib geographiclib-1.21/src/PolarStereographic.cpp0000644000175000017500000001145711745620415021161 0ustar frankiefrankie/** * \file PolarStereographic.cpp * \brief Implementation for GeographicLib::PolarStereographic class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #define GEOGRAPHICLIB_POLARSTEREOGRAPHIC_CPP \ "$Id: 3a2dee07e6ef1c55ddcdc2178d818c8edd4d1cd4 $" RCSID_DECL(GEOGRAPHICLIB_POLARSTEREOGRAPHIC_CPP) RCSID_DECL(GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP) namespace GeographicLib { using namespace std; const Math::real PolarStereographic::tol_ = real(0.1)*sqrt(numeric_limits::epsilon()); // Overflow value s.t. atan(overflow_) = pi/2 const Math::real PolarStereographic::overflow_ = 1 / Math::sq(numeric_limits::epsilon()); PolarStereographic::PolarStereographic(real a, real f, real k0) : _a(a) , _f(f <= 1 ? f : 1/f) , _e2(_f * (2 - _f)) , _e(sqrt(abs(_e2))) , _e2m(1 - _e2) , _Cx(exp(eatanhe(real(1)))) , _c( (1 - _f) * _Cx ) , _k0(k0) { if (!(Math::isfinite(_a) && _a > 0)) throw GeographicErr("Major radius is not positive"); if (!(Math::isfinite(_f) && _f < 1)) throw GeographicErr("Minor radius is not positive"); if (!(Math::isfinite(_k0) && _k0 > 0)) throw GeographicErr("Scale is not positive"); } const PolarStereographic PolarStereographic::UPS(Constants::WGS84_a(), Constants::WGS84_f(), Constants::UPS_k0()); // This formulation converts to conformal coordinates by tau = tan(phi) and // tau' = tan(phi') where phi' is the conformal latitude. The formulas are: // tau = tan(phi) // secphi = hypot(1, tau) // sig = sinh(e * atanh(e * tau / secphi)) // taup = tan(phip) = tau * hypot(1, sig) - sig * hypot(1, tau) // c = (1 - f) * exp(e * atanh(e)) // // Forward: // rho = (2*k0*a/c) / (hypot(1, taup) + taup) (taup >= 0) // = (2*k0*a/c) * (hypot(1, taup) - taup) (taup < 0) // // Reverse: // taup = ((2*k0*a/c) / rho - rho / (2*k0*a/c))/2 // // Scale: // k = (rho/a) * secphi * sqrt((1-e2) + e2 / secphi^2) // // In limit rho -> 0, tau -> inf, taup -> inf, secphi -> inf, secphip -> inf // secphip = taup = exp(-e * atanh(e)) * tau = exp(-e * atanh(e)) * secphi void PolarStereographic::Forward(bool northp, real lat, real lon, real& x, real& y, real& gamma, real& k) const throw() { lat *= northp ? 1 : -1; real phi = lat * Math::degree(), tau = lat != -90 ? tanx(phi) : -overflow_, secphi = Math::hypot(real(1), tau), sig = sinh( eatanhe(tau / secphi) ), taup = Math::hypot(real(1), sig) * tau - sig * secphi, rho = Math::hypot(real(1), taup) + abs(taup); rho = taup >= 0 ? (lat != 90 ? 1/rho : 0) : rho; rho *= 2 * _k0 * _a / _c; k = lat != 90 ? (rho / _a) * secphi * sqrt(_e2m + _e2 / Math::sq(secphi)) : _k0; lon = lon >= 180 ? lon - 360 : (lon < -180 ? lon + 360 : lon); real lam = lon * Math::degree(); x = rho * (lon == -180 ? 0 : sin(lam)); y = (northp ? -rho : rho) * (abs(lon) == 90 ? 0 : cos(lam)); gamma = northp ? lon : -lon; } void PolarStereographic::Reverse(bool northp, real x, real y, real& lat, real& lon, real& gamma, real& k) const throw() { real rho = Math::hypot(x, y), t = rho / (2 * _k0 * _a / _c), taup = (1 / t - t) / 2, tau = taup * _Cx, stol = tol_ * max(real(1), abs(taup)); // min iterations = 1, max iterations = 2; mean = 1.99 for (int i = 0; i < numit_; ++i) { real tau1 = Math::hypot(real(1), tau), sig = sinh( eatanhe( tau / tau1 ) ), taupa = Math::hypot(real(1), sig) * tau - sig * tau1, dtau = (taup - taupa) * (1 + _e2m * Math::sq(tau)) / ( _e2m * tau1 * Math::hypot(real(1), taupa) ); tau += dtau; if (!(abs(dtau) >= stol)) break; } real phi = atan(tau), secphi = Math::hypot(real(1), tau); k = rho != 0 ? (rho / _a) * secphi * sqrt(_e2m + _e2 / Math::sq(secphi)) : _k0; lat = (northp ? 1 : -1) * (rho != 0 ? phi / Math::degree() : 90); lon = -atan2( -x, northp ? -y : y ) / Math::degree(); gamma = northp ? lon : -lon; } void PolarStereographic::SetScale(real lat, real k) { if (!(Math::isfinite(k) && k > 0)) throw GeographicErr("Scale is not positive"); if (!(-90 < lat && lat <= 90)) throw GeographicErr("Latitude must be in (-90d, 90d]"); real x, y, gamma, kold; _k0 = 1; Forward(true, lat, 0, x, y, gamma, kold); _k0 *= k/kold; } } // namespace GeographicLib geographiclib-1.21/src/EllipticFunction.cpp0000644000175000017500000001350711745620415020635 0ustar frankiefrankie/** * \file EllipticFunction.cpp * \brief Implementation for GeographicLib::EllipticFunction class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #define GEOGRAPHICLIB_ELLIPTICFUNCTION_CPP \ "$Id: 00b30b3d051fce1da7eb0c7e74c1c03854de6ea3 $" RCSID_DECL(GEOGRAPHICLIB_ELLIPTICFUNCTION_CPP) RCSID_DECL(GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP) namespace GeographicLib { using namespace std; const Math::real EllipticFunction::tol_ = numeric_limits::epsilon() * real(0.01); const Math::real EllipticFunction::tolRF_ = pow(3 * tol_, 1/real(6)); const Math::real EllipticFunction::tolRD_ = pow(real(0.25) * tol_, 1/real(6)); const Math::real EllipticFunction::tolRG0_ = real(2.7) * sqrt(tol_); const Math::real EllipticFunction::tolJAC_ = sqrt(tol_); const Math::real EllipticFunction::tolJAC1_ = sqrt(6 * tol_); /* * Implementation of methods given in * * B. C. Carlson * Computation of elliptic integrals * Numerical Algorithms 10, 13-26 (1995) */ Math::real EllipticFunction::RF(real x, real y, real z) throw() { // Carlson, eqs 2.2 - 2.7 real a0 = (x + y + z)/3, an = a0, q = max(max(abs(a0-x), abs(a0-y)), abs(a0-z)) / tolRF_, x0 = x, y0 = y, z0 = z, mul = 1; while (q >= mul * abs(an)) { // Max 6 trips real ln = sqrt(x0)*sqrt(y0) + sqrt(y0)*sqrt(z0) + sqrt(z0)*sqrt(x0); an = (an + ln)/4; x0 = (x0 + ln)/4; y0 = (y0 + ln)/4; z0 = (z0 + ln)/4; mul *= 4; } real xx = (a0 - x) / (mul * an), yy = (a0 - y) / (mul * an), zz = - xx - yy, e2 = xx * yy - zz * zz, e3 = xx * yy * zz; return (1 - e2 / 10 + e3 / 14 + e2 * e2 / 24 - 3 * e2 * e3 / 44) / sqrt(an); } Math::real EllipticFunction::RD(real x, real y, real z) throw() { // Carlson, eqs 2.28 - 2.34 real a0 = (x + y + 3 * z)/5, an = a0, q = max(max(abs(a0-x), abs(a0-y)), abs(a0-z)) / tolRD_, x0 = x, y0 = y, z0 = z, mul = 1, s = 0; while (q >= mul * abs(an)) { // Max 7 trips real ln = sqrt(x0)*sqrt(y0) + sqrt(y0)*sqrt(z0) + sqrt(z0)*sqrt(x0); s += 1/(mul * sqrt(z0) * (z0 + ln )); an = (an + ln)/4; x0 = (x0 + ln)/4; y0 = (y0 + ln)/4; z0 = (z0 + ln)/4; mul *= 4; } real xx = (a0 - x) / (mul * an), yy = (a0 - y) / (mul * an), zz = -(xx + yy) / 3, e2 = xx * yy - 6 * zz * zz, e3 = (3 * xx * yy - 8 * zz * zz)*zz, e4 = 3 * (xx * yy - zz * zz) * zz * zz, e5 = xx * yy * zz * zz * zz; return (1 - 3 * e2 / 14 + e3 / 6 + 9 * e2 * e2 / 88 - 3 * e4 / 22 - 9 * e2 * e3 / 52 + 3 * e5 / 26) / (mul * an * sqrt(an)) + 3 * s; } Math::real EllipticFunction::RG0(real x, real y) throw() { // Carlson, eqs 2.36 - 2.39 real x0 = sqrt(x), y0 = sqrt(y), xn = x0, yn = y0, s = 0, mul = real(0.25); while (abs(xn-yn) >= tolRG0_ * abs(xn)) { // Max 4 trips real t = (xn + yn) /2; yn = sqrt(xn * yn); xn = t; mul *= 2; t = xn - yn; s += mul * t * t; } x0 = (x0 + y0)/2; return (x0 * x0 - s) * Math::pi() / (2 * (xn + yn)); } EllipticFunction::EllipticFunction(real m) throw() : _m(m) , _m1(1 - m) // Don't initialize _kc, _ec, _kec since this constructor might be called // before the static real constants tolRF_, etc., are initialized. , _init(false) {} bool EllipticFunction::Init() const throw() { // Complete elliptic integral K(m), Carlson eq. 4.1 _kc = RF(real(0), _m1, real(1)); // Complete elliptic integral E(m), Carlson eq. 4.2 _ec = 2 * RG0(_m1, real(1)); // K - E, Carlson eq.4.3 _kec = _m / 3 * RD(real(0), _m1, real(1)); return _init = true; } /* * Implementation of methods given in * * R. Bulirsch * Numerical Calculation of Elliptic Integrals and Elliptic Functions * Numericshe Mathematik 7, 78-90 (1965) */ void EllipticFunction::sncndn(real x, real& sn, real& cn, real& dn) const throw() { // Bulirsch's sncndn routine, p 89. // // Assume _m1 is in [0, 1]. See Bulirsch article for code to treat // negative _m1. if (_m1 != 0) { real mc = _m1; real c; real m[num_], n[num_]; unsigned l = 0; for (real a = 1; l < num_; ++l) { // Max 5 trips m[l] = a; n[l] = mc = sqrt(mc); c = (a + mc) / 2; if (!(abs(a - mc) > tolJAC_ * a)) { ++l; break; } mc = a * mc; a = c; } x = c * x; sn = sin(x); cn = cos(x); dn = 1; if (sn != 0) { real a = cn / sn; c = a * c; while (l--) { real b = m[l]; a = c * a; c = dn * c; dn = (n[l] + a) / (b + a); a = c / b; } a = 1 / sqrt(c * c + 1); sn = sn < 0 ? -a : a; cn = c * sn; } } else { sn = tanh(x); dn = cn = 1 / cosh(x); } } Math::real EllipticFunction::E(real sn, real cn, real dn) const throw() { real cn2 = cn * cn, dn2 = dn * dn, sn2 = sn * sn, // Carlson, eq. 4.6 ei = abs(sn) * (RF(cn2, dn2, real(1)) - (_m / 3) * sn2 * RD(cn2, dn2, real(1))); // Enforce usual trig-like symmetries if (cn < 0) { ei = 2 * E() - ei; } if (sn < 0) ei = -ei; return ei; } Math::real EllipticFunction::E(real phi) const throw() { real sn = sin(phi); return E(sn, cos(phi), sqrt(1 - _m * sn * sn)); } } // namespace GeographicLib geographiclib-1.21/src/GeodesicLine.cpp0000644000175000017500000002417611745620415017720 0ustar frankiefrankie/** * \file GeodesicLine.cpp * \brief Implementation for GeographicLib::GeodesicLine class * * Copyright (c) Charles Karney (2009-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * This is a reformulation of the geodesic problem. The notation is as * follows: * - at a general point (no suffix or 1 or 2 as suffix) * - phi = latitude * - beta = latitude on auxiliary sphere * - omega = longitude on auxiliary sphere * - lambda = longitude * - alpha = azimuth of great circle * - sigma = arc length along great circle * - s = distance * - tau = scaled distance (= sigma at multiples of pi/2) * - at northwards equator crossing * - beta = phi = 0 * - omega = lambda = 0 * - alpha = alpha0 * - sigma = s = 0 * - a 12 suffix means a difference, e.g., s12 = s2 - s1. * - s and c prefixes mean sin and cos **********************************************************************/ #include #define GEOGRAPHICLIB_GEODESICLINE_CPP \ "$Id: d95fea8e73fd86fdc558e5b0397a97241cfe40c2 $" RCSID_DECL(GEOGRAPHICLIB_GEODESICLINE_CPP) RCSID_DECL(GEOGRAPHICLIB_GEODESICLINE_HPP) namespace GeographicLib { using namespace std; GeodesicLine::GeodesicLine(const Geodesic& g, real lat1, real lon1, real azi1, unsigned caps) throw() : _a(g._a) , _f(g._f) , _b(g._b) , _c2(g._c2) , _f1(g._f1) // Always allow latitude and azimuth , _caps(caps | LATITUDE | AZIMUTH) { azi1 = Geodesic::AngNormalize(azi1); // Guard against underflow in salp0 azi1 = Geodesic::AngRound(azi1); lon1 = Geodesic::AngNormalize(lon1); _lat1 = lat1; _lon1 = lon1; _azi1 = azi1; // alp1 is in [0, pi] real alp1 = azi1 * Math::degree(); // Enforce sin(pi) == 0 and cos(pi/2) == 0. Better to face the ensuing // problems directly than to skirt them. _salp1 = azi1 == -180 ? 0 : sin(alp1); _calp1 = abs(azi1) == 90 ? 0 : cos(alp1); real cbet1, sbet1, phi; phi = lat1 * Math::degree(); // Ensure cbet1 = +epsilon at poles sbet1 = _f1 * sin(phi); cbet1 = abs(lat1) == 90 ? Geodesic::tiny_ : cos(phi); Geodesic::SinCosNorm(sbet1, cbet1); // Evaluate alp0 from sin(alp1) * cos(bet1) = sin(alp0), _salp0 = _salp1 * cbet1; // alp0 in [0, pi/2 - |bet1|] // Alt: calp0 = hypot(sbet1, calp1 * cbet1). The following // is slightly better (consider the case salp1 = 0). _calp0 = Math::hypot(_calp1, _salp1 * sbet1); // Evaluate sig with tan(bet1) = tan(sig1) * cos(alp1). // sig = 0 is nearest northward crossing of equator. // With bet1 = 0, alp1 = pi/2, we have sig1 = 0 (equatorial line). // With bet1 = pi/2, alp1 = -pi, sig1 = pi/2 // With bet1 = -pi/2, alp1 = 0 , sig1 = -pi/2 // Evaluate omg1 with tan(omg1) = sin(alp0) * tan(sig1). // With alp0 in (0, pi/2], quadrants for sig and omg coincide. // No atan2(0,0) ambiguity at poles since cbet1 = +epsilon. // With alp0 = 0, omg1 = 0 for alp1 = 0, omg1 = pi for alp1 = pi. _ssig1 = sbet1; _somg1 = _salp0 * sbet1; _csig1 = _comg1 = sbet1 != 0 || _calp1 != 0 ? cbet1 * _calp1 : 1; Geodesic::SinCosNorm(_ssig1, _csig1); // sig1 in (-pi, pi] Geodesic::SinCosNorm(_somg1, _comg1); _k2 = Math::sq(_calp0) * g._ep2; real eps = _k2 / (2 * (1 + sqrt(1 + _k2)) + _k2); if (_caps & CAP_C1) { _A1m1 = Geodesic::A1m1f(eps); Geodesic::C1f(eps, _C1a); _B11 = Geodesic::SinCosSeries(true, _ssig1, _csig1, _C1a, nC1_); real s = sin(_B11), c = cos(_B11); // tau1 = sig1 + B11 _stau1 = _ssig1 * c + _csig1 * s; _ctau1 = _csig1 * c - _ssig1 * s; // Not necessary because C1pa reverts C1a // _B11 = -SinCosSeries(true, _stau1, _ctau1, _C1pa, nC1p_); } if (_caps & CAP_C1p) Geodesic::C1pf(eps, _C1pa); if (_caps & CAP_C2) { _A2m1 = Geodesic::A2m1f(eps); Geodesic::C2f(eps, _C2a); _B21 = Geodesic::SinCosSeries(true, _ssig1, _csig1, _C2a, nC2_); } if (_caps & CAP_C3) { g.C3f(eps, _C3a); _A3c = -_f * _salp0 * g.A3f(eps); _B31 = Geodesic::SinCosSeries(true, _ssig1, _csig1, _C3a, nC3_-1); } if (_caps & CAP_C4) { g.C4f(_k2, _C4a); // Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0) _A4 = Math::sq(_a) * _calp0 * _salp0 * g._e2; _B41 = Geodesic::SinCosSeries(false, _ssig1, _csig1, _C4a, nC4_); } } Math::real GeodesicLine::GenPosition(bool arcmode, real s12_a12, unsigned outmask, real& lat2, real& lon2, real& azi2, real& s12, real& m12, real& M12, real& M21, real& S12) const throw() { outmask &= _caps & OUT_ALL; if (!( Init() && (arcmode || (_caps & DISTANCE_IN & OUT_ALL)) )) // Uninitialized or impossible distance calculation requested return Math::NaN(); // Avoid warning about uninitialized B12. real sig12, ssig12, csig12, B12 = 0, AB1 = 0; if (arcmode) { // Interpret s12_a12 as spherical arc length sig12 = s12_a12 * Math::degree(); real s12a = abs(s12_a12); s12a -= 180 * floor(s12a / 180); ssig12 = s12a == 0 ? 0 : sin(sig12); csig12 = s12a == 90 ? 0 : cos(sig12); } else { // Interpret s12_a12 as distance real tau12 = s12_a12 / (_b * (1 + _A1m1)), s = sin(tau12), c = cos(tau12); // tau2 = tau1 + tau12 B12 = - Geodesic::SinCosSeries(true, _stau1 * c + _ctau1 * s, _ctau1 * c - _stau1 * s, _C1pa, nC1p_); sig12 = tau12 - (B12 - _B11); ssig12 = sin(sig12); csig12 = cos(sig12); } real omg12, lam12, lon12; real ssig2, csig2, sbet2, cbet2, somg2, comg2, salp2, calp2; // sig2 = sig1 + sig12 ssig2 = _ssig1 * csig12 + _csig1 * ssig12; csig2 = _csig1 * csig12 - _ssig1 * ssig12; if (outmask & (DISTANCE | REDUCEDLENGTH | GEODESICSCALE)) { if (arcmode) B12 = Geodesic::SinCosSeries(true, ssig2, csig2, _C1a, nC1_); AB1 = (1 + _A1m1) * (B12 - _B11); } // sin(bet2) = cos(alp0) * sin(sig2) sbet2 = _calp0 * ssig2; // Alt: cbet2 = hypot(csig2, salp0 * ssig2); cbet2 = Math::hypot(_salp0, _calp0 * csig2); if (cbet2 == 0) // I.e., salp0 = 0, csig2 = 0. Break the degeneracy in this case cbet2 = csig2 = Geodesic::tiny_; // tan(omg2) = sin(alp0) * tan(sig2) somg2 = _salp0 * ssig2; comg2 = csig2; // No need to normalize // tan(alp0) = cos(sig2)*tan(alp2) salp2 = _salp0; calp2 = _calp0 * csig2; // No need to normalize // omg12 = omg2 - omg1 omg12 = atan2(somg2 * _comg1 - comg2 * _somg1, comg2 * _comg1 + somg2 * _somg1); if (outmask & DISTANCE) s12 = arcmode ? _b * ((1 + _A1m1) * sig12 + AB1) : s12_a12; if (outmask & LONGITUDE) { lam12 = omg12 + _A3c * ( sig12 + (Geodesic::SinCosSeries(true, ssig2, csig2, _C3a, nC3_-1) - _B31)); lon12 = lam12 / Math::degree(); // Can't use AngNormalize because longitude might have wrapped multiple // times. lon12 = lon12 - 360 * floor(lon12/360 + real(0.5)); lon2 = Geodesic::AngNormalize(_lon1 + lon12); } if (outmask & LATITUDE) lat2 = atan2(sbet2, _f1 * cbet2) / Math::degree(); if (outmask & AZIMUTH) // minus signs give range [-180, 180). 0- converts -0 to +0. azi2 = 0 - atan2(-salp2, calp2) / Math::degree(); if (outmask & (REDUCEDLENGTH | GEODESICSCALE)) { real ssig1sq = Math::sq(_ssig1), ssig2sq = Math::sq( ssig2), w1 = sqrt(1 + _k2 * ssig1sq), w2 = sqrt(1 + _k2 * ssig2sq), B22 = Geodesic::SinCosSeries(true, ssig2, csig2, _C2a, nC2_), AB2 = (1 + _A2m1) * (B22 - _B21), J12 = (_A1m1 - _A2m1) * sig12 + (AB1 - AB2); if (outmask & REDUCEDLENGTH) // Add parens around (_csig1 * ssig2) and (_ssig1 * csig2) to ensure // accurate cancellation in the case of coincident points. m12 = _b * ((w2 * (_csig1 * ssig2) - w1 * (_ssig1 * csig2)) - _csig1 * csig2 * J12); if (outmask & GEODESICSCALE) { M12 = csig12 + (_k2 * (ssig2sq - ssig1sq) * ssig2 / (w1 + w2) - csig2 * J12) * _ssig1 / w1; M21 = csig12 - (_k2 * (ssig2sq - ssig1sq) * _ssig1 / (w1 + w2) - _csig1 * J12) * ssig2 / w2; } } if (outmask & AREA) { real B42 = Geodesic::SinCosSeries(false, ssig2, csig2, _C4a, nC4_); real salp12, calp12; if (_calp0 == 0 || _salp0 == 0) { // alp12 = alp2 - alp1, used in atan2 so no need to normalized salp12 = salp2 * _calp1 - calp2 * _salp1; calp12 = calp2 * _calp1 + salp2 * _salp1; // The right thing appears to happen if alp1 = +/-180 and alp2 = 0, viz // salp12 = -0 and alp12 = -180. However this depends on the sign being // attached to 0 correctly. The following ensures the correct behavior. if (salp12 == 0 && calp12 < 0) { salp12 = Geodesic::tiny_ * _calp1; calp12 = -1; } } else { // tan(alp) = tan(alp0) * sec(sig) // tan(alp2-alp1) = (tan(alp2) -tan(alp1)) / (tan(alp2)*tan(alp1)+1) // = calp0 * salp0 * (csig1-csig2) / (salp0^2 + calp0^2 * csig1*csig2) // If csig12 > 0, write // csig1 - csig2 = ssig12 * (csig1 * ssig12 / (1 + csig12) + ssig1) // else // csig1 - csig2 = csig1 * (1 - csig12) + ssig12 * ssig1 // No need to normalize salp12 = _calp0 * _salp0 * (csig12 <= 0 ? _csig1 * (1 - csig12) + ssig12 * _ssig1 : ssig12 * (_csig1 * ssig12 / (1 + csig12) + _ssig1)); calp12 = Math::sq(_salp0) + Math::sq(_calp0) * _csig1 * csig2; } S12 = _c2 * atan2(salp12, calp12) + _A4 * (B42 - _B41); } return arcmode ? s12_a12 : sig12 / Math::degree(); } } // namespace GeographicLib geographiclib-1.21/src/AlbersEqualArea.cpp0000644000175000017500000004320011745620415020344 0ustar frankiefrankie/** * \file AlbersEqualArea.cpp * \brief Implementation for GeographicLib::AlbersEqualArea class * * Copyright (c) Charles Karney (2010, 2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #define GEOGRAPHICLIB_ALBERSEQUALAREA_CPP \ "$Id: a7aa5e2e232feec5c866f0d645f110fd0bb38dd2 $" RCSID_DECL(GEOGRAPHICLIB_ALBERSEQUALAREA_CPP) RCSID_DECL(GEOGRAPHICLIB_ALBERSEQUALAREA_HPP) namespace GeographicLib { using namespace std; const Math::real AlbersEqualArea::eps_ = numeric_limits::epsilon(); const Math::real AlbersEqualArea::epsx_ = Math::sq(eps_); const Math::real AlbersEqualArea::epsx2_ = Math::sq(epsx_); const Math::real AlbersEqualArea::tol_ = sqrt(eps_); const Math::real AlbersEqualArea::tol0_ = tol_ * sqrt(sqrt(eps_)); const Math::real AlbersEqualArea::ahypover_ = real(numeric_limits::digits) * log(real(numeric_limits::radix)) + 2; AlbersEqualArea::AlbersEqualArea(real a, real f, real stdlat, real k0) : _a(a) , _f(f <= 1 ? f : 1/f) , _fm(1 - _f) , _e2(_f * (2 - _f)) , _e(sqrt(abs(_e2))) , _e2m(1 - _e2) , _qZ(1 + _e2m * atanhee(real(1))) , _qx(_qZ / ( 2 * _e2m )) { if (!(Math::isfinite(_a) && _a > 0)) throw GeographicErr("Major radius is not positive"); if (!(Math::isfinite(_f) && _f < 1)) throw GeographicErr("Minor radius is not positive"); if (!(Math::isfinite(k0) && k0 > 0)) throw GeographicErr("Scale is not positive"); if (!(abs(stdlat) <= 90)) throw GeographicErr("Standard latitude not in [-90, 90]"); real phi = stdlat * Math::degree(), sphi = sin(phi), cphi = abs(stdlat) != 90 ? cos(phi) : 0; Init(sphi, cphi, sphi, cphi, k0); } AlbersEqualArea::AlbersEqualArea(real a, real f, real stdlat1, real stdlat2, real k1) : _a(a) , _f(f <= 1 ? f : 1/f) , _fm(1 - _f) , _e2(_f * (2 - _f)) , _e(sqrt(abs(_e2))) , _e2m(1 - _e2) , _qZ(1 + _e2m * atanhee(real(1))) , _qx(_qZ / ( 2 * _e2m )) { if (!(Math::isfinite(_a) && _a > 0)) throw GeographicErr("Major radius is not positive"); if (!(Math::isfinite(_f) && _f < 1)) throw GeographicErr("Minor radius is not positive"); if (!(Math::isfinite(k1) && k1 > 0)) throw GeographicErr("Scale is not positive"); if (!(abs(stdlat1) <= 90)) throw GeographicErr("Standard latitude 1 not in [-90, 90]"); if (!(abs(stdlat2) <= 90)) throw GeographicErr("Standard latitude 2 not in [-90, 90]"); real phi1 = stdlat1 * Math::degree(), phi2 = stdlat2 * Math::degree(); Init(sin(phi1), abs(stdlat1) != 90 ? cos(phi1) : 0, sin(phi2), abs(stdlat2) != 90 ? cos(phi2) : 0, k1); } AlbersEqualArea::AlbersEqualArea(real a, real f, real sinlat1, real coslat1, real sinlat2, real coslat2, real k1) : _a(a) , _f(f <= 1 ? f : 1/f) , _fm(1 - _f) , _e2(_f * (2 - _f)) , _e(sqrt(abs(_e2))) , _e2m(1 - _e2) , _qZ(1 + _e2m * atanhee(real(1))) , _qx(_qZ / ( 2 * _e2m )) { if (!(Math::isfinite(_a) && _a > 0)) throw GeographicErr("Major radius is not positive"); if (!(Math::isfinite(_f) && _f < 1)) throw GeographicErr("Minor radius is not positive"); if (!(Math::isfinite(k1) && k1 > 0)) throw GeographicErr("Scale is not positive"); if (!(coslat1 >= 0)) throw GeographicErr("Standard latitude 1 not in [-90, 90]"); if (!(coslat2 >= 0)) throw GeographicErr("Standard latitude 2 not in [-90, 90]"); if (!(abs(sinlat1) <= 1 && coslat1 <= 1) || (coslat1 == 0 && sinlat1 == 0)) throw GeographicErr("Bad sine/cosine of standard latitude 1"); if (!(abs(sinlat2) <= 1 && coslat2 <= 1) || (coslat2 == 0 && sinlat2 == 0)) throw GeographicErr("Bad sine/cosine of standard latitude 2"); if (coslat1 == 0 && coslat2 == 0 && sinlat1 * sinlat2 <= 0) throw GeographicErr ("Standard latitudes cannot be opposite poles"); Init(sinlat1, coslat1, sinlat2, coslat2, k1); } void AlbersEqualArea::Init(real sphi1, real cphi1, real sphi2, real cphi2, real k1) throw() { { real r; r = Math::hypot(sphi1, cphi1); sphi1 /= r; cphi1 /= r; r = Math::hypot(sphi2, cphi2); sphi2 /= r; cphi2 /= r; } bool polar = (cphi1 == 0); cphi1 = max(epsx_, cphi1); // Avoid singularities at poles cphi2 = max(epsx_, cphi2); // Determine hemisphere of tangent latitude _sign = sphi1 + sphi2 >= 0 ? 1 : -1; // Internally work with tangent latitude positive sphi1 *= _sign; sphi2 *= _sign; if (sphi1 > sphi2) { swap(sphi1, sphi2); swap(cphi1, cphi2); // Make phi1 < phi2 } real tphi1 = sphi1/cphi1, tphi2 = sphi2/cphi2; // q = (1-e^2)*(sphi/(1-e^2*sphi^2) - atanhee(sphi)) // qZ = q(pi/2) = (1 + (1-e^2)*atanhee(1)) // atanhee(x) = atanh(e*x)/e // q = sxi * qZ // dq/dphi = 2*(1-e^2)*cphi/(1-e^2*sphi^2)^2 // // n = (m1^2-m2^2)/(q2-q1) -> sin(phi0) for phi1, phi2 -> phi0 // C = m1^2 + n*q1 = (m1^2*q2-m2^2*q1)/(q2-q1) // let // rho(pi/2)/rho(-pi/2) = (1-s)/(1+s) // s = n*qZ/C // = qZ * (m1^2-m2^2)/(m1^2*q2-m2^2*q1) // = qZ * (scbet2^2 - scbet1^2)/(scbet2^2*q2 - scbet1^2*q1) // = (scbet2^2 - scbet1^2)/(scbet2^2*sxi2 - scbet1^2*sxi1) // = (tbet2^2 - tbet1^2)/(scbet2^2*sxi2 - scbet1^2*sxi1) // 1-s = -((1-sxi2)*scbet2^2 - (1-sxi1)*scbet1^2)/ // (scbet2^2*sxi2 - scbet1^2*sxi1) // // Define phi0 to give same value of s, i.e., // s = sphi0 * qZ / (m0^2 + sphi0*q0) // = sphi0 * scbet0^2 / (1/qZ + sphi0 * scbet0^2 * sxi0) real tphi0, C; if (polar || tphi1 == tphi2) { tphi0 = tphi2; C = 1; // ignored } else { real tbet1 = _fm * tphi1, scbet12 = 1 + Math::sq(tbet1), tbet2 = _fm * tphi2, scbet22 = 1 + Math::sq(tbet2), txi1 = txif(tphi1), cxi1 = 1/hyp(txi1), sxi1 = txi1 * cxi1, txi2 = txif(tphi2), cxi2 = 1/hyp(txi2), sxi2 = txi2 * cxi2, dtbet2 = _fm * (tbet1 + tbet2), es1 = 1 - _e2 * Math::sq(sphi1), es2 = 1 - _e2 * Math::sq(sphi2), /* dsxi = ( (_e2 * sq(sphi2 + sphi1) + es2 + es1) / (2 * es2 * es1) + Datanhee(sphi2, sphi1) ) * Dsn(tphi2, tphi1, sphi2, sphi1) / ( 2 * _qx ), */ dsxi = ( (1 + _e2 * sphi1 * sphi2) / (es2 * es1) + Datanhee(sphi2, sphi1) ) * Dsn(tphi2, tphi1, sphi2, sphi1) / ( 2 * _qx ), den = (sxi2 + sxi1) * dtbet2 + (scbet22 + scbet12) * dsxi, // s = (sq(tbet2) - sq(tbet1)) / (scbet22*sxi2 - scbet12*sxi1) s = 2 * dtbet2 / den, // 1-s = -(sq(scbet2)*(1-sxi2) - sq(scbet1)*(1-sxi1)) / // (scbet22*sxi2 - scbet12*sxi1) // Write // sq(scbet)*(1-sxi) = sq(scbet)*(1-sphi) * (1-sxi)/(1-sphi) sm1 = -Dsn(tphi2, tphi1, sphi2, sphi1) * ( -( ((sphi2 <= 0 ? (1 - sxi2) / (1 - sphi2) : Math::sq(cxi2/cphi2) * (1 + sphi2) / (1 + sxi2)) + (sphi1 <= 0 ? (1 - sxi1) / (1 - sphi1) : Math::sq(cxi1/cphi1) * (1 + sphi1) / (1 + sxi1))) ) * (1 + _e2 * (sphi1 + sphi2 + sphi1 * sphi2)) / (1 + (sphi1 + sphi2 + sphi1 * sphi2)) + (scbet22 * (sphi2 <= 0 ? 1 - sphi2 : Math::sq(cphi2) / ( 1 + sphi2)) + scbet12 * (sphi1 <= 0 ? 1 - sphi1 : Math::sq(cphi1) / ( 1 + sphi1))) * (_e2 * (1 + sphi1 + sphi2 + _e2 * sphi1 * sphi2)/(es1 * es2) +_e2m * DDatanhee(sphi1, sphi2) ) / _qZ ) / den; // C = (scbet22*sxi2 - scbet12*sxi1) / (scbet22 * scbet12 * (sx2 - sx1)) C = den / (2 * scbet12 * scbet22 * dsxi); tphi0 = (tphi2 + tphi1)/2; real stol = tol0_ * max(real(1), abs(tphi0)); for (int i = 0; i < 2*numit0_; ++i) { // Solve (scbet0^2 * sphi0) / (1/qZ + scbet0^2 * sphi0 * sxi0) = s // for tphi0 by Newton's method on // v(tphi0) = (scbet0^2 * sphi0) - s * (1/qZ + scbet0^2 * sphi0 * sxi0) // = 0 // Alt: // (scbet0^2 * sphi0) / (1/qZ - scbet0^2 * sphi0 * (1-sxi0)) = s / (1-s) // w(tphi0) = (1-s) * (scbet0^2 * sphi0) // - s * (1/qZ - scbet0^2 * sphi0 * (1-sxi0)) // = (1-s) * (scbet0^2 * sphi0) // - S/qZ * (1 - scbet0^2 * sphi0 * (qZ-q0)) // Now // qZ-q0 = (1+e2*sphi0)*(1-sphi0)/(1-e2*sphi0^2) + // (1-e2)*atanhee((1-sphi0)/(1-e2*sphi0)) // In limit sphi0 -> 1, qZ-q0 -> 2*(1-sphi0)/(1-e2), so wrte // qZ-q0 = 2*(1-sphi0)/(1-e2) + A + B // A = (1-sphi0)*( (1+e2*sphi0)/(1-e2*sphi0^2) - (1+e2)/(1-e2) ) // = -e2 *(1-sphi0)^2 * (2+(1+e2)*sphi0) / ((1-e2)*(1-e2*sphi0^2)) // B = (1-e2)*atanhee((1-sphi0)/(1-e2*sphi0)) - (1-sphi0) // = (1-sphi0)*(1-e2)/(1-e2*sphi0)* // ((atanhee(x)/x-1) - e2*(1-sphi0)/(1-e2)) // x = (1-sphi0)/(1-e2*sphi0), atanhee(x)/x = atanh(e*x)/(e*x) // // 1 - scbet0^2 * sphi0 * (qZ-q0) // = 1 - scbet0^2 * sphi0 * (2*(1-sphi0)/(1-e2) + A + B) // = D - scbet0^2 * sphi0 * (A + B) // D = 1 - scbet0^2 * sphi0 * 2*(1-sphi0)/(1-e2) // = (1-sphi0)*(1-e2*(1+2*sphi0*(1+sphi0)))/((1-e2)*(1+sphi0)) // dD/dsphi0 = -2*(1-e2*sphi0^2*(2*sphi0+3))/((1-e2)*(1+sphi0)^2) // d(A+B)/dsphi0 = 2*(1-sphi0^2)*e2*(2-e2*(1+sphi0^2))/ // ((1-e2)*(1-e2*sphi0^2)^2) real scphi02 = 1 + Math::sq(tphi0), scphi0 = sqrt(scphi02), // sphi0m = 1-sin(phi0) = 1/( sec(phi0) * (tan(phi0) + sec(phi0)) ) sphi0 = tphi0 / scphi0, sphi0m = 1/(scphi0 * (tphi0 + scphi0)), // scbet0^2 * sphi0 g = (1 + Math::sq( _fm * tphi0 )) * sphi0, // dg/dsphi0 = dg/dtphi0 * scphi0^3 dg = _e2m * scphi02 * (1 + 2 * Math::sq(tphi0)) + _e2, D = sphi0m * (1 - _e2*(1 + 2*sphi0*(1+sphi0))) / (_e2m * (1+sphi0)), // dD/dsphi0 dD = -2 * (1 - _e2*Math::sq(sphi0) * (2*sphi0+3)) / (_e2m * Math::sq(1+sphi0)), A = -_e2 * Math::sq(sphi0m) * (2+(1+_e2)*sphi0) / (_e2m*(1-_e2*Math::sq(sphi0))), B = (sphi0m * _e2m / (1 - _e2*sphi0) * (atanhxm1(_e2 * Math::sq(sphi0m / (1-_e2*sphi0))) - _e2*sphi0m/_e2m)), // d(A+B)/dsphi0 dAB = (2 * _e2 * (2 - _e2 * (1 + Math::sq(sphi0))) / (_e2m * Math::sq(1 - _e2*Math::sq(sphi0)) * scphi02)), u = sm1 * g - s/_qZ * ( D - g * (A + B) ), // du/dsphi0 du = sm1 * dg - s/_qZ * (dD - dg * (A + B) - g * dAB), dtu = -u/du * (scphi0 * scphi02); tphi0 += dtu; if (!(abs(dtu) >= stol)) break; } } _txi0 = txif(tphi0); _scxi0 = hyp(_txi0); _sxi0 = _txi0 / _scxi0; _n0 = tphi0/hyp(tphi0); _m02 = 1 / (1 + Math::sq(_fm * tphi0)); _nrho0 = polar ? 0 : _a * sqrt(_m02); _k0 = sqrt(tphi1 == tphi2 ? 1 : C / (_m02 + _n0 * _qZ * _sxi0)) * k1; _k2 = Math::sq(_k0); _lat0 = _sign * atan(tphi0)/Math::degree(); } const AlbersEqualArea AlbersEqualArea::CylindricalEqualArea(Constants::WGS84_a(), Constants::WGS84_f(), real(0), real(1), real(0), real(1), real(1)); const AlbersEqualArea AlbersEqualArea::AzimuthalEqualAreaNorth(Constants::WGS84_a(), Constants::WGS84_f(), real(1), real(0), real(1), real(0), real(1)); const AlbersEqualArea AlbersEqualArea::AzimuthalEqualAreaSouth(Constants::WGS84_a(), Constants::WGS84_f(), real(-1), real(0), real(-1), real(0), real(1)); Math::real AlbersEqualArea::txif(real tphi) const throw() { // sxi = ( sphi/(1-e2*sphi^2) + atanhee(sphi) ) / // ( 1/(1-e2) + atanhee(1) ) // // txi = ( sphi/(1-e2*sphi^2) + atanhee(sphi) ) / // sqrt( ( (1+e2*sphi)*(1-sphi)/( (1-e2*sphi^2) * (1-e2) ) + // atanhee((1-sphi)/(1-e2*sphi)) ) * // ( (1-e2*sphi)*(1+sphi)/( (1-e2*sphi^2) * (1-e2) ) + // atanhee((1+sphi)/(1+e2*sphi)) ) ) // // subst 1-sphi = cphi^2/(1+sphi) int s = tphi < 0 ? -1 : 1; // Enforce odd parity tphi *= s; real cphi2 = 1 / (1 + Math::sq(tphi)), sphi = tphi * sqrt(cphi2), es1 = _e2 * sphi, es2m1 = 1 - es1 * sphi, sp1 = 1 + sphi, es1m1 = (1 - es1) * sp1, es2m1a = _e2m * es2m1, es1p1 = sp1 / (1 + es1); return s * ( sphi / es2m1 + atanhee(sphi) ) / sqrt( ( cphi2 / (es1p1 * es2m1a) + atanhee(cphi2 / es1m1) ) * ( es1m1 / es2m1a + atanhee(es1p1) ) ); } Math::real AlbersEqualArea::tphif(real txi) const throw() { real tphi = txi, stol = tol_ * max(real(1), abs(txi)); // CHECK: min iterations = 1, max iterations = 2; mean = 1.99 for (int i = 0; i < numit_; ++i) { // dtxi/dtphi = (scxi/scphi)^3 * 2*(1-e^2)/(qZ*(1-e^2*sphi^2)^2) real txia = txif(tphi), tphi2 = Math::sq(tphi), scphi2 = 1 + tphi2, scterm = scphi2/(1 + Math::sq(txia)), dtphi = (txi - txia) * scterm * sqrt(scterm) * _qx * Math::sq(1 - _e2 * tphi2 / scphi2); tphi += dtphi; if (!(abs(dtphi) >= stol)) break; } return tphi; } // return atanh(sqrt(x))/sqrt(x) - 1 = y/3 + y^2/5 + y^3/7 + ... // typical x < e^2 = 2*f Math::real AlbersEqualArea::atanhxm1(real x) throw() { real s = 0; if (abs(x) < real(0.5)) { real os = -1, y = 1, k = 1; while (os != s) { os = s; y *= x; // y = x^n k += 2; // k = 2*n + 1 s += y/k; // sum( x^n/(2*n + 1) ) } } else { real xs = sqrt(abs(x)); s = (x > 0 ? Math::atanh(xs) : atan(xs)) / xs - 1; } return s; } // return (Datanhee(1,y) - Datanhee(1,x))/(y-x) Math::real AlbersEqualArea::DDatanhee(real x, real y) const throw() { real s = 0; if (_e2 * (abs(x) + abs(y)) < real(0.5)) { real os = -1, z = 1, k = 1, t = 0, c = 0, en = 1; while (os != s) { os = s; t = y * t + z; c += t; z *= x; t = y * t + z; c += t; z *= x; k += 2; en *= _e2; // Here en[l] = e2^l, k[l] = 2*l + 1, // c[l] = sum( x^i * y^j; i >= 0, j >= 0, i+j < 2*l) s += en * c / k; } // Taylor expansion is // s = sum( c[l] * e2^l / (2*l + 1), l, 1, N) } else s = (Datanhee(1, y) - Datanhee(x, y))/(1 - x); return s; } void AlbersEqualArea::Forward(real lon0, real lat, real lon, real& x, real& y, real& gamma, real& k) const throw() { if (lon - lon0 >= 180) lon -= lon0 + 360; else if (lon - lon0 < -180) lon -= lon0 - 360; else lon -= lon0; lat *= _sign; real lam = lon * Math::degree(), phi = lat * Math::degree(), sphi = sin(phi), cphi = abs(lat) != 90 ? cos(phi) : epsx_, tphi = sphi/cphi, txi = txif(tphi), sxi = txi/hyp(txi), dq = _qZ * Dsn(txi, _txi0, sxi, _sxi0) * (txi - _txi0), drho = - _a * dq / (sqrt(_m02 - _n0 * dq) + _nrho0 / _a), theta = _k2 * _n0 * lam, stheta = sin(theta), ctheta = cos(theta), t = _nrho0 + _n0 * drho; x = t * (_n0 != 0 ? stheta / _n0 : _k2 * lam) / _k0; y = (_nrho0 * (_n0 != 0 ? (ctheta < 0 ? 1 - ctheta : Math::sq(stheta)/(1 + ctheta)) / _n0 : 0) - drho * ctheta) / _k0; k = _k0 * (t != 0 ? t * hyp(_fm * tphi) / _a : 1); y *= _sign; gamma = _sign * theta / Math::degree(); } void AlbersEqualArea::Reverse(real lon0, real x, real y, real& lat, real& lon, real& gamma, real& k) const throw() { y *= _sign; real nx = _k0 * _n0 * x, ny = _k0 * _n0 * y, y1 = _nrho0 - ny, den = Math::hypot(nx, y1) + _nrho0, // 0 implies origin with polar aspect drho = den != 0 ? (_k0*x*nx - 2*_k0*y*_nrho0 + _k0*y*ny) / den : 0, // dsxia = scxi0 * dsxi dsxia = - _scxi0 * (2 * _nrho0 + _n0 * drho) * drho / (Math::sq(_a) * _qZ), txi = (_txi0 + dsxia) / sqrt(max(1 - dsxia * (2*_txi0 + dsxia), epsx2_)), tphi = tphif(txi), phi = _sign * atan(tphi), theta = atan2(nx, y1), lam = _n0 != 0 ? theta / (_k2 * _n0) : x / (y1 * _k0); gamma = _sign * theta / Math::degree(); lat = phi / Math::degree(); lon = lam / Math::degree(); // Avoid losing a bit of accuracy in lon (assuming lon0 is an integer) if (lon + lon0 >= 180) lon += lon0 - 360; else if (lon + lon0 < -180) lon += lon0 + 360; else lon += lon0; k = _k0 * (den != 0 ? (_nrho0 + _n0 * drho) * hyp(_fm * tphi) / _a : 1); } void AlbersEqualArea::SetScale(real lat, real k) { if (!(Math::isfinite(k) && k > 0)) throw GeographicErr("Scale is not positive"); if (!(abs(lat) < 90)) throw GeographicErr("Latitude for SetScale not in (-90, 90)"); real x, y, gamma, kold; Forward(0, lat, 0, x, y, gamma, kold); k /= kold; _k0 *= k; _k2 = Math::sq(_k0); } } // namespace GeographicLib geographiclib-1.21/src/TransverseMercatorExact.cpp0000644000175000017500000004416011745620415022177 0ustar frankiefrankie/** * \file TransverseMercatorExact.cpp * \brief Implementation for GeographicLib::TransverseMercatorExact class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * The relevant section of Lee's paper is part V, pp 67–101, * Conformal * Projections Based On Jacobian Elliptic Functions. * * The method entails using the Thompson Transverse Mercator as an * intermediate projection. The projections from the intermediate * coordinates to [\e phi, \e lam] and [\e x, \e y] are given by elliptic * functions. The inverse of these projections are found by Newton's method * with a suitable starting guess. * * This implementation and notation closely follows Lee, with the following * exceptions: *
*
Lee here Description *
x/a xi Northing (unit Earth) *
y/a eta Easting (unit Earth) *
s/a sigma xi + i * eta *
y x Easting *
x y Northing *
k e eccentricity *
k^2 mu elliptic function parameter *
k'^2 mv elliptic function complementary parameter *
m k scale *
zeta zeta complex longitude = Mercator = chi in paper *
s sigma complex GK = zeta in paper *
* * Minor alterations have been made in some of Lee's expressions in an * attempt to control round-off. For example atanh(sin(phi)) is replaced by * asinh(tan(phi)) which maintains accuracy near phi = pi/2. Such changes * are noted in the code. **********************************************************************/ #include #define GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_CPP \ "$Id: 125a2d11919018a84fb0c09ea2e77011a35a4a2d $" RCSID_DECL(GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_CPP) RCSID_DECL(GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP) namespace GeographicLib { using namespace std; const Math::real TransverseMercatorExact::tol_ = numeric_limits::epsilon(); const Math::real TransverseMercatorExact::tol1_ = real(0.1) * sqrt(tol_); const Math::real TransverseMercatorExact::tol2_ = real(0.1) * tol_; const Math::real TransverseMercatorExact::taytol_ = pow(tol_, real(0.6)); // Overflow value s.t. atan(overflow_) = pi/2 const Math::real TransverseMercatorExact::overflow_ = 1 / Math::sq(tol_); TransverseMercatorExact::TransverseMercatorExact(real a, real f, real k0, bool extendp) : _a(a) , _f(f <= 1 ? f : 1/f) , _k0(k0) , _mu(_f * (2 - _f)) // e^2 , _mv(1 - _mu) // 1 - e^2 , _e(sqrt(_mu)) , _ep2(_mu / _mv) // e^2 / (1 - e^2) , _extendp(extendp) , _Eu(_mu) , _Ev(_mv) { if (!(Math::isfinite(_a) && _a > 0)) throw GeographicErr("Major radius is not positive"); if (!(_f > 0)) throw GeographicErr("Flattening is not positive"); if (!(_f < 1)) throw GeographicErr("Minor radius is not positive"); if (!(Math::isfinite(_k0) && _k0 > 0)) throw GeographicErr("Scale is not positive"); } const TransverseMercatorExact TransverseMercatorExact::UTM(Constants::WGS84_a(), Constants::WGS84_f(), Constants::UTM_k0()); // tau = tan(phi), taup = sinh(psi) Math::real TransverseMercatorExact::taup(real tau) const throw() { real tau1 = Math::hypot(real(1), tau), sig = sinh( _e * Math::atanh(_e * tau / tau1) ); return Math::hypot(real(1), sig) * tau - sig * tau1; } Math::real TransverseMercatorExact::taupinv(real taup) const throw() { real // See comment in TransverseMercator.cpp about the initial guess tau = taup/_mv, stol = tol_ * max(real(1), abs(taup)); // min iterations = 1, max iterations = 2; mean = 1.94 for (int i = 0; i < numit_; ++i) { real tau1 = Math::hypot(real(1), tau), sig = sinh( _e * Math::atanh(_e * tau / tau1 ) ), taupa = Math::hypot(real(1), sig) * tau - sig * tau1, dtau = (taup - taupa) * (1 + _mv * Math::sq(tau)) / ( _mv * tau1 * Math::hypot(real(1), taupa) ); tau += dtau; if (!(abs(dtau) >= stol)) break; } return tau; } void TransverseMercatorExact::zeta(real /*u*/, real snu, real cnu, real dnu, real /*v*/, real snv, real cnv, real dnv, real& taup, real& lam) const throw() { // Lee 54.17 but write // atanh(snu * dnv) = asinh(snu * dnv / sqrt(cnu^2 + _mv * snu^2 * snv^2)) // atanh(_e * snu / dnv) = // asinh(_e * snu / sqrt(_mu * cnu^2 + _mv * cnv^2)) real d1 = sqrt(Math::sq(cnu) + _mv * Math::sq(snu * snv)), d2 = sqrt(_mu * Math::sq(cnu) + _mv * Math::sq(cnv)), t1 = (d1 ? snu * dnv / d1 : (snu < 0 ? -overflow_ : overflow_)), t2 = (d2 ? sinh( _e * Math::asinh(_e * snu / d2) ) : (snu < 0 ? -overflow_ : overflow_)); // psi = asinh(t1) - asinh(t2) // taup = sinh(psi) taup = t1 * Math::hypot(real(1), t2) - t2 * Math::hypot(real(1), t1); lam = (d1 != 0 && d2 != 0) ? atan2(dnu * snv, cnu * cnv) - _e * atan2(_e * cnu * snv, dnu * cnv) : 0; } void TransverseMercatorExact::dwdzeta(real /*u*/, real snu, real cnu, real dnu, real /*v*/, real snv, real cnv, real dnv, real& du, real& dv) const throw() { // Lee 54.21 but write (1 - dnu^2 * snv^2) = (cnv^2 + _mu * snu^2 * snv^2) // (see A+S 16.21.4) real d = _mv * Math::sq(Math::sq(cnv) + _mu * Math::sq(snu * snv)); du = cnu * dnu * dnv * (Math::sq(cnv) - _mu * Math::sq(snu * snv)) / d; dv = -snu * snv * cnv * (Math::sq(dnu * dnv) + _mu * Math::sq(cnu)) / d; } // Starting point for zetainv bool TransverseMercatorExact::zetainv0(real psi, real lam, real& u, real& v) const throw() { bool retval = false; if (psi < -_e * Math::pi()/4 && lam > (1 - 2 * _e) * Math::pi()/2 && psi < lam - (1 - _e) * Math::pi()/2) { // N.B. this branch is normally not taken because psi < 0 is converted // psi > 0 by Forward. // // There's a log singularity at w = w0 = Eu.K() + i * Ev.K(), // corresponding to the south pole, where we have, approximately // // psi = _e + i * pi/2 - _e * atanh(cos(i * (w - w0)/(1 + _mu/2))) // // Inverting this gives: real psix = 1 - psi / _e, lamx = (Math::pi()/2 - lam) / _e; u = Math::asinh(sin(lamx) / Math::hypot(cos(lamx), sinh(psix))) * (1 + _mu/2); v = atan2(cos(lamx), sinh(psix)) * (1 + _mu/2); u = _Eu.K() - u; v = _Ev.K() - v; } else if (psi < _e * Math::pi()/2 && lam > (1 - 2 * _e) * Math::pi()/2) { // At w = w0 = i * Ev.K(), we have // // zeta = zeta0 = i * (1 - _e) * pi/2 // zeta' = zeta'' = 0 // // including the next term in the Taylor series gives: // // zeta = zeta0 - (_mv * _e) / 3 * (w - w0)^3 // // When inverting this, we map arg(w - w0) = [-90, 0] to // arg(zeta - zeta0) = [-90, 180] real dlam = lam - (1 - _e) * Math::pi()/2, rad = Math::hypot(psi, dlam), // atan2(dlam-psi, psi+dlam) + 45d gives arg(zeta - zeta0) in range // [-135, 225). Subtracting 180 (since multiplier is negative) makes // range [-315, 45). Multiplying by 1/3 (for cube root) gives range // [-105, 15). In particular the range [-90, 180] in zeta space maps // to [-90, 0] in w space as required. ang = atan2(dlam-psi, psi+dlam) - real(0.75) * Math::pi(); // Error using this guess is about 0.21 * (rad/e)^(5/3) retval = rad < _e * taytol_; rad = Math::cbrt(3 / (_mv * _e) * rad); ang /= 3; u = rad * cos(ang); v = rad * sin(ang) + _Ev.K(); } else { // Use spherical TM, Lee 12.6 -- writing atanh(sin(lam) / cosh(psi)) = // asinh(sin(lam) / hypot(cos(lam), sinh(psi))). This takes care of the // log singularity at zeta = Eu.K() (corresponding to the north pole) v = Math::asinh(sin(lam) / Math::hypot(cos(lam), sinh(psi))); u = atan2(sinh(psi), cos(lam)); // But scale to put 90,0 on the right place u *= _Eu.K() / (Math::pi()/2); v *= _Eu.K() / (Math::pi()/2); } return retval; } // Invert zeta using Newton's method void TransverseMercatorExact::zetainv(real taup, real lam, real& u, real& v) const throw() { real psi = Math::asinh(taup), scal = 1/Math::hypot(real(1), taup); if (zetainv0(psi, lam, u, v)) return; real stol2 = tol2_ / Math::sq(max(psi, real(1))); // min iterations = 2, max iterations = 6; mean = 4.0 for (int i = 0, trip = 0; i < numit_; ++i) { real snu, cnu, dnu, snv, cnv, dnv; _Eu.sncndn(u, snu, cnu, dnu); _Ev.sncndn(v, snv, cnv, dnv); real tau1, lam1, du1, dv1; zeta(u, snu, cnu, dnu, v, snv, cnv, dnv, tau1, lam1); dwdzeta(u, snu, cnu, dnu, v, snv, cnv, dnv, du1, dv1); tau1 -= taup; lam1 -= lam; tau1 *= scal; real delu = tau1 * du1 - lam1 * dv1, delv = tau1 * dv1 + lam1 * du1; u -= delu; v -= delv; if (trip) break; real delw2 = Math::sq(delu) + Math::sq(delv); if (!(delw2 >= stol2)) ++trip; } } void TransverseMercatorExact::sigma(real /*u*/, real snu, real cnu, real dnu, real v, real snv, real cnv, real dnv, real& xi, real& eta) const throw() { // Lee 55.4 writing // dnu^2 + dnv^2 - 1 = _mu * cnu^2 + _mv * cnv^2 real d = _mu * Math::sq(cnu) + _mv * Math::sq(cnv); xi = _Eu.E(snu, cnu, dnu) - _mu * snu * cnu * dnu / d; eta = v - _Ev.E(snv, cnv, dnv) + _mv * snv * cnv * dnv / d; } void TransverseMercatorExact::dwdsigma(real /*u*/, real snu, real cnu, real dnu, real /*v*/, real snv, real cnv, real dnv, real& du, real& dv) const throw() { // Reciprocal of 55.9: dw/ds = dn(w)^2/_mv, expanding complex dn(w) using // A+S 16.21.4 real d = _mv * Math::sq(Math::sq(cnv) + _mu * Math::sq(snu * snv)); real dnr = dnu * cnv * dnv, dni = - _mu * snu * cnu * snv; du = (Math::sq(dnr) - Math::sq(dni)) / d; dv = 2 * dnr * dni / d; } // Starting point for sigmainv bool TransverseMercatorExact::sigmainv0(real xi, real eta, real& u, real& v) const throw() { bool retval = false; if (eta > real(1.25) * _Ev.KE() || (xi < -real(0.25) * _Eu.E() && xi < eta - _Ev.KE())) { // sigma as a simple pole at w = w0 = Eu.K() + i * Ev.K() and sigma is // approximated by // // sigma = (Eu.E() + i * Ev.KE()) + 1/(w - w0) real x = xi - _Eu.E(), y = eta - _Ev.KE(), r2 = Math::sq(x) + Math::sq(y); u = _Eu.K() + x/r2; v = _Ev.K() - y/r2; } else if ((eta > real(0.75) * _Ev.KE() && xi < real(0.25) * _Eu.E()) || eta > _Ev.KE()) { // At w = w0 = i * Ev.K(), we have // // sigma = sigma0 = i * Ev.KE() // sigma' = sigma'' = 0 // // including the next term in the Taylor series gives: // // sigma = sigma0 - _mv / 3 * (w - w0)^3 // // When inverting this, we map arg(w - w0) = [-pi/2, -pi/6] to // arg(sigma - sigma0) = [-pi/2, pi/2] // mapping arg = [-pi/2, -pi/6] to [-pi/2, pi/2] real deta = eta - _Ev.KE(), rad = Math::hypot(xi, deta), // Map the range [-90, 180] in sigma space to [-90, 0] in w space. See // discussion in zetainv0 on the cut for ang. ang = atan2(deta-xi, xi+deta) - real(0.75) * Math::pi(); // Error using this guess is about 0.068 * rad^(5/3) retval = rad < 2 * taytol_; rad = Math::cbrt(3 / _mv * rad); ang /= 3; u = rad * cos(ang); v = rad * sin(ang) + _Ev.K(); } else { // Else use w = sigma * Eu.K/Eu.E (which is correct in the limit _e -> 0) u = xi * _Eu.K()/_Eu.E(); v = eta * _Eu.K()/_Eu.E(); } return retval; } // Invert sigma using Newton's method void TransverseMercatorExact::sigmainv(real xi, real eta, real& u, real& v) const throw() { if (sigmainv0(xi, eta, u, v)) return; // min iterations = 2, max iterations = 7; mean = 3.9 for (int i = 0, trip = 0; i < numit_; ++i) { real snu, cnu, dnu, snv, cnv, dnv; _Eu.sncndn(u, snu, cnu, dnu); _Ev.sncndn(v, snv, cnv, dnv); real xi1, eta1, du1, dv1; sigma(u, snu, cnu, dnu, v, snv, cnv, dnv, xi1, eta1); dwdsigma(u, snu, cnu, dnu, v, snv, cnv, dnv, du1, dv1); xi1 -= xi; eta1 -= eta; real delu = xi1 * du1 - eta1 * dv1, delv = xi1 * dv1 + eta1 * du1; u -= delu; v -= delv; if (trip) break; real delw2 = Math::sq(delu) + Math::sq(delv); if (!(delw2 >= tol2_)) ++trip; } } void TransverseMercatorExact::Scale(real tau, real /*lam*/, real snu, real cnu, real dnu, real snv, real cnv, real dnv, real& gamma, real& k) const throw() { real sec2 = 1 + Math::sq(tau); // sec(phi)^2 // Lee 55.12 -- negated for our sign convention. gamma gives the bearing // (clockwise from true north) of grid north gamma = atan2(_mv * snu * snv * cnv, cnu * dnu * dnv); // Lee 55.13 with nu given by Lee 9.1 -- in sqrt change the numerator // from // // (1 - snu^2 * dnv^2) to (_mv * snv^2 + cnu^2 * dnv^2) // // to maintain accuracy near phi = 90 and change the denomintor from // // (dnu^2 + dnv^2 - 1) to (_mu * cnu^2 + _mv * cnv^2) // // to maintain accuracy near phi = 0, lam = 90 * (1 - e). Similarly // rewrite sqrt term in 9.1 as // // _mv + _mu * c^2 instead of 1 - _mu * sin(phi)^2 k = sqrt(_mv + _mu / sec2) * sqrt(sec2) * sqrt( (_mv * Math::sq(snv) + Math::sq(cnu * dnv)) / (_mu * Math::sq(cnu) + _mv * Math::sq(cnv)) ); } void TransverseMercatorExact::Forward(real lon0, real lat, real lon, real& x, real& y, real& gamma, real& k) const throw() { // Avoid losing a bit of accuracy in lon (assuming lon0 is an integer) if (lon - lon0 > 180) lon -= lon0 + 360; else if (lon - lon0 <= -180) lon -= lon0 - 360; else lon -= lon0; // Now lon in (-180, 180] // Explicitly enforce the parity int latsign = !_extendp && lat < 0 ? -1 : 1, lonsign = !_extendp && lon < 0 ? -1 : 1; lon *= lonsign; lat *= latsign; bool backside = !_extendp && lon > 90; if (backside) { if (lat == 0) latsign = -1; lon = 180 - lon; } real phi = lat * Math::degree(), lam = lon * Math::degree(), tau = tanx(phi); // u,v = coordinates for the Thompson TM, Lee 54 real u, v; if (lat == 90) { u = _Eu.K(); v = 0; } else if (lat == 0 && lon == 90 * (1 - _e)) { u = 0; v = _Ev.K(); } else zetainv(taup(tau), lam, u, v); real snu, cnu, dnu, snv, cnv, dnv; _Eu.sncndn(u, snu, cnu, dnu); _Ev.sncndn(v, snv, cnv, dnv); real xi, eta; sigma(u, snu, cnu, dnu, v, snv, cnv, dnv, xi, eta); if (backside) xi = 2 * _Eu.E() - xi; y = xi * _a * _k0 * latsign; x = eta * _a * _k0 * lonsign; // Recompute (tau, lam) from (u, v) to improve accuracy of Scale zeta(u, snu, cnu, dnu, v, snv, cnv, dnv, tau, lam); tau=taupinv(tau); Scale(tau, lam, snu, cnu, dnu, snv, cnv, dnv, gamma, k); gamma /= Math::degree(); if (backside) gamma = 180 - gamma; gamma *= latsign * lonsign; k *= _k0; } void TransverseMercatorExact::Reverse(real lon0, real x, real y, real& lat, real& lon, real& gamma, real& k) const throw() { // This undoes the steps in Forward. real xi = y / (_a * _k0), eta = x / (_a * _k0); // Explicitly enforce the parity int latsign = !_extendp && y < 0 ? -1 : 1, lonsign = !_extendp && x < 0 ? -1 : 1; xi *= latsign; eta *= lonsign; bool backside = !_extendp && xi > _Eu.E(); if (backside) xi = 2 * _Eu.E()- xi; // u,v = coordinates for the Thompson TM, Lee 54 real u, v; if (xi == 0 && eta == _Ev.KE()) { u = 0; v = _Ev.K(); } else sigmainv(xi, eta, u, v); real snu, cnu, dnu, snv, cnv, dnv; _Eu.sncndn(u, snu, cnu, dnu); _Ev.sncndn(v, snv, cnv, dnv); real phi, lam, tau; if (v != 0 || u != _Eu.K()) { zeta(u, snu, cnu, dnu, v, snv, cnv, dnv, tau, lam); tau = taupinv(tau); phi = atan(tau); lat = phi / Math::degree(); lon = lam / Math::degree(); } else { tau = overflow_; phi = Math::pi()/2; lat = 90; lon = lam = 0; } Scale(tau, lam, snu, cnu, dnu, snv, cnv, dnv, gamma, k); gamma /= Math::degree(); if (backside) lon = 180 - lon; lon *= lonsign; // Avoid losing a bit of accuracy in lon (assuming lon0 is an integer) if (lon + lon0 >= 180) lon += lon0 - 360; else if (lon + lon0 < -180) lon += lon0 + 360; else lon += lon0; lat *= latsign; if (backside) y = 2 * _Eu.E() - y; y *= _a * _k0 * latsign; x *= _a * _k0 * lonsign; if (backside) gamma = 180 - gamma; gamma *= latsign * lonsign; k *= _k0; } } // namespace GeographicLib geographiclib-1.21/src/CMakeLists.txt0000644000175000017500000000163511745620415017415 0ustar frankiefrankie# $Id: db0813d9df0e4b911eb0282bbf2e5bebca5c6563 $ # Build the library... # Include all the .cpp files in the library. file (GLOB SOURCES *.cpp) file (GLOB HEADERS ${PROJECT_BINARY_DIR}/include/GeographicLib/Config.h ../include/GeographicLib/*.hpp) # Define the library and specify whether it is shared or not. if (GEOGRAPHIC_SHARED_LIB) add_library (Geographic SHARED ${SOURCES} ${HEADERS}) else () add_library (Geographic STATIC ${SOURCES} ${HEADERS}) endif () # Set the version number on the library if (WIN32) set_target_properties (Geographic PROPERTIES VERSION "${LIBVERSIONFULL}" ) else () set_target_properties (Geographic PROPERTIES VERSION "${LIBVERSIONFULL}" SOVERSION "${LIBVERSION}" ) endif () # Specify where the library is installed, adding it to the export depends install (TARGETS Geographic EXPORT depends RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) geographiclib-1.21/src/Geoid.cpp0000644000175000017500000004430411745620415016410 0ustar frankiefrankie/** * \file Geoid.cpp * \brief Implementation for GeographicLib::Geoid class * * Copyright (c) Charles Karney (2009-2012) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #include #include #include #include #define GEOGRAPHICLIB_GEOID_CPP \ "$Id: 5c3c23dd877485af9c9e298ddb28c5aac12b5e6a $" RCSID_DECL(GEOGRAPHICLIB_GEOID_CPP) RCSID_DECL(GEOGRAPHICLIB_GEOID_HPP) #if !defined(GEOGRAPHICLIB_DATA) # if defined(_MSC_VER) # define GEOGRAPHICLIB_DATA \ "C:/Documents and Settings/All Users/Application Data/GeographicLib" # else # define GEOGRAPHICLIB_DATA "/usr/local/share/GeographicLib" # endif #endif #if !defined(GEOID_DEFAULT_NAME) # define GEOID_DEFAULT_NAME "egm96-5" #endif #if defined(_MSC_VER) // Squelch warnings about unsafe use of getenv #pragma warning (disable: 4996) #endif namespace GeographicLib { using namespace std; // This is the transfer matrix for a 3rd order fit with a 12-point stencil // with weights // // \x -1 0 1 2 // y // -1 . 1 1 . // 0 1 2 2 1 // 1 1 2 2 1 // 2 . 1 1 . // // A algorithm for n-dimensional polynomial fits is described in // F. H. Lesh, // Multi-dimensional least-squares polynomial curve fitting, // CACM 2, 29-30 (1959). // // Here's the Maxima code to generate this matrix: // // /* The stencil and the weights */ // xarr:[ // 0, 1, // -1, 0, 1, 2, // -1, 0, 1, 2, // 0, 1]$ // yarr:[ // -1,-1, // 0, 0, 0, 0, // 1, 1, 1, 1, // 2, 2]$ // warr:[ // 1, 1, // 1, 2, 2, 1, // 1, 2, 2, 1, // 1, 1]$ // // /* [x exponent, y exponent] for cubic fit */ // pows:[ // [0,0], // [1,0],[0,1], // [2,0],[1,1],[0,2], // [3,0],[2,1],[1,2],[0,3]]$ // // basisvec(x,y,pows):=map(lambda([ex],(if ex[1]=0 then 1 else x^ex[1])* // (if ex[2]=0 then 1 else y^ex[2])),pows)$ // addterm(x,y,f,w,pows):=block([a,b,bb:basisvec(x,y,pows)], // a:w*(transpose(bb).bb), // b:(w*f) * bb, // [a,b])$ // // c3row(k):=block([a,b,c,pows:pows,n], // n:length(pows), // a:zeromatrix(n,n), // b:copylist(part(a,1)), // c:[a,b], // for i:1 thru length(xarr) do // c:c+addterm(xarr[i],yarr[i],if i=k then 1 else 0,warr[i],pows), // a:c[1],b:c[2], // part(transpose( a^^-1 . transpose(b)),1))$ // c3:[]$ // for k:1 thru length(warr) do c3:endcons(c3row(k),c3)$ // c3:apply(matrix,c3)$ // c0:part(ratsimp( // genmatrix(yc,1,length(warr)).abs(c3).genmatrix(yd,length(pows),1)),2)$ // c3:c0*c3$ const Math::real Geoid::c0_ = 240; // Common denominator const Math::real Geoid::c3_[stencilsize_ * nterms_] = { 9, -18, -88, 0, 96, 90, 0, 0, -60, -20, -9, 18, 8, 0, -96, 30, 0, 0, 60, -20, 9, -88, -18, 90, 96, 0, -20, -60, 0, 0, 186, -42, -42, -150, -96, -150, 60, 60, 60, 60, 54, 162, -78, 30, -24, -90, -60, 60, -60, 60, -9, -32, 18, 30, 24, 0, 20, -60, 0, 0, -9, 8, 18, 30, -96, 0, -20, 60, 0, 0, 54, -78, 162, -90, -24, 30, 60, -60, 60, -60, -54, 78, 78, 90, 144, 90, -60, -60, -60, -60, 9, -8, -18, -30, -24, 0, 20, 60, 0, 0, -9, 18, -32, 0, 24, 30, 0, 0, -60, 20, 9, -18, -8, 0, -24, -30, 0, 0, 60, 20, }; // Like c3, but with the coeffs of x, x^2, and x^3 constrained to be zero. // Use this at the N pole so that the height in independent of the longitude // there. // // Here's the Maxima code to generate this matrix (continued from above). // // /* figure which terms to exclude so that fit is indep of x at y=0 */ // mask:part(zeromatrix(1,length(pows)),1)+1$ // for i:1 thru length(pows) do // if pows[i][1]>0 and pows[i][2]=0 then mask[i]:0$ // // /* Same as c3row but with masked pows. */ // c3nrow(k):=block([a,b,c,powsa:[],n,d,e], // for i:1 thru length(mask) do if mask[i]>0 then // powsa:endcons(pows[i],powsa), // n:length(powsa), // a:zeromatrix(n,n), // b:copylist(part(a,1)), // c:[a,b], // for i:1 thru length(xarr) do // c:c+addterm(xarr[i],yarr[i],if i=k then 1 else 0,warr[i],powsa), // a:c[1],b:c[2], // d:part(transpose( a^^-1 . transpose(b)),1), // e:[], // for i:1 thru length(mask) do // if mask[i]>0 then (e:endcons(first(d),e),d:rest(d)) else e:endcons(0,e), // e)$ // c3n:[]$ // for k:1 thru length(warr) do c3n:endcons(c3nrow(k),c3n)$ // c3n:apply(matrix,c3n)$ // c0n:part(ratsimp( // genmatrix(yc,1,length(warr)).abs(c3n).genmatrix(yd,length(pows),1)),2)$ // c3n:c0n*c3n$ const Math::real Geoid::c0n_ = 372; // Common denominator const Math::real Geoid::c3n_[stencilsize_ * nterms_] = { 0, 0, -131, 0, 138, 144, 0, 0, -102, -31, 0, 0, 7, 0, -138, 42, 0, 0, 102, -31, 62, 0, -31, 0, 0, -62, 0, 0, 0, 31, 124, 0, -62, 0, 0, -124, 0, 0, 0, 62, 124, 0, -62, 0, 0, -124, 0, 0, 0, 62, 62, 0, -31, 0, 0, -62, 0, 0, 0, 31, 0, 0, 45, 0, -183, -9, 0, 93, 18, 0, 0, 0, 216, 0, 33, 87, 0, -93, 12, -93, 0, 0, 156, 0, 153, 99, 0, -93, -12, -93, 0, 0, -45, 0, -3, 9, 0, 93, -18, 0, 0, 0, -55, 0, 48, 42, 0, 0, -84, 31, 0, 0, -7, 0, -48, -42, 0, 0, 84, 31, }; // Like c3n, but y -> 1-y so that h is independent of x at y = 1. Use this // at the S pole so that the height in independent of the longitude there. // // Here's the Maxima code to generate this matrix (continued from above). // // /* Transform c3n to c3s by transforming y -> 1-y */ // vv:[ // v[11],v[12], // v[7],v[8],v[9],v[10], // v[3],v[4],v[5],v[6], // v[1],v[2]]$ // poly:expand(vv.(c3n/c0n).transpose(basisvec(x,1-y,pows)))$ // c3sf[i,j]:=coeff(coeff(coeff(poly,v[i]),x,pows[j][1]),y,pows[j][2])$ // c3s:genmatrix(c3sf,length(vv),length(pows))$ // c0s:part(ratsimp( // genmatrix(yc,1,length(warr)).abs(c3s).genmatrix(yd,length(pows),1)),2)$ // c3s:c0s*c3s$ const Math::real Geoid::c0s_ = 372; // Common denominator const Math::real Geoid::c3s_[stencilsize_ * nterms_] = { 18, -36, -122, 0, 120, 135, 0, 0, -84, -31, -18, 36, -2, 0, -120, 51, 0, 0, 84, -31, 36, -165, -27, 93, 147, -9, 0, -93, 18, 0, 210, 45, -111, -93, -57, -192, 0, 93, 12, 93, 162, 141, -75, -93, -129, -180, 0, 93, -12, 93, -36, -21, 27, 93, 39, 9, 0, -93, -18, 0, 0, 0, 62, 0, 0, 31, 0, 0, 0, -31, 0, 0, 124, 0, 0, 62, 0, 0, 0, -62, 0, 0, 124, 0, 0, 62, 0, 0, 0, -62, 0, 0, 62, 0, 0, 31, 0, 0, 0, -31, -18, 36, -64, 0, 66, 51, 0, 0, -102, 31, 18, -36, 2, 0, -66, -51, 0, 0, 102, 31, }; Geoid::Geoid(const std::string& name, const std::string& path, bool cubic, bool threadsafe) : _name(name) , _dir(path) , _cubic(cubic) , _a( Constants::WGS84_a() ) , _e2( (2 - Constants::WGS84_f()) * Constants::WGS84_f() ) , _degree( Math::degree() ) , _eps( sqrt(numeric_limits::epsilon()) ) , _threadsafe(false) // Set after cache is read { STATIC_ASSERT(sizeof(pixel_t) == pixel_size_, "pixel_t has the wrong size"); if (_dir.empty()) _dir = DefaultGeoidPath(); _filename = _dir + "/" + _name + (pixel_size_ != 4 ? ".pgm" : ".pgm4"); _file.open(_filename.c_str(), ios::binary); if (!(_file.good())) throw GeographicErr("File not readable " + _filename); string s; if (!(getline(_file, s) && s == "P5")) throw GeographicErr("File not in PGM format " + _filename); _offset = numeric_limits::max(); _scale = 0; _maxerror = _rmserror = -1; _description = "NONE"; _datetime = "UNKNOWN"; while (getline(_file, s)) { if (s.empty()) continue; if (s[0] == '#') { istringstream is(s); string commentid, key; if (!(is >> commentid >> key) || commentid != "#") continue; if (key == "Description" || key =="DateTime") { string::size_type p = s.find_first_not_of(" \t", unsigned(is.tellg())); if (p != string::npos) (key == "Description" ? _description : _datetime) = s.substr(p); } else if (key == "Offset") { if (!(is >> _offset)) throw GeographicErr("Error reading offset " + _filename); } else if (key == "Scale") { if (!(is >> _scale)) throw GeographicErr("Error reading scale " + _filename); } else if (key == (_cubic ? "MaxCubicError" : "MaxBilinearError")) { // It's not an error if the error can't be read is >> _maxerror; } else if (key == (_cubic ? "RMSCubicError" : "RMSBilinearError")) { // It's not an error if the error can't be read is >> _rmserror; } } else { istringstream is(s); if (!(is >> _width >> _height)) throw GeographicErr("Error reading raster size " + _filename); break; } } { unsigned maxval; if (!(_file >> maxval)) throw GeographicErr("Error reading maxval " + _filename); if (maxval != pixel_max_) throw GeographicErr("Incorrect value of maxval " + _filename); // Add 1 for whitespace after maxval _datastart = (unsigned long long)(_file.tellg()) + 1ULL; _swidth = (unsigned long long)(_width); } if (_offset == numeric_limits::max()) throw GeographicErr("Offset not set " + _filename); if (_scale == 0) throw GeographicErr("Scale not set " + _filename); if (_scale < 0) throw GeographicErr("Scale must be positive " + _filename); if (_height < 2 || _width < 2) // Coarsest grid spacing is 180deg. throw GeographicErr("Raster size too small " + _filename); if (_width & 1) // This is so that longitude grids can be extended thru the poles. throw GeographicErr("Raster width is odd " + _filename); if (!(_height & 1)) // This is so that latitude grid includes the equator. throw GeographicErr("Raster height is even " + _filename); _file.seekg(0, ios::end); if (!_file.good() || _datastart + pixel_size_ * _swidth * (unsigned long long)(_height) != (unsigned long long)(_file.tellg())) // Possibly this test should be "<" because the file contains, e.g., a // second image. However, for now we are more strict. throw GeographicErr("File has the wrong length " + _filename); _rlonres = _width / real(360); _rlatres = (_height - 1) / real(180); _cache = false; _ix = _width; _iy = _height; // Ensure that file errors throw exceptions _file.exceptions(ifstream::eofbit | ifstream::failbit | ifstream::badbit); if (threadsafe) { CacheAll(); _file.close(); _threadsafe = true; } } Math::real Geoid::height(real lat, real lon, bool gradp, real& gradn, real& grade) const { if (Math::isnan(lat) || Math::isnan(lon)) { if (gradp) gradn = grade = Math::NaN(); return Math::NaN(); } real fx = lon * _rlonres, fy = -lat * _rlatres; int ix = int(floor(fx)), iy = min((_height - 1)/2 - 1, int(floor(fy))); fx -= ix; fy -= iy; iy += (_height - 1)/2; ix += ix < 0 ? _width : (ix >= _width ? -_width : 0); real v00 = 0, v01 = 0, v10 = 0, v11 = 0; real t[nterms_]; if (_threadsafe || !(ix == _ix && iy == _iy)) { if (!_cubic) { v00 = rawval(ix , iy ); v01 = rawval(ix + 1, iy ); v10 = rawval(ix , iy + 1); v11 = rawval(ix + 1, iy + 1); } else { real v[stencilsize_]; int k = 0; v[k++] = rawval(ix , iy - 1); v[k++] = rawval(ix + 1, iy - 1); v[k++] = rawval(ix - 1, iy ); v[k++] = rawval(ix , iy ); v[k++] = rawval(ix + 1, iy ); v[k++] = rawval(ix + 2, iy ); v[k++] = rawval(ix - 1, iy + 1); v[k++] = rawval(ix , iy + 1); v[k++] = rawval(ix + 1, iy + 1); v[k++] = rawval(ix + 2, iy + 1); v[k++] = rawval(ix , iy + 2); v[k++] = rawval(ix + 1, iy + 2); const real* c3x = iy == 0 ? c3n_ : (iy == _height - 2 ? c3s_ : c3_); real c0x = iy == 0 ? c0n_ : (iy == _height - 2 ? c0s_ : c0_); for (unsigned i = 0; i < nterms_; ++i) { t[i] = 0; for (unsigned j = 0; j < stencilsize_; ++j) t[i] += v[j] * c3x[nterms_ * j + i]; t[i] /= c0x; } } } else { // same cell; used cached coefficients if (!_cubic) { v00 = _v00; v01 = _v01; v10 = _v10; v11 = _v11; } else copy(_t, _t + nterms_, t); } if (!_cubic) { real a = (1 - fx) * v00 + fx * v01, b = (1 - fx) * v10 + fx * v11, c = (1 - fy) * a + fy * b, h = _offset + _scale * c; if (gradp) { real phi = lat * _degree, cosphi = cos(phi), sinphi = sin(phi), n = 1/sqrt(1 - _e2 * sinphi * sinphi); gradn = ((1 - fx) * (v00 - v10) + fx * (v01 - v11)) * _rlatres / (_degree * _a * (1 - _e2) * n * n * n); grade = (cosphi > _eps ? ((1 - fy) * (v01 - v00) + fy * (v11 - v10)) / cosphi : (sinphi > 0 ? v11 - v10 : v01 - v00) * _rlatres / _degree ) * _rlonres / (_degree * _a * n); gradn *= _scale; grade *= _scale; } if (!_threadsafe) { _ix = ix; _iy = iy; _v00 = v00; _v01 = v01; _v10 = v10; _v11 = v11; } return h; } else { real h = t[0] + fx * (t[1] + fx * (t[3] + fx * t[6])) + fy * (t[2] + fx * (t[4] + fx * t[7]) + fy * (t[5] + fx * t[8] + fy * t[9])); h = _offset + _scale * h; if (gradp) { // Avoid 0/0 at the poles by backing off 1/100 of a cell size lat = min(lat, 90 - 1/(100 * _rlatres)); lat = max(lat, -90 + 1/(100 * _rlatres)); fy = (90 - lat) * _rlatres; fy -= int(fy); real phi = lat * _degree, cosphi = cos(phi), sinphi = sin(phi), n = 1/sqrt(1 - _e2 * sinphi * sinphi); gradn = t[2] + fx * (t[4] + fx * t[7]) + fy * (2 * t[5] + fx * 2 * t[8] + 3 * fy * t[9]); grade = t[1] + fx * (2 * t[3] + fx * 3 * t[6]) + fy * (t[4] + fx * 2 * t[7] + fy * t[8]); gradn *= - _rlatres / (_degree * _a * (1 - _e2) * n * n * n) * _scale; grade *= _rlonres / (_degree * _a * n * cosphi) * _scale; } if (!_threadsafe) { _ix = ix; _iy = iy; copy(t, t + nterms_, _t); } return h; } } void Geoid::CacheClear() const throw() { if (!_threadsafe) { _cache = false; try { _data.clear(); // Use swap to release memory back to system vector< vector >().swap(_data); } catch (const exception&) { } } } void Geoid::CacheArea(real south, real west, real north, real east) const { if (_threadsafe) throw GeographicErr("Attempt to change cache of threadsafe Geoid"); if (south > north) { CacheClear(); return; } if (west >= 180) west -= 360; // west in [-180, 180) if (east >= 180) east -= 360; if (east <= west) east += 360; // east - west in (0, 360] int iw = int(floor(west * _rlonres)), ie = int(floor(east * _rlonres)), in = int(floor(-north * _rlatres)) + (_height - 1)/2, is = int(floor(-south * _rlatres)) + (_height - 1)/2; in = max(0, min(_height - 2, in)); is = max(0, min(_height - 2, is)); is += 1; ie += 1; if (_cubic) { in -= 1; is += 1; iw -= 1; ie += 1; } if (ie - iw >= _width - 1) { // Include entire longitude range iw = 0; ie = _width - 1; } else { ie += iw < 0 ? _width : (iw >= _width ? -_width : 0); iw += iw < 0 ? _width : (iw >= _width ? -_width : 0); } int oysize = int(_data.size()); _xsize = ie - iw + 1; _ysize = is - in + 1; _xoffset = iw; _yoffset = in; try { _data.resize(_ysize, vector(_xsize)); for (int iy = min(oysize, _ysize); iy--;) _data[iy].resize(_xsize); } catch (const bad_alloc&) { CacheClear(); throw GeographicErr("Insufficient memory for caching " + _filename); } try { for (int iy = in; iy <= is; ++iy) { int iy1 = iy, iw1 = iw; if (iy < 0 || iy >= _height) { // Allow points "beyond" the poles to support interpolation iy1 = iy1 < 0 ? -iy1 : 2 * (_height - 1) - iy1; iw1 += _width/2; if (iw1 >= _width) iw1 -= _width; } int xs1 = min(_width - iw1, _xsize); filepos(iw1, iy1); Utility::readarray (_file, &(_data[iy - in][0]), xs1); if (xs1 < _xsize) { // Wrap around longitude = 0 filepos(0, iy1); Utility::readarray (_file, &(_data[iy - in][xs1]), _xsize - xs1); } } _cache = true; } catch (const exception& e) { CacheClear(); throw GeographicErr(string("Error filling cache ") + e.what()); } } std::string Geoid::DefaultGeoidPath() { string path; char* geoidpath = getenv("GEOID_PATH"); if (geoidpath) path = string(geoidpath); if (path.length()) return path; char* datapath = getenv("GEOGRAPHICLIB_DATA"); if (datapath) path = string(datapath); return (path.length() ? path : string(GEOGRAPHICLIB_DATA)) + "/geoids"; } std::string Geoid::DefaultGeoidName() { string name; char* geoidname = getenv("GEOID_NAME"); if (geoidname) name = string(geoidname); return name.length() ? name : string(GEOID_DEFAULT_NAME); } } // namespace GeographicLib geographiclib-1.21/src/PolygonArea.cpp0000644000175000017500000000736711745620415017611 0ustar frankiefrankie/** * \file PolygonArea.cpp * \brief Implementation for GeographicLib::PolygonArea class * * Copyright (c) Charles Karney (2010, 2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #define GEOGRAPHICLIB_POLYGONAREA_CPP \ "$Id: ae2fce0b24653309ca8835d962b1a3e047a6768a $" RCSID_DECL(GEOGRAPHICLIB_POLYGONAREA_CPP) RCSID_DECL(GEOGRAPHICLIB_POLYGONAREA_HPP) RCSID_DECL(GEOGRAPHICLIB_ACCUMULATOR_HPP) namespace GeographicLib { using namespace std; void PolygonArea::AddPoint(real lat, real lon) throw() { if (_num == 0) { _lat0 = _lat1 = lat; _lon0 = _lon1 = lon; } else { real s12, S12, t; _earth.GenInverse(_lat1, _lon1, lat, lon, _mask, s12, t, t, t, t, t, S12); _perimetersum += s12; if (!_polyline) { _areasum += S12; _crossings += transit(_lon1, lon); } _lat1 = lat; _lon1 = lon; } ++_num; } unsigned PolygonArea::Compute(bool reverse, bool sign, real& perimeter, real& area) const throw() { real s12, S12, t; if (_num < 2) { perimeter = 0; if (!_polyline) area = 0; return _num; } if (_polyline) { perimeter = _perimetersum(); return _num; } _earth.GenInverse(_lat1, _lon1, _lat0, _lon0, _mask, s12, t, t, t, t, t, S12); perimeter = _perimetersum(s12); Accumulator tempsum(_areasum); tempsum += S12; int crossings = _crossings + transit(_lon1, _lon0); if (crossings & 1) tempsum += (tempsum < 0 ? 1 : -1) * _area0/2; // area is with the clockwise sense. If !reverse convert to // counter-clockwise convention. if (!reverse) tempsum *= -1; // If sign put area in (-area0/2, area0/2], else put area in [0, area0) if (sign) { if (tempsum > _area0/2) tempsum -= _area0; else if (tempsum <= -_area0/2) tempsum += _area0; } else { if (tempsum >= _area0) tempsum -= _area0; else if (tempsum < 0) tempsum += _area0; } area = 0 + tempsum(); return _num; } unsigned PolygonArea::TestCompute(real lat, real lon, bool reverse, bool sign, real& perimeter, real& area) const throw() { if (_num == 0) { perimeter = 0; if (!_polyline) area = 0; return 1; } perimeter = _perimetersum(); real tempsum = _polyline ? 0 : _areasum(); int crossings = _crossings, num = _num + 1; for (int i = 0; i < (_polyline ? 1 : 2); ++i) { real s12, S12, t; _earth.GenInverse(i == 0 ? _lat1 : lat, i == 0 ? _lon1 : lon, i != 0 ? _lat0 : lat, i != 0 ? _lon0 : lon, _mask, s12, t, t, t, t, t, S12); perimeter += s12; if (!_polyline) { tempsum += S12; crossings += transit(i == 0 ? _lon1 : lon, i != 0 ? _lon0 : lon); } } if (_polyline) return num; if (crossings & 1) tempsum += (tempsum < 0 ? 1 : -1) * _area0/2; // area is with the clockwise sense. If !reverse convert to // counter-clockwise convention. if (!reverse) tempsum *= -1; // If sign put area in (-area0/2, area0/2], else put area in [0, area0) if (sign) { if (tempsum > _area0/2) tempsum -= _area0; else if (tempsum <= -_area0/2) tempsum += _area0; } else { if (tempsum >= _area0) tempsum -= _area0; else if (tempsum < 0) tempsum += _area0; } area = 0 + tempsum; return num; } } // namespace GeographicLib geographiclib-1.21/src/SphericalEngine.cpp0000644000175000017500000004512311745620415020421 0ustar frankiefrankie/** * \file SphericalEngine.cpp * \brief Implementation for GeographicLib::SphericalEngine class * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * The general sum is\verbatim V(r, theta, lambda) = sum(n = 0..N) sum(m = 0..n) q^(n+1) * (C[n,m] * cos(m*lambda) + S[n,m] * sin(m*lambda)) * P[n,m](t) \endverbatim * where t = cos(theta), q = a/r. In addition write u = * sin(theta). * * P[n,m] is a normalized associated Legendre function of degree * n and order m. Here the formulas are given for full * normalized functions (usually denoted Pbar). * * Rewrite outer sum\verbatim V(r, theta, lambda) = sum(m = 0..N) * P[m,m](t) * q^(m+1) * [Sc[m] * cos(m*lambda) + Ss[m] * sin(m*lambda)] \endverbatim * where the inner sums are\verbatim Sc[m] = sum(n = m..N) q^(n-m) * C[n,m] * P[n,m](t)/P[m,m](t) Ss[m] = sum(n = m..N) q^(n-m) * S[n,m] * P[n,m](t)/P[m,m](t) \endverbatim * Evaluate sums via Clenshaw method. The overall framework is similar to * Deakin with the following changes: * - Clenshaw summation is used to roll the computation of * cos(m*lambda) and sin(m*lambda) into the evaluation of * the outer sum (rather than independently computing an array of these * trigonometric terms). * - Scale the coefficients to guard against overflow when N is large. * . * For the general framework of Clenshaw, see * http://mathworld.wolfram.com/ClenshawRecurrenceFormula.html * * Let\verbatim S = sum(k = 0..N) c[k] * F[k](x) F[n+1](x) = alpha[n](x) * F[n](x) + beta[n](x) * F[n-1](x) \endverbatim * Evaluate S with\verbatim y[N+2] = y[N+1] = 0 y[k] = alpha[k] * y[k+1] + beta[k+1] * y[k+2] + c[k] S = c[0] * F[0] + y[1] * F[1] + beta[1] * F[0] * y[2] \endverbatim * \e IF F[0](x) = 1 and beta(0,x) = 0, then F[1](x) = * alpha(0,x) and we can continue the recursion for y[k] until * y[0], giving\verbatim S = y[0] \endverbatim * * Evaluating the inner sum\verbatim l = n-m; n = l+m Sc[m] = sum(l = 0..N-m) C[l+m,m] * q^l * P[l+m,m](t)/P[m,m](t) F[l] = q^l * P[l+m,m](t)/P[m,m](t) \endverbatim * Holmes + Featherstone, Eq. (11), give\verbatim P[n,m] = sqrt((2*n-1)*(2*n+1)/((n-m)*(n+m))) * t * P[n-1,m] - sqrt((2*n+1)*(n+m-1)*(n-m-1)/((n-m)*(n+m)*(2*n-3))) * P[n-2,m] \endverbatim * thus\verbatim alpha[l] = t * q * sqrt(((2*n+1)*(2*n+3))/ ((n-m+1)*(n+m+1))) beta[l+1] = - q^2 * sqrt(((n-m+1)*(n+m+1)*(2*n+5))/ ((n-m+2)*(n+m+2)*(2*n+1))) \endverbatim * In this case, F[0] = 1 and beta[0] = 0, so the Sc[m] * = y[0]. * * Evaluating the outer sum\verbatim V = sum(m = 0..N) Sc[m] * q^(m+1) * cos(m*lambda) * P[m,m](t) + sum(m = 0..N) Ss[m] * q^(m+1) * cos(m*lambda) * P[m,m](t) F[m] = q^(m+1) * cos(m*lambda) * P[m,m](t) [or sin(m*lambda)] \endverbatim * Holmes + Featherstone, Eq. (13), give\verbatim P[m,m] = u * sqrt((2*m+1)/((m>1?2:1)*m)) * P[m-1,m-1] \endverbatim * also, we have\verbatim cos((m+1)*lambda) = 2*cos(lambda)*cos(m*lambda) - cos((m-1)*lambda) \endverbatim * thus\verbatim alpha[m] = 2*cos(lambda) * sqrt((2*m+3)/(2*(m+1))) * u * q = cos(lambda) * sqrt( 2*(2*m+3)/(m+1) ) * u * q beta[m+1] = -sqrt((2*m+3)*(2*m+5)/(4*(m+1)*(m+2))) * u^2 * q^2 * (m == 0 ? sqrt(2) : 1) \endverbatim * Thus\verbatim F[0] = q [or 0] F[1] = cos(lambda) * sqrt(3) * u * q^2 [or sin(lambda)] beta[1] = - sqrt(15/4) * u^2 * q^2 \endverbatim * * Here is how the various components of the gradient are computed * * Differentiate wrt r\verbatim d q^(n+1) / dr = (-1/r) * (n+1) * q^(n+1) \endverbatim * so multiply C[n,m] by n+1 in inner sum and multiply the * sum by -1/r. * * Differentiate wrt lambda\verbatim d cos(m*lambda) = -m * sin(m*lambda) d sin(m*lambda) = m * cos(m*lambda) \endverbatim * so multiply terms by m in outer sum and swap sine and cosine * variables. * * Differentiate wrt theta\verbatim dV/dtheta = V' = -u * dV/dt = -u * V' \endverbatim * here ' denotes differentiation wrt theta.\verbatim d/dtheta (Sc[m] * P[m,m](t)) = Sc'[m] * P[m,m](t) + Sc[m] * P'[m,m](t) \endverbatim * Now P[m,m](t) = const * u^m, so P'[m,m](t) = m * t/u * * P[m,m](t), thus\verbatim d/dtheta (Sc[m] * P[m,m](t)) = (Sc'[m] + m * t/u * Sc[m]) * P[m,m](t) \endverbatim * Clenshaw recursion for Sc[m] reads\verbatim y[k] = alpha[k] * y[k+1] + beta[k+1] * y[k+2] + c[k] \endverbatim * Substituting alpha[k] = const * t, alpha'[k] = -u/t * * alpha[k], beta'[k] = c'[k] = 0 gives\verbatim y'[k] = alpha[k] * y'[k+1] + beta[k+1] * y'[k+2] - u/t * alpha[k] * y[k+1] \endverbatim * * Finally, given the derivatives of V, we can compute the components * of the gradient in spherical coordinates and transform the result into * cartesian coordinates. **********************************************************************/ #include #include #include #include #include #define GEOGRAPHICLIB_SPHERICALENGINE_CPP \ "$Id: 861a718d09c83cdd9bf58939d938a25797b9f306 $" RCSID_DECL(GEOGRAPHICLIB_SPHERICALENGINE_CPP) RCSID_DECL(GEOGRAPHICLIB_SPHERICALENGINE_HPP) namespace GeographicLib { using namespace std; const Math::real SphericalEngine::scale_ = pow(real(numeric_limits::radix), -3 * numeric_limits::max_exponent / 5); const Math::real SphericalEngine::eps_ = numeric_limits::epsilon() * sqrt(numeric_limits::epsilon()); const vector SphericalEngine::Z_(0); vector SphericalEngine::root_(0); template Math::real SphericalEngine::Value(const coeff c[], const real f[], real x, real y, real z, real a, real& gradx, real& grady, real& gradz) throw() { STATIC_ASSERT(L > 0, "L must be positive"); STATIC_ASSERT(norm == FULL || norm == SCHMIDT, "Unknown normalization"); int N = c[0].nmx(), M = c[0].mmx(); real p = Math::hypot(x, y), cl = p ? x / p : 1, // cos(lambda); at pole, pick lambda = 0 sl = p ? y / p : 0, // sin(lambda) r = Math::hypot(z, p), t = r ? z / r : 0, // cos(theta); at origin, pick theta = pi/2 u = r ? max(p / r, eps_) : 1, // sin(theta); but avoid the pole q = a / r; real q2 = Math::sq(q), uq = u * q, uq2 = Math::sq(uq), tu = t / u; // Initialize outer sum real vc = 0, vc2 = 0, vs = 0, vs2 = 0; // v [N + 1], v [N + 2] // vr, vt, vl and similar w variable accumulate the sums for the // derivatives wrt r, theta, and lambda, respectively. real vrc = 0, vrc2 = 0, vrs = 0, vrs2 = 0; // vr[N + 1], vr[N + 2] real vtc = 0, vtc2 = 0, vts = 0, vts2 = 0; // vt[N + 1], vt[N + 2] real vlc = 0, vlc2 = 0, vls = 0, vls2 = 0; // vl[N + 1], vl[N + 2] int k[L]; for (int m = M; m >= 0; --m) { // m = M .. 0 // Initialize inner sum real wc = 0, wc2 = 0, ws = 0, ws2 = 0; // w [N - m + 1], w [N - m + 2] real wrc = 0, wrc2 = 0, wrs = 0, wrs2 = 0; // wr[N - m + 1], wr[N - m + 2] real wtc = 0, wtc2 = 0, wts = 0, wts2 = 0; // wt[N - m + 1], wt[N - m + 2] for (int l = 0; l < L; ++l) k[l] = c[l].index(N, m) + 1; for (int n = N; n >= m; --n) { // n = N .. m; l = N - m .. 0 real w, A, Ax, B, R; // alpha[l], beta[l + 1] switch (norm) { case FULL: w = root_[2 * n + 1] / (root_[n - m + 1] * root_[n + m + 1]); Ax = q * w * root_[2 * n + 3]; A = t * Ax; B = - q2 * root_[2 * n + 5] / (w * root_[n - m + 2] * root_[n + m + 2]); break; case SCHMIDT: w = root_[n - m + 1] * root_[n + m + 1]; Ax = q * (2 * n + 1) / w; A = t * Ax; B = - q2 * w / (root_[n - m + 2] * root_[n + m + 2]); break; } R = c[0].Cv(--k[0]); for (int l = 1; l < L; ++l) R += c[l].Cv(--k[l], n, m, f[l]); R *= scale_; w = A * wc + B * wc2 + R; wc2 = wc; wc = w; if (gradp) { w = A * wrc + B * wrc2 + (n + 1) * R; wrc2 = wrc; wrc = w; w = A * wtc + B * wtc2 - u*Ax * wc2; wtc2 = wtc; wtc = w; } if (m) { R = c[0].Sv(k[0]); for (int l = 1; l < L; ++l) R += c[l].Sv(k[l], n, m, f[l]); R *= scale_; w = A * ws + B * ws2 + R; ws2 = ws; ws = w; if (gradp) { w = A * wrs + B * wrs2 + (n + 1) * R; wrs2 = wrs; wrs = w; w = A * wts + B * wts2 - u*Ax * ws2; wts2 = wts; wts = w; } } } // Now Sc[m] = wc, Ss[m] = ws // Sc'[m] = wtc, Ss'[m] = wtc if (m) { real v, A, B; // alpha[m], beta[m + 1] switch (norm) { case FULL: v = root_[2] * root_[2 * m + 3] / root_[m + 1]; A = cl * v * uq; B = - v * root_[2 * m + 5] / (root_[8] * root_[m + 2]) * uq2; break; case SCHMIDT: v = root_[2] * root_[2 * m + 1] / root_[m + 1]; A = cl * v * uq; B = - v * root_[2 * m + 3] / (root_[8] * root_[m + 2]) * uq2; break; } v = A * vc + B * vc2 + wc ; vc2 = vc ; vc = v; v = A * vs + B * vs2 + ws ; vs2 = vs ; vs = v; if (gradp) { // Include the terms Sc[m] * P'[m,m](t) and Ss[m] * P'[m,m](t) wtc += m * tu * wc; wts += m * tu * ws; v = A * vrc + B * vrc2 + wrc; vrc2 = vrc; vrc = v; v = A * vrs + B * vrs2 + wrs; vrs2 = vrs; vrs = v; v = A * vtc + B * vtc2 + wtc; vtc2 = vtc; vtc = v; v = A * vts + B * vts2 + wts; vts2 = vts; vts = v; v = A * vlc + B * vlc2 + m*ws; vlc2 = vlc; vlc = v; v = A * vls + B * vls2 - m*wc; vls2 = vls; vls = v; } } else { real A, B, qs; switch (norm) { case FULL: A = root_[3] * uq; // F[1]/(q*cl) or F[1]/(q*sl) B = - root_[15]/2 * uq2; // beta[1]/q break; case SCHMIDT: A = uq; B = - root_[3]/2 * uq2; break; } qs = q / scale_; vc = qs * (wc + A * (cl * vc + sl * vs ) + B * vc2); if (gradp) { qs /= r; // The components of the gradient in spherical coordinates are // r: dV/dr // theta: 1/r * dV/dtheta // lambda: 1/(r*u) * dV/dlambda vrc = - qs * (wrc + A * (cl * vrc + sl * vrs) + B * vrc2); vtc = qs * (wtc + A * (cl * vtc + sl * vts) + B * vtc2); vlc = qs / u * ( A * (cl * vlc + sl * vls) + B * vlc2); } } } if (gradp) { // Rotate into cartesian (geocentric) coordinates gradx = cl * (u * vrc + t * vtc) - sl * vlc; grady = sl * (u * vrc + t * vtc) + cl * vlc; gradz = t * vrc - u * vtc ; } return vc; } template CircularEngine SphericalEngine::Circle(const coeff c[], const real f[], real p, real z, real a) { STATIC_ASSERT(L > 0, "L must be positive"); STATIC_ASSERT(norm == FULL || norm == SCHMIDT, "Unknown normalization"); int N = c[0].nmx(), M = c[0].mmx(); real r = Math::hypot(z, p), t = r ? z / r : 0, // cos(theta); at origin, pick theta = pi/2 u = r ? max(p / r, eps_) : 1, // sin(theta); but avoid the pole q = a / r; real q2 = Math::sq(q), tu = t / u; CircularEngine circ(M, gradp, norm, a, r, u, t); int k[L]; for (int m = M; m >= 0; --m) { // m = M .. 0 // Initialize inner sum real wc = 0, wc2 = 0, ws = 0, ws2 = 0; // w [N - m + 1], w [N - m + 2] real wrc = 0, wrc2 = 0, wrs = 0, wrs2 = 0; // wr[N - m + 1], wr[N - m + 2] real wtc = 0, wtc2 = 0, wts = 0, wts2 = 0; // wt[N - m + 1], wt[N - m + 2] for (int l = 0; l < L; ++l) k[l] = c[l].index(N, m) + 1; for (int n = N; n >= m; --n) { // n = N .. m; l = N - m .. 0 real w, A, Ax, B, R; // alpha[l], beta[l + 1] switch (norm) { case FULL: w = root_[2 * n + 1] / (root_[n - m + 1] * root_[n + m + 1]); Ax = q * w * root_[2 * n + 3]; A = t * Ax; B = - q2 * root_[2 * n + 5] / (w * root_[n - m + 2] * root_[n + m + 2]); break; case SCHMIDT: w = root_[n - m + 1] * root_[n + m + 1]; Ax = q * (2 * n + 1) / w; A = t * Ax; B = - q2 * w / (root_[n - m + 2] * root_[n + m + 2]); break; } R = c[0].Cv(--k[0]); for (int l = 1; l < L; ++l) R += c[l].Cv(--k[l], n, m, f[l]); R *= scale_; w = A * wc + B * wc2 + R; wc2 = wc; wc = w; if (gradp) { w = A * wrc + B * wrc2 + (n + 1) * R; wrc2 = wrc; wrc = w; w = A * wtc + B * wtc2 - u*Ax * wc2; wtc2 = wtc; wtc = w; } if (m) { R = c[0].Sv(k[0]); for (int l = 1; l < L; ++l) R += c[l].Sv(k[l], n, m, f[l]); R *= scale_; w = A * ws + B * ws2 + R; ws2 = ws; ws = w; if (gradp) { w = A * wrs + B * wrs2 + (n + 1) * R; wrs2 = wrs; wrs = w; w = A * wts + B * wts2 - u*Ax * ws2; wts2 = wts; wts = w; } } } if (!gradp) circ.SetCoeff(m, wc, ws); else { // Include the terms Sc[m] * P'[m,m](t) and Ss[m] * P'[m,m](t) wtc += m * tu * wc; wts += m * tu * ws; circ.SetCoeff(m, wc, ws, wrc, wrs, wtc, wts); } } return circ; } void SphericalEngine::RootTable(int N) { // Need square roots up to max(2 * N + 5, 15). int L = max(2 * N + 5, 15) + 1, oldL = int(root_.size()); if (oldL >= L) return; root_.resize(L); for (int l = oldL; l < L; ++l) root_[l] = sqrt(real(l)); } void SphericalEngine::coeff::readcoeffs(std::istream& stream, int& N, int& M, std::vector& C, std::vector& S) { int nm[2]; Utility::readarray(stream, nm, 2); N = nm[0]; M = nm[1]; if (!(N >= M && M >= -1 && N * M >= 0)) // The last condition is that M = -1 implies N = -1 and vice versa. throw GeographicErr("Bad degree and order " + Utility::str(N) + " " + Utility::str(M)); C.resize(SphericalEngine::coeff::Csize(N, M)); Utility::readarray(stream, C); S.resize(SphericalEngine::coeff::Ssize(N, M)); Utility::readarray(stream, S); return; } /// \cond SKIP template Math::real SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template CircularEngine SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine SphericalEngine::Circle (const coeff[], const real[], real, real, real); /// \endcond } // namespace GeographicLib geographiclib-1.21/src/LocalCartesian.cpp0000644000175000017500000000454511745620415020250 0ustar frankiefrankie/** * \file LocalCartesian.cpp * \brief Implementation for GeographicLib::LocalCartesian class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #define GEOGRAPHICLIB_LOCALCARTESIAN_CPP \ "$Id: 4d15764c089e07855bf6db300271e18f4fa89624 $" RCSID_DECL(GEOGRAPHICLIB_LOCALCARTESIAN_CPP) RCSID_DECL(GEOGRAPHICLIB_LOCALCARTESIAN_HPP) namespace GeographicLib { using namespace std; void LocalCartesian::Reset(real lat0, real lon0, real h0) throw() { _lat0 = lat0; _lon0 = lon0 >= 180 ? lon0 - 360 : (lon0 < -180 ? lon0 + 360 : lon0); _h0 = h0; _earth.Forward(_lat0, _lon0, _h0, _x0, _y0, _z0); real phi = lat0 * Math::degree(), sphi = sin(phi), cphi = abs(_lat0) == 90 ? 0 : cos(phi), lam = lon0 * Math::degree(), slam = _lon0 == -180 ? 0 : sin(lam), clam = abs(_lon0) == 90 ? 0 : cos(lam); _earth.Rotation(sphi, cphi, slam, clam, _r); } void LocalCartesian::MatrixMultiply(real M[dim2_]) const throw() { real t[dim2_]; copy(M, M + dim2_, t); for (size_t i = 0; i < dim2_; ++i) { size_t row = i / dim_, col = i % dim_; M[i] = _r[row] * t[col] + _r[row+3] * t[col+3] + _r[row+6] * t[col+6]; } } void LocalCartesian::IntForward(real lat, real lon, real h, real& x, real& y, real& z, real M[dim2_]) const throw() { real xc, yc, zc; _earth.IntForward(lat, lon, h, xc, yc, zc, M); xc -= _x0; yc -= _y0; zc -= _z0; x = _r[0] * xc + _r[3] * yc + _r[6] * zc; y = _r[1] * xc + _r[4] * yc + _r[7] * zc; z = _r[2] * xc + _r[5] * yc + _r[8] * zc; if (M) MatrixMultiply(M); } void LocalCartesian::IntReverse(real x, real y, real z, real& lat, real& lon, real& h, real M[dim2_]) const throw() { real xc = _x0 + _r[0] * x + _r[1] * y + _r[2] * z, yc = _y0 + _r[3] * x + _r[4] * y + _r[5] * z, zc = _z0 + _r[6] * x + _r[7] * y + _r[8] * z; _earth.IntReverse(xc, yc, zc, lat, lon, h, M); if (M) MatrixMultiply(M); } } // namespace GeographicLib geographiclib-1.21/src/CircularEngine.cpp0000644000175000017500000000730511745620415020253 0ustar frankiefrankie/** * \file CircularEngine.cpp * \brief Implementation for GeographicLib::CircularEngine class * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #include #define GEOGRAPHICLIB_CIRCULARENGINE_CPP \ "$Id: bdd0d21aa34063706e4042410f06bb0f7844fea9 $" RCSID_DECL(GEOGRAPHICLIB_CIRCULARENGINE_CPP) RCSID_DECL(GEOGRAPHICLIB_CIRCULARENGINE_HPP) namespace GeographicLib { using namespace std; Math::real CircularEngine::Value(bool gradp, real cl, real sl, real& gradx, real& grady, real& gradz) const throw() { gradp = _gradp && gradp; const vector& root_( SphericalEngine::root_ ); // Initialize outer sum real vc = 0, vc2 = 0, vs = 0, vs2 = 0; // v [N + 1], v [N + 2] // vr, vt, vl and similar w variable accumulate the sums for the // derivatives wrt r, theta, and lambda, respectively. real vrc = 0, vrc2 = 0, vrs = 0, vrs2 = 0; // vr[N + 1], vr[N + 2] real vtc = 0, vtc2 = 0, vts = 0, vts2 = 0; // vt[N + 1], vt[N + 2] real vlc = 0, vlc2 = 0, vls = 0, vls2 = 0; // vl[N + 1], vl[N + 2] for (int m = _M; m >= 0; --m) { // m = M .. 0 // Now Sc[m] = wc, Ss[m] = ws // Sc'[m] = wtc, Ss'[m] = wtc if (m) { real v, A, B; // alpha[m], beta[m + 1] switch (_norm) { case FULL: v = root_[2] * root_[2 * m + 3] / root_[m + 1]; A = cl * v * _uq; B = - v * root_[2 * m + 5] / (root_[8] * root_[m + 2]) * _uq2; break; case SCHMIDT: v = root_[2] * root_[2 * m + 1] / root_[m + 1]; A = cl * v * _uq; B = - v * root_[2 * m + 3] / (root_[8] * root_[m + 2]) * _uq2; break; default: A = B = 0; } v = A * vc + B * vc2 + _wc[m] ; vc2 = vc ; vc = v; v = A * vs + B * vs2 + _ws[m] ; vs2 = vs ; vs = v; if (gradp) { v = A * vrc + B * vrc2 + _wrc[m]; vrc2 = vrc; vrc = v; v = A * vrs + B * vrs2 + _wrs[m]; vrs2 = vrs; vrs = v; v = A * vtc + B * vtc2 + _wtc[m]; vtc2 = vtc; vtc = v; v = A * vts + B * vts2 + _wts[m]; vts2 = vts; vts = v; v = A * vlc + B * vlc2 + m*_ws[m]; vlc2 = vlc; vlc = v; v = A * vls + B * vls2 - m*_wc[m]; vls2 = vls; vls = v; } } else { real A, B, qs; switch (_norm) { case FULL: A = root_[3] * _uq; // F[1]/(q*cl) or F[1]/(q*sl) B = - root_[15]/2 * _uq2; // beta[1]/q break; case SCHMIDT: A = _uq; B = - root_[3]/2 * _uq2; break; default: A = B = 0; } qs = _q / SphericalEngine::scale_; vc = qs * (_wc[m] + A * (cl * vc + sl * vs ) + B * vc2); if (gradp) { qs /= _r; // The components of the gradient in circular coordinates are // r: dV/dr // theta: 1/r * dV/dtheta // lambda: 1/(r*u) * dV/dlambda vrc = - qs * (_wrc[m] + A * (cl * vrc + sl * vrs) + B * vrc2); vtc = qs * (_wtc[m] + A * (cl * vtc + sl * vts) + B * vtc2); vlc = qs / _u * ( A * (cl * vlc + sl * vls) + B * vlc2); } } } if (gradp) { // Rotate into cartesian (geocentric) coordinates gradx = cl * (_u * vrc + _t * vtc) - sl * vlc; grady = sl * (_u * vrc + _t * vtc) + cl * vlc; gradz = _t * vrc - _u * vtc ; } return vc; } } // namespace GeographicLib geographiclib-1.21/src/Makefile.am0000644000175000017500000000567211745620415016716 0ustar frankiefrankie# # Makefile.am # # Copyright (C) 2009, Francesco P. Lovergine # $Id: f4da355113a782652c871e23951589bb90e4578b $ AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -Wall -Wextra lib_LTLIBRARIES = libGeographic.la libGeographic_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) libGeographic_la_SOURCES = AlbersEqualArea.cpp \ AzimuthalEquidistant.cpp \ CassiniSoldner.cpp \ CircularEngine.cpp \ DMS.cpp \ EllipticFunction.cpp \ GeoCoords.cpp \ Geocentric.cpp \ Geodesic.cpp \ GeodesicLine.cpp \ Geoid.cpp \ Gnomonic.cpp \ GravityCircle.cpp \ GravityModel.cpp \ LambertConformalConic.cpp \ LocalCartesian.cpp \ MGRS.cpp \ MagneticCircle.cpp \ MagneticModel.cpp \ NormalGravity.cpp \ OSGB.cpp \ PolarStereographic.cpp \ PolygonArea.cpp \ SphericalEngine.cpp \ TransverseMercator.cpp \ TransverseMercatorExact.cpp \ UTMUPS.cpp \ Utility.cpp \ ../include/GeographicLib/Accumulator.hpp \ ../include/GeographicLib/AlbersEqualArea.hpp \ ../include/GeographicLib/AzimuthalEquidistant.hpp \ ../include/GeographicLib/CassiniSoldner.hpp \ ../include/GeographicLib/CircularEngine.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/EllipticFunction.hpp \ ../include/GeographicLib/GeoCoords.hpp \ ../include/GeographicLib/Geocentric.hpp \ ../include/GeographicLib/Geodesic.hpp \ ../include/GeographicLib/GeodesicLine.hpp \ ../include/GeographicLib/Geoid.hpp \ ../include/GeographicLib/Gnomonic.hpp \ ../include/GeographicLib/GravityCircle.hpp \ ../include/GeographicLib/GravityModel.hpp \ ../include/GeographicLib/LambertConformalConic.hpp \ ../include/GeographicLib/LocalCartesian.hpp \ ../include/GeographicLib/MGRS.hpp \ ../include/GeographicLib/MagneticCircle.hpp \ ../include/GeographicLib/MagneticModel.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/NormalGravity.hpp \ ../include/GeographicLib/OSGB.hpp \ ../include/GeographicLib/PolarStereographic.hpp \ ../include/GeographicLib/PolygonArea.hpp \ ../include/GeographicLib/SphericalEngine.hpp \ ../include/GeographicLib/SphericalHarmonic.hpp \ ../include/GeographicLib/SphericalHarmonic1.hpp \ ../include/GeographicLib/SphericalHarmonic2.hpp \ ../include/GeographicLib/TransverseMercator.hpp \ ../include/GeographicLib/TransverseMercatorExact.hpp \ ../include/GeographicLib/UTMUPS.hpp \ ../include/GeographicLib/Utility.hpp \ ../include/GeographicLib/Config.h ../include/GeographicLib/Config.h: ../include/GeographicLib/Config-ac.h ( egrep '\bVERSION\b|\bHAVE_LONG_DOUBLE\b' $< | \ sed -e s/VERSION/GEOGRAPHICLIB_VERSION_STRING/; \ grep WORDS_BIGENDIAN $< | tail -1 ) > $@ $(libGeographic_la_OBJECTS): ../include/GeographicLib/Config.h geographiclib_data=$(datadir)/GeographicLib DEFS=-DGEOGRAPHICLIB_DATA=\"$(geographiclib_data)\" @DEFS@ EXTRA_DIST = Makefile.mk CMakeLists.txt Geographic.pro geographiclib-1.21/src/Makefile.in0000644000175000017500000005456411745620415016733 0ustar frankiefrankie# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Makefile.am # # Copyright (C) 2009, Francesco P. Lovergine # $Id: f4da355113a782652c871e23951589bb90e4578b $ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) libGeographic_la_LIBADD = am_libGeographic_la_OBJECTS = AlbersEqualArea.lo \ AzimuthalEquidistant.lo CassiniSoldner.lo CircularEngine.lo \ DMS.lo EllipticFunction.lo GeoCoords.lo Geocentric.lo \ Geodesic.lo GeodesicLine.lo Geoid.lo Gnomonic.lo \ GravityCircle.lo GravityModel.lo LambertConformalConic.lo \ LocalCartesian.lo MGRS.lo MagneticCircle.lo MagneticModel.lo \ NormalGravity.lo OSGB.lo PolarStereographic.lo PolygonArea.lo \ SphericalEngine.lo TransverseMercator.lo \ TransverseMercatorExact.lo UTMUPS.lo Utility.lo libGeographic_la_OBJECTS = $(am_libGeographic_la_OBJECTS) libGeographic_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(libGeographic_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include/GeographicLib depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libGeographic_la_SOURCES) DIST_SOURCES = $(libGeographic_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = -DGEOGRAPHICLIB_DATA=\"$(geographiclib_data)\" @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POW_LIB = @POW_LIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -Wall -Wextra lib_LTLIBRARIES = libGeographic.la libGeographic_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) libGeographic_la_SOURCES = AlbersEqualArea.cpp \ AzimuthalEquidistant.cpp \ CassiniSoldner.cpp \ CircularEngine.cpp \ DMS.cpp \ EllipticFunction.cpp \ GeoCoords.cpp \ Geocentric.cpp \ Geodesic.cpp \ GeodesicLine.cpp \ Geoid.cpp \ Gnomonic.cpp \ GravityCircle.cpp \ GravityModel.cpp \ LambertConformalConic.cpp \ LocalCartesian.cpp \ MGRS.cpp \ MagneticCircle.cpp \ MagneticModel.cpp \ NormalGravity.cpp \ OSGB.cpp \ PolarStereographic.cpp \ PolygonArea.cpp \ SphericalEngine.cpp \ TransverseMercator.cpp \ TransverseMercatorExact.cpp \ UTMUPS.cpp \ Utility.cpp \ ../include/GeographicLib/Accumulator.hpp \ ../include/GeographicLib/AlbersEqualArea.hpp \ ../include/GeographicLib/AzimuthalEquidistant.hpp \ ../include/GeographicLib/CassiniSoldner.hpp \ ../include/GeographicLib/CircularEngine.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/EllipticFunction.hpp \ ../include/GeographicLib/GeoCoords.hpp \ ../include/GeographicLib/Geocentric.hpp \ ../include/GeographicLib/Geodesic.hpp \ ../include/GeographicLib/GeodesicLine.hpp \ ../include/GeographicLib/Geoid.hpp \ ../include/GeographicLib/Gnomonic.hpp \ ../include/GeographicLib/GravityCircle.hpp \ ../include/GeographicLib/GravityModel.hpp \ ../include/GeographicLib/LambertConformalConic.hpp \ ../include/GeographicLib/LocalCartesian.hpp \ ../include/GeographicLib/MGRS.hpp \ ../include/GeographicLib/MagneticCircle.hpp \ ../include/GeographicLib/MagneticModel.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/NormalGravity.hpp \ ../include/GeographicLib/OSGB.hpp \ ../include/GeographicLib/PolarStereographic.hpp \ ../include/GeographicLib/PolygonArea.hpp \ ../include/GeographicLib/SphericalEngine.hpp \ ../include/GeographicLib/SphericalHarmonic.hpp \ ../include/GeographicLib/SphericalHarmonic1.hpp \ ../include/GeographicLib/SphericalHarmonic2.hpp \ ../include/GeographicLib/TransverseMercator.hpp \ ../include/GeographicLib/TransverseMercatorExact.hpp \ ../include/GeographicLib/UTMUPS.hpp \ ../include/GeographicLib/Utility.hpp \ ../include/GeographicLib/Config.h geographiclib_data = $(datadir)/GeographicLib EXTRA_DIST = Makefile.mk CMakeLists.txt Geographic.pro all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libGeographic.la: $(libGeographic_la_OBJECTS) $(libGeographic_la_DEPENDENCIES) $(libGeographic_la_LINK) -rpath $(libdir) $(libGeographic_la_OBJECTS) $(libGeographic_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AlbersEqualArea.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AzimuthalEquidistant.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CassiniSoldner.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CircularEngine.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DMS.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/EllipticFunction.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeoCoords.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Geocentric.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Geodesic.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeodesicLine.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Geoid.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Gnomonic.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GravityCircle.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GravityModel.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LambertConformalConic.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LocalCartesian.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MGRS.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MagneticCircle.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MagneticModel.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NormalGravity.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OSGB.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PolarStereographic.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PolygonArea.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SphericalEngine.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TransverseMercator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TransverseMercatorExact.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UTMUPS.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Utility.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-libLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am \ install-libLTLIBRARIES install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-libLTLIBRARIES ../include/GeographicLib/Config.h: ../include/GeographicLib/Config-ac.h ( egrep '\bVERSION\b|\bHAVE_LONG_DOUBLE\b' $< | \ sed -e s/VERSION/GEOGRAPHICLIB_VERSION_STRING/; \ grep WORDS_BIGENDIAN $< | tail -1 ) > $@ $(libGeographic_la_OBJECTS): ../include/GeographicLib/Config.h # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: geographiclib-1.21/src/Makefile.mk0000644000175000017500000001003511745620415016715 0ustar frankiefrankie# $Id: fcc7381297d2c8de25e002260cfc217eb6448551 $ LIBSTEM = Geographic LIBRARY = lib$(LIBSTEM).a all: $(LIBRARY) INCLUDEPATH = ../include PREFIX = /usr/local GEOGRAPHICLIB_DATA = $(PREFIX)/share/GeographicLib MODULES = AlbersEqualArea \ AzimuthalEquidistant \ CassiniSoldner \ CircularEngine \ DMS \ EllipticFunction \ GeoCoords \ Geocentric \ Geodesic \ GeodesicLine \ Geoid \ Gnomonic \ GravityCircle \ GravityModel \ LambertConformalConic \ LocalCartesian \ MGRS \ MagneticCircle \ MagneticModel \ NormalGravity \ OSGB \ PolarStereographic \ PolygonArea \ SphericalEngine \ TransverseMercator \ TransverseMercatorExact \ UTMUPS \ Utility EXTRAHEADERS = Accumulator \ Constants \ Math \ SphericalHarmonic \ SphericalHarmonic1 \ SphericalHarmonic2 HEADERS = Config.h $(addsuffix .hpp,$(EXTRAHEADERS) $(MODULES)) SOURCES = $(addsuffix .cpp,$(MODULES)) OBJECTS = $(addsuffix .o,$(MODULES)) CC = g++ -g CXXFLAGS = -g -Wall -Wextra -O3 CPPFLAGS = -I$(INCLUDEPATH) $(DEFINES) \ -DGEOGRAPHICLIB_DATA=\"$(GEOGRAPHICLIB_DATA)\" LDFLAGS = $(LIBRARY) $(LIBRARY): $(OBJECTS) $(AR) r $@ $? VPATH = ../include/GeographicLib INSTALL = install -b install: $(LIBRARY) test -f $(PREFIX)/lib || mkdir -p $(PREFIX)/lib $(INSTALL) -m 644 $^ $(PREFIX)/lib clean: rm -f *.o $(LIBRARY) TAGS: $(HEADERS) $(SOURCES) etags $^ AlbersEqualArea.o: AlbersEqualArea.hpp Config.h Constants.hpp Math.hpp AzimuthalEquidistant.o: AzimuthalEquidistant.hpp Config.h Constants.hpp \ Geodesic.hpp Math.hpp CassiniSoldner.o: CassiniSoldner.hpp Config.h Constants.hpp Geodesic.hpp \ GeodesicLine.hpp Math.hpp CircularEngine.o: CircularEngine.hpp Config.h Constants.hpp Math.hpp \ SphericalEngine.hpp DMS.o: Config.h Constants.hpp DMS.hpp Math.hpp Utility.hpp EllipticFunction.o: Config.h Constants.hpp EllipticFunction.hpp Math.hpp GeoCoords.o: Config.h Constants.hpp DMS.hpp GeoCoords.hpp MGRS.hpp Math.hpp \ UTMUPS.hpp Utility.hpp Geocentric.o: Config.h Constants.hpp Geocentric.hpp Math.hpp Geodesic.o: Config.h Constants.hpp Geodesic.hpp GeodesicLine.hpp Math.hpp GeodesicLine.o: Config.h Constants.hpp Geodesic.hpp GeodesicLine.hpp Math.hpp Geoid.o: Config.h Constants.hpp Geoid.hpp Math.hpp Gnomonic.o: Config.h Constants.hpp Geodesic.hpp GeodesicLine.hpp Gnomonic.hpp \ Math.hpp GravityCircle.o: CircularEngine.hpp Config.h Constants.hpp Geocentric.hpp \ GravityCircle.hpp GravityModel.hpp Math.hpp NormalGravity.hpp \ SphericalEngine.hpp SphericalHarmonic.hpp SphericalHarmonic1.hpp GravityModel.o: CircularEngine.hpp Config.h Constants.hpp Geocentric.hpp \ GravityCircle.hpp GravityModel.hpp Math.hpp NormalGravity.hpp \ SphericalEngine.hpp SphericalHarmonic.hpp SphericalHarmonic1.hpp \ Utility.hpp LambertConformalConic.o: Config.h Constants.hpp LambertConformalConic.hpp \ Math.hpp LocalCartesian.o: Config.h Constants.hpp Geocentric.hpp LocalCartesian.hpp \ Math.hpp MGRS.o: Config.h Constants.hpp MGRS.hpp Math.hpp UTMUPS.hpp Utility.hpp MagneticCircle.o: CircularEngine.hpp Config.h Constants.hpp Geocentric.hpp \ MagneticCircle.hpp Math.hpp SphericalEngine.hpp MagneticModel.o: CircularEngine.hpp Config.h Constants.hpp Geocentric.hpp \ MagneticCircle.hpp MagneticModel.hpp Math.hpp SphericalEngine.hpp \ SphericalHarmonic.hpp Utility.hpp NormalGravity.o: Config.h Constants.hpp Geocentric.hpp Math.hpp \ NormalGravity.hpp OSGB.o: Config.h Constants.hpp Math.hpp OSGB.hpp TransverseMercator.hpp \ Utility.hpp PolarStereographic.o: Config.h Constants.hpp Math.hpp PolarStereographic.hpp PolygonArea.o: Accumulator.hpp Config.h Constants.hpp Geodesic.hpp Math.hpp \ PolygonArea.hpp SphericalEngine.o: CircularEngine.hpp Config.h Constants.hpp Math.hpp \ SphericalEngine.hpp Utility.hpp TransverseMercator.o: Config.h Constants.hpp Math.hpp TransverseMercator.hpp TransverseMercatorExact.o: Config.h Constants.hpp EllipticFunction.hpp \ Math.hpp TransverseMercatorExact.hpp UTMUPS.o: Config.h Constants.hpp MGRS.hpp Math.hpp PolarStereographic.hpp \ TransverseMercator.hpp UTMUPS.hpp Utility.hpp Utility.o: Config.h Constants.hpp Math.hpp Utility.hpp .PHONY: all install clean geographiclib-1.21/src/CassiniSoldner.cpp0000644000175000017500000000621111745620415020274 0ustar frankiefrankie/** * \file CassiniSoldner.cpp * \brief Implementation for GeographicLib::CassiniSoldner class * * Copyright (c) Charles Karney (2009-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #define GEOGRAPHICLIB_CASSINISOLDNER_CPP \ "$Id: 2823df38f3e31fd8b882e2f55ad72d6419b03246 $" RCSID_DECL(GEOGRAPHICLIB_CASSINISOLDNER_CPP) RCSID_DECL(GEOGRAPHICLIB_CASSINISOLDNER_HPP) namespace GeographicLib { using namespace std; const Math::real CassiniSoldner::eps1_ = real(0.01) * sqrt(numeric_limits::epsilon()); const Math::real CassiniSoldner::tiny_ = sqrt(numeric_limits::min()); void CassiniSoldner::Reset(real lat0, real lon0) throw() { _meridian = _earth.Line(lat0, lon0, real(0), Geodesic::LATITUDE | Geodesic::LONGITUDE | Geodesic::DISTANCE | Geodesic::DISTANCE_IN | Geodesic::AZIMUTH); real phi = LatitudeOrigin() * Math::degree(), f = _earth.Flattening(); _sbet0 = (1 - f) * sin(phi); _cbet0 = abs(LatitudeOrigin()) == 90 ? 0 : cos(phi); SinCosNorm(_sbet0, _cbet0); } void CassiniSoldner::Forward(real lat, real lon, real& x, real& y, real& azi, real& rk) const throw() { if (!Init()) return; real dlon = AngNormalize(lon - LongitudeOrigin()); real sig12, s12, azi1, azi2; lat = AngRound(lat); sig12 = _earth.Inverse(lat, -abs(dlon), lat, abs(dlon), s12, azi1, azi2); if (sig12 < 100 * tiny_) sig12 = s12 = 0; sig12 *= real(0.5); s12 *= real(0.5); if (s12 == 0) { real da = (azi2 - azi1)/2; if (abs(dlon) <= 90) { azi1 = 90 - da; azi2 = 90 + da; } else { azi1 = -90 - da; azi2 = -90 + da; } } if (dlon < 0) { azi2 = azi1; s12 = -s12; sig12 = -sig12; } x = s12; azi = AngNormalize(azi2); GeodesicLine perp(_earth.Line(lat, dlon, azi2, Geodesic::GEODESICSCALE)); real t; perp.GenPosition(true, -sig12, Geodesic::GEODESICSCALE, t, t, t, t, t, t, rk, t); real alp0 = perp.EquatorialAzimuth() * Math::degree(), calp0 = cos(alp0), salp0 = sin(alp0), sbet1 = lat >=0 ? calp0 : -calp0, cbet1 = abs(dlon) <= 90 ? abs(salp0) : -abs(salp0), sbet01 = sbet1 * _cbet0 - cbet1 * _sbet0, cbet01 = cbet1 * _cbet0 + sbet1 * _sbet0, sig01 = atan2(sbet01, cbet01) / Math::degree(); _meridian.GenPosition(true, sig01, Geodesic::DISTANCE, t, t, t, y, t, t, t, t); } void CassiniSoldner::Reverse(real x, real y, real& lat, real& lon, real& azi, real& rk) const throw() { if (!Init()) return; real lat1, lon1; real azi0, t; _meridian.Position(y, lat1, lon1, azi0); _earth.Direct(lat1, lon1, azi0 + 90, x, lat, lon, azi, rk, t); } } // namespace GeographicLib geographiclib-1.21/src/AzimuthalEquidistant.cpp0000644000175000017500000000304411745620415021526 0ustar frankiefrankie/** * \file AzimuthalEquidistant.cpp * \brief Implementation for GeographicLib::AzimuthalEquidistant class * * Copyright (c) Charles Karney (2009-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #define GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_CPP \ "$Id: 324fc318b35a411f024cfd5046ba58b8ef819df7 $" RCSID_DECL(GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_CPP) RCSID_DECL(GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP) namespace GeographicLib { using namespace std; const Math::real AzimuthalEquidistant::eps_ = real(0.01) * sqrt(numeric_limits::min()); void AzimuthalEquidistant::Forward(real lat0, real lon0, real lat, real lon, real& x, real& y, real& azi, real& rk) const throw() { real sig, s, azi0, m; sig = _earth.Inverse(lat0, lon0, lat, lon, s, azi0, azi, m); azi0 *= Math::degree(); x = s * sin(azi0); y = s * cos(azi0); rk = !(sig <= eps_) ? m / s : 1; } void AzimuthalEquidistant::Reverse(real lat0, real lon0, real x, real y, real& lat, real& lon, real& azi, real& rk) const throw() { real azi0 = atan2(x, y) / Math::degree(), s = Math::hypot(x, y); real sig, m; sig = _earth.Direct(lat0, lon0, azi0, s, lat, lon, azi, m); rk = !(sig <= eps_) ? m / s : 1; } } // namespace GeographicLib geographiclib-1.21/src/Geocentric.cpp0000644000175000017500000001626011745620415017443 0ustar frankiefrankie/** * \file Geocentric.cpp * \brief Implementation for GeographicLib::Geocentric class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #define GEOGRAPHICLIB_GEOCENTRIC_CPP \ "$Id: b5135e8042dbbbcddfd5894c66b729bf5c43cab9 $" RCSID_DECL(GEOGRAPHICLIB_GEOCENTRIC_CPP) RCSID_DECL(GEOGRAPHICLIB_GEOCENTRIC_HPP) namespace GeographicLib { using namespace std; Geocentric::Geocentric(real a, real f) : _a(a) , _f(f <= 1 ? f : 1/f) , _e2(_f * (2 - _f)) , _e2m(Math::sq(1 - _f)) // 1 - _e2 , _e2a(abs(_e2)) , _e4a(Math::sq(_e2)) , _maxrad(2 * _a / numeric_limits::epsilon()) { if (!(Math::isfinite(_a) && _a > 0)) throw GeographicErr("Major radius is not positive"); if (!(Math::isfinite(_f) && _f < 1)) throw GeographicErr("Minor radius is not positive"); } const Geocentric Geocentric::WGS84(Constants::WGS84_a(), Constants::WGS84_f()); void Geocentric::IntForward(real lat, real lon, real h, real& X, real& Y, real& Z, real M[dim2_]) const throw() { lon = lon >= 180 ? lon - 360 : (lon < -180 ? lon + 360 : lon); real phi = lat * Math::degree(), lam = lon * Math::degree(), sphi = sin(phi), cphi = abs(lat) == 90 ? 0 : cos(phi), n = _a/sqrt(1 - _e2 * Math::sq(sphi)), slam = lon == -180 ? 0 : sin(lam), clam = abs(lon) == 90 ? 0 : cos(lam); Z = ( _e2m * n + h) * sphi; X = (n + h) * cphi; Y = X * slam; X *= clam; if (M) Rotation(sphi, cphi, slam, clam, M); } void Geocentric::IntReverse(real X, real Y, real Z, real& lat, real& lon, real& h, real M[dim2_]) const throw() { real R = Math::hypot(X, Y), slam = R ? Y / R : 0, clam = R ? X / R : 1; h = Math::hypot(R, Z); // Distance to center of earth real sphi, cphi; if (h > _maxrad) { // We really far away (> 12 million light years); treat the earth as a // point and h, above, is an acceptable approximation to the height. // This avoids overflow, e.g., in the computation of disc below. It's // possible that h has overflowed to inf; but that's OK. // // Treat the case X, Y finite, but R overflows to +inf by scaling by 2. R = Math::hypot(X/2, Y/2); slam = R ? (Y/2) / R : 0; clam = R ? (X/2) / R : 1; real H = Math::hypot(Z/2, R); sphi = (Z/2) / H; cphi = R / H; } else if (_e4a == 0) { // Treat the spherical case. Dealing with underflow in the general case // with _e2 = 0 is difficult. Origin maps to N pole same as with // ellipsoid. real H = Math::hypot(h == 0 ? 1 : Z, R); sphi = (h == 0 ? 1 : Z) / H; cphi = R / H; h -= _a; } else { // Treat prolate spheroids by swapping R and Z here and by switching // the arguments to phi = atan2(...) at the end. real p = Math::sq(R / _a), q = _e2m * Math::sq(Z / _a), r = (p + q - _e4a) / 6; if (_f < 0) swap(p, q); if ( !(_e4a * q == 0 && r <= 0) ) { real // Avoid possible division by zero when r = 0 by multiplying // equations for s and t by r^3 and r, resp. S = _e4a * p * q / 4, // S = r^3 * s r2 = Math::sq(r), r3 = r * r2, disc = S * (2 * r3 + S); real u = r; if (disc >= 0) { real T3 = S + r3; // Pick the sign on the sqrt to maximize abs(T3). This minimizes // loss of precision due to cancellation. The result is unchanged // because of the way the T is used in definition of u. T3 += T3 < 0 ? -sqrt(disc) : sqrt(disc); // T3 = (r * t)^3 // N.B. cbrt always returns the real root. cbrt(-8) = -2. real T = Math::cbrt(T3); // T = r * t // T can be zero; but then r2 / T -> 0. u += T + (T != 0 ? r2 / T : 0); } else { // T is complex, but the way u is defined the result is real. real ang = atan2(sqrt(-disc), -(S + r3)); // There are three possible cube roots. We choose the root which // avoids cancellation. Note that disc < 0 implies that r < 0. u += 2 * r * cos(ang / 3); } real v = sqrt(Math::sq(u) + _e4a * q), // guaranteed positive // Avoid loss of accuracy when u < 0. Underflow doesn't occur in // e4 * q / (v - u) because u ~ e^4 when q is small and u < 0. uv = u < 0 ? _e4a * q / (v - u) : u + v, // u+v, guaranteed positive // Need to guard against w going negative due to roundoff in uv - q. w = max(real(0), _e2a * (uv - q) / (2 * v)), // Rearrange expression for k to avoid loss of accuracy due to // subtraction. Division by 0 not possible because uv > 0, w >= 0. k = uv / (sqrt(uv + Math::sq(w)) + w), k1 = _f >= 0 ? k : k - _e2, k2 = _f >= 0 ? k + _e2 : k, d = k1 * R / k2, H = Math::hypot(Z/k1, R/k2); sphi = (Z/k1) / H; cphi = (R/k2) / H; h = (1 - _e2m/k1) * Math::hypot(d, Z); } else { // e4 * q == 0 && r <= 0 // This leads to k = 0 (oblate, equatorial plane) and k + e^2 = 0 // (prolate, rotation axis) and the generation of 0/0 in the general // formulas for phi and h. using the general formula and division by 0 // in formula for h. So handle this case by taking the limits: // f > 0: z -> 0, k -> e2 * sqrt(q)/sqrt(e4 - p) // f < 0: R -> 0, k + e2 -> - e2 * sqrt(q)/sqrt(e4 - p) real zz = sqrt((_f >= 0 ? _e4a - p : p) / _e2m), xx = sqrt( _f < 0 ? _e4a - p : p ), H = Math::hypot(zz, xx); sphi = zz / H; cphi = xx / H; if (Z < 0) sphi = -sphi; // for tiny negative Z (not for prolate) h = - _a * (_f >= 0 ? _e2m : 1) * H / _e2a; } } lat = atan2(sphi, cphi) / Math::degree(); // Negative signs return lon in [-180, 180). lon = -atan2(-slam, clam) / Math::degree(); if (M) Rotation(sphi, cphi, slam, clam, M); } void Geocentric::Rotation(real sphi, real cphi, real slam, real clam, real M[dim2_]) throw() { // This rotation matrix is given by the following quaternion operations // qrot(lam, [0,0,1]) * qrot(phi, [0,-1,0]) * [1,1,1,1]/2 // or // qrot(pi/2 + lam, [0,0,1]) * qrot(-pi/2 + phi , [-1,0,0]) // where // qrot(t,v) = [cos(t/2), sin(t/2)*v[1], sin(t/2)*v[2], sin(t/2)*v[3]] // Local X axis (east) in geocentric coords M[0] = -slam; M[3] = clam; M[6] = 0; // Local Y axis (north) in geocentric coords M[1] = -clam * sphi; M[4] = -slam * sphi; M[7] = cphi; // Local Z axis (up) in geocentric coords M[2] = clam * cphi; M[5] = slam * cphi; M[8] = sphi; } } // namespace GeographicLib geographiclib-1.21/src/Geographic.pro0000644000175000017500000000451011745620415017442 0ustar frankiefrankie# $Id: fb1395afc191fe67ced4b6e7227b5afaa2559a1c $ VERSION = 9.2.4 TEMPLATE = lib INCLUDEPATH = ../include INCLUDEDIR = $$INCLUDEPATH/GeographicLib SOURCES += AlbersEqualArea.cpp SOURCES += AzimuthalEquidistant.cpp SOURCES += CassiniSoldner.cpp SOURCES += CircularEngine.cpp SOURCES += DMS.cpp SOURCES += EllipticFunction.cpp SOURCES += GeoCoords.cpp SOURCES += Geocentric.cpp SOURCES += Geodesic.cpp SOURCES += GeodesicLine.cpp SOURCES += Geoid.cpp SOURCES += Gnomonic.cpp SOURCES += GravityCircle.cpp SOURCES += GravityModel.cpp SOURCES += LambertConformalConic.cpp SOURCES += LocalCartesian.cpp SOURCES += MGRS.cpp SOURCES += MagneticCircle.cpp SOURCES += MagneticModel.cpp SOURCES += NormalGravity.cpp SOURCES += OSGB.cpp SOURCES += PolarStereographic.cpp SOURCES += PolygonArea.cpp SOURCES += SphericalEngine.cpp SOURCES += TransverseMercator.cpp SOURCES += TransverseMercatorExact.cpp SOURCES += UTMUPS.cpp SOURCES += Utility.cpp HEADERS += $$INCLUDEDIR/Accumulator.hpp HEADERS += $$INCLUDEDIR/AlbersEqualArea.hpp HEADERS += $$INCLUDEDIR/AzimuthalEquidistant.hpp HEADERS += $$INCLUDEDIR/CassiniSoldner.hpp HEADERS += $$INCLUDEDIR/CircularEngine.hpp HEADERS += $$INCLUDEDIR/Constants.hpp HEADERS += $$INCLUDEDIR/DMS.hpp HEADERS += $$INCLUDEDIR/EllipticFunction.hpp HEADERS += $$INCLUDEDIR/GeoCoords.hpp HEADERS += $$INCLUDEDIR/Geocentric.hpp HEADERS += $$INCLUDEDIR/Geodesic.hpp HEADERS += $$INCLUDEDIR/GeodesicLine.hpp HEADERS += $$INCLUDEDIR/Geoid.hpp HEADERS += $$INCLUDEDIR/Gnomonic.hpp HEADERS += $$INCLUDEDIR/GravityCircle.hpp HEADERS += $$INCLUDEDIR/GravityModel.hpp HEADERS += $$INCLUDEDIR/LambertConformalConic.hpp HEADERS += $$INCLUDEDIR/LocalCartesian.hpp HEADERS += $$INCLUDEDIR/MGRS.hpp HEADERS += $$INCLUDEDIR/MagneticCircle.hpp HEADERS += $$INCLUDEDIR/MagneticModel.hpp HEADERS += $$INCLUDEDIR/Math.hpp HEADERS += $$INCLUDEDIR/NormalGravity.hpp HEADERS += $$INCLUDEDIR/OSGB.hpp HEADERS += $$INCLUDEDIR/PolarStereographic.hpp HEADERS += $$INCLUDEDIR/PolygonArea.hpp HEADERS += $$INCLUDEDIR/SphericalEngine.hpp HEADERS += $$INCLUDEDIR/SphericalHarmonic.hpp HEADERS += $$INCLUDEDIR/SphericalHarmonic1.hpp HEADERS += $$INCLUDEDIR/SphericalHarmonic2.hpp HEADERS += $$INCLUDEDIR/TransverseMercator.hpp HEADERS += $$INCLUDEDIR/TransverseMercatorExact.hpp HEADERS += $$INCLUDEDIR/UTMUPS.hpp HEADERS += $$INCLUDEDIR/Utility.hpp HEADERS += $$INCLUDEDIR/Config.h geographiclib-1.21/src/GravityCircle.cpp0000644000175000017500000001073211745620415020126 0ustar frankiefrankie/** * \file GravityCircle.cpp * \brief Implementation for GeographicLib::GravityCircle class * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #include #include #include #define GEOGRAPHICLIB_GRAVITYCIRCLE_CPP \ "$Id: 94c2bce8fa9f379b5e3d0e176c89b4989762ef3a $" RCSID_DECL(GEOGRAPHICLIB_GRAVITYCIRCLE_CPP) RCSID_DECL(GEOGRAPHICLIB_GRAVITYCIRCLE_HPP) #define GRAVITY_DEFAULT_PATH "/home/ckarney/geographiclib/gravity" namespace GeographicLib { using namespace std; Math::real GravityCircle::Gravity(real lon, real& gx, real& gy, real& gz) const throw() { real clam, slam, M[Geocentric::dim2_]; CircularEngine::cossin(lon, clam, slam); real Wres = W(clam, slam, gx, gy, gz); Geocentric::Rotation(_sphi, _cphi, slam, clam, M); Geocentric::Unrotate(M, gx, gy, gz, gx, gy, gz); return Wres; } Math::real GravityCircle::Disturbance(real lon, real& deltax, real& deltay, real& deltaz) const throw() { real clam, slam, M[Geocentric::dim2_]; CircularEngine::cossin(lon, clam, slam); real Tres = InternalT(clam, slam, deltax, deltay, deltaz, true, true); Geocentric::Rotation(_sphi, _cphi, slam, clam, M); Geocentric::Unrotate(M, deltax, deltay, deltaz, deltax, deltay, deltaz); return Tres; } Math::real GravityCircle::GeoidHeight(real lon) const throw() { if ((_caps & GEOID_HEIGHT) != GEOID_HEIGHT) return Math::NaN(); real clam, slam, dummy; CircularEngine::cossin(lon, clam, slam); real T = InternalT(clam, slam, dummy, dummy, dummy, false, false); real correction = _corrmult * _correction(clam, slam); return T/_gamma0 + correction; } void GravityCircle::SphericalAnomaly(real lon, real& Dg01, real& xi, real& eta) const throw() { if ((_caps & SPHERICAL_ANOMALY) != SPHERICAL_ANOMALY) { Dg01 = xi = eta = Math::NaN(); return; } real clam, slam; CircularEngine::cossin(lon, clam, slam); real deltax, deltay, deltaz, T = InternalT(clam, slam, deltax, deltay, deltaz, true, false); // Rotate cartesian into spherical coordinates real MC[Geocentric::dim2_]; Geocentric::Rotation(_spsi, _cpsi, slam, clam, MC); Geocentric::Unrotate(MC, deltax, deltay, deltaz, deltax, deltay, deltaz); // H+M, Eq 2-151c Dg01 = - deltaz - 2 * T * _invR; xi = -(deltay/_gamma) / Math::degree(); eta = -(deltax/_gamma) / Math::degree(); } Math::real GravityCircle::W(real clam, real slam, real& gX, real& gY, real& gZ) const throw() { real Wres = V(clam, slam, gX, gY, gZ) + _frot * _P / 2; gX += _frot * clam; gY += _frot * slam; return Wres; } Math::real GravityCircle::V(real clam, real slam, real& GX, real& GY, real& GZ) const throw() { if ((_caps & GRAVITY) != GRAVITY) { GX = GY = GZ = Math::NaN(); return Math::NaN(); } real Vres = _gravitational(clam, slam, GX, GY, GZ), f = _GMmodel / _amodel; Vres *= f; GX *= f; GY *= f; GZ *= f; return Vres; } Math::real GravityCircle::InternalT(real clam, real slam, real& deltaX, real& deltaY, real& deltaZ, bool gradp, bool correct) const throw() { if (gradp) { if ((_caps & DISTURBANCE) != DISTURBANCE) { deltaX = deltaY = deltaZ = Math::NaN(); return Math::NaN(); } } else { if ((_caps & DISTURBING_POTENTIAL) != DISTURBING_POTENTIAL) return Math::NaN(); } if (_dzonal0 == 0) correct = false; real T = (gradp ? _disturbing(clam, slam, deltaX, deltaY, deltaZ) : _disturbing(clam, slam)); T = (T / _amodel - (correct ? _dzonal0 : 0) * _invR) * _GMmodel; if (gradp) { real f = _GMmodel / _amodel; deltaX *= f; deltaY *= f; deltaZ *= f; if (correct) { real r3 = _GMmodel * _dzonal0 * _invR * _invR * _invR; deltaX += _P * clam * r3; deltaY += _P * slam * r3; deltaZ += _Z * r3; } } return T; } } // namespace GeographicLib geographiclib-1.21/src/UTMUPS.cpp0000644000175000017500000002315311745620415016415 0ustar frankiefrankie/** * \file UTMUPS.cpp * \brief Implementation for GeographicLib::UTMUPS class * * Copyright (c) Charles Karney (2008-2012) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #include #include #include #include #include #define GEOGRAPHICLIB_UTMUPS_CPP \ "$Id: 5672b003ee47cd660377c111e3fca2b81da86323 $" RCSID_DECL(GEOGRAPHICLIB_UTMUPS_CPP) RCSID_DECL(GEOGRAPHICLIB_UTMUPS_HPP) namespace GeographicLib { using namespace std; const Math::real UTMUPS::falseeasting_[4] = { MGRS::upseasting_ * MGRS::tile_, MGRS::upseasting_ * MGRS::tile_, MGRS::utmeasting_ * MGRS::tile_, MGRS::utmeasting_ * MGRS::tile_ }; const Math::real UTMUPS::falsenorthing_[4] = { MGRS::upseasting_ * MGRS::tile_, MGRS::upseasting_ * MGRS::tile_, MGRS::maxutmSrow_ * MGRS::tile_, MGRS::minutmNrow_ * MGRS::tile_ }; const Math::real UTMUPS::mineasting_[4] = { MGRS::minupsSind_ * MGRS::tile_, MGRS::minupsNind_ * MGRS::tile_, MGRS::minutmcol_ * MGRS::tile_, MGRS::minutmcol_ * MGRS::tile_ }; const Math::real UTMUPS::maxeasting_[4] = { MGRS::maxupsSind_ * MGRS::tile_, MGRS::maxupsNind_ * MGRS::tile_, MGRS::maxutmcol_ * MGRS::tile_, MGRS::maxutmcol_ * MGRS::tile_ }; const Math::real UTMUPS::minnorthing_[4] = { MGRS::minupsSind_ * MGRS::tile_, MGRS::minupsNind_ * MGRS::tile_, MGRS::minutmSrow_ * MGRS::tile_, (MGRS::minutmNrow_ + MGRS::minutmSrow_ - MGRS::maxutmSrow_) * MGRS::tile_ }; const Math::real UTMUPS::maxnorthing_[4] = { MGRS::maxupsSind_ * MGRS::tile_, MGRS::maxupsNind_ * MGRS::tile_, (MGRS::maxutmSrow_ + MGRS::maxutmNrow_ - MGRS::minutmNrow_) * MGRS::tile_, MGRS::maxutmNrow_ * MGRS::tile_ }; int UTMUPS::StandardZone(real lat, real lon, int setzone) { if (!(setzone >= MINPSEUDOZONE && setzone <= MAXZONE)) throw GeographicErr("Illegal zone requested " + Utility::str(setzone)); if (setzone >= MINZONE || setzone == INVALID) return setzone; if (Math::isnan(lat) || Math::isnan(lon)) // Check if lat or lon is a NaN return INVALID; // Assume lon is in [-180, 360]. if (setzone == UTM || (lat >= -80 && lat < 84)) { // Assume lon is in [-180, 360]. int ilon = int(floor(lon)); if (ilon >= 180) ilon -= 360; int zone = (ilon + 186)/6; int band = MGRS::LatitudeBand(lat); if (band == 7 && zone == 31 && ilon >= 3) zone = 32; else if (band == 9 && ilon >= 0 && ilon < 42) zone = 2 * ((ilon + 183)/12) + 1; return zone; } else return UPS; } void UTMUPS::Forward(real lat, real lon, int& zone, bool& northp, real& x, real& y, real& gamma, real& k, int setzone, bool mgrslimits) { CheckLatLon(lat, lon); bool northp1 = lat >= 0; int zone1 = StandardZone(lat, lon, setzone); if (zone1 == INVALID) { zone = zone1; northp = northp1; x = y = gamma = k = Math::NaN(); return; } real x1, y1, gamma1, k1; bool utmp = zone1 != UPS; if (utmp) { real lon0 = CentralMeridian(zone1), dlon = lon - lon0; dlon = abs(dlon - 360 * floor((dlon + 180)/360)); if (dlon > 60) // Check isn't really necessary because CheckCoords catches this case. // But this allows a more meaningful error message to be given. throw GeographicErr("Longitude " + Utility::str(lon) + "d more than 60d from center of UTM zone " + Utility::str(zone1)); TransverseMercator::UTM.Forward(lon0, lat, lon, x1, y1, gamma1, k1); } else { if (abs(lat) < 70) // Check isn't really necessary ... (see above). throw GeographicErr("Latitude " + Utility::str(lat) + "d more than 20d from " + (northp1 ? "N" : "S") + " pole"); PolarStereographic::UPS.Forward(northp1, lat, lon, x1, y1, gamma1, k1); } int ind = (utmp ? 2 : 0) + (northp1 ? 1 : 0); x1 += falseeasting_[ind]; y1 += falsenorthing_[ind]; if (! CheckCoords(zone1 != UPS, northp1, x1, y1, mgrslimits, false) ) throw GeographicErr("Latitude " + Utility::str(lat) + ", longitude " + Utility::str(lon) + " out of legal range for " + (utmp ? "UTM zone " + Utility::str(zone1) : "UPS")); zone = zone1; northp = northp1; x = x1; y = y1; gamma = gamma1; k = k1; } void UTMUPS::Reverse(int zone, bool northp, real x, real y, real& lat, real& lon, real& gamma, real& k, bool mgrslimits) { if (zone == INVALID || Math::isnan(x) || Math::isnan(y)) { lat = lon = gamma = k = Math::NaN(); return; } if (!(zone >= MINZONE && zone <= MAXZONE)) throw GeographicErr("Zone " + Utility::str(zone) + " not in range [0, 60]"); bool utmp = zone != UPS; CheckCoords(utmp, northp, x, y, mgrslimits); int ind = (utmp ? 2 : 0) + (northp ? 1 : 0); x -= falseeasting_[ind]; y -= falsenorthing_[ind]; if (utmp) TransverseMercator::UTM.Reverse(CentralMeridian(zone), x, y, lat, lon, gamma, k); else PolarStereographic::UPS.Reverse(northp, x, y, lat, lon, gamma, k); } void UTMUPS::CheckLatLon(real lat, real lon) { if (lat < -90 || lat > 90) throw GeographicErr("Latitude " + Utility::str(lat) + "d not in [-90d, 90d]"); if (lon < -180 || lon > 360) throw GeographicErr("Latitude " + Utility::str(lon) + "d not in [-180d, 360d]"); } bool UTMUPS::CheckCoords(bool utmp, bool northp, real x, real y, bool mgrslimits, bool throwp) { // Limits are all multiples of 100km and are all closed on the both ends. // Failure tests are such that NaNs succeed. real slop = mgrslimits ? 0 : MGRS::tile_; int ind = (utmp ? 2 : 0) + (northp ? 1 : 0); if (x < mineasting_[ind] - slop || x > maxeasting_[ind] + slop) { if (!throwp) return false; throw GeographicErr("Easting " + Utility::str(x/1000) + "km not in " + (mgrslimits ? "MGRS/" : "") + (utmp ? "UTM" : "UPS") + " range for " + (northp ? "N" : "S" ) + " hemisphere [" + Utility::str((mineasting_[ind] - slop)/1000) + "km, " + Utility::str((maxeasting_[ind] + slop)/1000) + "km]"); } if (y < minnorthing_[ind] - slop || y > maxnorthing_[ind] + slop) { if (!throwp) return false; throw GeographicErr("Northing " + Utility::str(y/1000) + "km not in " + (mgrslimits ? "MGRS/" : "") + (utmp ? "UTM" : "UPS") + " range for " + (northp ? "N" : "S" ) + " hemisphere [" + Utility::str((minnorthing_[ind] - slop)/1000) + "km, " + Utility::str((maxnorthing_[ind] + slop)/1000) + "km]"); } return true; } void UTMUPS::DecodeZone(const std::string& zonestr, int& zone, bool& northp) { unsigned zlen = unsigned(zonestr.size()); if (zlen == 0) throw GeographicErr("Empty zone specification"); if (zlen > 3) throw GeographicErr("More than 3 characters in zone specification " + zonestr); if (zlen == 3 && toupper(zonestr[0]) == 'I' && toupper(zonestr[1]) == 'N' && toupper(zonestr[2]) == 'V') { zone = INVALID; northp = false; return; } char hemi = toupper(zonestr[zlen - 1]); bool northp1 = hemi == 'N'; if (! (northp1 || hemi == 'S')) throw GeographicErr(string("Illegal hemisphere letter ") + hemi + " in " + zonestr + ", specify N or S"); if (zlen == 1) zone = UPS; else { const char* c = zonestr.c_str(); char* q; int zone1 = strtol(c, &q, 10); if (q == c) throw GeographicErr("No zone number found in " + zonestr); if (q - c != int(zlen) - 1) throw GeographicErr("Extra text " + zonestr.substr(q - c, int(zlen) - 1 - (q - c)) + " in UTM/UPS zone " + zonestr); if (zone1 == UPS) // Don't allow 0N as an alternative to N for UPS coordinates throw GeographicErr("Illegal zone 0 in " + zonestr + ", use just " + hemi + " for UPS"); if (!(zone1 >= MINUTMZONE && zone1 <= MAXUTMZONE)) throw GeographicErr("Zone " + Utility::str(zone1) + " not in range [1, 60]"); zone = zone1; } northp = northp1; } std::string UTMUPS::EncodeZone(int zone, bool northp) { if (zone == INVALID) return string("INV"); if (!(zone >= MINZONE && zone <= MAXZONE)) throw GeographicErr("Zone " + Utility::str(zone) + " not in range [0, 60]"); ostringstream os; if (zone != UPS) os << setfill('0') << setw(2) << zone; os << (northp ? 'N' : 'S'); return os.str(); } Math::real UTMUPS::UTMShift() throw() { return real(MGRS::utmNshift_); } } // namespace GeographicLib geographiclib-1.21/src/OSGB.cpp0000644000175000017500000001173711745620415016117 0ustar frankiefrankie/** * \file OSGB.cpp * \brief Implementation for GeographicLib::OSGB class * * Copyright (c) Charles Karney (2010-2012) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #include #define GEOGRAPHICLIB_OSGB_CPP "$Id: 4bfb35c88866ed936faad797f3cef6f4ece36196 $" RCSID_DECL(GEOGRAPHICLIB_OSGB_CPP) RCSID_DECL(GEOGRAPHICLIB_OSGB_HPP) namespace GeographicLib { using namespace std; const string OSGB::letters_ = "ABCDEFGHJKLMNOPQRSTUVWXYZ"; const string OSGB::digits_ = "0123456789"; const TransverseMercator OSGB::OSGBTM_(MajorRadius(), Flattening(), CentralScale()); Math::real OSGB::computenorthoffset() throw() { real x, y; OSGBTM_.Forward(real(0), OriginLatitude(), real(0), x, y); return FalseNorthing() - y; } const Math::real OSGB::northoffset_ = computenorthoffset(); void OSGB::GridReference(real x, real y, int prec, std::string& gridref) { CheckCoords(x, y); if (!(prec >= 0 && prec <= maxprec_)) throw GeographicErr("OSGB precision " + Utility::str(prec) + " not in [0, " + Utility::str(int(maxprec_)) + "]"); char grid[2 + 2 * maxprec_]; int xh = int(floor(x)) / tile_, yh = int(floor(y)) / tile_; real xf = x - tile_ * xh, yf = y - tile_ * yh; xh += tileoffx_; yh += tileoffy_; int z = 0; grid[z++] = letters_[(tilegrid_ - (yh / tilegrid_) - 1) * tilegrid_ + (xh / tilegrid_)]; grid[z++] = letters_[(tilegrid_ - (yh % tilegrid_) - 1) * tilegrid_ + (xh % tilegrid_)]; real mult = pow(real(base_), max(tilelevel_ - prec, 0)); int ix = int(floor(xf / mult)), iy = int(floor(yf / mult)); for (int c = min(prec, int(tilelevel_)); c--;) { grid[z + c] = digits_[ ix % base_ ]; ix /= base_; grid[z + c + prec] = digits_[ iy % base_ ]; iy /= base_; } if (prec > tilelevel_) { xf -= floor(xf / mult); yf -= floor(yf / mult); mult = pow(real(base_), prec - tilelevel_); ix = int(floor(xf * mult)); iy = int(floor(yf * mult)); for (int c = prec - tilelevel_; c--;) { grid[z + c + tilelevel_] = digits_[ ix % base_ ]; ix /= base_; grid[z + c + tilelevel_ + prec] = digits_[ iy % base_ ]; iy /= base_; } } int mlen = z + 2 * prec; gridref.resize(mlen); copy(grid, grid + mlen, gridref.begin()); } void OSGB::GridReference(const std::string& gridref, real& x, real& y, int& prec, bool centerp) { int len = int(gridref.size()), p = 0; char grid[2 + 2 * maxprec_]; for (int i = 0; i < len; ++i) { if (!isspace(gridref[i])) { if (p >= 2 + 2 * maxprec_) throw GeographicErr("OSGB string " + gridref + " too long"); grid[p++] = gridref[i]; } } len = p; p = 0; if (len < 2) throw GeographicErr("OSGB string " + gridref + " too short"); if (len % 2) throw GeographicErr("OSGB string " + gridref + " has odd number of characters"); int xh = 0, yh = 0; while (p < 2) { int i = Utility::lookup(letters_, grid[p++]); if (i < 0) throw GeographicErr("Illegal prefix character " + gridref); yh = yh * tilegrid_ + tilegrid_ - (i / tilegrid_) - 1; xh = xh * tilegrid_ + (i % tilegrid_); } xh -= tileoffx_; yh -= tileoffy_; int prec1 = (len - p)/2; real unit = tile_, x1 = unit * xh, y1 = unit * yh; for (int i = 0; i < prec1; ++i) { unit /= base_; int ix = Utility::lookup(digits_, grid[p + i]), iy = Utility::lookup(digits_, grid[p + i + prec1]); if (ix < 0 || iy < 0) throw GeographicErr("Encountered a non-digit in " + gridref); x1 += unit * ix; y1 += unit * iy; } if (centerp) { x1 += unit/2; y1 += unit/2; } x = x1; y = y1; prec = prec1; } void OSGB::CheckCoords(real x, real y) { // Limits are all multiples of 100km and are all closed on the lower end // and open on the upper end -- and this is reflected in the error // messages. if (! (x >= minx_ && x < maxx_) ) throw GeographicErr("Easting " + Utility::str(int(floor(x/1000))) + "km not in OSGB range [" + Utility::str(minx_/1000) + "km, " + Utility::str(maxx_/1000) + "km)"); if (! (y >= miny_ && y < maxy_) ) throw GeographicErr("Northing " + Utility::str(int(floor(y/1000))) + "km not in OSGB range [" + Utility::str(miny_/1000) + "km, " + Utility::str(maxy_/1000) + "km)"); } } // namespace GeographicLib geographiclib-1.21/src/Utility.cpp0000644000175000017500000000264011745620415017021 0ustar frankiefrankie/** * \file Utility.cpp * \brief Implementation for GeographicLib::Utility class * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #define GEOGRAPHICLIB_UTILITY_CPP \ "$Id: 6f06d5d8fa9d731dc5a5fa4516838f639a2ba40b $" RCSID_DECL(GEOGRAPHICLIB_UTILITY_CPP) RCSID_DECL(GEOGRAPHICLIB_UTILITY_HPP) namespace GeographicLib { using namespace std; bool Utility::ParseLine(const std::string& line, std::string& key, std::string& val) { const char* spaces = " \t\n\v\f\r"; string::size_type n0 = line.find_first_not_of(spaces); if (n0 == string::npos) return false; // Blank line string::size_type n1 = line.find_first_of('#', n0); if (n0 == n1) return false; // Only a comment val = line.substr(n0, n1 == string::npos ? n1 : n1 - n0); n0 = val.find_first_of(spaces); key = val.substr(0, n0); if (n0 == string::npos) { val = ""; return true; } n0 = val.find_first_not_of(spaces, n0); if (n0 == string::npos) { val = ""; return true; } n1 = val.find_last_not_of(spaces); val = val.substr(n0, n1 + 1 - n0); return true; } } // namespace GeographicLib geographiclib-1.21/src/TransverseMercator.cpp0000644000175000017500000004656311745620415021223 0ustar frankiefrankie/** * \file TransverseMercator.cpp * \brief Implementation for GeographicLib::TransverseMercator class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * This implementation follows closely * JHS 154, ETRS89 - * järjestelmään liittyvät karttaprojektiot, * tasokoordinaatistot ja karttalehtijako (Map projections, plane * coordinates, and map sheet index for ETRS89), published by JUHTA, Finnish * Geodetic Institute, and the National Land Survey of Finland (2006). * * The relevant section is available as the 2008 PDF file * http://docs.jhs-suositukset.fi/jhs-suositukset/JHS154/JHS154_liite1.pdf * * This is a straight transcription of the formulas in this paper with the * following exceptions: * - use of 6th order series instead of 4th order series. This reduces the * error to about 5nm for the UTM range of coordinates (instead of 200nm), * with a speed penalty of only 1%; * - use Newton's method instead of plain iteration to solve for latitude in * terms of isometric latitude in the Reverse method; * - use of Horner's representation for evaluating polynomials and Clenshaw's * method for summing trigonometric series; * - several modifications of the formulas to improve the numerical accuracy; * - evaluating the convergence and scale using the expression for the * projection or its inverse. * * If the preprocessor variable TM_TX_MAXPOW is set to an integer between 4 and * 8, then this specifies the order of the series used for the forward and * reverse transformations. The default value is 6. (The series accurate to * 12th order is given in \ref tmseries.) * * Other equivalent implementations are given in * - http://www.ign.fr/DISPLAY/000/526/702/5267021/NTG_76.pdf * - http://www.lantmateriet.se/upload/filer/kartor/geodesi_gps_och_detaljmatning/geodesi/Formelsamling/Gauss_Conformal_Projection.pdf **********************************************************************/ #include #define GEOGRAPHICLIB_TRANSVERSEMERCATOR_CPP \ "$Id: 7b5a1854a015da061b8fdad0a4b35be7e06fcb9a $" RCSID_DECL(GEOGRAPHICLIB_TRANSVERSEMERCATOR_CPP) RCSID_DECL(GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP) namespace GeographicLib { using namespace std; const Math::real TransverseMercator::tol_ = real(0.1)*sqrt(numeric_limits::epsilon()); // Overflow value s.t. atan(overflow_) = pi/2 const Math::real TransverseMercator::overflow_ = 1 / Math::sq(numeric_limits::epsilon()); TransverseMercator::TransverseMercator(real a, real f, real k0) : _a(a) , _f(f <= 1 ? f : 1/f) , _k0(k0) , _e2(_f * (2 - _f)) , _e(sqrt(abs(_e2))) , _e2m(1 - _e2) // _c = sqrt( pow(1 + _e, 1 + _e) * pow(1 - _e, 1 - _e) ) ) // See, for example, Lee (1976), p 100. , _c( sqrt(_e2m) * exp(eatanhe(real(1))) ) , _n(_f / (2 - _f)) { if (!(Math::isfinite(_a) && _a > 0)) throw GeographicErr("Major radius is not positive"); if (!(Math::isfinite(_f) && _f < 1)) throw GeographicErr("Minor radius is not positive"); if (!(Math::isfinite(_k0) && _k0 > 0)) throw GeographicErr("Scale is not positive"); // If coefficents might overflow_ an int, convert them to double (and they // are all exactly representable as doubles). real nx = Math::sq(_n); switch (maxpow_) { case 4: _b1 = 1/(1+_n)*(nx*(nx+16)+64)/64; _alp[1] = _n*(_n*(_n*(164*_n+225)-480)+360)/720; _bet[1] = _n*(_n*((555-4*_n)*_n-960)+720)/1440; _alp[2] = nx*(_n*(557*_n-864)+390)/1440; _bet[2] = nx*((96-437*_n)*_n+30)/1440; nx *= _n; _alp[3] = (427-1236*_n)*nx/1680; _bet[3] = (119-148*_n)*nx/3360; nx *= _n; _alp[4] = 49561*nx/161280; _bet[4] = 4397*nx/161280; break; case 5: _b1 = 1/(1+_n)*(nx*(nx+16)+64)/64; _alp[1] = _n*(_n*(_n*((328-635*_n)*_n+450)-960)+720)/1440; _bet[1] = _n*(_n*(_n*((-3645*_n-64)*_n+8880)-15360)+11520)/23040; _alp[2] = nx*(_n*(_n*(4496*_n+3899)-6048)+2730)/10080; _bet[2] = nx*(_n*(_n*(4416*_n-3059)+672)+210)/10080; nx *= _n; _alp[3] = nx*(_n*(15061*_n-19776)+6832)/26880; _bet[3] = nx*((-627*_n-592)*_n+476)/13440; nx *= _n; _alp[4] = (49561-171840*_n)*nx/161280; _bet[4] = (4397-3520*_n)*nx/161280; nx *= _n; _alp[5] = 34729*nx/80640; _bet[5] = 4583*nx/161280; break; case 6: _b1 = 1/(1+_n)*(nx*(nx*(nx+4)+64)+256)/256; _alp[1] = _n*(_n*(_n*(_n*(_n*(31564*_n-66675)+34440)+47250)-100800)+ 75600)/151200; _bet[1] = _n*(_n*(_n*(_n*(_n*(384796*_n-382725)-6720)+932400)-1612800)+ 1209600)/2419200; _alp[2] = nx*(_n*(_n*((863232-1983433*_n)*_n+748608)-1161216)+524160)/ 1935360; _bet[2] = nx*(_n*(_n*((1695744-1118711*_n)*_n-1174656)+258048)+80640)/ 3870720; nx *= _n; _alp[3] = nx*(_n*(_n*(670412*_n+406647)-533952)+184464)/725760; _bet[3] = nx*(_n*(_n*(22276*_n-16929)-15984)+12852)/362880; nx *= _n; _alp[4] = nx*(_n*(6601661*_n-7732800)+2230245)/7257600; _bet[4] = nx*((-830251*_n-158400)*_n+197865)/7257600; nx *= _n; _alp[5] = (3438171-13675556*_n)*nx/7983360; _bet[5] = (453717-435388*_n)*nx/15966720; nx *= _n; _alp[6] = 212378941*nx/319334400; _bet[6] = 20648693*nx/638668800; break; case 7: _b1 = 1/(1+_n)*(nx*(nx*(nx+4)+64)+256)/256; _alp[1] = _n*(_n*(_n*(_n*(_n*(_n*(1804025*_n+2020096)-4267200)+2204160)+ 3024000)-6451200)+4838400)/9676800; _bet[1] = _n*(_n*(_n*(_n*(_n*((6156736-5406467*_n)*_n-6123600)-107520)+ 14918400)-25804800)+19353600)/38707200; _alp[2] = nx*(_n*(_n*(_n*(_n*(4626384*_n-9917165)+4316160)+3743040)- 5806080)+2620800)/9676800; _bet[2] = nx*(_n*(_n*(_n*(_n*(829456*_n-5593555)+8478720)-5873280)+ 1290240)+403200)/19353600; nx *= _n; _alp[3] = nx*(_n*(_n*((26816480-67102379*_n)*_n+16265880)-21358080)+ 7378560)/29030400; _bet[3] = nx*(_n*(_n*(_n*(9261899*_n+3564160)-2708640)-2557440)+ 2056320)/58060800; nx *= _n; _alp[4] = nx*(_n*(_n*(155912000*_n+72618271)-85060800)+24532695)/ 79833600; _bet[4] = nx*(_n*(_n*(14928352*_n-9132761)-1742400)+2176515)/79833600; nx *= _n; _alp[5] = nx*(_n*(102508609*_n-109404448)+27505368)/63866880; _bet[5] = nx*((-8005831*_n-1741552)*_n+1814868)/63866880; nx *= _n; _alp[6] = (2760926233.0-12282192400.0*_n)*nx/4151347200.0; _bet[6] = (268433009-261810608*_n)*nx/8302694400.0; nx *= _n; _alp[7] = 1522256789.0*nx/1383782400.0; _bet[7] = 219941297*nx/5535129600.0; break; case 8: _b1 = 1/(1+_n)*(nx*(nx*(nx*(25*nx+64)+256)+4096)+16384)/16384; _alp[1] = _n*(_n*(_n*(_n*(_n*(_n*((37884525-75900428*_n)*_n+42422016)- 89611200)+46287360)+63504000)-135475200)+ 101606400)/203212800; _bet[1] = _n*(_n*(_n*(_n*(_n*(_n*(_n*(31777436*_n-37845269)+43097152)- 42865200)-752640)+104428800)-180633600)+ 135475200)/270950400; _alp[2] = nx*(_n*(_n*(_n*(_n*(_n*(148003883*_n+83274912)-178508970)+ 77690880)+67374720)-104509440)+47174400)/ 174182400; _bet[2] = nx*(_n*(_n*(_n*(_n*(_n*(24749483*_n+14930208)-100683990)+ 152616960)-105719040)+23224320)+7257600)/ 348364800; nx *= _n; _alp[3] = nx*(_n*(_n*(_n*(_n*(318729724*_n-738126169)+294981280)+ 178924680)-234938880)+81164160)/319334400; _bet[3] = nx*(_n*(_n*(_n*((101880889-232468668*_n)*_n+39205760)- 29795040)-28131840)+22619520)/638668800; nx *= _n; _alp[4] = nx*(_n*(_n*((14967552000.0-40176129013.0*_n)*_n+6971354016.0)- 8165836800.0)+2355138720.0)/7664025600.0; _bet[4] = nx*(_n*(_n*(_n*(324154477*_n+1433121792.0)-876745056)- 167270400)+208945440)/7664025600.0; nx *= _n; _alp[5] = nx*(_n*(_n*(10421654396.0*_n+3997835751.0)-4266773472.0)+ 1072709352.0)/2490808320.0; _bet[5] = nx*(_n*(_n*(457888660*_n-312227409)-67920528)+70779852)/ 2490808320.0; nx *= _n; _alp[6] = nx*(_n*(175214326799.0*_n-171950693600.0)+38652967262.0)/ 58118860800.0; _bet[6] = nx*((-19841813847.0*_n-3665348512.0)*_n+3758062126.0)/ 116237721600.0; nx *= _n; _alp[7] = (13700311101.0-67039739596.0*_n)*nx/12454041600.0; _bet[7] = (1979471673.0-1989295244.0*_n)*nx/49816166400.0; nx *= _n; _alp[8] = 1424729850961.0*nx/743921418240.0; _bet[8] = 191773887257.0*nx/3719607091200.0; break; default: STATIC_ASSERT(maxpow_ >= 4 && maxpow_ <= 8, "Bad value of maxpow_"); } // _a1 is the equivalent radius for computing the circumference of // ellipse. _a1 = _b1 * _a; } const TransverseMercator TransverseMercator::UTM(Constants::WGS84_a(), Constants::WGS84_f(), Constants::UTM_k0()); void TransverseMercator::Forward(real lon0, real lat, real lon, real& x, real& y, real& gamma, real& k) const throw() { // Avoid losing a bit of accuracy in lon (assuming lon0 is an integer) if (lon - lon0 > 180) lon -= lon0 + 360; else if (lon - lon0 <= -180) lon -= lon0 - 360; else lon -= lon0; // Now lon in (-180, 180] // Explicitly enforce the parity int latsign = lat < 0 ? -1 : 1, lonsign = lon < 0 ? -1 : 1; lon *= lonsign; lat *= latsign; bool backside = lon > 90; if (backside) { if (lat == 0) latsign = -1; lon = 180 - lon; } real phi = lat * Math::degree(), lam = lon * Math::degree(); // phi = latitude // phi' = conformal latitude // psi = isometric latitude // tau = tan(phi) // tau' = tan(phi') // [xi', eta'] = Gauss-Schreiber TM coordinates // [xi, eta] = Gauss-Krueger TM coordinates // // We use // tan(phi') = sinh(psi) // sin(phi') = tanh(psi) // cos(phi') = sech(psi) // denom^2 = 1-cos(phi')^2*sin(lam)^2 = 1-sech(psi)^2*sin(lam)^2 // sin(xip) = sin(phi')/denom = tanh(psi)/denom // cos(xip) = cos(phi')*cos(lam)/denom = sech(psi)*cos(lam)/denom // cosh(etap) = 1/denom = 1/denom // sinh(etap) = cos(phi')*sin(lam)/denom = sech(psi)*sin(lam)/denom real etap, xip; if (lat != 90) { real c = max(real(0), cos(lam)), // cos(pi/2) might be negative tau = tan(phi), secphi = Math::hypot(real(1), tau), sig = sinh( eatanhe(tau / secphi) ), taup = Math::hypot(real(1), sig) * tau - sig * secphi; xip = atan2(taup, c); // Used to be // etap = Math::atanh(sin(lam) / cosh(psi)); etap = Math::asinh(sin(lam) / Math::hypot(taup, c)); // convergence and scale for Gauss-Schreiber TM (xip, etap) -- gamma0 = // atan(tan(xip) * tanh(etap)) = atan(tan(lam) * sin(phi')); // sin(phi') = tau'/sqrt(1 + tau'^2) gamma = atan(tanx(lam) * taup / Math::hypot(real(1), taup)); // Krueger p 22 (44) // k0 = sqrt(1 - _e2 * sin(phi)^2) * (cos(phi') / cos(phi)) * cosh(etap) // Note 1/cos(phi) = cosh(psip); // and cos(phi') * cosh(etap) = 1/hypot(sinh(psi), cos(lam)) // // This form has cancelling errors. This property is lost if cosh(psip) // is replaced by 1/cos(phi), even though it's using "primary" data (phi // instead of psip). k = sqrt(_e2m + _e2 * Math::sq(cos(phi))) * secphi / Math::hypot(taup, c); } else { xip = Math::pi()/2; etap = 0; gamma = lam; k = _c; } // {xi',eta'} is {northing,easting} for Gauss-Schreiber transverse Mercator // (for eta' = 0, xi' = bet). {xi,eta} is {northing,easting} for transverse // Mercator with constant scale on the central meridian (for eta = 0, xip = // rectifying latitude). Define // // zeta = xi + i*eta // zeta' = xi' + i*eta' // // The conversion from conformal to rectifying latitude can be expresses as // a series in _n: // // zeta = zeta' + sum(h[j-1]' * sin(2 * j * zeta'), j = 1..maxpow_) // // where h[j]' = O(_n^j). The reversion of this series gives // // zeta' = zeta - sum(h[j-1] * sin(2 * j * zeta), j = 1..maxpow_) // // which is used in Reverse. // // Evaluate sums via Clenshaw method. See // http://mathworld.wolfram.com/ClenshawRecurrenceFormula.html // // Let // // S = sum(c[k] * F[k](x), k = 0..N) // F[n+1](x) = alpha(n,x) * F[n](x) + beta(n,x) * F[n-1](x) // // Evaluate S with // // y[N+2] = y[N+1] = 0 // y[k] = alpha(k,x) * y[k+1] + beta(k+1,x) * y[k+2] + c[k] // S = c[0] * F[0](x) + y[1] * F[1](x) + beta(1,x) * F[0](x) * y[2] // // Here we have // // x = 2 * zeta' // F[n](x) = sin(n * x) // a(n, x) = 2 * cos(x) // b(n, x) = -1 // [ sin(A+B) - 2*cos(B)*sin(A) + sin(A-B) = 0, A = n*x, B = x ] // N = maxpow_ // c[k] = _alp[k] // S = y[1] * sin(x) // // For the derivative we have // // x = 2 * zeta' // F[n](x) = cos(n * x) // a(n, x) = 2 * cos(x) // b(n, x) = -1 // [ cos(A+B) - 2*cos(B)*cos(A) + cos(A-B) = 0, A = n*x, B = x ] // c[0] = 1; c[k] = 2*k*_alp[k] // S = (c[0] - y[2]) + y[1] * cos(x) real c0 = cos(2 * xip), ch0 = cosh(2 * etap), s0 = sin(2 * xip), sh0 = sinh(2 * etap), ar = 2 * c0 * ch0, ai = -2 * s0 * sh0; // 2 * cos(2*zeta') int n = maxpow_; real xi0 = (n & 1 ? _alp[n] : 0), eta0 = 0, xi1 = 0, eta1 = 0; real // Accumulators for dzeta/dzeta' yr0 = (n & 1 ? 2 * maxpow_ * _alp[n--] : 0), yi0 = 0, yr1 = 0, yi1 = 0; while (n) { xi1 = ar * xi0 - ai * eta0 - xi1 + _alp[n]; eta1 = ai * xi0 + ar * eta0 - eta1; yr1 = ar * yr0 - ai * yi0 - yr1 + 2 * n * _alp[n]; yi1 = ai * yr0 + ar * yi0 - yi1; --n; xi0 = ar * xi1 - ai * eta1 - xi0 + _alp[n]; eta0 = ai * xi1 + ar * eta1 - eta0; yr0 = ar * yr1 - ai * yi1 - yr0 + 2 * n * _alp[n]; yi0 = ai * yr1 + ar * yi1 - yi0; --n; } ar /= 2; ai /= 2; // cos(2*zeta') yr1 = 1 - yr1 + ar * yr0 - ai * yi0; yi1 = - yi1 + ai * yr0 + ar * yi0; ar = s0 * ch0; ai = c0 * sh0; // sin(2*zeta') real xi = xip + ar * xi0 - ai * eta0, eta = etap + ai * xi0 + ar * eta0; // Fold in change in convergence and scale for Gauss-Schreiber TM to // Gauss-Krueger TM. gamma -= atan2(yi1, yr1); k *= _b1 * Math::hypot(yr1, yi1); gamma /= Math::degree(); y = _a1 * _k0 * (backside ? Math::pi() - xi : xi) * latsign; x = _a1 * _k0 * eta * lonsign; if (backside) gamma = 180 - gamma; gamma *= latsign * lonsign; k *= _k0; } void TransverseMercator::Reverse(real lon0, real x, real y, real& lat, real& lon, real& gamma, real& k) const throw() { // This undoes the steps in Forward. The wrinkles are: (1) Use of the // reverted series to express zeta' in terms of zeta. (2) Newton's method // to solve for phi in terms of tan(phi). real xi = y / (_a1 * _k0), eta = x / (_a1 * _k0); // Explicitly enforce the parity int xisign = xi < 0 ? -1 : 1, etasign = eta < 0 ? -1 : 1; xi *= xisign; eta *= etasign; bool backside = xi > Math::pi()/2; if (backside) xi = Math::pi() - xi; real c0 = cos(2 * xi), ch0 = cosh(2 * eta), s0 = sin(2 * xi), sh0 = sinh(2 * eta), ar = 2 * c0 * ch0, ai = -2 * s0 * sh0; // 2 * cos(2*zeta) int n = maxpow_; real // Accumulators for zeta' xip0 = (n & 1 ? -_bet[n] : 0), etap0 = 0, xip1 = 0, etap1 = 0; real // Accumulators for dzeta'/dzeta yr0 = (n & 1 ? - 2 * maxpow_ * _bet[n--] : 0), yi0 = 0, yr1 = 0, yi1 = 0; while (n) { xip1 = ar * xip0 - ai * etap0 - xip1 - _bet[n]; etap1 = ai * xip0 + ar * etap0 - etap1; yr1 = ar * yr0 - ai * yi0 - yr1 - 2 * n * _bet[n]; yi1 = ai * yr0 + ar * yi0 - yi1; --n; xip0 = ar * xip1 - ai * etap1 - xip0 - _bet[n]; etap0 = ai * xip1 + ar * etap1 - etap0; yr0 = ar * yr1 - ai * yi1 - yr0 - 2 * n * _bet[n]; yi0 = ai * yr1 + ar * yi1 - yi0; --n; } ar /= 2; ai /= 2; // cos(2*zeta') yr1 = 1 - yr1 + ar * yr0 - ai * yi0; yi1 = - yi1 + ai * yr0 + ar * yi0; ar = s0 * ch0; ai = c0 * sh0; // sin(2*zeta) real xip = xi + ar * xip0 - ai * etap0, etap = eta + ai * xip0 + ar * etap0; // Convergence and scale for Gauss-Schreiber TM to Gauss-Krueger TM. gamma = atan2(yi1, yr1); k = _b1 / Math::hypot(yr1, yi1); // JHS 154 has // // phi' = asin(sin(xi') / cosh(eta')) (Krueger p 17 (25)) // lam = asin(tanh(eta') / cos(phi') // psi = asinh(tan(phi')) real lam, phi; real s = sinh(etap), c = max(real(0), cos(xip)), // cos(pi/2) might be negative r = Math::hypot(s, c); if (r != 0) { lam = atan2(s, c); // Krueger p 17 (25) // Use Newton's method to solve for tau real taup = sin(xip)/r, // To lowest order in e^2, taup = (1 - e^2) * tau = _e2m * tau; so use // tau = taup/_e2m as a starting guess. Only 1 iteration is needed for // |lat| < 3.35 deg, otherwise 2 iterations are needed. If, instead, // tau = taup is used the mean number of iterations increases to 1.99 // (2 iterations are needed except near tau = 0). tau = taup/_e2m, stol = tol_ * max(real(1), abs(taup)); // min iterations = 1, max iterations = 2; mean = 1.94 for (int i = 0; i < numit_; ++i) { real tau1 = Math::hypot(real(1), tau), sig = sinh( eatanhe( tau / tau1 ) ), taupa = Math::hypot(real(1), sig) * tau - sig * tau1, dtau = (taup - taupa) * (1 + _e2m * Math::sq(tau)) / ( _e2m * tau1 * Math::hypot(real(1), taupa) ); tau += dtau; if (!(abs(dtau) >= stol)) break; } phi = atan(tau); gamma += atan(tanx(xip) * tanh(etap)); // Krueger p 19 (31) // Note cos(phi') * cosh(eta') = r k *= sqrt(_e2m + _e2 * Math::sq(cos(phi))) * Math::hypot(real(1), tau) * r; } else { phi = Math::pi()/2; lam = 0; k *= _c; } lat = phi / Math::degree() * xisign; lon = lam / Math::degree(); if (backside) lon = 180 - lon; lon *= etasign; // Avoid losing a bit of accuracy in lon (assuming lon0 is an integer) if (lon + lon0 >= 180) lon += lon0 - 360; else if (lon + lon0 < -180) lon += lon0 + 360; else lon += lon0; gamma /= Math::degree(); if (backside) gamma = 180 - gamma; gamma *= xisign * etasign; k *= _k0; } } // namespace GeographicLib geographiclib-1.21/src/LambertConformalConic.cpp0000644000175000017500000004455511745620415021574 0ustar frankiefrankie/** * \file LambertConformalConic.cpp * \brief Implementation for GeographicLib::LambertConformalConic class * * Copyright (c) Charles Karney (2010, 2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #define GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_CPP \ "$Id: da8f6ce89092006a26946d671edca1a7836e7ce6 $" RCSID_DECL(GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_CPP) RCSID_DECL(GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP) namespace GeographicLib { using namespace std; const Math::real LambertConformalConic::eps_ = numeric_limits::epsilon(); const Math::real LambertConformalConic::epsx_ = Math::sq(eps_); const Math::real LambertConformalConic::tol_ = real(0.1) * sqrt(eps_); const Math::real LambertConformalConic::ahypover_ = real(numeric_limits::digits) * log(real(numeric_limits::radix)) + 2; LambertConformalConic::LambertConformalConic(real a, real f, real stdlat, real k0) : _a(a) , _f(f <= 1 ? f : 1/f) , _fm(1 - _f) , _e2(_f * (2 - _f)) , _e(sqrt(abs(_e2))) , _e2m(1 - _e2) { if (!(Math::isfinite(_a) && _a > 0)) throw GeographicErr("Major radius is not positive"); if (!(Math::isfinite(_f) && _f < 1)) throw GeographicErr("Minor radius is not positive"); if (!(Math::isfinite(k0) && k0 > 0)) throw GeographicErr("Scale is not positive"); if (!(abs(stdlat) <= 90)) throw GeographicErr("Standard latitude not in [-90, 90]"); real phi = stdlat * Math::degree(), sphi = sin(phi), cphi = abs(stdlat) != 90 ? cos(phi) : 0; Init(sphi, cphi, sphi, cphi, k0); } LambertConformalConic::LambertConformalConic(real a, real f, real stdlat1, real stdlat2, real k1) : _a(a) , _f(f <= 1 ? f : 1/f) , _fm(1 - _f) , _e2(_f * (2 - _f)) , _e(sqrt(abs(_e2))) , _e2m(1 - _e2) { if (!(Math::isfinite(_a) && _a > 0)) throw GeographicErr("Major radius is not positive"); if (!(Math::isfinite(_f) && _f < 1)) throw GeographicErr("Minor radius is not positive"); if (!(Math::isfinite(k1) && k1 > 0)) throw GeographicErr("Scale is not positive"); if (!(abs(stdlat1) <= 90)) throw GeographicErr("Standard latitude 1 not in [-90, 90]"); if (!(abs(stdlat2) <= 90)) throw GeographicErr("Standard latitude 2 not in [-90, 90]"); real phi1 = stdlat1 * Math::degree(), phi2 = stdlat2 * Math::degree(); Init(sin(phi1), abs(stdlat1) != 90 ? cos(phi1) : 0, sin(phi2), abs(stdlat2) != 90 ? cos(phi2) : 0, k1); } LambertConformalConic::LambertConformalConic(real a, real f, real sinlat1, real coslat1, real sinlat2, real coslat2, real k1) : _a(a) , _f(f <= 1 ? f : 1/f) , _fm(1 - _f) , _e2(_f * (2 - _f)) , _e(sqrt(abs(_e2))) , _e2m(1 - _e2) { if (!(Math::isfinite(_a) && _a > 0)) throw GeographicErr("Major radius is not positive"); if (!(Math::isfinite(_f) && _f < 1)) throw GeographicErr("Minor radius is not positive"); if (!(Math::isfinite(k1) && k1 > 0)) throw GeographicErr("Scale is not positive"); if (!(coslat1 >= 0)) throw GeographicErr("Standard latitude 1 not in [-90, 90]"); if (!(coslat2 >= 0)) throw GeographicErr("Standard latitude 2 not in [-90, 90]"); if (!(abs(sinlat1) <= 1 && coslat1 <= 1) || (coslat1 == 0 && sinlat1 == 0)) throw GeographicErr("Bad sine/cosine of standard latitude 1"); if (!(abs(sinlat2) <= 1 && coslat2 <= 1) || (coslat2 == 0 && sinlat2 == 0)) throw GeographicErr("Bad sine/cosine of standard latitude 2"); if (coslat1 == 0 || coslat2 == 0) if (!(coslat1 == coslat2 && sinlat1 == sinlat2)) throw GeographicErr ("Standard latitudes must be equal is either is a pole"); Init(sinlat1, coslat1, sinlat2, coslat2, k1); } void LambertConformalConic::Init(real sphi1, real cphi1, real sphi2, real cphi2, real k1) throw() { { real r; r = Math::hypot(sphi1, cphi1); sphi1 /= r; cphi1 /= r; r = Math::hypot(sphi2, cphi2); sphi2 /= r; cphi2 /= r; } bool polar = (cphi1 == 0); cphi1 = max(epsx_, cphi1); // Avoid singularities at poles cphi2 = max(epsx_, cphi2); // Determine hemisphere of tangent latitude _sign = sphi1 + sphi2 >= 0 ? 1 : -1; // Internally work with tangent latitude positive sphi1 *= _sign; sphi2 *= _sign; if (sphi1 > sphi2) { swap(sphi1, sphi2); swap(cphi1, cphi2); // Make phi1 < phi2 } real tphi1 = sphi1/cphi1, tphi2 = sphi2/cphi2, tphi0; // // Snyder: 15-8: n = (log(m1) - log(m2))/(log(t1)-log(t2)) // // m = cos(bet) = 1/sec(bet) = 1/sqrt(1+tan(bet)^2) // bet = parametric lat, tan(bet) = (1-f)*tan(phi) // // t = tan(pi/4-chi/2) = 1/(sec(chi) + tan(chi)) = sec(chi) - tan(chi) // log(t) = -asinh(tan(chi)) = -psi // chi = conformal lat // tan(chi) = tan(phi)*cosh(xi) - sinh(xi)*sec(phi) // xi = eatanhe(sin(phi)), eatanhe(x) = e * atanh(e*x) // // n = (log(sec(bet2))-log(sec(bet1)))/(asinh(tan(chi2))-asinh(tan(chi1))) // // Let log(sec(bet)) = b(tphi), asinh(tan(chi)) = c(tphi) // Then n = Db(tphi2, tphi1)/Dc(tphi2, tphi1) // In limit tphi2 -> tphi1, n -> sphi1 // real tbet1 = _fm * tphi1, scbet1 = hyp(tbet1), tbet2 = _fm * tphi2, scbet2 = hyp(tbet2); real scphi1 = 1/cphi1, xi1 = eatanhe(sphi1), shxi1 = sinh(xi1), chxi1 = hyp(shxi1), tchi1 = chxi1 * tphi1 - shxi1 * scphi1, scchi1 = hyp(tchi1), scphi2 = 1/cphi2, xi2 = eatanhe(sphi2), shxi2 = sinh(xi2), chxi2 = hyp(shxi2), tchi2 = chxi2 * tphi2 - shxi2 * scphi2, scchi2 = hyp(tchi2), psi1 = Math::asinh(tchi1); if (tphi2 - tphi1 != 0) { // Db(tphi2, tphi1) real num = Dlog1p(Math::sq(tbet2)/(1 + scbet2), Math::sq(tbet1)/(1 + scbet1)) * Dhyp(tbet2, tbet1, scbet2, scbet1) * _fm; // Dc(tphi2, tphi1) real den = Dasinh(tphi2, tphi1, scphi2, scphi1) - Deatanhe(sphi2, sphi1) * Dsn(tphi2, tphi1, sphi2, sphi1); _n = num/den; if (_n < 0.25) _nc = sqrt((1 - _n) * (1 + _n)); else { // Compute nc = cos(phi0) = sqrt((1 - n) * (1 + n)), evaluating 1 - n // carefully. First write // // Dc(tphi2, tphi1) * (tphi2 - tphi1) // = log(tchi2 + scchi2) - log(tchi1 + scchi1) // // then den * (1 - n) = // (log((tchi2 + scchi2)/(2*scbet2)) - log((tchi1 + scchi1)/(2*scbet1))) // / (tphi2 - tphi1) // = Dlog1p(a2, a1) * (tchi2+scchi2 + tchi1+scchi1)/(4*scbet1*scbet2) // * fm * Q // // where // a1 = ( (tchi1 - scbet1) + (scchi1 - scbet1) ) / (2 * scbet1) // Q = ((scbet2 + scbet1)/fm)/((scchi2 + scchi1)/D(tchi2, tchi1)) // - (tbet2 + tbet1)/(scbet2 + scbet1) real t; { real // s1 = (scbet1 - scchi1) * (scbet1 + scchi1) s1 = (tphi1 * (2 * shxi1 * chxi1 * scphi1 - _e2 * tphi1) - Math::sq(shxi1) * (1 + 2 * Math::sq(tphi1))), s2 = (tphi2 * (2 * shxi2 * chxi2 * scphi2 - _e2 * tphi2) - Math::sq(shxi2) * (1 + 2 * Math::sq(tphi2))), // t1 = scbet1 - tchi1 t1 = tchi1 < 0 ? scbet1 - tchi1 : (s1 + 1)/(scbet1 + tchi1), t2 = tchi2 < 0 ? scbet2 - tchi2 : (s2 + 1)/(scbet2 + tchi2), a2 = -(s2 / (scbet2 + scchi2) + t2) / (2 * scbet2), a1 = -(s1 / (scbet1 + scchi1) + t1) / (2 * scbet1); t = Dlog1p(a2, a1) / den; } // multiply by (tchi2 + scchi2 + tchi1 + scchi1)/(4*scbet1*scbet2) * fm t *= ( ( (tchi2 >= 0 ? scchi2 + tchi2 : 1/(scchi2 - tchi2)) + (tchi1 >= 0 ? scchi1 + tchi1 : 1/(scchi1 - tchi1)) ) / (4 * scbet1 * scbet2) ) * _fm; // Rewrite // Q = (1 - (tbet2 + tbet1)/(scbet2 + scbet1)) - // (1 - ((scbet2 + scbet1)/fm)/((scchi2 + scchi1)/D(tchi2, tchi1))) // = tbm - tam // where real tbm = ( ((tbet1 > 0 ? 1/(scbet1+tbet1) : scbet1 - tbet1) + (tbet2 > 0 ? 1/(scbet2+tbet2) : scbet2 - tbet2)) / (scbet1+scbet2) ); // tam = (1 - ((scbet2+scbet1)/fm)/((scchi2+scchi1)/D(tchi2, tchi1))) // // Let // (scbet2 + scbet1)/fm = scphi2 + scphi1 + dbet // (scchi2 + scchi1)/D(tchi2, tchi1) = scphi2 + scphi1 + dchi // then // tam = D(tchi2, tchi1) * (dchi - dbet) / (scchi1 + scchi2) real // D(tchi2, tchi1) dtchi = den / Dasinh(tchi2, tchi1, scchi2, scchi1), // (scbet2 + scbet1)/fm - (scphi2 + scphi1) dbet = (_e2/_fm) * ( 1 / (scbet2 + _fm * scphi2) + 1 / (scbet1 + _fm * scphi1) ); // dchi = (scchi2 + scchi1)/D(tchi2, tchi1) - (scphi2 + scphi1) // Let // tzet = chxiZ * tphi - shxiZ * scphi // tchi = tzet + nu // scchi = sczet + mu // where // xiZ = eatanhe(1), shxiZ = sinh(xiZ), chxiZ = cosh(xiZ) // nu = scphi * (shxiZ - shxi) - tphi * (chxiZ - chxi) // mu = - scphi * (chxiZ - chxi) + tphi * (shxiZ - shxi) // then // dchi = ((mu2 + mu1) - D(nu2, nu1) * (scphi2 + scphi1)) / // D(tchi2, tchi1) real xiZ = eatanhe(real(1)), shxiZ = sinh(xiZ), chxiZ = hyp(shxiZ), // These are differences not divided differences // dxiZ1 = xiZ - xi1; dshxiZ1 = shxiZ - shxi; dchxiZ1 = chxiZ - chxi dxiZ1 = Deatanhe(real(1), sphi1)/(scphi1*(tphi1+scphi1)), dxiZ2 = Deatanhe(real(1), sphi2)/(scphi2*(tphi2+scphi2)), dshxiZ1 = Dsinh(xiZ, xi1, shxiZ, shxi1, chxiZ, chxi1) * dxiZ1, dshxiZ2 = Dsinh(xiZ, xi2, shxiZ, shxi2, chxiZ, chxi2) * dxiZ2, dchxiZ1 = Dhyp(shxiZ, shxi1, chxiZ, chxi1) * dshxiZ1, dchxiZ2 = Dhyp(shxiZ, shxi2, chxiZ, chxi2) * dshxiZ2, // mu1 + mu2 amu12 = (- scphi1 * dchxiZ1 + tphi1 * dshxiZ1 - scphi2 * dchxiZ2 + tphi2 * dshxiZ2), // D(xi2, xi1) dxi = Deatanhe(sphi1, sphi2) * Dsn(tphi2, tphi1, sphi2, sphi1), // D(nu2, nu1) dnu12 = ( (_f * 4 * scphi2 * dshxiZ2 > _f * scphi1 * dshxiZ1 ? // Use divided differences (dshxiZ1 + dshxiZ2)/2 * Dhyp(tphi1, tphi2, scphi1, scphi2) - ( (scphi1 + scphi2)/2 * Dsinh(xi1, xi2, shxi1, shxi2, chxi1, chxi2) * dxi ) : // Use ratio of differences (scphi2 * dshxiZ2 - scphi1 * dshxiZ1)/(tphi2 - tphi1)) + ( (tphi1 + tphi2)/2 * Dhyp(shxi1, shxi2, chxi1, chxi2) * Dsinh(xi1, xi2, shxi1, shxi2, chxi1, chxi2) * dxi ) - (dchxiZ1 + dchxiZ2)/2 ), // dtchi * dchi dchia = (amu12 - dnu12 * (scphi2 + scphi1)), tam = (dchia - dtchi * dbet) / (scchi1 + scchi2); t *= tbm - tam; _nc = sqrt(max(real(0), t) * (1 + _n)); } { real r = Math::hypot(_n, _nc); _n /= r; _nc /= r; } tphi0 = _n / _nc; } else { tphi0 = tphi1; _nc = 1/hyp(tphi0); _n = tphi0 * _nc; if (polar) _nc = 0; } _scbet0 = hyp(_fm * tphi0); real shxi0 = sinh(eatanhe(_n)); _tchi0 = tphi0 * hyp(shxi0) - shxi0 * hyp(tphi0); _scchi0 = hyp(_tchi0); _psi0 = Math::asinh(_tchi0); _lat0 = atan(_sign * tphi0) / Math::degree(); _t0nm1 = Math::expm1(- _n * _psi0); // Snyder's t0^n - 1 // a * k1 * m1/t1^n = a * k1 * m2/t2^n = a * k1 * n * (Snyder's F) // = a * k1 / (scbet1 * exp(-n * psi1)) _scale = _a * k1 / scbet1 * // exp(n * psi1) = exp(- (1 - n) * psi1) * exp(psi1) // with (1-n) = nc^2/(1+n) and exp(-psi1) = scchi1 + tchi1 exp( - (Math::sq(_nc)/(1 + _n)) * psi1 ) * (tchi1 >= 0 ? scchi1 + tchi1 : 1 / (scchi1 - tchi1)); // Scale at phi0 = k0 = k1 * (scbet0*exp(-n*psi0))/(scbet1*exp(-n*psi1)) // = k1 * scbet0/scbet1 * exp(n * (psi1 - psi0)) // psi1 - psi0 = Dasinh(tchi1, tchi0) * (tchi1 - tchi0) _k0 = k1 * (_scbet0/scbet1) * exp( - (Math::sq(_nc)/(1 + _n)) * Dasinh(tchi1, _tchi0, scchi1, _scchi0) * (tchi1 - _tchi0)) * (tchi1 >= 0 ? scchi1 + tchi1 : 1 / (scchi1 - tchi1)) / (_scchi0 + _tchi0); _nrho0 = polar ? 0 : _a * _k0 / _scbet0; } const LambertConformalConic LambertConformalConic::Mercator(Constants::WGS84_a(), Constants::WGS84_f(), real(0), real(1)); void LambertConformalConic::Forward(real lon0, real lat, real lon, real& x, real& y, real& gamma, real& k) const throw() { if (lon - lon0 >= 180) lon -= lon0 + 360; else if (lon - lon0 < -180) lon -= lon0 - 360; else lon -= lon0; lat *= _sign; // From Snyder, we have // // theta = n * lambda // x = rho * sin(theta) // = (nrho0 + n * drho) * sin(theta)/n // y = rho0 - rho * cos(theta) // = nrho0 * (1-cos(theta))/n - drho * cos(theta) // // where nrho0 = n * rho0, drho = rho - rho0 // and drho is evaluated with divided differences real lam = lon * Math::degree(), phi = lat * Math::degree(), sphi = sin(phi), cphi = abs(lat) != 90 ? cos(phi) : epsx_, tphi = sphi/cphi, tbet = _fm * tphi, scbet = hyp(tbet), scphi = 1/cphi, shxi = sinh(eatanhe(sphi)), tchi = hyp(shxi) * tphi - shxi * scphi, scchi = hyp(tchi), psi = Math::asinh(tchi), theta = _n * lam, stheta = sin(theta), ctheta = cos(theta), dpsi = Dasinh(tchi, _tchi0, scchi, _scchi0) * (tchi - _tchi0), drho = - _scale * (2 * _nc < 1 && dpsi != 0 ? (exp(Math::sq(_nc)/(1 + _n) * psi ) * (tchi > 0 ? 1/(scchi + tchi) : (scchi - tchi)) - (_t0nm1 + 1))/(-_n) : Dexp(-_n * psi, -_n * _psi0) * dpsi); x = (_nrho0 + _n * drho) * (_n != 0 ? stheta / _n : lam); y = _nrho0 * (_n != 0 ? (ctheta < 0 ? 1 - ctheta : Math::sq(stheta)/(1 + ctheta)) / _n : 0) - drho * ctheta; k = _k0 * (scbet/_scbet0) / (exp( - (Math::sq(_nc)/(1 + _n)) * dpsi ) * (tchi >= 0 ? scchi + tchi : 1 / (scchi - tchi)) / (_scchi0 + _tchi0)); y *= _sign; gamma = _sign * theta / Math::degree(); } void LambertConformalConic::Reverse(real lon0, real x, real y, real& lat, real& lon, real& gamma, real& k) const throw() { // From Snyder, we have // // x = rho * sin(theta) // rho0 - y = rho * cos(theta) // // rho = hypot(x, rho0 - y) // drho = (n*x^2 - 2*y*nrho0 + n*y^2)/(hypot(n*x, nrho0-n*y) + nrho0) // theta = atan2(n*x, nrho0-n*y) // // From drho, obtain t^n-1 // psi = -log(t), so // dpsi = - Dlog1p(t^n-1, t0^n-1) * drho / scale y *= _sign; real nx = _n * x, ny = _n * y, y1 = _nrho0 - ny, den = Math::hypot(nx, y1) + _nrho0, // 0 implies origin with polar aspect drho = den != 0 ? (x*nx - 2*y*_nrho0 + y*ny) / den : 0, tnm1 = _t0nm1 + _n * drho/_scale, dpsi = (den == 0 ? 0 : (tnm1 + 1 != 0 ? - Dlog1p(tnm1, _t0nm1) * drho / _scale : ahypover_)); real tchi; if (2 * _n <= 1) { // tchi = sinh(psi) real psi = _psi0 + dpsi, tchia = sinh(psi), scchi = hyp(tchia), dtchi = Dsinh(psi, _psi0, tchia, _tchi0, scchi, _scchi0) * dpsi; tchi = _tchi0 + dtchi; // Update tchi using divided difference } else { // tchi = sinh(-1/n * log(tn)) // = sinh((1-1/n) * log(tn) - log(tn)) // = + sinh((1-1/n) * log(tn)) * cosh(log(tn)) // - cosh((1-1/n) * log(tn)) * sinh(log(tn)) // (1-1/n) = - nc^2/(n*(1+n)) // cosh(log(tn)) = (tn + 1/tn)/2; sinh(log(tn)) = (tn - 1/tn)/2 real tn = tnm1 + 1 == 0 ? epsx_ : tnm1 + 1, sh = sinh( -Math::sq(_nc)/(_n * (1 + _n)) * (2 * tn > 1 ? Math::log1p(tnm1) : log(tn)) ); tchi = sh * (tn + 1/tn)/2 - hyp(sh) * (tnm1 * (tn + 1)/tn)/2; } // Use Newton's method to solve for tphi real // See comment in TransverseMercator.cpp about the initial guess tphi = tchi/_e2m, stol = tol_ * max(real(1), abs(tchi)); // min iterations = 1, max iterations = 2; mean = 1.94 for (int i = 0; i < numit_; ++i) { real scphi = hyp(tphi), shxi = sinh( eatanhe( tphi / scphi ) ), tchia = hyp(shxi) * tphi - shxi * scphi, dtphi = (tchi - tchia) * (1 + _e2m * Math::sq(tphi)) / ( _e2m * scphi * hyp(tchia) ); tphi += dtphi; if (!(abs(dtphi) >= stol)) break; } // log(t) = -asinh(tan(chi)) = -psi gamma = atan2(nx, y1); real phi = _sign * atan(tphi), scbet = hyp(_fm * tphi), scchi = hyp(tchi), lam = _n != 0 ? gamma / _n : x / y1; lat = phi / Math::degree(); lon = lam / Math::degree(); // Avoid losing a bit of accuracy in lon (assuming lon0 is an integer) if (lon + lon0 >= 180) lon += lon0 - 360; else if (lon + lon0 < -180) lon += lon0 + 360; else lon += lon0; k = _k0 * (scbet/_scbet0) / (exp(_nc != 0 ? - (Math::sq(_nc)/(1 + _n)) * dpsi : 0) * (tchi >= 0 ? scchi + tchi : 1 / (scchi - tchi)) / (_scchi0 + _tchi0)); gamma /= _sign * Math::degree(); } void LambertConformalConic::SetScale(real lat, real k) { if (!(Math::isfinite(k) && k > 0)) throw GeographicErr("Scale is not positive"); if (!(abs(lat) <= 90)) throw GeographicErr("Latitude for SetScale not in [-90, 90]"); if (abs(lat) == 90 && !(_nc == 0 && lat * _n > 0)) throw GeographicErr("Incompatible polar latitude in SetScale"); real x, y, gamma, kold; Forward(0, lat, 0, x, y, gamma, kold); k /= kold; _scale *= k; _k0 *= k; } } // namespace GeographicLib geographiclib-1.21/src/MagneticCircle.cpp0000644000175000017500000000331211745620415020224 0ustar frankiefrankie/** * \file MagneticCircle.cpp * \brief Implementation for GeographicLib::MagneticCircle class * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #include #include #include #define GEOGRAPHICLIB_MAGNETICCIRCLE_CPP \ "$Id: 8cd933c406708a1f8b90e029e89bb99d2eb177b0 $" RCSID_DECL(GEOGRAPHICLIB_MAGNETICCIRCLE_CPP) RCSID_DECL(GEOGRAPHICLIB_MAGNETICCIRCLE_HPP) #define MAGNETIC_DEFAULT_PATH "/home/ckarney/geographiclib/magnetic" namespace GeographicLib { using namespace std; void MagneticCircle::Field(real lon, bool diffp, real& Bx, real& By, real& Bz, real& Bxt, real& Byt, real& Bzt) const throw() { real clam, slam; CircularEngine::cossin(lon, clam, slam); real M[Geocentric::dim2_]; Geocentric::Rotation(_sphi, _cphi, slam, clam, M); real BX0, BY0, BZ0, BX1, BY1, BZ1; // Components in geocentric basis _circ0(clam, slam, BX0, BY0, BZ0); _circ1(clam, slam, BX1, BY1, BZ1); if (_interpolate) { BX1 = (BX1 - BX0) / _dt0; BY1 = (BY1 - BY0) / _dt0; BZ1 = (BZ1 - BZ0) / _dt0; } BX0 += _t1 * BX1; BY0 += _t1 * BY1; BZ0 += _t1 * BZ1; if (diffp) { Geocentric::Unrotate(M, BX1, BY1, BZ1, Bxt, Byt, Bzt); Bxt *= - _a; Byt *= - _a; Bzt *= - _a; } Geocentric::Unrotate(M, BX0, BY0, BZ0, Bx, By, Bz); Bx *= - _a; By *= - _a; Bz *= - _a; } } // namespace GeographicLib geographiclib-1.21/src/GravityModel.cpp0000644000175000017500000003305611745620415017771 0ustar frankiefrankie/** * \file GravityModel.cpp * \brief Implementation for GeographicLib::GravityModel class * * Copyright (c) Charles Karney (2011, 2012) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #include #include #include #include #define GEOGRAPHICLIB_GRAVITYMODEL_CPP \ "$Id: 1897d0d53c7339ecdf20b1348637340e9f687f30 $" RCSID_DECL(GEOGRAPHICLIB_GRAVITYMODEL_CPP) RCSID_DECL(GEOGRAPHICLIB_GRAVITYMODEL_HPP) #if !defined(GEOGRAPHICLIB_DATA) # if defined(_MSC_VER) # define GEOGRAPHICLIB_DATA \ "C:/Documents and Settings/All Users/Application Data/GeographicLib" # else # define GEOGRAPHICLIB_DATA "/usr/local/share/GeographicLib" # endif #endif #if !defined(GRAVITY_DEFAULT_NAME) # define GRAVITY_DEFAULT_NAME "egm96" #endif #if defined(_MSC_VER) // Squelch warnings about unsafe use of getenv #pragma warning (disable: 4996) #endif namespace GeographicLib { using namespace std; GravityModel::GravityModel(const std::string& name,const std::string& path) : _name(name) , _dir(path) , _description("NONE") , _date("UNKNOWN") , _amodel(Math::NaN()) , _GMmodel(Math::NaN()) , _zeta0(0) , _corrmult(1) , _norm(SphericalHarmonic::FULL) { if (_dir.empty()) _dir = DefaultGravityPath(); ReadMetadata(_name); { string coeff = _filename + ".cof"; ifstream coeffstr(coeff.c_str(), ios::binary); if (!coeffstr.good()) throw GeographicErr("Error opening " + coeff); char id[idlength_ + 1]; coeffstr.read(id, idlength_); if (!coeffstr.good()) throw GeographicErr("No header in " + coeff); id[idlength_] = '\0'; if (_id != string(id)) throw GeographicErr("ID mismatch: " + _id + " vs " + id); int N, M; SphericalEngine::coeff::readcoeffs(coeffstr, N, M, _C, _S); if (!(M < 0 || _C[0] == 0)) throw GeographicErr("A degree 0 term should be zero"); _C[0] = 1; // Include the 1/r term in the sum _gravitational = SphericalHarmonic(_C, _S, N, N, M, _amodel, _norm); SphericalEngine::coeff::readcoeffs(coeffstr, N, M, _CC, _CS); if (N < 0) { N = M = 0; _CC.resize(1, real(0)); } _CC[0] += _zeta0 / _corrmult; _correction = SphericalHarmonic(_CC, _CS, N, N, M, real(1), _norm); int pos = int(coeffstr.tellg()); coeffstr.seekg(0, ios::end); if (pos != coeffstr.tellg()) throw GeographicErr("Extra data in " + coeff); } int nmx = _gravitational.Coefficients().nmx(); // Adjust the normalization of the normal potential to match the model. real mult = _earth._GM / _GMmodel; real amult = Math::sq(_earth._a / _amodel); // The 0th term in _zonal should be is 1 + _dzonal0. Instead set it to 1 // to give exact cancellation with the (0,0) term in the model and account // for _dzonal0 separately. _zonal.clear(); _zonal.push_back(1); _dzonal0 = (_earth.MassConstant() - _GMmodel) / _GMmodel; for (int n = 2; n <= nmx; n += 2) { // Only include as many normal zonal terms as matter. Figuring the limit // in this way works because the coefficients of the normal potential // (which is smooth) decay much more rapidly that the corresponding // coefficient of the model potential (which is bumpy). Typically this // goes out to n = 18. mult *= amult; real r = _C[n], // the model term s = - mult * _earth.Jn(n) / sqrt(real(2 * n + 1)), // the normal term t = r - s; // the difference if (t == r) // the normal term is negligible break; _zonal.push_back(0); // index = n - 1; the odd terms are 0 _zonal.push_back(s); } int nmx1 = int(_zonal.size()) - 1; _disturbing = SphericalHarmonic1(_C, _S, _gravitational.Coefficients().N(), nmx, _gravitational.Coefficients().mmx(), _zonal, _zonal, // This is not accessed! nmx1, nmx1, 0, _amodel, SphericalHarmonic1::normalization(_norm)); } void GravityModel::ReadMetadata(const std::string& name) { const char* spaces = " \t\n\v\f\r"; _filename = _dir + "/" + name + ".egm"; ifstream metastr(_filename.c_str()); if (!metastr.good()) throw GeographicErr("Cannot open " + _filename); string line; getline(metastr, line); if (!(line.size() >= 6 && line.substr(0,5) == "EGMF-")) throw GeographicErr(_filename + " does not contain EGMF-n signature"); string::size_type n = line.find_first_of(spaces, 5); if (n != string::npos) n -= 5; string version = line.substr(5, n); if (version != "1") throw GeographicErr("Unknown version in " + _filename + ": " + version); string key, val; real a = Math::NaN(), GM = a, omega = a, f = a, J2 = a; while (getline(metastr, line)) { if (!Utility::ParseLine(line, key, val)) continue; // Process key words if (key == "Name") _name = val; else if (key == "Description") _description = val; else if (key == "ReleaseDate") _date = val; else if (key == "ModelRadius") _amodel = Utility::num(val); else if (key == "ModelMass") _GMmodel = Utility::num(val); else if (key == "AngularVelocity") omega = Utility::num(val); else if (key == "ReferenceRadius") a = Utility::num(val); else if (key == "ReferenceMass") GM = Utility::num(val); else if (key == "Flattening") f = Utility::fract(val); else if (key == "DynamicalFormFactor") J2 = Utility::fract(val); else if (key == "HeightOffset") _zeta0 = Utility::fract(val); else if (key == "CorrectionMultiplier") _corrmult = Utility::fract(val); else if (key == "Normalization") { if (val == "FULL" || val == "Full" || val == "full") _norm = SphericalHarmonic::FULL; else if (val == "SCHMIDT" || val == "Schmidt" || val == "schmidt") _norm = SphericalHarmonic::SCHMIDT; else throw GeographicErr("Unknown normalization " + val); } else if (key == "ByteOrder") { if (val == "Big" || val == "big") throw GeographicErr("Only little-endian ordering is supported"); else if (!(val == "Little" || val == "little")) throw GeographicErr("Unknown byte ordering " + val); } else if (key == "ID") _id = val; // else unrecognized keywords are skipped } // Check values if (!(Math::isfinite(_amodel) && _amodel > 0)) throw GeographicErr("Model radius must be positive"); if (!(Math::isfinite(_GMmodel) && _GMmodel > 0)) throw GeographicErr("Model mass constant must be positive"); if (!(Math::isfinite(_corrmult) && _corrmult > 0)) throw GeographicErr("Correction multiplier must be positive"); if (!(Math::isfinite(_zeta0))) throw GeographicErr("Height offset must be finite"); if (int(_id.size()) != idlength_) throw GeographicErr("Invalid ID"); _earth = NormalGravity(a, GM, omega, f, J2); } Math::real GravityModel::InternalT(real X, real Y, real Z, real& deltaX, real& deltaY, real& deltaZ, bool gradp, bool correct) const throw() { // If correct, then produce the correct T = W - U. Otherwise, neglect the // n = 0 term (which is proportial to the difference in the model and // reference values of GM). if (_dzonal0 == 0) // No need to do the correction correct = false; real invR = correct ? 1 / Math::hypot(Math::hypot(X, Y), Z) : 1, T = (gradp ? _disturbing(-1, X, Y, Z, deltaX, deltaY, deltaZ) : _disturbing(-1, X, Y, Z)); T = (T / _amodel - (correct ? _dzonal0 : 0) * invR) * _GMmodel; if (gradp) { real f = _GMmodel / _amodel; deltaX *= f; deltaY *= f; deltaZ *= f; if (correct) { invR = _GMmodel * _dzonal0 * invR * invR * invR; deltaX += X * invR; deltaY += Y * invR; deltaZ += Z * invR; } } return T; } Math::real GravityModel::V(real X, real Y, real Z, real& GX, real& GY, real& GZ) const throw() { real Vres = _gravitational(X, Y, Z, GX, GY, GZ), f = _GMmodel / _amodel; Vres *= f; GX *= f; GY *= f; GZ *= f; return Vres; } Math::real GravityModel::W(real X, real Y, real Z, real& gX, real& gY, real& gZ) const throw() { real fX, fY, Wres = V(X, Y, Z, gX, gY, gZ) + _earth.Phi(X, Y, fX, fY); gX += fX; gY += fY; return Wres; } void GravityModel::SphericalAnomaly(real lat, real lon, real h, real& Dg01, real& xi, real& eta) const throw() { real X, Y, Z, M[Geocentric::dim2_]; _earth.Earth().IntForward(lat, lon, h, X, Y, Z, M); real deltax, deltay, deltaz, T = InternalT(X, Y, Z, deltax, deltay, deltaz, true, false), clam = M[3], slam = -M[0], P = Math::hypot(X, Y), R = Math::hypot(P, Z), // psi is geocentric latitude cpsi = R ? P / R : M[7], spsi = R ? Z / R : M[8]; // Rotate cartesian into spherical coordinates real MC[Geocentric::dim2_]; Geocentric::Rotation(spsi, cpsi, slam, clam, MC); Geocentric::Unrotate(MC, deltax, deltay, deltaz, deltax, deltay, deltaz); // H+M, Eq 2-151c Dg01 = - deltaz - 2 * T / R; real gammaX, gammaY, gammaZ; _earth.U(X, Y, Z, gammaX, gammaY, gammaZ); real gamma = Math::hypot( Math::hypot(gammaX, gammaY), gammaZ); xi = -(deltay/gamma) / Math::degree(); eta = -(deltax/gamma) / Math::degree(); } Math::real GravityModel::GeoidHeight(real lat, real lon) const throw() { real X, Y, Z; _earth.Earth().IntForward(lat, lon, 0, X, Y, Z, NULL); real gamma0 = _earth.SurfaceGravity(lat), dummy, T = InternalT(X, Y, Z, dummy, dummy, dummy, false, false), invR = 1 / Math::hypot(Math::hypot(X, Y), Z), correction = _corrmult * _correction(invR * X, invR * Y, invR * Z); // _zeta0 has been included in _correction return T/gamma0 + correction; } Math::real GravityModel::Gravity(real lat, real lon, real h, real& gx, real& gy, real& gz) const throw() { real X, Y, Z, M[Geocentric::dim2_]; _earth.Earth().IntForward(lat, lon, h, X, Y, Z, M); real Wres = W(X, Y, Z, gx, gy, gz); Geocentric::Unrotate(M, gx, gy, gz, gx, gy, gz); return Wres; } Math::real GravityModel::Disturbance(real lat, real lon, real h, real& deltax, real& deltay, real& deltaz) const throw() { real X, Y, Z, M[Geocentric::dim2_]; _earth.Earth().IntForward(lat, lon, h, X, Y, Z, M); real Tres = InternalT(X, Y, Z, deltax, deltay, deltaz, true, true); Geocentric::Unrotate(M, deltax, deltay, deltaz, deltax, deltay, deltaz); return Tres; } GravityCircle GravityModel::Circle(real lat, real h, unsigned caps) const { if (h != 0) // Disallow invoking GeoidHeight unless h is zero. caps &= ~(CAP_GAMMA0 | CAP_C); real X, Y, Z, M[Geocentric::dim2_]; _earth.Earth().IntForward(lat, 0, h, X, Y, Z, M); // Y = 0, cphi = M[7], sphi = M[8]; real invR = 1 / Math::hypot(X, Z), gamma0 = (caps & CAP_GAMMA0 ?_earth.SurfaceGravity(lat) : Math::NaN()), fx, fy, fz, gamma; if (caps & CAP_GAMMA) { _earth.U(X, Y, Z, fx, fy, fz); // fy = 0 gamma = Math::hypot(fx, fz); } else gamma = Math::NaN(); _earth.Phi(X, Y, fx, fy); return GravityCircle(GravityCircle::mask(caps), _earth._a, _earth._f, lat, h, Z, X, M[7], M[8], _amodel, _GMmodel, _dzonal0, _corrmult, gamma0, gamma, fx, caps & CAP_G ? _gravitational.Circle(X, Z, true) : CircularEngine(), // N.B. If CAP_DELTA is set then CAP_T should be too. caps & CAP_T ? _disturbing.Circle(-1, X, Z, (caps & CAP_DELTA) != 0) : CircularEngine(), caps & CAP_C ? _correction.Circle(invR * X, invR * Z, false) : CircularEngine()); } std::string GravityModel::DefaultGravityPath() { string path; char* gravitypath = getenv("GRAVITY_PATH"); if (gravitypath) path = string(gravitypath); if (path.length()) return path; char* datapath = getenv("GEOGRAPHICLIB_DATA"); if (datapath) path = string(datapath); return (path.length() ? path : string(GEOGRAPHICLIB_DATA)) + "/gravity"; } std::string GravityModel::DefaultGravityName() { string name; char* gravityname = getenv("GRAVITY_NAME"); if (gravityname) name = string(gravityname); return name.length() ? name : string(GRAVITY_DEFAULT_NAME); } } // namespace GeographicLib geographiclib-1.21/src/MGRS.cpp0000644000175000017500000003150211745620415016125 0ustar frankiefrankie/** * \file MGRS.cpp * \brief Implementation for GeographicLib::MGRS class * * Copyright (c) Charles Karney (2008-2012) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #include #include #define GEOGRAPHICLIB_MGRS_CPP "$Id: e4e6b419c8cd8544b3edab85b3352add0d1dd7cb $" RCSID_DECL(GEOGRAPHICLIB_MGRS_CPP) RCSID_DECL(GEOGRAPHICLIB_MGRS_HPP) namespace GeographicLib { using namespace std; const Math::real MGRS::eps_ = // 25 = ceil(log_2(2e7)) -- use half circumference here because northing // 195e5 is a legal in the "southern" hemisphere. pow(real(0.5), numeric_limits::digits - 25); const Math::real MGRS::angeps_ = // 7 = ceil(log_2(90)) pow(real(0.5), numeric_limits::digits - 7); const string MGRS::hemispheres_ = "SN"; const string MGRS::utmcols_[3] = { "ABCDEFGH", "JKLMNPQR", "STUVWXYZ" }; const string MGRS::utmrow_ = "ABCDEFGHJKLMNPQRSTUV"; const string MGRS::upscols_[4] = { "JKLPQRSTUXYZ", "ABCFGHJKLPQR", "RSTUXYZ", "ABCFGHJ" }; const string MGRS::upsrows_[2] = { "ABCDEFGHJKLMNPQRSTUVWXYZ", "ABCDEFGHJKLMNP" }; const string MGRS::latband_ = "CDEFGHJKLMNPQRSTUVWX"; const string MGRS::upsband_ = "ABYZ"; const string MGRS::digits_ = "0123456789"; const int MGRS::mineasting_[4] = { minupsSind_, minupsNind_, minutmcol_, minutmcol_ }; const int MGRS::maxeasting_[4] = { maxupsSind_, maxupsNind_, maxutmcol_, maxutmcol_ }; const int MGRS::minnorthing_[4] = { minupsSind_, minupsNind_, minutmSrow_, minutmSrow_ - (maxutmSrow_ - minutmNrow_) }; const int MGRS::maxnorthing_[4] = { maxupsSind_, maxupsNind_, maxutmNrow_ + (maxutmSrow_ - minutmNrow_), maxutmNrow_ }; void MGRS::Forward(int zone, bool northp, real x, real y, real lat, int prec, std::string& mgrs) { if (zone == UTMUPS::INVALID || Math::isnan(x) || Math::isnan(y) || Math::isnan(lat)) { prec = -1; mgrs = "INVALID"; return; } bool utmp = zone != 0; CheckCoords(utmp, northp, x, y); if (!(zone >= UTMUPS::MINZONE && zone <= UTMUPS::MAXZONE)) throw GeographicErr("Zone " + Utility::str(zone) + " not in [0,60]"); if (!(prec >= 0 && prec <= maxprec_)) throw GeographicErr("MGRS precision " + Utility::str(prec) + " not in [0, " + Utility::str(int(maxprec_)) + "]"); // Fixed char array for accumulating string. Allow space for zone, 3 block // letters, easting + northing. Don't need to allow for terminating null. char mgrs1[2 + 3 + 2 * maxprec_]; int zone1 = zone - 1, z = utmp ? 2 : 0, mlen = z + 3 + 2 * prec; if (utmp) { mgrs1[0] = digits_[ zone / base_ ]; mgrs1[1] = digits_[ zone % base_ ]; // This isn't necessary...! Keep y non-neg // if (!northp) y -= maxutmSrow_ * tile_; } int xh = int(floor(x)) / tile_, yh = int(floor(y)) / tile_; real xf = x - tile_ * xh, yf = y - tile_ * yh; if (utmp) { int // Correct fuzziness in latitude near equator iband = abs(lat) > angeps_ ? LatitudeBand(lat) : (northp ? 0 : -1), icol = xh - minutmcol_, irow = UTMRow(iband, icol, yh % utmrowperiod_); if (irow != yh - (northp ? minutmNrow_ : maxutmSrow_)) throw GeographicErr("Latitude " + Utility::str(lat) + " is inconsistent with UTM coordinates"); mgrs1[z++] = latband_[10 + iband]; mgrs1[z++] = utmcols_[zone1 % 3][icol]; mgrs1[z++] = utmrow_[(yh + (zone1 & 1 ? utmevenrowshift_ : 0)) % utmrowperiod_]; } else { bool eastp = xh >= upseasting_; int iband = (northp ? 2 : 0) + (eastp ? 1 : 0); mgrs1[z++] = upsband_[iband]; mgrs1[z++] = upscols_[iband][xh - (eastp ? upseasting_ : (northp ? minupsNind_ : minupsSind_))]; mgrs1[z++] = upsrows_[northp][yh - (northp ? minupsNind_ : minupsSind_)]; } real mult = pow(real(base_), max(tilelevel_ - prec, 0)); int ix = int(floor(xf / mult)), iy = int(floor(yf / mult)); for (int c = min(prec, int(tilelevel_)); c--;) { mgrs1[z + c] = digits_[ ix % base_ ]; ix /= base_; mgrs1[z + c + prec] = digits_[ iy % base_ ]; iy /= base_; } if (prec > tilelevel_) { xf -= floor(xf / mult); yf -= floor(yf / mult); mult = pow(real(base_), prec - tilelevel_); ix = int(floor(xf * mult)); iy = int(floor(yf * mult)); for (int c = prec - tilelevel_; c--;) { mgrs1[z + c + tilelevel_] = digits_[ ix % base_ ]; ix /= base_; mgrs1[z + c + tilelevel_ + prec] = digits_[ iy % base_ ]; iy /= base_; } } mgrs.resize(mlen); copy(mgrs1, mgrs1 + mlen, mgrs.begin()); } void MGRS::Forward(int zone, bool northp, real x, real y, int prec, std::string& mgrs) { real lat, lon; if (zone > 0) UTMUPS::Reverse(zone, northp, x, y, lat, lon); else // Latitude isn't needed for UPS specs or for INVALID lat = 0; Forward(zone, northp, x, y, lat, prec, mgrs); } void MGRS::Reverse(const std::string& mgrs, int& zone, bool& northp, real& x, real& y, int& prec, bool centerp) { int p = 0, len = int(mgrs.size()); if (len >= 3 && toupper(mgrs[0]) == 'I' && toupper(mgrs[1]) == 'N' && toupper(mgrs[2]) == 'V') { zone = UTMUPS::INVALID; northp = false; x = y = Math::NaN(); prec = -1; return; } int zone1 = 0; while (p < len) { int i = Utility::lookup(digits_, mgrs[p]); if (i < 0) break; zone1 = 10 * zone1 + i; ++p; } if (p > 0 && !(zone1 >= UTMUPS::MINUTMZONE && zone1 <= UTMUPS::MAXUTMZONE)) throw GeographicErr("Zone " + Utility::str(zone1) + " not in [1,60]"); if (p > 2) throw GeographicErr("More than 2 digits_ at start of MGRS " + mgrs.substr(0, p)); if (len - p < 3) throw GeographicErr("MGRS string too short " + mgrs); bool utmp = zone1 != UTMUPS::UPS; int zonem1 = zone1 - 1; const string& band = utmp ? latband_ : upsband_; int iband = Utility::lookup(band, mgrs[p++]); if (iband < 0) throw GeographicErr("Band letter " + Utility::str(mgrs[p-1]) + " not in " + (utmp ? "UTM" : "UPS") + " set " + band); bool northp1 = iband >= (utmp ? 10 : 2); const string& col = utmp ? utmcols_[zonem1 % 3] : upscols_[iband]; const string& row = utmp ? utmrow_ : upsrows_[northp1]; int icol = Utility::lookup(col, mgrs[p++]); if (icol < 0) throw GeographicErr("Column letter " + Utility::str(mgrs[p-1]) + " not in " + (utmp ? "zone " + mgrs.substr(0, p-2) : "UPS band " + Utility::str(mgrs[p-2])) + " set " + col ); int irow = Utility::lookup(row, mgrs[p++]); if (irow < 0) throw GeographicErr("Row letter " + Utility::str(mgrs[p-1]) + " not in " + (utmp ? "UTM" : "UPS " + Utility::str(hemispheres_[northp1])) + " set " + row); if (utmp) { if (zonem1 & 1) irow = (irow + utmrowperiod_ - utmevenrowshift_) % utmrowperiod_; iband -= 10; irow = UTMRow(iband, icol, irow); if (irow == maxutmSrow_) throw GeographicErr("Block " + mgrs.substr(p-2, 2) + " not in zone/band " + mgrs.substr(0, p-2)); irow = northp1 ? irow : irow + 100; icol = icol + minutmcol_; } else { bool eastp = iband & 1; icol += eastp ? upseasting_ : (northp1 ? minupsNind_ : minupsSind_); irow += northp1 ? minupsNind_ : minupsSind_; } int prec1 = (len - p)/2; real unit = tile_, x1 = unit * icol, y1 = unit * irow; for (int i = 0; i < prec1; ++i) { unit /= base_; int ix = Utility::lookup(digits_, mgrs[p + i]), iy = Utility::lookup(digits_, mgrs[p + i + prec1]); if (ix < 0 || iy < 0) throw GeographicErr("Encountered a non-digit in " + mgrs.substr(p)); x1 += unit * ix; y1 += unit * iy; } if ((len - p) % 2) { if (Utility::lookup(digits_, mgrs[len - 1]) < 0) throw GeographicErr("Encountered a non-digit in " + mgrs.substr(p)); else throw GeographicErr("Not an even number of digits_ in " + mgrs.substr(p)); } if (prec1 > maxprec_) throw GeographicErr("More than " + Utility::str(2*maxprec_) + " digits_ in " + mgrs.substr(p)); if (centerp) { x1 += unit/2; y1 += unit/2; } zone = zone1; northp = northp1; x = x1; y = y1; prec = prec1; } void MGRS::CheckCoords(bool utmp, bool& northp, real& x, real& y) { // Limits are all multiples of 100km and are all closed on the lower end // and open on the upper end -- and this is reflected in the error // messages. However if a coordinate lies on the excluded upper end (e.g., // after rounding), it is shifted down by eps_. This also folds UTM // northings to the correct N/S hemisphere. int ix = int(floor(x / tile_)), iy = int(floor(y / tile_)), ind = (utmp ? 2 : 0) + (northp ? 1 : 0); if (! (ix >= mineasting_[ind] && ix < maxeasting_[ind]) ) { if (ix == maxeasting_[ind] && x == maxeasting_[ind] * tile_) x -= eps_; else throw GeographicErr("Easting " + Utility::str(int(floor(x/1000))) + "km not in MGRS/" + (utmp ? "UTM" : "UPS") + " range for " + (northp ? "N" : "S" ) + " hemisphere [" + Utility::str(mineasting_[ind]*tile_/1000) + "km, " + Utility::str(maxeasting_[ind]*tile_/1000) + "km)"); } if (! (iy >= minnorthing_[ind] && iy < maxnorthing_[ind]) ) { if (iy == maxnorthing_[ind] && y == maxnorthing_[ind] * tile_) y -= eps_; else throw GeographicErr("Northing " + Utility::str(int(floor(y/1000))) + "km not in MGRS/" + (utmp ? "UTM" : "UPS") + " range for " + (northp ? "N" : "S" ) + " hemisphere [" + Utility::str(minnorthing_[ind]*tile_/1000) + "km, " + Utility::str(maxnorthing_[ind]*tile_/1000) + "km)"); } // Correct the UTM northing and hemisphere if necessary if (utmp) { if (northp && iy < minutmNrow_) { northp = false; y += utmNshift_; } else if (!northp && iy >= maxutmSrow_) { if (y == maxutmSrow_ * tile_) // If on equator retain S hemisphere y -= eps_; else { northp = true; y -= utmNshift_; } } } } int MGRS::UTMRow(int iband, int icol, int irow) throw() { // Input is MGRS (periodic) row index and output is true row index. Band // index is in [-10, 10) (as returned by LatitudeBand). Column index // origin is easting = 100km. Returns maxutmSrow_ if irow and iband are // incompatible. Row index origin is equator. // Estimate center row number for latitude band // 90 deg = 100 tiles; 1 band = 8 deg = 100*8/90 tiles real c = 100 * (8 * iband + 4)/real(90); bool northp = iband >= 0; int minrow = iband > -10 ? int(floor(c - real(4.3) - real(0.1) * northp)) : -90, maxrow = iband < 9 ? int(floor(c + real(4.4) - real(0.1) * northp)) : 94, baserow = (minrow + maxrow) / 2 - utmrowperiod_ / 2; // Add maxutmSrow_ = 5 * utmrowperiod_ to ensure operand is positive irow = (irow - baserow + maxutmSrow_) % utmrowperiod_ + baserow; if (irow < minrow || irow > maxrow) { // Northing = 71*100km and 80*100km intersect band boundaries // The following deals with these special cases. int // Fold [-10,-1] -> [9,0] sband = iband >= 0 ? iband : -iband - 1, // Fold [-90,-1] -> [89,0] srow = irow >= 0 ? irow : -irow - 1, // Fold [4,7] -> [3,0] scol = icol < 4 ? icol : -icol + 7; if ( ! ( (srow == 70 && sband == 8 && scol >= 2) || (srow == 71 && sband == 7 && scol <= 2) || (srow == 79 && sband == 9 && scol >= 1) || (srow == 80 && sband == 8 && scol <= 1) ) ) irow = maxutmSrow_; } return irow; } } // namespace GeographicLib geographiclib-1.21/NEWS0000644000175000017500000005463711745620415014577 0ustar frankiefrankie# $Id: a8ebe2940755523ec7b77a1645c4155c441a7f17 $ A reverse chronological list of changes to GeographicLib For more information, see http://geographiclib.sourceforge.net/ The current version of the library is 1.21. Changes between 1.21 (released 2012-04-25) and 1.20 versions: * Support colon-separated DMS output: + DMS::Encode and GeoCoords::DMSRepresentation generalized; + GeoConvert and Geod now accept a -: option. * GeoidEval does not print the gradient of the geoid height by default (because it's subject to large errors); give the -g option to get the gradient printed. * Work around optimization BUG in GeographicLib::Geodesic::Inverse with tdm mingw g++ version 4.6.1. * autoconf fixed to ensure that that out-of-sources builds work; document this as the preferred method of using autoconf. * cmake tweaks: + simplify the configuration of doxygen; + allow the Matlab compiler to be specified with the MATLAB_COMPILER option. Changes between 1.20 (released 2012-03-23) and 1.19 versions: * cmake tweaks: + improve find_package's matching of compiler versions; + CMAKE_INSTALL_PREFIX set from CMAKE_PREFIX_PATH if available; + add "x64" to the package name for the 64-bit binary installer; + fix cmake warning with Visual Studio Express. * Fix SphericalEngine to deal with aggessive iterator checking by Visual Studio. * Fix transcription BUG is Geodesic.js. Changes between 1.19 (released 2012-03-13) and 1.18 versions: * Slight improvement in Geodesic::Inverse for very short lines. * Fix argument checking tests in MGRS::Forward. * Add --comment-delimiter and --line-separator options to the utility programs. * Add installer for 64-bit Windows; the compiled Matlab interface is supplied with the Windows 64-bit installer only. Changes between 1.18 (released 2012-02-18) and 1.17 versions: * Improve documentation on configuration with cmake. * cmake's find_package ensures that the compiler versions match on Windows. * Improve documentation on compiling Matlab interface. * Binary installer for Windows installs under C:/pkg-vc10 by default. Changes between 1.17 (released 2012-01-21) and 1.16 versions: * Work around optimization BUG in Geodesic::Inverse with g++ version 4.4.0 (mingw). * Fix BUG in argument checking with OSGB::GridReference. * Fix missing include file in SphericalHarmonic2. * Add simple examples of usage for each class. * Add internal documenation to the cmake configuration files. Changes between 1.16 (released 2011-12-07) and 1.15 versions: * Add calculation of the earth's gravitational field: + add NormalGravity GravityModel and GravityCircle classes; + add command line utility Gravity; + add Gravity models; + add Constants::WGS84_GM(), Constants::WGS84_omega(), and similarly for GRS80. * Build uses GEOGRAPHICLIB_DATA to specify a common parent directory for geoid, gravity, and magnetic data (instead of GEOGRAPHICLIB_GEOID_PATH, etc.); similarly, GeoidEval, Gravity, and MagneticField, look at the environment variable GEOGRAPHICLIB_DATA to locate the data. * Spherical harmonic software changes: + capitalize enums SphericalHarmonic::FULL and SphericalHarmonic::SCHMIDT (the lower case names are retained but deprecated); + optimize the sum by using a static table of square roots which is updated by SphericalEngine::RootTable; + avoid overflow for high degree models. * Magnetic software fixes: + fix documentation BUG in MagneticModel::Circle; + make MagneticModel constructor explicit; + provide default MagneticCircle constructor; + add additional inspector functions to MagneticCircle; + add -c option to MagneticField; + default height to zero in MagneticField. Changes between 1.15 (released 2011-11-08) and 1.14 versions: * Add calculation of the earth's magnetic field: + add MagneticModel and MagneticCircle classes; + add command line utility MagneticField; + add Magnetic models; + add Installing the magnetic field models; + add The format of the magnetic model files; + add classes SphericalEngine, CircularEngine, SphericalHarmonic, SphericalHarmonic1, and SphericalHarmonic2. which sum spherical harmonic series. * Add Utility class to support I/O and date manipulation. * Cmake configuration includes a _d suffix on the library built in debug mode. * For the Python package, include manifest and readme files; don't install setup.py for non-Windows systems. * Include Doxygen tag file in distribution as doc/html/Geographic.tag. Changes between 1.14 (released 2011-09-30) and 1.13 versions: * Ensure that geographiclib-config.cmake is relocatable. * Allow more unicode symbols to be used in DMS::Decode. * Modify GeoidEval so that it can be used to convert the height datum for LIDAR data. * Modest speed-up of Geodesic::Inverse. * Changes in python interface: + FIX BUG in transcription of Geodesic::Inverse; + include setup.py for easy installation; + python only distribution is available at http://pypi.python.org/pypi/geographiclib * Supply a minimal Qt qmake project file for library src/Geographic.pro. Changes between 1.13 (released 2011-08-13) and 1.12 versions: * Changes to I/O: + allow : (colon) to be used as a DMS separator in DMS::Decode; + also accept Unicode symbols for degrees, minutes, and seconds (coded as UTF-8); + provide optional swaplatlong argument to various DMS and GeoCoords functions to make longitude precede latitude; + GeoConvert now has a -w option to make longitude precede latitude on input and output; + include a Javascript version of DMS. * Slight improvement in starting guess for solution of geographic latitude in terms of conformal latitude in TransverseMercator, TransverseMercatorExact, and LambertConformalConic. * For most classes, get rid of const member variables so that the default copy assignment works. * Put Math and Accumulator in their own header files. * Remove unused "fast" GeographicLib::Accumulator method. * Reorganize the Python interface. * Withdraw some deprecated routines. * cmake changes: + include FindGeographic.cmake in distribution; + building with cmake creates and installs geographiclib-config.cmake; + better support for building a shared library under Windows. Changes between 1.12 (released 2011-07-21) and 1.11 versions: * Change license to MIT/X11. * Add GeographicLib::PolygonArea class and equivalent Matlab function. * Provide Javascript and Python implementations of geodesic routines. * Fix Windows installer to include runtime dlls for Matlab. * Fix (innocuous) unassigned variable in Geodesic::GenInverse. * Geodesic routines in Matlab return a12 as first column of aux return value (incompatible change). * A couple of code changes to enable compilation with Visual Studio 2003. Changes between 1.11 (released 2011-06-27) and 1.10 versions: * Changes to Planimeter: + add -l flag to Planimeter for polyline calculations; + trim precision of area to 3 decimal places; + FIX BUG with pole crossing edges (due to compiler optimization). * Geod no longer reports the reduced length by default; however the -f flag still reports this and in addition gives the geodesic scales and the geodesic area. * FIX BUGS (compiler-specific) in inverse geodesic calculations. * FIX BUG: accommodate tellg() returning -1 at end of string. * Change way flattening of the ellipsoid is specified: + constructors take f argument which is taken to be the flattening if f < 1 and the inverse flattening otherwise (this is a compatible change for spheres and oblate ellipsoids, but it is an INCOMPATIBLE change for prolate ellipsoids); + the -e arguments to the Utility Programs are handled similarly; in addition, simple fractions, e.g., 1/297, can be used for the flattening; + introduce Constants::WGS84_f() for the WGS84 flattening (and deprecate Constants::WGS84_r() for the inverse flattening); + most classes have a Flattening() member function; + InverseFlattening() has been deprecated (and now returns inf for a sphere, instead of 0). Changes between 1.10 (released 2011-06-11) and 1.9 versions: * Improvements to Matlab/Octave interface: + add {geocentric,localcartesian}{forward,reverse}; + make geographiclibinterface more general; + install the source for the interface; + cmake compiles the interface if ENABLE_MATLAB=ON; + include compiled interface with Windows binary installer. * Fix various configuration issues + autoconf did not install Config.h; + cmake installed in man/man1 instead of share/man/man1; + cmake did not set the rpath on the tools. Changes between 1.9 (released 2011-05-28) and 1.8 versions: * FIX BUG in area returned by Planimeter for pole encircling polygons. * FIX BUG in error message reported when DMS::Decode reads the string "5d.". * FIX BUG in AlbersEqualArea::Reverse (lon0 not being used). * Ensure that all exceptions thrown in the Utility Programs are caught. * Avoid using catch within GeographicLib::DMS. * Move Accumulator class from Planimeter.cpp to Constants.hpp. * Add Math::sq. * Simplify Installing the geoid datasets + add geographiclib-get-geoids for Unix-like systems; + add installers for Windows. * Provide cmake support: + build binary installer for Windows; + include regression tests; + add --input-string, --input-file, --output-file options to the Utility Programs to support tests. * Rename utility EquidistantTest as GeodesicProj and TransverseMercatorTest as TransverseMercatorProj. * Add ConicProj. * Reverse the initial sense of the -s option for Planimeter. * Migrate source from subversion to git. Changes between 1.8 (released 2011-02-22) and 1.7 versions: * Optionally return rotation matrix from GeographicLib::Geocentric and GeographicLib::LocalCartesian. * For the Utility Programs, supply man pages, -h prints the synopsis, --help prints the man page, --version prints the version. * Use accurate summation in Planimeter. * Add 64-bit targets for Visual Studio 2010. * Use templates for defining math functions and some constants. * GeographicLib::Geoid updates + Add GeographicLib::Geoid::DefaultGeoidPath and GeographicLib::Geoid::DefaultGeoidName; + GeoidEval uses environment variable GEOID_NAME as the default geoid; + Add --msltohae and --haetomsl as GeoidEval options (and don't document the single hyphen versions). * Remove documentation that duplicates papers on transverse Mercator and geodesics. Changes between 1.7 (released 2010-12-21) and 1.6 versions: * FIX BUG in scale returned by GeographicLib::LambertConformalConic::Reverse. * Add GeographicLib::AlbersEqualArea projection. * Library created by Visual Studio is Geographic.lib instead of GeographicLib.lib (compatible with makefiles). * Make classes NaN aware. * Use cell arrays for MGRS strings in Matlab. * Add solution/project files for Visual Studio 2010 (32-bit only). * Use C++11 static_assert and math functions, if available. Change between 1.6 (released 2010-11-23) and 1.5 versions: * FIX BUG introduced in GeographicLib::Geoid in version 1.5 (found by Dave Edwards). Changes between 1.5 (released 2010-11-19) and 1.4 versions: * Improve area calculations for small polygons. * Add -s and -r flags to Planimeter utility. * Improve the accuracy of GeographicLib::LambertConformalConic using divided differences. * FIX BUG in meridian convergence returned by LambertConformalConic::Forward. * Add optional threadsafe parameter to GeographicLib::Geoid constructor. WARNING: This changes may break binary compatibility with previous versions of GeographicLib. However, the library is source compatible. * Add GeographicLib::OSGB. * Matlab and Octave interfaces to GeographicLib::UTMUPS, GeographicLib::MGRS, GeographicLib::Geoid, GeographicLib::Geodesic provided. * Minor changes + explicitly turn on optimization in Visual Studio 2008 projects; + add missing dependencies in some Makefiles; + move pi() and degree() from GeographicLib::Constants to GeographicLib::Math; + introduce GeographicLib::Math::extended type to aid testing; + add GeographicLib::Math::epi() and GeographicLib::Math::edegree(). + fixes to compile under cygwin; + tweak expression used to find latitude from conformal latitude. Changes between 1.4 (released 2010-09-12) and 1.3 versions: * Changes to GeographicLib::Geodesic and GeographicLib::GeodesicLine: + FIX BUG in Geodesic::Inverse with prolate ellipsoids; + add area computations to Geodesic::Direct and Geodesic::Inverse; + add geodesic areas to geodesic test set; + make GeodesicLine constructor public; + change longitude series in Geodesic into Helmert-like form; + ensure that equatorial geodesics have cos(alpha0) = 0 identically; + generalize interface for Geodesic and GeodesicLine; + split GeodesicLine and Geodesic into different files; + signal convergence failure in Geodesic::Inverse with NaNs; + deprecate one function in Geodesic and two functions in GeodesicLine; + deprecate -n option for Geod. WARNING: These changes may break binary compatibility with previous versions of GeographicLib. However, the library is source compatible (with the proviso that GeographicLib/GeodesicLine.hpp may now need to be included). * Add the Planimeter utility for computing the areas of geodesic polygons. * Improve iterative solution of GeographicLib::Gnomonic::Reverse. * Add GeographicLib::Geoid::ConvertHeight. * Add -msltohae, -haetomsl, and -z options to \ref geoideval. * Constructors check that minor radius is positive. * Add overloaded Forward and Reverse functions to the projection classes which don't return the convergence (or azimuth) and scale. * Document function parameters and return values consistently. Changes between 1.3 (released 2010-07-21) and 1.2 versions: * Add GeographicLib::Gnomonic, the ellipsoid generalization of the gnomonic projection. * Add -g and -e options to Equidistanttest. * Use fixed-point notation for output from Cartconvert, Equidistanttest, Transversemercatortest. * PolarStereographic: + Improved conversion to conformal coordinates; + Fix bug with scale at opposite pole; + Complain if latitude out of range in SetScale. * Add GeographicLib::Math::NaN(). * Add long double version of hypot for Windows. * Add EllipticFunction::E(real). * Update references to Geotrans in MGRS documentation. * Speed up tmseries.mac. Changes between 1.2 (released 2010-05-21) and 1.1 versions: * FIX BUGS in GeographicLib::Geodesic, + wrong azimuth returned by Direct if point 2 is on a pole; + Inverse sometimes fails with very close points. * Improve calculation of scale in GeographicLib::CassiniSoldner, + add GeodesicLine::Scale, GeodesicLine::EquatorialAzimuth, and GeodesicLine::EquatorialArc; + break friend connection between CassiniSoldner and Geodesic. * Add DMS::DecodeAngle and DMS::DecodeAzimuth. Extend DMS::Decode and DMS::Encode to deal with distances. * Code and documentation changes in Geodesic and Geocentric for consistency with the forthcoming paper on geodesics. * Increase order of series using in Geodesic to 6 (full accuracy maintained for ellipsoid flattening < 0.01). * Macro __NO_LONG_DOUBLE_MATH to disable use of long double. * Correct declaration of Math::isfinite to return a bool. * Changes in the Utility Programs, + improve error reporting when parsing command line arguments; + accept latitudes and longitudes in decimal degrees or degrees, minutes, and seconds, with optional hemisphere designators; + GeoConvert -z accepts zone or zone+hemisphere; + GeoidEval accepts any of the input formats used by GeoConvert; + CartConvert allows the ellipsoid to be specified with -e. Changes between 1.1 (released 2010-02-09) and 1.0 versions: * FIX BUG (introduced in 2009-03) in EllipticFunction::E(sn,cn,dn). * Increase accuracy of scale calculation in TransverseMercator and TransverseMercatorExact. * Code and documentation changes for consistency with arXiv:1002.1417 Changes between 1.0 (released 2010-01-07) and 2009-11 versions: * Add autoconf configuration files. * BUG FIX: Improve initial guess for Newton's method in PolarStereographic::Reverse. (Previously this failed to converge when the co-latitude exceeded about 130 deg.) * Constructors for TransverseMercator, TransverseMercatorExact, PolarStereographic, Geocentric, and Geodesic now check for obvious problems with their arguments and throw an exception if necessary. * Most classes now include inspector functions such as MajorRadius() so that you can determine how instances were constructed. * Add GeographicLib::LambertConformalConic class. * Add GeographicLib::PolarStereographic::SetScale to allow the latitude of true scale to be specified. * Add solution and project files for Visual Studio 2008. * Add GeographicLib::GeographicErr for exceptions. * GeographicLib::Geoid changes: + BUG FIX: fix typo in GeographicLib::Geoid::Cache which could cause a segmentation fault in some cases when the cached area spanned the prime meridian. + Include sufficient edge data to allow heights to be returned for cached area without disk reads; + Add inspector functions to query the extent of the cache. Changes between 2009-11 and 2009-10 versions: * Allow specification of "closest UTM zone" in GeographicLib::UTMUPS and GeoConvert (via -t option). * Utilities now complain is there are too many tokens on input lines. * Include real-to-real versions of GeographicLib::DMS::Decode and GeographicLib::DMS::Encode. * More house-cleaning changes: + Ensure that functions which return results through reference arguments do not alter the arguments when an exception is thrown. + Improve accuracy of GeographicLib::MGRS::Forward. + Include more information in some error messages. + Improve accuracy of inverse hyperbolic functions. + Fix the way GeographicLib::Math functions handle different precisions. Changes between 2009-10 and 2009-09 versions: * Change web site to http://geographiclib.sourceforge.net * Several house-cleaning changes: + Change from the a flat directory structure to a more easily maintained one. + Introduce Math class for common mathematical functions (in Constants.hpp). + Use Math::real as the type for all real quantities. By default this is typedef'ed to double; and the library should be installed this way. + Eliminate const reference members of AzimuthalEquidistant, CassiniSoldner and LocalCartesian so that they may be copied. + Make several constructors explicit. Disallow some constructors. Disallow copy constructor/assignment for Geoid. + Document least square formulas in Geoid.cpp. + Use unsigned long long for files positions of geoid files in Geoid. + Introduce optional mgrslimits argument in UTMUPS::Forward and UTMUPS::Reverse to enforce stricter MGRS limits on eastings and northings.in + Add 64-bit targets in Visual Studio project files. Changes between 2009-09 and 2009-08 versions: * Add GeographicLib::Geoid and GeoidEval utility. Changes between 2009-08 and 2009-07 versions: * Add GeographicLib::CassiniSoldner class and EquidistantTest utility. * Fix bug in GeographicLib::Geodesic::Inverse where NaNs were sometimes returned. * INCOMPATIBLE CHANGE: AzimuthalEquidistant now returns the reciprocal of the azimuthal scale instead of the reduced length. * Add -n option to GeoConvert. Changes between 2009-07 and 2009-06 versions: * Speed up the series inversion code in tmseries.mac and geod.mac. * Reference Borkowski in section on Geocentric coordinates. Changes between 2009-06 and 2009-05 versions: * Add routines to decode and encode zone+hemisphere to GeographicLib::UTMUPS. * Clean up code in GeographicLib::Geodesic. Changes between 2009-05 and 2009-04 versions: * Improvements to GeographicLib::Geodesic: + more economical series expansions, + return reduced length (as does the Geod utility), + improved calculation of starting point for inverse method, + use reduced length to give derivative for Newton's method. * Add AzimuthalEquidistant class. + Make GeographicLib::Geocentric, GeographicLib::TransverseMercator, and GeographicLib::PolarStereographic classes work with prolate ellipsoids. * CartConvert checks its inputs more carefully. * Remove reference to defunct Constants.cpp from GeographicLib.vcproj. Changes between 2009-04 and 2009-03 versions: * Use compile-time constants to select the order of series in GeographicLib::TransverseMercator. * 2x unroll of Clenshaw summation to avoid data shuffling. * Simplification of GeographicLib::EllipticFunction::E. * Use STATIC_ASSERT for compile-time checking of constants. * Improvements to GeographicLib::Geodesic: + compile-time option to change order of series used, + post maxima code for generating the series, + tune the order of series for double, + improvements in the selection of starting points for Newton's method, + accept and return spherical arc lengths, + works with both oblate and prolate spheroids, + add -a, -e, -b options to the Geod utility. Changes between 2009-03 and 2009-02 versions: * Add GeographicLib::Geodesic and the Geod utility. * Declare when no exceptions are thrown by functions. * Minor changes to GeographicLib::DMS class. * Use invf = 0 to mean a sphere in constructors to some classes. * The makefile creates a library and includes an install target. * Rename GeographicLib::ECEF to GeographicLib::Geocentric, ECEFConvert to CartConvert. * Use inline functions to define constant doubles in Constants.hpp. Changes between 2009-02 and 2009-01 versions: * Fix documentation of constructors (flattening -> inverse flattening). * Use std versions of math functions. * Add ECEF and LocalCartesian classes and ECEFConvert utility. * Gather the documentation on the utility programs onto one page. geographiclib-1.21/depcomp0000755000175000017500000004426711745620415015453 0ustar frankiefrankie#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2009-04-28.21; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free # Software Foundation, Inc. # 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 2, 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 . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u="sed s,\\\\\\\\,/,g" depmode=msvisualcpp fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: geographiclib-1.21/Makefile0000644000175000017500000000002411745620415015515 0ustar frankiefrankieinclude Makefile.mk geographiclib-1.21/cmake/0002755000175000017500000000000011757437425015155 5ustar frankiefrankiegeographiclib-1.21/cmake/geographiclib-config-version.cmake.in0000644000175000017500000000137511745620414024302 0ustar frankiefrankie# $Id: bcb4b84d50be4e5bf5a85d13dff07dcfa3e6715a $ # Version checking for GeographicLib set (PACKAGE_VERSION "@GeographicLib_VERSION@") set (PACKAGE_VERSION_MAJOR "@GeographicLib_VERSION_MAJOR@") set (PACKAGE_VERSION_MINOR "@GeographicLib_VERSION_MINOR@") if (WIN32 AND NOT "${CMAKE_GENERATOR}" STREQUAL "@CMAKE_GENERATOR@") # Reject if there's a mismatch on compiler versions (Windows only) set (PACKAGE_VERSION_UNSUITABLE TRUE) elseif (PACKAGE_FIND_VERSION) if (${PACKAGE_FIND_VERSION} VERSION_EQUAL ${PACKAGE_VERSION}) set (PACKAGE_VERSION_EXACT TRUE) elseif (${PACKAGE_FIND_VERSION} VERSION_LESS ${PACKAGE_VERSION} AND ${PACKAGE_FIND_VERSION_MAJOR} EQUAL ${PACKAGE_VERSION_MAJOR}) set (PACKAGE_VERSION_COMPATIBLE TRUE) endif () endif () geographiclib-1.21/cmake/geographiclib-config.cmake.in0000644000175000017500000000177311745620414022621 0ustar frankiefrankie# $Id: 6f2f024584465d9903d8e3cd313cd876a850b4d2 $ # # Configure GeographicLib # # Set # GEOGRAPHICLIB_FOUND = TRUE # GeographicLib_INCLUDE_DIRS = /usr/local/include # GeographicLib_LIBRARIES = Geographic # GeographicLib_LIBRARY_DIRS = /usr/local/lib # GeographicLib_VERSION = 1.13 (for example) message (STATUS "Reading ${CMAKE_CURRENT_LIST_FILE}") set (GeographicLib_VERSION "@GeographicLib_VERSION@") message (STATUS "GeographicLib configuration, version " ${GeographicLib_VERSION}) # Tell the user project where to find our headers and libraries get_filename_component (_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) get_filename_component (GEOGRAPHICLIB_ROOT_DIR "${_DIR}/@GEOGRAPHICLIB_ROOT_DIR@" ABSOLUTE) set (GeographicLib_INCLUDE_DIRS "${GEOGRAPHICLIB_ROOT_DIR}/include") set (GeographicLib_LIBRARY_DIRS "${GEOGRAPHICLIB_ROOT_DIR}/lib") # Read in the exported definition of the library include ("${_DIR}/geographiclib-depends.cmake") set (GeographicLib_LIBRARIES Geographic) set (GEOGRAPHICLIB_FOUND TRUE) geographiclib-1.21/cmake/FindGeographicLib.cmake0000644000175000017500000000224211745620414021442 0ustar frankiefrankie# $Id: 68ad590f505a0fc2f5419b6abf59d457d7901fc7 $ # # Look for GeographicLib # # Set # GEOGRAPHICLIB_FOUND = TRUE # GeographicLib_INCLUDE_DIRS = /usr/local/include # GeographicLib_LIBRARIES = /usr/local/lib/libGeographic.so # GeographicLib_LIBRARY_DIRS = /usr/local/lib find_library (GeographicLib_LIBRARIES Geographic PATHS "${CMAKE_INSTALL_PREFIX}/../GeographicLib/lib") if (GeographicLib_LIBRARIES) get_filename_component (GeographicLib_LIBRARY_DIRS "${GeographicLib_LIBRARIES}" PATH) get_filename_component (GEOGRAPHICLIB_ROOT_DIR "${GeographicLib_LIBRARY_DIRS}" PATH) set (GeographicLib_INCLUDE_DIRS "${GEOGRAPHICLIB_ROOT_DIR}/include") unset (GEOGRAPHICLIB_ROOT_DIR) if (NOT EXISTS "${GeographicLib_INCLUDE_DIRS}/GeographicLib/Config.h") unset (GeographicLib_INCLUDE_DIRS) unset (GeographicLib_LIBRARIES) unset (GeographicLib_LIBRARY_DIRS) endif () endif () include (FindPackageHandleStandardArgs) find_package_handle_standard_args (GeographicLib DEFAULT_MSG GeographicLib_LIBRARY_DIRS GeographicLib_LIBRARIES GeographicLib_INCLUDE_DIRS) mark_as_advanced (GeographicLib_LIBRARY_DIRS GeographicLib_LIBRARIES GeographicLib_INCLUDE_DIRS) geographiclib-1.21/cmake/Makefile.am0000644000175000017500000000063611745620414017201 0ustar frankiefrankie# # Makefile.am # # Copyright (C) 2011, Charles Karney # $Id: f340bddbdd117ebc666bf508bc582ac92690bf57 $ cmakedir=$(datadir)/cmake/GeographicLib install: $(INSTALL) -d $(DESTDIR)$(cmakedir) $(INSTALL) -m 644 $(srcdir)/FindGeographicLib.cmake \ $(DESTDIR)$(cmakedir) EXTRA_DIST = Makefile.mk FindGeographicLib.cmake \ geographiclib-config-version.cmake.in geographiclib-config.cmake.in geographiclib-1.21/cmake/Makefile.in0000644000175000017500000002406511745620414017214 0ustar frankiefrankie# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Makefile.am # # Copyright (C) 2011, Charles Karney # $Id: f340bddbdd117ebc666bf508bc582ac92690bf57 $ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = cmake DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POW_LIB = @POW_LIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ cmakedir = $(datadir)/cmake/GeographicLib EXTRA_DIST = Makefile.mk FindGeographicLib.cmake \ geographiclib-config-version.cmake.in geographiclib-config.cmake.in all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu cmake/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu cmake/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am install: $(INSTALL) -d $(DESTDIR)$(cmakedir) $(INSTALL) -m 644 $(srcdir)/FindGeographicLib.cmake \ $(DESTDIR)$(cmakedir) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: geographiclib-1.21/cmake/Makefile.mk0000644000175000017500000000040311745620414017203 0ustar frankiefrankie# $Id: 9c58123e002564d0252e543c70539b5a79df36a6 $ DEST = $(PREFIX)/share/cmake/GeographicLib INSTALL=install -b all: @: install: test -d $(DEST) || mkdir -p $(DEST) $(INSTALL) -m 644 FindGeographicLib.cmake $(DEST) clean: @: .PHONY: all install clean geographiclib-1.21/aclocal.m40000644000175000017500000010724511745620415015732 0ustar frankiefrankie# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, [m4_warning([this file was generated for autoconf 2.68. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 10 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless `enable' is passed literally. # For symmetry, `disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful (and sometimes confusing) to the casual installer], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) geographiclib-1.21/tools/0002755000175000017500000000000011757437426015236 5ustar frankiefrankiegeographiclib-1.21/tools/GeodesicProj.cpp0000644000175000017500000001615511745620415020312 0ustar frankiefrankie/** * \file GeodesicProj.cpp * \brief Command line utility for geodesic projections * * Copyright (c) Charles Karney (2009-2012) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * Compile and link with * g++ -g -O3 -I../include -I../man -o GeodesicProj \ * GeodesicProj.cpp \ * ../src/AzimuthalEquidistant.cpp \ * ../src/CassiniSoldner.cpp \ * ../src/DMS.cpp \ * ../src/Geodesic.cpp \ * ../src/GeodesicLine.cpp \ * ../src/Gnomonic.cpp * * See the man page for usage * information. **********************************************************************/ #include #include #include #include #include #include #include #include #include #include #include #include "GeodesicProj.usage" int main(int argc, char* argv[]) { try { using namespace GeographicLib; typedef Math::real real; bool azimuthal = false, cassini = false, gnomonic = false, reverse = false; real lat0 = 0, lon0 = 0; real a = Constants::WGS84_a(), f = Constants::WGS84_f(); std::string istring, ifile, ofile, cdelim; char lsep = ';'; for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-r") reverse = true; else if (arg == "-c" || arg == "-z" || arg == "-g") { cassini = arg == "-c"; azimuthal = arg == "-z"; gnomonic = arg == "-g"; if (m + 2 >= argc) return usage(1, true); try { DMS::DecodeLatLon(std::string(argv[m + 1]), std::string(argv[m + 2]), lat0, lon0); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of " << arg << ": " << e.what() << "\n"; return 1; } m += 2; } else if (arg == "-e") { if (m + 2 >= argc) return usage(1, true); try { a = Utility::num(std::string(argv[m + 1])); f = Utility::fract(std::string(argv[m + 2])); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -e: " << e.what() << "\n"; return 1; } m += 2; } else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": $Id: d6745c19af3da288a8f95b4c6a9003906409800c $\n" << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else return usage(!(arg == "-h" || arg == "--help"), arg != "--help"); } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; if (!(azimuthal || cassini || gnomonic)) { std::cerr << "Must specify \"-z lat0 lon0\" or " << "\"-c lat0 lon0\" or \"-g lat0 lon0\"\n"; return 1; } const Geodesic geod(a, f); const CassiniSoldner cs = cassini ? CassiniSoldner(lat0, lon0, geod) : CassiniSoldner(geod); const AzimuthalEquidistant az(geod); const Gnomonic gn(geod); std::string s; int retval = 0; std::cout << std::fixed; while (std::getline(*input, s)) { try { std::string eol("\n"); if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; s = s.substr(0, m); } } std::istringstream str(s); real lat, lon, x, y, azi, rk; std::string stra, strb; if (!(str >> stra >> strb)) throw GeographicErr("Incomplete input: " + s); if (reverse) { x = Utility::num(stra); y = Utility::num(strb); } else DMS::DecodeLatLon(stra, strb, lat, lon); std::string strc; if (str >> strc) throw GeographicErr("Extraneous input: " + strc); if (reverse) { if (cassini) cs.Reverse(x, y, lat, lon, azi, rk); else if (azimuthal) az.Reverse(lat0, lon0, x, y, lat, lon, azi, rk); else gn.Reverse(lat0, lon0, x, y, lat, lon, azi, rk); *output << Utility::str(lat, 15) << " " << Utility::str(lon, 15) << " " << Utility::str(azi, 15) << " " << Utility::str(rk, 16) << eol; } else { if (cassini) cs.Forward(lat, lon, x, y, azi, rk); else if (azimuthal) az.Forward(lat0, lon0, lat, lon, x, y, azi, rk); else gn.Forward(lat0, lon0, lat, lon, x, y, azi, rk); *output << Utility::str(x, 10) << " " << Utility::str(y, 10) << " " << Utility::str(azi, 15) << " " << Utility::str(rk, 16) << eol; } } catch (const std::exception& e) { *output << "ERROR: " << e.what() << "\n"; retval = 1; } } return retval; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } geographiclib-1.21/tools/geographiclib-get-gravity.sh0000644000175000017500000000674311745620415022626 0ustar frankiefrankie#! /bin/sh # # Download gravity models for use by GeographicLib::GravityModel. # # Copyright (c) Charles Karney (2011) and licensed # under the MIT/X11 License. For more information, see # http://geographiclib.sourceforge.net/ # # $Id: c51df2bd26c5734d35de1fc47d60c433680c6721 $ DEFAULTDIR="@DEFAULTDIR@" usage() { cat <&2; exit 1 ;; esac done shift `expr $OPTIND - 1` test -d "$PARENTDIR"/gravity || mkdir -p "$PARENTDIR"/gravity 2> /dev/null if test ! -d "$PARENTDIR"/gravity; then echo Cannot create directory $PARENTDIR/gravity 1>&2 exit 1 fi TEMP= if test -z "$DEBUG"; then trap 'trap "" 0; test "$TEMP" && rm -rf "$TEMP"; exit 1' 1 2 3 9 15 trap 'test "$TEMP" && rm -rf "$TEMP"' 0 fi TEMP=`mktemp --tmpdir --quiet --directory gravity-XXXXXXXX` if test -z "$TEMP" -o ! -d "$TEMP"; then echo Cannot create temporary directory 1>&2 exit 1 fi WRITETEST="$PARENTDIR"/gravity/write-test-`basename $TEMP` if touch "$WRITETEST" 2> /dev/null; then rm -f "$WRITETEST" else echo Cannot write in directory $PARENTDIR/gravity 1>&2 exit 1 fi set -e cat > $TEMP/all < /dev/null; then echo $1 else case "$1" in all ) cat $TEMP/all ;; minimal ) # same as no argument echo egm96; echo wgs84 ;; * ) echo Unknown gravity model $1 1>&2 exit 1 ;; esac fi shift done > $TEMP/list sort -u $TEMP/list > $TEMP/todo while read file; do echo download $file.tar.bz2 ... URL="http://downloads.sourceforge.net/project/geographiclib/gravity-distrib/$file.tar.bz2?use_mirror=autoselect" ARCHIVE=$TEMP/$file.tar.bz2 wget -O$ARCHIVE $URL echo unpack $file.tar.bz2 ... tar vxojf $ARCHIVE -C $PARENTDIR echo gravity $file installed. done < $TEMP/todo if test "$DEBUG"; then echo Saving temporary directory $TEMP fi cat < and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * Compile and link with * g++ -g -O3 -I../include -I../man -o Geod \ * Geod.cpp \ * ../src/DMS.cpp \ * ../src/Geodesic.cpp \ * ../src/GeodesicLine.cpp * * See the man page for usage * information. **********************************************************************/ #include #include #include #include #include #include #include #include #include #include "Geod.usage" typedef GeographicLib::Math::real real; std::string LatLonString(real lat, real lon, int prec, bool dms, char dmssep) { using namespace GeographicLib; return dms ? DMS::Encode(lat, prec + 5, DMS::LATITUDE, dmssep) + " " + DMS::Encode(lon, prec + 5, DMS::LONGITUDE, dmssep) : DMS::Encode(lat, prec + 5, DMS::NUMBER) + " " + DMS::Encode(lon, prec + 5, DMS::NUMBER); } std::string AzimuthString(real azi, int prec, bool dms, char dmssep) { using namespace GeographicLib; return dms ? DMS::Encode(azi, prec + 5, DMS::AZIMUTH, dmssep) : DMS::Encode(azi >= 180 ? azi - 360 : azi, prec + 5, DMS::NUMBER); } std::string DistanceStrings(real s12, real a12, bool full, bool arcmode, int prec, bool dms) { using namespace GeographicLib; std::string s; if (full || !arcmode) s += Utility::str(s12, prec); if (full) s += " "; if (full || arcmode) s += DMS::Encode(a12, prec + 5, dms ? DMS::NONE : DMS::NUMBER); return s; } real ReadDistance(const std::string& s, bool arcmode) { using namespace GeographicLib; return arcmode ? DMS::DecodeAngle(s) : Utility::num(s); } int main(int argc, char* argv[]) { try { using namespace GeographicLib; bool linecalc = false, inverse = false, arcmode = false, dms = false, full = false; real a = Constants::WGS84_a(), f = Constants::WGS84_f(); real lat1, lon1, azi1, lat2, lon2, azi2, s12, m12, a12, M12, M21, S12; real azi2sense = 0; int prec = 3; std::string istring, ifile, ofile, cdelim; char lsep = ';', dmssep = char(0); for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-i") { inverse = true; linecalc = false; } else if (arg == "-a") arcmode = true; else if (arg == "-l") { inverse = false; linecalc = true; if (m + 3 >= argc) return usage(1, true); try { DMS::DecodeLatLon(std::string(argv[m + 1]), std::string(argv[m + 2]), lat1, lon1); azi1 = DMS::DecodeAzimuth(std::string(argv[m + 3])); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -l: " << e.what() << "\n"; return 1; } m += 3; } else if (arg == "-e") { if (m + 2 >= argc) return usage(1, true); try { a = Utility::num(std::string(argv[m + 1])); f = Utility::fract(std::string(argv[m + 2])); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -e: " << e.what() << "\n"; return 1; } m += 2; } else if (arg == "-d") { dms = true; dmssep = '\0'; } else if (arg == "-:") { dms = true; dmssep = ':'; } else if (arg == "-b") azi2sense = 180; else if (arg == "-f") full = true; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::num(std::string(argv[m])); } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": $Id: 68e3a8ec4a5717094498179912279a756f6e3f8b $\n" << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else return usage(!(arg == "-h" || arg == "--help"), arg != "--help"); } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; const Geodesic geod(a, f); GeodesicLine l; if (linecalc) l = geod.Line(lat1, lon1, azi1); // Max precision = 10: 0.1 nm in distance, 10^-15 deg (= 0.11 nm), // 10^-11 sec (= 0.3 nm). prec = std::min(10, std::max(0, prec)); std::string s; int retval = 0; while (std::getline(*input, s)) { try { std::string eol("\n"); if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; s = s.substr(0, m); } } std::istringstream str(s); if (inverse) { std::string slat1, slon1, slat2, slon2; if (!(str >> slat1 >> slon1 >> slat2 >> slon2)) throw GeographicErr("Incomplete input: " + s); std::string strc; if (str >> strc) throw GeographicErr("Extraneous input: " + strc); DMS::DecodeLatLon(slat1, slon1, lat1, lon1); DMS::DecodeLatLon(slat2, slon2, lat2, lon2); a12 = geod.Inverse(lat1, lon1, lat2, lon2, s12, azi1, azi2, m12, M12, M21, S12); if (full) *output << LatLonString(lat1, lon1, prec, dms, dmssep) << " "; *output << AzimuthString(azi1, prec, dms, dmssep) << " "; if (full) *output << LatLonString(lat2, lon2, prec, dms, dmssep) << " "; *output << AzimuthString(azi2 + azi2sense, prec, dms, dmssep) << " " << DistanceStrings(s12, a12, full, arcmode, prec, dms); if (full) *output << " " << Utility::str(m12, prec) << " " << Utility::str(M12, prec+7) << " " << Utility::str(M21, prec+7) << " " << Utility::str(S12, std::max(prec-7, 0)); *output << eol; } else { if (linecalc) { std::string ss12; if (!(str >> ss12)) throw GeographicErr("Incomplete input: " + s); std::string strc; if (str >> strc) throw GeographicErr("Extraneous input: " + strc); s12 = ReadDistance(ss12, arcmode); if (arcmode) l.ArcPosition(s12, lat2, lon2, azi2, a12, m12, M12, M21, S12); else a12 = l.Position(s12, lat2, lon2, azi2, m12, M12, M21, S12); } else { std::string slat1, slon1, sazi1, ss12; if (!(str >> slat1 >> slon1 >> sazi1 >> ss12)) throw GeographicErr("Incomplete input: " + s); std::string strc; if (str >> strc) throw GeographicErr("Extraneous input: " + strc); DMS::DecodeLatLon(slat1, slon1, lat1, lon1); azi1 = DMS::DecodeAzimuth(sazi1); s12 = ReadDistance(ss12, arcmode); if (arcmode) geod.ArcDirect(lat1, lon1, azi1, s12, lat2, lon2, azi2, a12, m12, M12, M21, S12); else a12 = geod.Direct(lat1, lon1, azi1, s12, lat2, lon2, azi2, m12, M12, M21, S12); } if (arcmode) std::swap(s12, a12); if (full) *output << LatLonString(lat1, lon1, prec, dms, dmssep) << " " << AzimuthString(azi1, prec, dms, dmssep) << " "; *output << LatLonString(lat2, lon2, prec, dms, dmssep) << " " << AzimuthString(azi2 + azi2sense, prec, dms, dmssep); if (full) *output << " " << DistanceStrings(s12, a12, full, arcmode, prec, dms) << " " << Utility::str(m12, prec) << " " << Utility::str(M12, prec+7) << " " << Utility::str(M21, prec+7) << " " << Utility::str(S12, std::max(prec-7, 0)); *output << eol; } } catch (const std::exception& e) { // Write error message cout so output lines match input lines *output << "ERROR: " << e.what() << "\n"; retval = 1; } } return retval; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } geographiclib-1.21/tools/GeoConvert.cpp0000644000175000017500000001523611745620415020007 0ustar frankiefrankie/** * \file GeoConvert.cpp * \brief Command line utility for geographic coordinate conversions * * Copyright (c) Charles Karney (2008-2012) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * Compile and link with * g++ -g -O3 -I../include -I../man -o GeoConvert \ * GeoConvert.cpp \ * ../src/DMS.cpp \ * ../src/GeoCoords.cpp \ * ../src/MGRS.cpp \ * ../src/PolarStereographic.cpp \ * ../src/TransverseMercator.cpp \ * ../src/UTMUPS.cpp * * See the man page for usage * information. **********************************************************************/ #include #include #include #include #include #include #include #include #include "GeoConvert.usage" int main(int argc, char* argv[]) { try { using namespace GeographicLib; typedef Math::real real; enum { GEOGRAPHIC, DMS, UTMUPS, MGRS, CONVERGENCE }; int outputmode = GEOGRAPHIC; int prec = 0; int zone = UTMUPS::MATCH; bool centerp = true, swaplatlong = false; std::string istring, ifile, ofile, cdelim; char lsep = ';', dmssep = char(0); for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-g") outputmode = GEOGRAPHIC; else if (arg == "-d") { outputmode = DMS; dmssep = '\0'; } else if (arg == "-:") { outputmode = DMS; dmssep = ':'; } else if (arg == "-u") outputmode = UTMUPS; else if (arg == "-m") outputmode = MGRS; else if (arg == "-c") outputmode = CONVERGENCE; else if (arg == "-n") centerp = false; else if (arg == "-w") swaplatlong = true; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::num(std::string(argv[m])); } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "-z") { if (++m == argc) return usage(1, true); std::string zonestr(argv[m]); try { bool northp; UTMUPS::DecodeZone(zonestr, zone, northp); } catch (const std::exception&) { std::istringstream str(zonestr); char c; if (!(str >> zone) || (str >> c)) { std::cerr << "Zone " << zonestr << " is not a number or zone+hemisphere\n"; return 1; } if (!(zone >= UTMUPS::MINZONE && zone <= UTMUPS::MAXZONE)) { std::cerr << "Zone " << zone << " not in [0, 60]\n"; return 1; } } } else if (arg == "-s") zone = UTMUPS::STANDARD; else if (arg == "-t") zone = UTMUPS::UTM; else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": $Id: e39b9974b58d123fd979b1c3c086ae3ccccba72d $\n" << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else return usage(!(arg == "-h" || arg == "--help"), arg != "--help"); } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; GeoCoords p; std::string s; std::string os; int retval = 0; while (std::getline(*input, s)) { std::string eol("\n"); try { if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; s = s.substr(0, m); } } p.Reset(s, centerp, swaplatlong); p.SetAltZone(zone); switch (outputmode) { case GEOGRAPHIC: os = p.GeoRepresentation(prec, swaplatlong); break; case DMS: os = p.DMSRepresentation(prec, swaplatlong, dmssep); break; case UTMUPS: os = p.AltUTMUPSRepresentation(prec); break; case MGRS: os = p.AltMGRSRepresentation(prec); break; case CONVERGENCE: { real gamma = p.AltConvergence(), k = p.AltScale(); os = Utility::str(gamma, std::max(-5,std::min(8,prec))+5) + " " + Utility::str(k, std::max(-5,std::min(8,prec))+7); } } } catch (const std::exception& e) { // Write error message to cout so output lines match input lines os = std::string("ERROR: ") + e.what(); retval = 1; } *output << os << eol; } return retval; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } geographiclib-1.21/tools/geographiclib-get-geoids.sh0000644000175000017500000001035111745620415022401 0ustar frankiefrankie#! /bin/sh # # Download geoid datasets for use by GeographicLib::Geoid. This is # modeled on a similar script geographiclib-datasets-download by # Francesco P. Lovergine # # Copyright (c) Charles Karney (2011) and licensed # under the MIT/X11 License. For more information, see # http://geographiclib.sourceforge.net/ # # $Id: 292585f16e1696fce69b211553723e5c0d03ac4b $ DEFAULTDIR="@DEFAULTDIR@" usage() { cat <&2; exit 1 ;; esac done shift `expr $OPTIND - 1` test -d "$PARENTDIR"/geoids || mkdir -p "$PARENTDIR"/geoids 2> /dev/null if test ! -d "$PARENTDIR"/geoids; then echo Cannot create directory $PARENTDIR/geoids 1>&2 exit 1 fi TEMP= if test -z "$DEBUG"; then trap 'trap "" 0; test "$TEMP" && rm -rf "$TEMP"; exit 1' 1 2 3 9 15 trap 'test "$TEMP" && rm -rf "$TEMP"' 0 fi TEMP=`mktemp --tmpdir --quiet --directory geoid-XXXXXXXX` if test -z "$TEMP" -o ! -d "$TEMP"; then echo Cannot create temporary directory 1>&2 exit 1 fi WRITETEST="$PARENTDIR"/geoids/write-test-`basename $TEMP` if touch "$WRITETEST" 2> /dev/null; then rm -f "$WRITETEST" else echo Cannot write in directory $PARENTDIR/geoids 1>&2 exit 1 fi set -e cat > $TEMP/all < /dev/null; then echo $1 else case "$1" in all ) cat $TEMP/all ;; minimal ) # same as no argument echo egm96-5 ;; best ) # highest resolution models cat < egm2008-2_5 cat <&2 exit 1 ;; esac fi shift done > $TEMP/list sort -u $TEMP/list > $TEMP/todo while read file; do echo download $file.tar.bz2 ... URL="http://downloads.sourceforge.net/project/geographiclib/geoids-distrib/$file.tar.bz2?use_mirror=autoselect" ARCHIVE=$TEMP/$file.tar.bz2 wget -O$ARCHIVE $URL echo unpack $file.tar.bz2 ... tar vxojf $ARCHIVE -C $PARENTDIR echo geoid $file installed. done < $TEMP/todo if test "$DEBUG"; then echo Saving temporary directory $TEMP fi cat < ${SCRIPT} COMMAND chmod +x ${SCRIPT} DEPENDS ${SCRIPT}.sh) install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${SCRIPT} DESTINATION sbin) endforeach () add_custom_target (scripts ALL DEPENDS ${SCRIPTS}) endif () # Copy the shared library on Windows systems to this directory (tools) so # that the tests can be run. if (WIN32 AND GEOGRAPHIC_SHARED_LIB) get_target_property (GEOGRAPHIC_LIBRARY_FILE Geographic "LOCATION_${CMAKE_CFG_INTDIR}") add_custom_command (TARGET tools POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${GEOGRAPHIC_LIBRARY_FILE} ${CMAKE_CFG_INTDIR}/) endif () # Turn on testing enable_testing () # Here are the tests. They consists of calling the various tools with # --input-string and matching the output against regular expressions. add_test (GeoConvert0 GeoConvert -p -3 -m --input-string "33.3 44.4") set_tests_properties (GeoConvert0 PROPERTIES PASS_REGULAR_EXPRESSION "38SMB4484") add_test (GeoConvert1 GeoConvert -d --input-string "38smb") set_tests_properties (GeoConvert1 PROPERTIES PASS_REGULAR_EXPRESSION "32d59'14\\.1\"N 044d27'53\\.4\"E") add_test (GeoConvert2 GeoConvert -p -2 --input-string "30d30'30\" 30.50833") set_tests_properties (GeoConvert2 PROPERTIES PASS_REGULAR_EXPRESSION "30\\.508 30\\.508") add_test (GeoConvert3 GeoConvert --junk) set_tests_properties (GeoConvert3 PROPERTIES WILL_FAIL ON) add_test (GeoConvert4 GeoConvert --input-string garbage) set_tests_properties (GeoConvert4 PROPERTIES WILL_FAIL ON) # Check fix for DMS::Decode bug fixed on 2011-03-22 add_test (GeoConvert5 GeoConvert --input-string "5d. 0") set_tests_properties (GeoConvert5 PROPERTIES WILL_FAIL ON) add_test (Geod0 Geod -i -p 0 --input-string "40.6 -73.8 49d01'N 2d33'E") set_tests_properties (Geod0 PROPERTIES PASS_REGULAR_EXPRESSION "53\\.47022 111\\.59367 5853226") add_test (Geod1 Geod -p 0 --input-string "40d38'23\"N 073d46'44\"W 53d30' 5850e3") set_tests_properties (Geod1 PROPERTIES PASS_REGULAR_EXPRESSION "49\\.01467 2\\.56106 111\\.62947") # Check fix for antipodal prolate bug found 2010-09-04 add_test (Geod2 Geod -i -p 0 -e 6.4e6 -1/150 --input-string "0.07476 0 -0.07476 180") set_tests_properties (Geod2 PROPERTIES PASS_REGULAR_EXPRESSION "90\\.00078 90\\.00078 20106193") # Another check for similar bug add_test (Geod3 Geod -i -p 0 -e 6.4e6 -1/150 --input-string "0.1 0 -0.1 180") set_tests_properties (Geod3 PROPERTIES PASS_REGULAR_EXPRESSION "90\\.00105 90\\.00105 20106193") # Check fix for short line bug found 2010-05-21 add_test (Geod4 Geod -i --input-string "36.493349428792 0 36.49334942879201 .0000008") set_tests_properties (Geod4 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 0\\.072") # Check fix for point2=pole bug found 2010-05-03 (but only with long double) add_test (Geod5 Geod -p 0 --input-string "0.01777745589997 30 0 10e6") set_tests_properties (Geod5 PROPERTIES PASS_REGULAR_EXPRESSION "90\\.00000 -150\\.00000 -180\\.00000;90\\.00000 30\\.00000 0\\.00000") # Check fix for volatile sbet12a bug found 2011-06-25 (gcc 4.4.4 x86 -O3) # Found again on 2012-03-27 with tdm-mingw32 (g++ 4.6.1). add_test (Geod6 Geod -i --input-string "88.202499451857 0 -88.202499451857 179.981022032992859592") add_test (Geod7 Geod -i --input-string "89.262080389218 0 -89.262080389218 179.992207982775375662") add_test (Geod8 Geod -i --input-string "89.333123580033 0 -89.333123580032997687 179.99295812360148422") set_tests_properties (Geod6 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 20003898.214") set_tests_properties (Geod7 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 20003925.854") set_tests_properties (Geod8 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 20003926.881") # Check fix for volatile x bug found 2011-06-25 (gcc 4.4.4 x86 -O3) add_test (Geod9 Geod -i --input-string "56.320923501171 0 -56.320923501171 179.664747671772880215") set_tests_properties (Geod9 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 19993558.287") # Check fix for adjust tol1_ bug found 2011-06-25 (Visual Studio 10 rel + debug) add_test (Geod10 Geod -i --input-string "52.784459512564 0 -52.784459512563990912 179.634407464943777557") set_tests_properties (Geod10 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 19991596.095") # Check fix for bet2 = -bet1 bug found 2011-06-25 (Visual Studio 10 rel + debug) add_test (Geod11 Geod -i --input-string "48.522876735459 0 -48.52287673545898293 179.599720456223079643") set_tests_properties (Geod11 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 19989144.774") # Check fix for pole-encircling bug found 2011-03-16 add_test (Planimeter0 Planimeter --input-string "89 0;89 90;89 180;89 270") add_test (Planimeter1 Planimeter -r --input-string "-89 0;-89 90;-89 180;-89 270") add_test (Planimeter2 Planimeter --input-string "0 -1;-1 0;0 1;1 0") add_test (Planimeter3 Planimeter --input-string "90 0; 0 0; 0 90") add_test (Planimeter4 Planimeter -l --input-string "90 0; 0 0; 0 90") set_tests_properties (Planimeter0 PROPERTIES PASS_REGULAR_EXPRESSION "4 631819\\.8745[0-9]+ 2495230567[78]\\.[0-9]+") set_tests_properties (Planimeter1 PROPERTIES PASS_REGULAR_EXPRESSION "4 631819\\.8745[0-9]+ 2495230567[78]\\.[0-9]+") set_tests_properties (Planimeter2 PROPERTIES PASS_REGULAR_EXPRESSION "4 627598\\.2731[0-9]+ 24619419146.[0-9]+") set_tests_properties (Planimeter3 PROPERTIES PASS_REGULAR_EXPRESSION "3 30022685\\.[0-9]+ 63758202715511\\.[0-9]+") set_tests_properties (Planimeter4 PROPERTIES PASS_REGULAR_EXPRESSION "3 20020719\\.[0-9]+") # Check fix for Planimeter pole crossing bug found 2011-06-24 add_test (Planimeter5 Planimeter --input-string "89,0.1;89,90.1;89,-179.9") set_tests_properties (Planimeter5 PROPERTIES PASS_REGULAR_EXPRESSION "3 539297\\.[0-9]+ 1247615283[89]\\.[0-9]+") # Check fix for AlbersEqualArea::Reverse bug found 2011-05-01 add_test (ConicProj0 ConicProj -a 40d58 39d56 -l 77d45W -r --input-string "220e3 -52e3") set_tests_properties (ConicProj0 PROPERTIES PASS_REGULAR_EXPRESSION "39\\.95[0-9]+ -75\\.17[0-9]+ 1\\.67[0-9]+ 0\\.99[0-9]+") add_test (CartConvert0 CartConvert -e 6.4e6 1/100 -r --input-string "10e3 0 1e3") add_test (CartConvert1 CartConvert -e 6.4e6 -1/100 -r --input-string "1e3 0 10e3") set_tests_properties (CartConvert0 PROPERTIES PASS_REGULAR_EXPRESSION "85\\.57[0-9]+ 0\\.0[0]+ -6334614\\.[0-9]+") set_tests_properties (CartConvert1 PROPERTIES PASS_REGULAR_EXPRESSION "4\\.42[0-9]+ 0\\.0[0]+ -6398614\\.[0-9]+") if (EXISTS ${GEOGRAPHICLIB_DATA}/geoids/egm96-5.pgm) # Check fix for single-cell cache bug found 2010-11-23 add_test (GeoidEval0 GeoidEval -n egm96-5 --input-string "0d1 0d1;0d4 0d4") set_tests_properties (GeoidEval0 PROPERTIES PASS_REGULAR_EXPRESSION "^17\\.1[56].. 17\\.1[45]..") endif () if (EXISTS ${GEOGRAPHICLIB_DATA}/magnetic/wmm2010.wmm) # Test case from WMM2010_Report.pdf, Sec 1.5, pp 14-15: # t = 2012.5, lat = -80, lon = 240, h = 100e3 add_test (MagneticField0 MagneticField -n wmm2010 -p 10 -r --input-string "2012.5 -80 240 100e3") add_test (MagneticField1 MagneticField -n wmm2010 -p 10 -r -t 2012.5 --input-string "-80 240 100e3") add_test (MagneticField2 MagneticField -n wmm2010 -p 10 -r -c 2012.5 -80 100e3 --input-string "240") set_tests_properties (MagneticField0 PROPERTIES PASS_REGULAR_EXPRESSION " 5535\\.5249148687 14765\\.3703243050 -50625\\.9305478794 .* .* 20\\.4904268023 1\\.0272592716 83\\.5313962281 ") set_tests_properties (MagneticField1 PROPERTIES PASS_REGULAR_EXPRESSION " 5535\\.5249148687 14765\\.3703243050 -50625\\.9305478794 .* .* 20\\.4904268023 1\\.0272592716 83\\.5313962281 ") set_tests_properties (MagneticField2 PROPERTIES PASS_REGULAR_EXPRESSION " 5535\\.5249148687 14765\\.3703243050 -50625\\.9305478794 .* .* 20\\.4904268023 1\\.0272592716 83\\.5313962281 ") endif () if (EXISTS ${GEOGRAPHICLIB_DATA}/gravity/egm2008.egm) # Verify no overflow at poles with high degree model add_test (Gravity0 Gravity -n egm2008 -p 6 --input-string "90 110 0") set_tests_properties (Gravity0 PROPERTIES PASS_REGULAR_EXPRESSION "-0\\.000146 0\\.000078 -9\\.832294") endif () geographiclib-1.21/tools/Makefile.am0000644000175000017500000001266711745620415017271 0ustar frankiefrankie# # Makefile.am # # Copyright (C) 2009, Francesco P. Lovergine # $Id: c212f6390b52c0be8aaa7ceba4ccabefe63fb1fd $ AM_CPPFLAGS = -Wall -funroll-loops -finline-functions -fomit-frame-pointer INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_builddir)/man -I$(top_srcdir)/man LDADD = $(top_builddir)/src/libGeographic.la DEPS = $(top_builddir)/src/libGeographic.la bin_PROGRAMS = CartConvert \ ConicProj \ GeoConvert \ Geod \ GeodesicProj \ GeoidEval \ Gravity \ MagneticField \ Planimeter \ TransverseMercatorProj CartConvert_SOURCES = CartConvert.cpp \ ../man/CartConvert.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geocentric.hpp \ ../include/GeographicLib/LocalCartesian.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/Utility.hpp ConicProj_SOURCES = ConicProj.cpp \ ../man/ConicProj.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/AlbersEqualArea.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/LambertConformalConic.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/Utility.hpp GeoConvert_SOURCES = GeoConvert.cpp \ ../man/GeoConvert.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/GeoCoords.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/UTMUPS.hpp \ ../include/GeographicLib/Utility.hpp Geod_SOURCES = Geod.cpp \ ../man/Geod.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geodesic.hpp \ ../include/GeographicLib/GeodesicLine.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/Utility.hpp GeodesicProj_SOURCES = GeodesicProj.cpp \ ../man/GeodesicProj.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/AzimuthalEquidistant.hpp \ ../include/GeographicLib/CassiniSoldner.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geodesic.hpp \ ../include/GeographicLib/GeodesicLine.hpp \ ../include/GeographicLib/Gnomonic.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/Utility.hpp GeoidEval_SOURCES = GeoidEval.cpp \ ../man/GeoidEval.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/GeoCoords.hpp \ ../include/GeographicLib/Geoid.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/UTMUPS.hpp \ ../include/GeographicLib/Utility.hpp Gravity_SOURCES = Gravity.cpp \ ../man/Gravity.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/CircularEngine.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geocentric.hpp \ ../include/GeographicLib/GravityCircle.hpp \ ../include/GeographicLib/GravityModel.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/NormalGravity.hpp \ ../include/GeographicLib/SphericalEngine.hpp \ ../include/GeographicLib/SphericalHarmonic.hpp \ ../include/GeographicLib/SphericalHarmonic1.hpp \ ../include/GeographicLib/Utility.hpp MagneticField_SOURCES = MagneticField.cpp \ ../man/MagneticField.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/CircularEngine.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geocentric.hpp \ ../include/GeographicLib/MagneticCircle.hpp \ ../include/GeographicLib/MagneticModel.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/SphericalEngine.hpp \ ../include/GeographicLib/SphericalHarmonic.hpp \ ../include/GeographicLib/Utility.hpp Planimeter_SOURCES = Planimeter.cpp \ ../man/Planimeter.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Accumulator.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/GeoCoords.hpp \ ../include/GeographicLib/Geodesic.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/PolygonArea.hpp \ ../include/GeographicLib/UTMUPS.hpp \ ../include/GeographicLib/Utility.hpp TransverseMercatorProj_SOURCES = TransverseMercatorProj.cpp \ ../man/TransverseMercatorProj.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/EllipticFunction.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/TransverseMercator.hpp \ ../include/GeographicLib/TransverseMercatorExact.hpp \ ../include/GeographicLib/Utility.hpp sbin_SCRIPTS = geographiclib-get-geoids \ geographiclib-get-gravity \ geographiclib-get-magnetic geographiclib_data=$(datadir)/GeographicLib geographiclib-get-geoids: geographiclib-get-geoids.sh sed -e "s%@DEFAULTDIR@%$(geographiclib_data)%" $< > $@ chmod +x $@ geographiclib-get-gravity: geographiclib-get-gravity.sh sed -e "s%@DEFAULTDIR@%$(geographiclib_data)%" $< > $@ chmod +x $@ geographiclib-get-magnetic: geographiclib-get-magnetic.sh sed -e "s%@DEFAULTDIR@%$(geographiclib_data)%" $< > $@ chmod +x $@ CLEANFILES = $(sbin_SCRIPTS) EXTRA_DIST = Makefile.mk CMakeLists.txt \ geographiclib-get-geoids.sh geographiclib-get-gravity.sh \ geographiclib-get-magnetic.sh geographiclib-1.21/tools/Makefile.in0000644000175000017500000007125411745620415017277 0ustar frankiefrankie# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Makefile.am # # Copyright (C) 2009, Francesco P. Lovergine # $Id: c212f6390b52c0be8aaa7ceba4ccabefe63fb1fd $ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ bin_PROGRAMS = CartConvert$(EXEEXT) ConicProj$(EXEEXT) \ GeoConvert$(EXEEXT) Geod$(EXEEXT) GeodesicProj$(EXEEXT) \ GeoidEval$(EXEEXT) Gravity$(EXEEXT) MagneticField$(EXEEXT) \ Planimeter$(EXEEXT) TransverseMercatorProj$(EXEEXT) subdir = tools DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" PROGRAMS = $(bin_PROGRAMS) am_CartConvert_OBJECTS = CartConvert.$(OBJEXT) CartConvert_OBJECTS = $(am_CartConvert_OBJECTS) CartConvert_LDADD = $(LDADD) CartConvert_DEPENDENCIES = $(top_builddir)/src/libGeographic.la am_ConicProj_OBJECTS = ConicProj.$(OBJEXT) ConicProj_OBJECTS = $(am_ConicProj_OBJECTS) ConicProj_LDADD = $(LDADD) ConicProj_DEPENDENCIES = $(top_builddir)/src/libGeographic.la am_GeoConvert_OBJECTS = GeoConvert.$(OBJEXT) GeoConvert_OBJECTS = $(am_GeoConvert_OBJECTS) GeoConvert_LDADD = $(LDADD) GeoConvert_DEPENDENCIES = $(top_builddir)/src/libGeographic.la am_Geod_OBJECTS = Geod.$(OBJEXT) Geod_OBJECTS = $(am_Geod_OBJECTS) Geod_LDADD = $(LDADD) Geod_DEPENDENCIES = $(top_builddir)/src/libGeographic.la am_GeodesicProj_OBJECTS = GeodesicProj.$(OBJEXT) GeodesicProj_OBJECTS = $(am_GeodesicProj_OBJECTS) GeodesicProj_LDADD = $(LDADD) GeodesicProj_DEPENDENCIES = $(top_builddir)/src/libGeographic.la am_GeoidEval_OBJECTS = GeoidEval.$(OBJEXT) GeoidEval_OBJECTS = $(am_GeoidEval_OBJECTS) GeoidEval_LDADD = $(LDADD) GeoidEval_DEPENDENCIES = $(top_builddir)/src/libGeographic.la am_Gravity_OBJECTS = Gravity.$(OBJEXT) Gravity_OBJECTS = $(am_Gravity_OBJECTS) Gravity_LDADD = $(LDADD) Gravity_DEPENDENCIES = $(top_builddir)/src/libGeographic.la am_MagneticField_OBJECTS = MagneticField.$(OBJEXT) MagneticField_OBJECTS = $(am_MagneticField_OBJECTS) MagneticField_LDADD = $(LDADD) MagneticField_DEPENDENCIES = $(top_builddir)/src/libGeographic.la am_Planimeter_OBJECTS = Planimeter.$(OBJEXT) Planimeter_OBJECTS = $(am_Planimeter_OBJECTS) Planimeter_LDADD = $(LDADD) Planimeter_DEPENDENCIES = $(top_builddir)/src/libGeographic.la am_TransverseMercatorProj_OBJECTS = TransverseMercatorProj.$(OBJEXT) TransverseMercatorProj_OBJECTS = $(am_TransverseMercatorProj_OBJECTS) TransverseMercatorProj_LDADD = $(LDADD) TransverseMercatorProj_DEPENDENCIES = \ $(top_builddir)/src/libGeographic.la am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' SCRIPTS = $(sbin_SCRIPTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include/GeographicLib depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(CartConvert_SOURCES) $(ConicProj_SOURCES) \ $(GeoConvert_SOURCES) $(Geod_SOURCES) $(GeodesicProj_SOURCES) \ $(GeoidEval_SOURCES) $(Gravity_SOURCES) \ $(MagneticField_SOURCES) $(Planimeter_SOURCES) \ $(TransverseMercatorProj_SOURCES) DIST_SOURCES = $(CartConvert_SOURCES) $(ConicProj_SOURCES) \ $(GeoConvert_SOURCES) $(Geod_SOURCES) $(GeodesicProj_SOURCES) \ $(GeoidEval_SOURCES) $(Gravity_SOURCES) \ $(MagneticField_SOURCES) $(Planimeter_SOURCES) \ $(TransverseMercatorProj_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POW_LIB = @POW_LIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -Wall -funroll-loops -finline-functions -fomit-frame-pointer INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_builddir)/man -I$(top_srcdir)/man LDADD = $(top_builddir)/src/libGeographic.la DEPS = $(top_builddir)/src/libGeographic.la CartConvert_SOURCES = CartConvert.cpp \ ../man/CartConvert.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geocentric.hpp \ ../include/GeographicLib/LocalCartesian.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/Utility.hpp ConicProj_SOURCES = ConicProj.cpp \ ../man/ConicProj.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/AlbersEqualArea.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/LambertConformalConic.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/Utility.hpp GeoConvert_SOURCES = GeoConvert.cpp \ ../man/GeoConvert.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/GeoCoords.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/UTMUPS.hpp \ ../include/GeographicLib/Utility.hpp Geod_SOURCES = Geod.cpp \ ../man/Geod.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geodesic.hpp \ ../include/GeographicLib/GeodesicLine.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/Utility.hpp GeodesicProj_SOURCES = GeodesicProj.cpp \ ../man/GeodesicProj.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/AzimuthalEquidistant.hpp \ ../include/GeographicLib/CassiniSoldner.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geodesic.hpp \ ../include/GeographicLib/GeodesicLine.hpp \ ../include/GeographicLib/Gnomonic.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/Utility.hpp GeoidEval_SOURCES = GeoidEval.cpp \ ../man/GeoidEval.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/GeoCoords.hpp \ ../include/GeographicLib/Geoid.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/UTMUPS.hpp \ ../include/GeographicLib/Utility.hpp Gravity_SOURCES = Gravity.cpp \ ../man/Gravity.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/CircularEngine.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geocentric.hpp \ ../include/GeographicLib/GravityCircle.hpp \ ../include/GeographicLib/GravityModel.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/NormalGravity.hpp \ ../include/GeographicLib/SphericalEngine.hpp \ ../include/GeographicLib/SphericalHarmonic.hpp \ ../include/GeographicLib/SphericalHarmonic1.hpp \ ../include/GeographicLib/Utility.hpp MagneticField_SOURCES = MagneticField.cpp \ ../man/MagneticField.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/CircularEngine.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geocentric.hpp \ ../include/GeographicLib/MagneticCircle.hpp \ ../include/GeographicLib/MagneticModel.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/SphericalEngine.hpp \ ../include/GeographicLib/SphericalHarmonic.hpp \ ../include/GeographicLib/Utility.hpp Planimeter_SOURCES = Planimeter.cpp \ ../man/Planimeter.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Accumulator.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/GeoCoords.hpp \ ../include/GeographicLib/Geodesic.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/PolygonArea.hpp \ ../include/GeographicLib/UTMUPS.hpp \ ../include/GeographicLib/Utility.hpp TransverseMercatorProj_SOURCES = TransverseMercatorProj.cpp \ ../man/TransverseMercatorProj.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/EllipticFunction.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/TransverseMercator.hpp \ ../include/GeographicLib/TransverseMercatorExact.hpp \ ../include/GeographicLib/Utility.hpp sbin_SCRIPTS = geographiclib-get-geoids \ geographiclib-get-gravity \ geographiclib-get-magnetic geographiclib_data = $(datadir)/GeographicLib CLEANFILES = $(sbin_SCRIPTS) EXTRA_DIST = Makefile.mk CMakeLists.txt \ geographiclib-get-geoids.sh geographiclib-get-gravity.sh \ geographiclib-get-magnetic.sh all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tools/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tools/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list CartConvert$(EXEEXT): $(CartConvert_OBJECTS) $(CartConvert_DEPENDENCIES) @rm -f CartConvert$(EXEEXT) $(CXXLINK) $(CartConvert_OBJECTS) $(CartConvert_LDADD) $(LIBS) ConicProj$(EXEEXT): $(ConicProj_OBJECTS) $(ConicProj_DEPENDENCIES) @rm -f ConicProj$(EXEEXT) $(CXXLINK) $(ConicProj_OBJECTS) $(ConicProj_LDADD) $(LIBS) GeoConvert$(EXEEXT): $(GeoConvert_OBJECTS) $(GeoConvert_DEPENDENCIES) @rm -f GeoConvert$(EXEEXT) $(CXXLINK) $(GeoConvert_OBJECTS) $(GeoConvert_LDADD) $(LIBS) Geod$(EXEEXT): $(Geod_OBJECTS) $(Geod_DEPENDENCIES) @rm -f Geod$(EXEEXT) $(CXXLINK) $(Geod_OBJECTS) $(Geod_LDADD) $(LIBS) GeodesicProj$(EXEEXT): $(GeodesicProj_OBJECTS) $(GeodesicProj_DEPENDENCIES) @rm -f GeodesicProj$(EXEEXT) $(CXXLINK) $(GeodesicProj_OBJECTS) $(GeodesicProj_LDADD) $(LIBS) GeoidEval$(EXEEXT): $(GeoidEval_OBJECTS) $(GeoidEval_DEPENDENCIES) @rm -f GeoidEval$(EXEEXT) $(CXXLINK) $(GeoidEval_OBJECTS) $(GeoidEval_LDADD) $(LIBS) Gravity$(EXEEXT): $(Gravity_OBJECTS) $(Gravity_DEPENDENCIES) @rm -f Gravity$(EXEEXT) $(CXXLINK) $(Gravity_OBJECTS) $(Gravity_LDADD) $(LIBS) MagneticField$(EXEEXT): $(MagneticField_OBJECTS) $(MagneticField_DEPENDENCIES) @rm -f MagneticField$(EXEEXT) $(CXXLINK) $(MagneticField_OBJECTS) $(MagneticField_LDADD) $(LIBS) Planimeter$(EXEEXT): $(Planimeter_OBJECTS) $(Planimeter_DEPENDENCIES) @rm -f Planimeter$(EXEEXT) $(CXXLINK) $(Planimeter_OBJECTS) $(Planimeter_LDADD) $(LIBS) TransverseMercatorProj$(EXEEXT): $(TransverseMercatorProj_OBJECTS) $(TransverseMercatorProj_DEPENDENCIES) @rm -f TransverseMercatorProj$(EXEEXT) $(CXXLINK) $(TransverseMercatorProj_OBJECTS) $(TransverseMercatorProj_LDADD) $(LIBS) install-sbinSCRIPTS: $(sbin_SCRIPTS) @$(NORMAL_INSTALL) test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)" @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ } \ ; done uninstall-sbinSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(sbindir)" && rm -f $$files mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CartConvert.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConicProj.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeoConvert.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Geod.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeodesicProj.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeoidEval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Gravity.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MagneticField.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Planimeter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TransverseMercatorProj.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(SCRIPTS) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-sbinSCRIPTS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-sbinSCRIPTS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-binPROGRAMS install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-sbinSCRIPTS install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-binPROGRAMS uninstall-sbinSCRIPTS geographiclib-get-geoids: geographiclib-get-geoids.sh sed -e "s%@DEFAULTDIR@%$(geographiclib_data)%" $< > $@ chmod +x $@ geographiclib-get-gravity: geographiclib-get-gravity.sh sed -e "s%@DEFAULTDIR@%$(geographiclib_data)%" $< > $@ chmod +x $@ geographiclib-get-magnetic: geographiclib-get-magnetic.sh sed -e "s%@DEFAULTDIR@%$(geographiclib_data)%" $< > $@ chmod +x $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: geographiclib-1.21/tools/Makefile.mk0000644000175000017500000000573111745620415017275 0ustar frankiefrankie# $Id: f2db3b0aaaea655853962095ae51f7c160a211ec $ PROGRAMS = GeoConvert \ TransverseMercatorProj \ CartConvert \ Geod \ GeodesicProj \ GeoidEval \ Gravity \ MagneticField \ Planimeter \ ConicProj SCRIPTS = geographiclib-get-geoids \ geographiclib-get-gravity \ geographiclib-get-magnetic all: $(PROGRAMS) $(SCRIPTS) LIBSTEM = Geographic LIBRARY = lib$(LIBSTEM).a INCLUDEPATH = ../include LIBPATH = ../src # After installation, use these values of INCLUDEPATH and LIBPATH # INCLUDEPATH = $(PREFIX)/include # LIBPATH = $(PREFIX)/lib PREFIX = /usr/local GEOGRAPHICLIB_DATA = $(PREFIX)/share/GeographicLib CC = g++ -g CXXFLAGS = -g -Wall -Wextra -O3 CPPFLAGS = -I$(INCLUDEPATH) -I../man $(DEFINES) LDLIBS = -L$(LIBPATH) -l$(LIBSTEM) $(PROGRAMS): $(LIBPATH)/$(LIBRARY) $(CC) $(LDFLAGS) -o $@ $@.o $(LDLIBS) VPATH = ../include/GeographicLib ../man clean: rm -f *.o $(SCRIPTS) GeoConvert: GeoConvert.o TransverseMercatorProj: TransverseMercatorProj.o CartConvert: CartConvert.o Geod: Geod.o GeodesicProj: GeodesicProj.o GeoidEval: GeoidEval.o Gravity: Gravity.o MagneticField: MagneticField.o Planimeter: Planimeter.o ConicProj: ConicProj.o CartConvert.o: CartConvert.usage Config.h Constants.hpp DMS.hpp Geocentric.hpp \ LocalCartesian.hpp Math.hpp Utility.hpp ConicProj.o: ConicProj.usage Config.h AlbersEqualArea.hpp Constants.hpp \ DMS.hpp LambertConformalConic.hpp Math.hpp Utility.hpp GeoConvert.o: GeoConvert.usage Config.h Constants.hpp DMS.hpp GeoCoords.hpp \ Math.hpp UTMUPS.hpp Utility.hpp Geod.o: Geod.usage Config.h Constants.hpp DMS.hpp Geodesic.hpp \ GeodesicLine.hpp Math.hpp Utility.hpp GeodesicProj.o: GeodesicProj.usage Config.h AzimuthalEquidistant.hpp \ CassiniSoldner.hpp Constants.hpp DMS.hpp Geodesic.hpp GeodesicLine.hpp \ Gnomonic.hpp Math.hpp Utility.hpp GeoidEval.o: GeoidEval.usage Config.h Constants.hpp DMS.hpp GeoCoords.hpp \ Geoid.hpp Math.hpp UTMUPS.hpp Utility.hpp Gravity.o: Gravity.usage Config.h CircularEngine.hpp Constants.hpp DMS.hpp \ Geocentric.hpp GravityCircle.hpp GravityModel.hpp Math.hpp \ NormalGravity.hpp SphericalEngine.hpp SphericalHarmonic.hpp \ SphericalHarmonic1.hpp Utility.hpp MagneticField.o: MagneticField.usage Config.h CircularEngine.hpp Constants.hpp \ DMS.hpp Geocentric.hpp MagneticCircle.hpp MagneticModel.hpp Math.hpp \ SphericalEngine.hpp SphericalHarmonic.hpp Utility.hpp Planimeter.o: Planimeter.usage Config.h Accumulator.hpp Constants.hpp DMS.hpp \ GeoCoords.hpp Geodesic.hpp Math.hpp PolygonArea.hpp UTMUPS.hpp \ Utility.hpp TransverseMercatorProj.o: TransverseMercatorProj.usage Config.h Constants.hpp \ DMS.hpp EllipticFunction.hpp Math.hpp TransverseMercator.hpp \ TransverseMercatorExact.hpp Utility.hpp %: %.sh sed -e "s%@DEFAULTDIR@%$(GEOGRAPHICLIB_DATA)%" $< > $@ chmod +x $@ INSTALL = install -b DEST = $(PREFIX)/bin SDEST = $(PREFIX)/sbin install: $(PROGRAMS) $(SCRIPTS) test -f $(DEST) || mkdir -p $(DEST) $(INSTALL) $(PROGRAMS) $(DEST) test -f $(SDEST) || mkdir -p $(SDEST) $(INSTALL) $(SCRIPTS) $(SDEST) geographiclib-1.21/tools/Gravity.cpp0000644000175000017500000002445211745620415017361 0ustar frankiefrankie/** * \file Gravity.cpp * \brief Command line utility for evaluating gravity fields * * Copyright (c) Charles Karney (2011, 2012) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * Compile and link with * g++ -g -O3 -I../include -I../man -o Gravity \ * Gravity.cpp \ * ../src/CircularEngine.cpp \ * ../src/DMS.cpp \ * ../src/Geocentric.cpp \ * ../src/GravityCircle.cpp \ * ../src/GravityModel.cpp \ * ../src/NormalGravity.cpp \ * ../src/SphericalEngine.cpp \ * ../src/Utility.cpp * * See the man page for usage * information. **********************************************************************/ #include #include #include #include #include #include #include #include #include "Gravity.usage" int main(int argc, char* argv[]) { try { using namespace GeographicLib; typedef Math::real real; bool verbose = false; std::string dir; std::string model = GravityModel::DefaultGravityName(); std::string istring, ifile, ofile, cdelim; char lsep = ';'; real lat = 0, h = 0; bool circle = false; int prec = -1; enum { GRAVITY = 0, DISTURBANCE = 1, ANOMALY = 2, UNDULATION = 3, }; unsigned mode = GRAVITY; for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-n") { if (++m == argc) return usage(1, true); model = argv[m]; } else if (arg == "-d") { if (++m == argc) return usage(1, true); dir = argv[m]; } else if (arg == "-G") mode = GRAVITY; else if (arg == "-D") mode = DISTURBANCE; else if (arg == "-A") mode = ANOMALY; else if (arg == "-H") mode = UNDULATION; else if (arg == "-c") { if (m + 2 >= argc) return usage(1, true); try { DMS::flag ind; lat = DMS::Decode(std::string(argv[++m]), ind); if (ind == DMS::LONGITUDE) throw GeographicErr("Bad hemisphere letter on latitude"); if (!(std::abs(lat) <= 90)) throw GeographicErr("Latitude not in [-90d, 90d]"); h = Utility::num(std::string(argv[++m])); circle = true; } catch (const std::exception& e) { std::cerr << "Error decoding argument of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::num(std::string(argv[m])); } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "-v") verbose = true; else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": $Id: c87c647c3e973929010cdb2fd5d1eaa6aa739eca $\n" << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else { int retval = usage(!(arg == "-h" || arg == "--help"), arg != "--help"); if (arg == "-h") std::cout<< "\nDefault gravity path = \"" << GravityModel::DefaultGravityPath() << "\"\nDefault gravity name = \"" << GravityModel::DefaultGravityName() << "\"\n"; return retval; } } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; switch (mode) { case GRAVITY: prec = std::min(16, prec < 0 ? 5 : prec); break; case DISTURBANCE: case ANOMALY: prec = std::min(14, prec < 0 ? 3 : prec); break; case UNDULATION: default: prec = std::min(12, prec < 0 ? 4 : prec); break; } int retval = 0; try { const GravityModel g(model, dir); if (circle) { if (!Math::isfinite(h)) throw GeographicErr("Bad height"); else if (mode == UNDULATION && h != 0) throw GeographicErr("Height should be zero for geoid undulations"); } if (verbose) { std::cerr << "Gravity file: " << g.GravityFile() << "\n" << "Name: " << g.GravityModelName() << "\n" << "Description: " << g.Description() << "\n" << "Date & Time: " << g.DateTime() << "\n"; } unsigned mask = (mode == GRAVITY ? GravityModel::GRAVITY : (mode == DISTURBANCE ? GravityModel::DISTURBANCE : (mode == ANOMALY ? GravityModel::SPHERICAL_ANOMALY : GravityModel::GEOID_HEIGHT))); // mode == UNDULATION const GravityCircle c(circle ? g.Circle(lat, h, mask) : GravityCircle()); std::string s, stra, strb; while (std::getline(*input, s)) { try { std::string eol("\n"); if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; s = s.substr(0, m); } } std::istringstream str(s); real lon; if (circle) { if (!(str >> strb)) throw GeographicErr("Incomplete input: " + s); DMS::flag ind; lon = DMS::Decode(strb, ind); if (ind == DMS::LATITUDE) throw GeographicErr("Bad hemisphere letter on " + strb); if (lon < -180 || lon > 360) throw GeographicErr("Longitude " + strb + "not in [-180d, 360d]"); } else { if (!(str >> stra >> strb)) throw GeographicErr("Incomplete input: " + s); DMS::DecodeLatLon(stra, strb, lat, lon); h = 0; if (!(str >> h)) // h is optional str.clear(); if (mode == UNDULATION && h != 0) throw GeographicErr("Height must be zero for geoid heights"); } if (str >> stra) throw GeographicErr("Extra junk in input: " + s); switch (mode) { case GRAVITY: { real gx, gy, gz; if (circle) { c.Gravity(lon, gx, gy, gz); } else { g.Gravity(lat, lon, h, gx, gy, gz); } *output << Utility::str(gx, prec) << " " << Utility::str(gy, prec) << " " << Utility::str(gz, prec) << eol; } break; case DISTURBANCE: { real deltax, deltay, deltaz; if (circle) { c.Disturbance(lon, deltax, deltay, deltaz); } else { g.Disturbance(lat, lon, h, deltax, deltay, deltaz); } // Convert to mGals *output << Utility::str(deltax * 1e5, prec) << " " << Utility::str(deltay * 1e5, prec) << " " << Utility::str(deltaz * 1e5, prec) << eol; } break; case ANOMALY: { real Dg01, xi, eta; if (circle) c.SphericalAnomaly(lon, Dg01, xi, eta); else g.SphericalAnomaly(lat, lon, h, Dg01, xi, eta); Dg01 *= 1e5; // Convert to mGals xi *= 3600; // Convert to arcsecs eta *= 3600; *output << Utility::str(Dg01, prec) << " " << Utility::str(xi, prec) << " " << Utility::str(eta, prec) << eol; } break; case UNDULATION: default: { real N = circle ? c.GeoidHeight(lon) : g.GeoidHeight(lat, lon); *output << Utility::str(N, prec) << eol; } break; } } catch (const std::exception& e) { *output << "ERROR: " << e.what() << "\n"; retval = 1; } } } catch (const std::exception& e) { std::cerr << "Error reading " << model << ": " << e.what() << "\n"; retval = 1; } return retval; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } geographiclib-1.21/tools/GeoidEval.cpp0000644000175000017500000002456011745620415017573 0ustar frankiefrankie/** * \file GeoidEval.cpp * \brief Command line utility for evaluating geoid heights * * Copyright (c) Charles Karney (2009-2012) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * Compile and link with * g++ -g -O3 -I../include -I../man -o GeoidEval \ * GeoidEval.cpp \ * ../src/DMS.cpp \ * ../src/GeoCoords.cpp \ * ../src/Geoid.cpp \ * ../src/MGRS.cpp \ * ../src/PolarStereographic.cpp \ * ../src/TransverseMercator.cpp \ * ../src/UTMUPS.cpp * * See the man page for usage * information. **********************************************************************/ #include #include #include #include #include #include #include #include #include "GeoidEval.usage" int main(int argc, char* argv[]) { try { using namespace GeographicLib; typedef Math::real real; bool cacheall = false, cachearea = false, verbose = false, cubic = true, gradp = false; real caches, cachew, cachen, cachee; std::string dir; std::string geoid = Geoid::DefaultGeoidName(); Geoid::convertflag heightmult = Geoid::NONE; std::string istring, ifile, ofile, cdelim; char lsep = ';'; bool northp = false; int zonenum = UTMUPS::INVALID; for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-a") { cacheall = true; cachearea = false; } else if (arg == "-c") { if (m + 4 >= argc) return usage(1, true); cacheall = false; cachearea = true; try { DMS::DecodeLatLon(std::string(argv[m + 1]), std::string(argv[m + 2]), caches, cachew); DMS::DecodeLatLon(std::string(argv[m + 3]), std::string(argv[m + 4]), cachen, cachee); } catch (const std::exception& e) { std::cerr << "Error decoding argument of -c: " << e.what() << "\n"; return 1; } m += 4; } else if (arg == "--msltohae") heightmult = Geoid::GEOIDTOELLIPSOID; else if (arg == "--haetomsl") heightmult = Geoid::ELLIPSOIDTOGEOID; else if (arg == "-z") { if (++m == argc) return usage(1, true); std::string zone = argv[m]; try { UTMUPS::DecodeZone(zone, zonenum, northp); } catch (const std::exception& e) { std::cerr << "Error decoding zone: " << e.what() << "\n"; return 1; } if (!(zonenum >= UTMUPS::MINZONE && zonenum <= UTMUPS::MAXZONE)) { std::cerr << "Illegal zone " << zone << "\n"; return 1; } } else if (arg == "-n") { if (++m == argc) return usage(1, true); geoid = argv[m]; } else if (arg == "-d") { if (++m == argc) return usage(1, true); dir = argv[m]; } else if (arg == "-l") cubic = false; else if (arg == "-g") gradp = true; else if (arg == "-v") verbose = true; else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": $Id: 6db1ff0b8309a39d0d9b0250dd73be964c5efb7c $\n" << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else { int retval = usage(!(arg == "-h" || arg == "--help"), arg != "--help"); if (arg == "-h") std::cout<< "\nDefault geoid path = \"" << Geoid::DefaultGeoidPath() << "\"\nDefault geoid name = \"" << Geoid::DefaultGeoidName() << "\"\n"; return retval; } } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; int retval = 0; try { const Geoid g(geoid, dir, cubic); try { if (cacheall) g.CacheAll(); else if (cachearea) g.CacheArea(caches, cachew, cachen, cachee); } catch (const std::exception& e) { std::cerr << "ERROR: " << e.what() << "\nProceeding without a cache\n"; } if (verbose) { std::cerr << "Geoid file: " << g.GeoidFile() << "\n" << "Description: " << g.Description() << "\n" << "Interpolation: " << g.Interpolation() << "\n" << "Date & Time: " << g.DateTime() << "\n" << "Offset (m): " << g.Offset() << "\n" << "Scale (m): " << g.Scale() << "\n" << "Max error (m): " << g.MaxError() << "\n" << "RMS error (m): " << g.RMSError() << "\n"; if (g.Cache()) std::cerr<< "Caching:" << "\n SW Corner: " << g.CacheSouth() << " " << g.CacheWest() << "\n NE Corner: " << g.CacheNorth() << " " << g.CacheEast() << "\n"; } GeoCoords p; std::string s, suff; const char* spaces = " \t\n\v\f\r,"; // Include comma as space while (std::getline(*input, s)) { try { std::string eol("\n"); if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; std::string::size_type m1 = m > 0 ? s.find_last_not_of(spaces, m - 1) : std::string::npos; s = s.substr(0, m1 != std::string::npos ? m1 + 1 : m); } } real height = 0; if (zonenum != UTMUPS::INVALID) { // Expect "easting northing" if heightmult == 0, or // "easting northing height" if heightmult != 0. std::string::size_type pa = 0, pb = 0; real easting = 0, northing = 0; for (int i = 0; i < (heightmult ? 3 : 2); ++i) { if (pb == std::string::npos) throw GeographicErr("Incomplete input: " + s); // Start of i'th token pa = s.find_first_not_of(spaces, pb); if (pa == std::string::npos) throw GeographicErr("Incomplete input: " + s); // End of i'th token pb = s.find_first_of(spaces, pa); (i == 2 ? height : (i == 0 ? easting : northing)) = Utility::num(s.substr(pa, (pb == std::string::npos ? pb : pb - pa))); } p.Reset(zonenum, northp, easting, northing); if (heightmult) { suff = pb == std::string::npos ? "" : s.substr(pb); s = s.substr(0, pa); } } else { if (heightmult) { // Treat last token as height // pb = last char of last token // pa = last char preceding white space // px = last char of 2nd last token std::string::size_type pb = s.find_last_not_of(spaces); std::string::size_type pa = s.find_last_of(spaces, pb); if (pa == std::string::npos || pb == std::string::npos) throw GeographicErr("Incomplete input: " + s); height = Utility::num(s.substr(pa + 1, pb - pa)); s = s.substr(0, pa + 1); } p.Reset(s); } if (heightmult) { real h = g(p.Latitude(), p.Longitude()); *output << s << Utility::str(height + real(heightmult) * h, 4) << suff << eol; } else { if (gradp) { real gradn, grade; real h = g(p.Latitude(), p.Longitude(), gradn, grade); *output << Utility::str(h, 4) << " " << Utility::str(gradn * 1e6, 2) << (Math::isnan(gradn) ? " " : "e-6 ") << Utility::str(grade * 1e6, 2) << (Math::isnan(grade) ? "" : "e-6") << eol; } else { real h = g(p.Latitude(), p.Longitude()); *output << Utility::str(h, 4) << eol; } } } catch (const std::exception& e) { *output << "ERROR: " << e.what() << "\n"; retval = 1; } } } catch (const std::exception& e) { std::cerr << "Error reading " << geoid << ": " << e.what() << "\n"; retval = 1; } return retval; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } geographiclib-1.21/tools/geographiclib-get-magnetic.sh0000644000175000017500000000703011745620415022716 0ustar frankiefrankie#! /bin/sh # # Download magnetic models for use by GeographicLib::MagneticModel. # # Copyright (c) Charles Karney (2011) and licensed # under the MIT/X11 License. For more information, see # http://geographiclib.sourceforge.net/ # # $Id: bd05b3437908f70fbcc21d1a91e1fec586276a7b $ DEFAULTDIR="@DEFAULTDIR@" usage() { cat <&2; exit 1 ;; esac done shift `expr $OPTIND - 1` test -d "$PARENTDIR"/magnetic || mkdir -p "$PARENTDIR"/magnetic 2> /dev/null if test ! -d "$PARENTDIR"/magnetic; then echo Cannot create directory $PARENTDIR/magnetic 1>&2 exit 1 fi TEMP= if test -z "$DEBUG"; then trap 'trap "" 0; test "$TEMP" && rm -rf "$TEMP"; exit 1' 1 2 3 9 15 trap 'test "$TEMP" && rm -rf "$TEMP"' 0 fi TEMP=`mktemp --tmpdir --quiet --directory magnetic-XXXXXXXX` if test -z "$TEMP" -o ! -d "$TEMP"; then echo Cannot create temporary directory 1>&2 exit 1 fi WRITETEST="$PARENTDIR"/magnetic/write-test-`basename $TEMP` if touch "$WRITETEST" 2> /dev/null; then rm -f "$WRITETEST" else echo Cannot write in directory $PARENTDIR/magnetic 1>&2 exit 1 fi set -e cat > $TEMP/all < /dev/null; then echo $1 else case "$1" in all ) cat $TEMP/all ;; minimal ) # same as no argument echo wmm2010; echo igrf11 ;; * ) echo Unknown magnetic model $1 1>&2 exit 1 ;; esac fi shift done > $TEMP/list sort -u $TEMP/list > $TEMP/todo while read file; do echo download $file.tar.bz2 ... URL="http://downloads.sourceforge.net/project/geographiclib/magnetic-distrib/$file.tar.bz2?use_mirror=autoselect" ARCHIVE=$TEMP/$file.tar.bz2 wget -O$ARCHIVE $URL echo unpack $file.tar.bz2 ... tar vxojf $ARCHIVE -C $PARENTDIR echo magnetic $file installed. done < $TEMP/todo if test "$DEBUG"; then echo Saving temporary directory $TEMP fi cat < and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * Compile and link with * g++ -g -O3 -I../include -I../man -o MagneticField \ * MagneticField.cpp \ * ../src/CircularEngine.cpp \ * ../src/DMS.cpp \ * ../src/Geocentric.cpp \ * ../src/MagneticCircle.cpp \ * ../src/MagneticModel.cpp \ * ../src/SphericalEngine.cpp \ * ../src/Utility.cpp * * See the man page for usage * information. **********************************************************************/ #include #include #include #include #include #include #include #include #include "MagneticField.usage" int main(int argc, char* argv[]) { try { using namespace GeographicLib; typedef Math::real real; bool verbose = false; std::string dir; std::string model = MagneticModel::DefaultMagneticName(); std::string istring, ifile, ofile, cdelim; char lsep = ';'; real time = 0, lat = 0, h = 0; bool timeset = false, circle = false, rate = false; real hguard = 500000, tguard = 50; int prec = 1; for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-n") { if (++m == argc) return usage(1, true); model = argv[m]; } else if (arg == "-d") { if (++m == argc) return usage(1, true); dir = argv[m]; } else if (arg == "-t") { if (++m == argc) return usage(1, true); try { time = Utility::fractionalyear(std::string(argv[m])); timeset = true; circle = false; } catch (const std::exception& e) { std::cerr << "Error decoding argument of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-c") { if (m + 3 >= argc) return usage(1, true); try { time = Utility::fractionalyear(std::string(argv[++m])); DMS::flag ind; lat = DMS::Decode(std::string(argv[++m]), ind); if (ind == DMS::LONGITUDE) throw GeographicErr("Bad hemisphere letter on latitude"); if (!(std::abs(lat) <= 90)) throw GeographicErr("Latitude not in [-90d, 90d]"); h = Utility::num(std::string(argv[++m])); timeset = false; circle = true; } catch (const std::exception& e) { std::cerr << "Error decoding argument of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-r") rate = !rate; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::num(std::string(argv[m])); } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "-T") { if (++m == argc) return usage(1, true); try { tguard = Utility::num(std::string(argv[m])); } catch (const std::exception& e) { std::cerr << "Error decoding argument of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-H") { if (++m == argc) return usage(1, true); try { hguard = Utility::num(std::string(argv[m])); } catch (const std::exception& e) { std::cerr << "Error decoding argument of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-v") verbose = true; else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": $Id: cd55a73582dee908c12a23bee33362e7607268af $\n" << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else { int retval = usage(!(arg == "-h" || arg == "--help"), arg != "--help"); if (arg == "-h") std::cout<< "\nDefault magnetic path = \"" << MagneticModel::DefaultMagneticPath() << "\"\nDefault magnetic name = \"" << MagneticModel::DefaultMagneticName() << "\"\n"; return retval; } } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; tguard = std::max(real(0), tguard); hguard = std::max(real(0), hguard); prec = std::min(10, std::max(0, prec)); int retval = 0; try { const MagneticModel m(model, dir); if ((timeset || circle) && (!Math::isfinite(time) || time < m.MinTime() - tguard || time > m.MaxTime() + tguard)) throw GeographicErr("Time " + Utility::str(time) + " too far outside allowed range [" + Utility::str(m.MinTime()) + "," + Utility::str(m.MaxTime()) + "]"); if (circle && (!Math::isfinite(h) || h < m.MinHeight() - hguard || h > m.MaxHeight() + hguard)) throw GeographicErr("Height " + Utility::str(h/1000) + "km too far outside allowed range [" + Utility::str(m.MinHeight()/1000) + "km," + Utility::str(m.MaxHeight()/1000) + "km]"); if (verbose) { std::cerr << "Magnetic file: " << m.MagneticFile() << "\n" << "Name: " << m.MagneticModelName() << "\n" << "Description: " << m.Description() << "\n" << "Date & Time: " << m.DateTime() << "\n" << "Time range: [" << m.MinTime() << "," << m.MaxTime() << "]\n" << "Height range: [" << m.MinHeight()/1000 << "km," << m.MaxHeight()/1000 << "km]\n"; } if ((timeset || circle) && (time < m.MinTime() || time > m.MaxTime())) std::cerr << "WARNING: Time " << time << " outside allowed range [" << m.MinTime() << "," << m.MaxTime() << "]\n"; if (circle && (h < m.MinHeight() || h > m.MaxHeight())) std::cerr << "WARNING: Height " << h/1000 << "km outside allowed range [" << m.MinHeight()/1000 << "km," << m.MaxHeight()/1000 << "km]\n"; const MagneticCircle c(circle ? m.Circle(time, lat, h) : MagneticCircle()); std::string s, stra, strb; while (std::getline(*input, s)) { try { std::string eol("\n"); if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; s = s.substr(0, m); } } std::istringstream str(s); if (!(timeset || circle)) { if (!(str >> stra)) throw GeographicErr("Incomplete input: " + s); time = Utility::fractionalyear(stra); if (time < m.MinTime() - tguard || time > m.MaxTime() + tguard) throw GeographicErr("Time " + Utility::str(time) + " too far outside allowed range [" + Utility::str(m.MinTime()) + "," + Utility::str(m.MaxTime()) + "]"); if (time < m.MinTime() || time > m.MaxTime()) std::cerr << "WARNING: Time " << time << " outside allowed range [" << m.MinTime() << "," << m.MaxTime() << "]\n"; } real lon; if (circle) { if (!(str >> strb)) throw GeographicErr("Incomplete input: " + s); DMS::flag ind; lon = DMS::Decode(strb, ind); if (ind == DMS::LATITUDE) throw GeographicErr("Bad hemisphere letter on " + strb); if (lon < -180 || lon > 360) throw GeographicErr("Longitude " + strb + "not in [-180d, 360d]"); } else { if (!(str >> stra >> strb)) throw GeographicErr("Incomplete input: " + s); DMS::DecodeLatLon(stra, strb, lat, lon); h = 0; // h is optional if (str >> h) { if (h < m.MinHeight() - hguard || h > m.MaxHeight() + hguard) throw GeographicErr("Height " + Utility::str(h/1000) + "km too far outside allowed range [" + Utility::str(m.MinHeight()/1000) + "km," + Utility::str(m.MaxHeight()/1000) + "km]"); if (h < m.MinHeight() || h > m.MaxHeight()) std::cerr << "WARNING: Height " << h/1000 << "km outside allowed range [" << m.MinHeight()/1000 << "km," << m.MaxHeight()/1000 << "km]\n"; } else str.clear(); } if (str >> stra) throw GeographicErr("Extra junk in input: " + s); real bx, by, bz, bxt, byt, bzt; if (circle) c(lon, bx, by, bz, bxt, byt, bzt); else m(time, lat, lon, h, bx, by, bz, bxt, byt, bzt); real H, F, D, I, Ht, Ft, Dt, It; MagneticModel::FieldComponents(bx, by, bz, bxt, byt, bzt, H, F, D, I, Ht, Ft, Dt, It); *output << DMS::Encode(D, prec + 1, DMS::NUMBER) << " " << DMS::Encode(I, prec + 1, DMS::NUMBER) << " " << Utility::str(H, prec) << " " << Utility::str(by, prec) << " " << Utility::str(bx, prec) << " " << Utility::str(-bz, prec) << " " << Utility::str(F, prec) << eol; if (rate) *output << DMS::Encode(Dt, prec + 1, DMS::NUMBER) << " " << DMS::Encode(It, prec + 1, DMS::NUMBER) << " " << Utility::str(Ht, prec) << " " << Utility::str(byt, prec) << " " << Utility::str(bxt, prec) << " " << Utility::str(-bzt, prec) << " " << Utility::str(Ft, prec) << eol; } catch (const std::exception& e) { *output << "ERROR: " << e.what() << "\n"; retval = 1; } } } catch (const std::exception& e) { std::cerr << "Error reading " << model << ": " << e.what() << "\n"; retval = 1; } return retval; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } geographiclib-1.21/tools/TransverseMercatorProj.cpp0000644000175000017500000001664511745620415022425 0ustar frankiefrankie/** * \file TransverseMercatorProj.cpp * \brief Command line utility for transverse Mercator projections * * Copyright (c) Charles Karney (2008-2012) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * Compile and link with * g++ -g -O3 -I../include -I../man -o TransverseMercatorProj \ * TransverseMercatorProj.cpp \ * ../src/DMS.cpp \ * ../src/EllipticFunction.cpp \ * ../src/TransverseMercator.cpp \ * ../src/TransverseMercatorExact.cpp * * See the man page for usage * information. **********************************************************************/ #include #include #include #include #include #include #include #include #include #include #include "TransverseMercatorProj.usage" int main(int argc, char* argv[]) { try { using namespace GeographicLib; typedef Math::real real; bool exact = true, extended = false, series = false, reverse = false; real a = Constants::WGS84_a(), f = Constants::WGS84_f(), k0 = Constants::UTM_k0(), lon0 = 0; std::string istring, ifile, ofile, cdelim; char lsep = ';'; for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-r") reverse = true; else if (arg == "-t") { exact = true; extended = true; series = false; } else if (arg == "-s") { exact = false; extended = false; series = true; } else if (arg == "-l") { if (++m >= argc) return usage(1, true); try { DMS::flag ind; lon0 = DMS::Decode(std::string(argv[m]), ind); if (ind == DMS::LATITUDE) throw GeographicErr("Bad hemisphere"); if (!(lon0 >= -180 && lon0 <= 360)) throw GeographicErr("Bad longitude"); if (lon0 >= 180) lon0 -= 360; } catch (const std::exception& e) { std::cerr << "Error decoding argument of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-k") { if (++m >= argc) return usage(1, true); try { k0 = Utility::num(std::string(argv[m])); } catch (const std::exception& e) { std::cerr << "Error decoding argument of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-e") { if (m + 2 >= argc) return usage(1, true); try { a = Utility::num(std::string(argv[m + 1])); f = Utility::fract(std::string(argv[m + 2])); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -e: " << e.what() << "\n"; return 1; } m += 2; } else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": $Id: dd2a53288a82171129091d16bec6d1457568eb4d $\n" << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else return usage(!(arg == "-h" || arg == "--help"), arg != "--help"); } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; const TransverseMercator& TMS = series ? TransverseMercator(a, f, k0) : TransverseMercator(1, 0, 1); const TransverseMercatorExact& TME = exact ? TransverseMercatorExact(a, f, k0, extended) : TransverseMercatorExact(1, real(0.1), 1, false); std::string s; int retval = 0; std::cout << std::fixed; while (std::getline(*input, s)) { try { std::string eol("\n"); if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; s = s.substr(0, m); } } std::istringstream str(s); real lat, lon, x, y; std::string stra, strb; if (!(str >> stra >> strb)) throw GeographicErr("Incomplete input: " + s); if (reverse) { x = Utility::num(stra); y = Utility::num(strb); } else DMS::DecodeLatLon(stra, strb, lat, lon); std::string strc; if (str >> strc) throw GeographicErr("Extraneous input: " + strc); real gamma, k; if (reverse) { if (series) TMS.Reverse(lon0, x, y, lat, lon, gamma, k); else TME.Reverse(lon0, x, y, lat, lon, gamma, k); *output << Utility::str(lat, 15) << " " << Utility::str(lon, 15) << " " << Utility::str(gamma, 16) << " " << Utility::str(k, 16) << eol; } else { if (series) TMS.Forward(lon0, lat, lon, x, y, gamma, k); else TME.Forward(lon0, lat, lon, x, y, gamma, k); *output << Utility::str(x, 10) << " " << Utility::str(y, 10) << " " << Utility::str(gamma, 16) << " " << Utility::str(k, 16) << eol; } } catch (const std::exception& e) { *output << "ERROR: " << e.what() << "\n"; retval = 1; } } return retval; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } geographiclib-1.21/tools/ConicProj.cpp0000644000175000017500000001736611745620415017630 0ustar frankiefrankie/** * \file ConicProj.cpp * \brief Command line utility for conical projections * * Copyright (c) Charles Karney (2009-2012) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * Compile and link with * g++ -g -O3 -I../include -I../man -o ConicProj \ * ConicProj.cpp \ * ../src/AlbersEqualArea.cpp \ * ../src/DMS.cpp \ * ../src/LambertConformalConic.cpp * * See the man page for usage * information. **********************************************************************/ #include #include #include #include #include #include #include #include #include #include "ConicProj.usage" int main(int argc, char* argv[]) { try { using namespace GeographicLib; typedef Math::real real; bool lcc = false, albers = false, reverse = false; real lat1 = 0, lat2 = 0, lon0 = 0, k1 = 1; real a = Constants::WGS84_a(), f = Constants::WGS84_f(); std::string istring, ifile, ofile, cdelim; char lsep = ';'; for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-r") reverse = true; else if (arg == "-c" || arg == "-a") { lcc = arg == "-c"; albers = arg == "-a"; if (m + 2 >= argc) return usage(1, true); try { for (int i = 0; i < 2; ++i) { DMS::flag ind; (i ? lat2 : lat1) = DMS::Decode(std::string(argv[++m]), ind); if (ind == DMS::LONGITUDE) throw GeographicErr("Bad hemisphere"); } } catch (const std::exception& e) { std::cerr << "Error decoding arguments of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-l") { if (++m == argc) return usage(1, true); try { DMS::flag ind; lon0 = DMS::Decode(std::string(argv[m]), ind); if (ind == DMS::LATITUDE) throw GeographicErr("Bad hemisphere"); if (!(lon0 >= -180 && lon0 <= 360)) throw GeographicErr("Bad longitude"); if (lon0 >= 180) lon0 -= 360; } catch (const std::exception& e) { std::cerr << "Error decoding argument of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-k") { if (++m == argc) return usage(1, true); try { k1 = Utility::num(std::string(argv[m])); } catch (const std::exception& e) { std::cerr << "Error decoding argument of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-e") { if (m + 2 >= argc) return usage(1, true); try { a = Utility::num(std::string(argv[m + 1])); f = Utility::fract(std::string(argv[m + 2])); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -e: " << e.what() << "\n"; return 1; } m += 2; } else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": $Id: 8efb8dcae1b8e8f1abac4d5d6f60e8730ecaa81c $\n" << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else return usage(!(arg == "-h" || arg == "--help"), arg != "--help"); } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; if (!(lcc || albers)) { std::cerr << "Must specify \"-c lat1 lat2\" or " << "\"-a lat1 lat2\"\n"; return 1; } const LambertConformalConic lproj = lcc ? LambertConformalConic(a, f, lat1, lat2, k1) : LambertConformalConic(1, 0, 0, 0, 1); const AlbersEqualArea aproj = albers ? AlbersEqualArea(a, f, lat1, lat2, k1) : AlbersEqualArea(1, 0, 0, 0, 1); std::string s; int retval = 0; std::cout << std::fixed; while (std::getline(*input, s)) { try { std::string eol("\n"); if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; s = s.substr(0, m); } } std::istringstream str(s); real lat, lon, x, y, gamma, k; std::string stra, strb; if (!(str >> stra >> strb)) throw GeographicErr("Incomplete input: " + s); if (reverse) { x = Utility::num(stra); y = Utility::num(strb); } else DMS::DecodeLatLon(stra, strb, lat, lon); std::string strc; if (str >> strc) throw GeographicErr("Extraneous input: " + strc); if (reverse) { if (lcc) lproj.Reverse(lon0, x, y, lat, lon, gamma, k); else aproj.Reverse(lon0, x, y, lat, lon, gamma, k); *output << Utility::str(lat, 15) << " " << Utility::str(lon, 15) << " " << Utility::str(gamma, 16) << " " << Utility::str(k, 16) << eol; } else { if (lcc) lproj.Forward(lon0, lat, lon, x, y, gamma, k); else aproj.Forward(lon0, lat, lon, x, y, gamma, k); *output << Utility::str(x, 10) << " " << Utility::str(y, 10) << " " << Utility::str(gamma, 16) << " " << Utility::str(k, 16) << eol; } } catch (const std::exception& e) { *output << "ERROR: " << e.what() << "\n"; retval = 1; } } return retval; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } geographiclib-1.21/tools/CartConvert.cpp0000644000175000017500000001447511745620415020172 0ustar frankiefrankie/** * \file CartConvert.cpp * \brief Command line utility for geodetic to cartesian coordinate conversions * * Copyright (c) Charles Karney (2009-2012) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * Compile and link with * g++ -g -O3 -I../include -I../man -o CartConvert \ * CartConvert.cpp \ * ../src/DMS.cpp \ * ../src/Geocentric.cpp \ * ../src/LocalCartesian.cpp * * See the man page for usage * information. **********************************************************************/ #include #include #include #include #include #include #include #include #include #include "CartConvert.usage" int main(int argc, char* argv[]) { try { using namespace GeographicLib; typedef Math::real real; bool localcartesian = false, reverse = false; real a = Constants::WGS84_a(), f = Constants::WGS84_f(); real lat0 = 0, lon0 = 0, h0 = 0; std::string istring, ifile, ofile, cdelim; char lsep = ';'; for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-r") reverse = true; else if (arg == "-l") { localcartesian = true; if (m + 3 >= argc) return usage(1, true); try { DMS::DecodeLatLon(std::string(argv[m + 1]), std::string(argv[m + 2]), lat0, lon0); h0 = Utility::num(std::string(argv[m + 3])); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -l: " << e.what() << "\n"; return 1; } m += 3; } else if (arg == "-e") { if (m + 2 >= argc) return usage(1, true); try { a = Utility::num(std::string(argv[m + 1])); f = Utility::fract(std::string(argv[m + 2])); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -e: " << e.what() << "\n"; return 1; } m += 2; } else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": $Id: b9e53a72ea7d026978678f3ab9d726a2d8485079 $\n" << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else return usage(!(arg == "-h" || arg == "--help"), arg != "--help"); } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; const Geocentric ec(a, f); const LocalCartesian lc(lat0, lon0, h0, ec); std::string s; int retval = 0; while (std::getline(*input, s)) { try { std::string eol("\n"); if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; s = s.substr(0, m); } } std::istringstream str(s); real lat, lon, h, x, y, z; std::string stra, strb, strc; if (!(str >> stra >> strb >> strc)) throw GeographicErr("Incomplete input: " + s); if (reverse) { x = Utility::num(stra); y = Utility::num(strb); z = Utility::num(strc); } else { DMS::DecodeLatLon(stra, strb, lat, lon); h = Utility::num(strc); } std::string strd; if (str >> strd) throw GeographicErr("Extraneous input: " + strd); if (reverse) { if (localcartesian) lc.Reverse(x, y, z, lat, lon, h); else ec.Reverse(x, y, z, lat, lon, h); *output << Utility::str(lat, 15) << " " << Utility::str(lon, 15) << " " << Utility::str(h, 12) << eol; } else { if (localcartesian) lc.Forward(lat, lon, h, x, y, z); else ec.Forward(lat, lon, h, x, y, z); *output << Utility::str(x, 10) << " " << Utility::str(y, 10) << " " << Utility::str(z, 10) << eol; } } catch (const std::exception& e) { *output << "ERROR: " << e.what() << "\n"; retval = 1; } } return retval; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } geographiclib-1.21/tools/Planimeter.cpp0000644000175000017500000001333311745620415020030 0ustar frankiefrankie/** * \file Planimeter.cpp * \brief Command line utility for measuring the area of geodesic polygons * * Copyright (c) Charles Karney (2010-2012) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * Compile and link with * g++ -g -O3 -I../include -I../man -o Planimeter \ * Planimeter.cpp \ * ../src/DMS.cpp \ * ../src/GeoCoords.cpp \ * ../src/Geodesic.cpp \ * ../src/GeodesicLine.cpp \ * ../src/MGRS.cpp \ * ../src/PolarStereographic.cpp \ * ../src/PolygonArea.cpp \ * ../src/TransverseMercator.cpp \ * ../src/UTMUPS.cpp * * See the man page for usage * information. **********************************************************************/ #include #include #include #include #include #include #include #include #include "Planimeter.usage" int main(int argc, char* argv[]) { try { using namespace GeographicLib; typedef Math::real real; real a = Constants::WGS84_a(), f = Constants::WGS84_f(); bool reverse = false, sign = true, polyline = false; std::string istring, ifile, ofile, cdelim; char lsep = ';'; for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-r") reverse = !reverse; else if (arg == "-s") sign = !sign; else if (arg == "-l") polyline = !polyline; else if (arg == "-e") { if (m + 2 >= argc) return usage(1, true); try { a = Utility::num(std::string(argv[m + 1])); f = Utility::fract(std::string(argv[m + 2])); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -e: " << e.what() << "\n"; return 1; } m += 2; } else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": $Id: dbb8a9a0d79f172256044e72f65ebc667801eeac $\n" << "GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else return usage(!(arg == "-h" || arg == "--help"), arg != "--help"); } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; const Geodesic geod(a, f); PolygonArea poly(geod, polyline); GeoCoords p; std::string s; real perimeter, area; unsigned num; std::string eol("\n"); while (std::getline(*input, s)) { if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; s = s.substr(0, m); } } bool endpoly = s.empty(); if (!endpoly) { try { p.Reset(s); if (Math::isnan(p.Latitude()) || Math::isnan(p.Longitude())) endpoly = true; } catch (const GeographicErr&) { endpoly = true; } } if (endpoly) { num = poly.Compute(reverse, sign, perimeter, area); if (num > 0) { *output << num << " " << Utility::str(perimeter, 8); if (!polyline) *output << " " << Utility::str(area, 3); *output << eol; } poly.Clear(); eol = "\n"; } else poly.AddPoint(p.Latitude(), p.Longitude()); } num = poly.Compute(reverse, sign, perimeter, area); if (num > 0) { *output << num << " " << Utility::str(perimeter, 8); if (!polyline) *output << " " << Utility::str(area, 3); *output << eol; } poly.Clear(); eol = "\n"; return 0; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } geographiclib-1.21/ltmain.sh0000755000175000017500000105021611745620415015711 0ustar frankiefrankie # libtool (GNU libtool) 2.4 # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008, 2009, 2010 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool 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 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --no-quiet, --no-silent # print informational messages (default) # --tag=TAG use configuration variables from tag TAG # -v, --verbose print more informational messages than default # --no-verbose don't print the extra informational messages # --version print version information # -h, --help, --help-all print short, long, or detailed help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. When passed as first option, # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.4 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # GNU libtool home page: . # General help using GNU software: . PROGRAM=libtool PACKAGE=libtool VERSION=2.4 TIMESTAMP="" package_revision=1.3293 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # NLS nuisances: We save the old values to restore during execute mode. lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL $lt_unset CDPATH # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" : ${CP="cp -f"} test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${EGREP="/bin/grep -E"} : ${FGREP="/bin/grep -F"} : ${GREP="/bin/grep"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SED="/bin/sed"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_dirname may be replaced by extended shell implementation # func_basename file func_basename () { func_basename_result=`$ECHO "${1}" | $SED "$basename"` } # func_basename may be replaced by extended shell implementation # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` } # func_dirname_and_basename may be replaced by extended shell implementation # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname may be replaced by extended shell implementation # These SED scripts presuppose an absolute path with a trailing slash. pathcar='s,^/\([^/]*\).*$,\1,' pathcdr='s,^/[^/]*,,' removedotparts=':dotsl s@/\./@/@g t dotsl s,/\.$,/,' collapseslashes='s@/\{1,\}@/@g' finalslash='s,/*$,/,' # func_normal_abspath PATH # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. # value returned in "$func_normal_abspath_result" func_normal_abspath () { # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` while :; do # Processed it all yet? if test "$func_normal_abspath_tpath" = / ; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result" ; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_relative_path SRCDIR DSTDIR # generates a relative path from SRCDIR to DSTDIR, with a trailing # slash if non-empty, suitable for immediately appending a filename # without needing to append a separator. # value returned in "$func_relative_path_result" func_relative_path () { func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=${func_dirname_result} if test "x$func_relative_path_tlibdir" = x ; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test "x$func_stripname_result" != x ; then func_relative_path_result=${func_relative_path_result}/${func_stripname_result} fi # Normalisation. If bindir is libdir, return empty string, # else relative path ending with a slash; either way, target # file name can be directly appended. if test ! -z "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result/" func_relative_path_result=$func_stripname_result fi } # The name of this program: func_dirname_and_basename "$progpath" progname=$func_basename_result # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=: for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' # Sed substitution that converts a w32 file name or path # which contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "$my_tmpdir" } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_tr_sh # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_version # Echo version message to standard output and exit. func_version () { $opt_debug $SED -n '/(C)/!b go :more /\./!{ N s/\n# / / b more } :go /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $opt_debug $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" echo $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help [NOEXIT] # Echo long help message to standard output and exit, # unless 'noexit' is passed as argument. func_help () { $opt_debug $SED -n '/^# Usage:/,/# Report bugs to/ { :print s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ p d } /^# .* home page:/b print /^# General help using/b print ' < "$progpath" ret=$? if test -z "$1"; then exit $ret fi } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $opt_debug func_error "missing argument for $1." exit_cmd=exit } # func_split_short_opt shortopt # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. func_split_short_opt () { my_sed_short_opt='1s/^\(..\).*$/\1/;q' my_sed_short_rest='1s/^..\(.*\)$/\1/;q' func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` } # func_split_short_opt may be replaced by extended shell implementation # func_split_long_opt longopt # Set func_split_long_opt_name and func_split_long_opt_arg shell # variables after splitting LONGOPT at the `=' sign. func_split_long_opt () { my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` } # func_split_long_opt may be replaced by extended shell implementation exit_cmd=: magic="%%%MAGIC variable%%%" magic_exe="%%%MAGIC EXE variable%%%" # Global variables. nonopt= preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "${1}=\$${1}\${2}" } # func_append may be replaced by extended shell implementation # func_append_quoted var value # Quote VALUE and append to the end of shell variable VAR, separated # by a space. func_append_quoted () { func_quote_for_eval "${2}" eval "${1}=\$${1}\\ \$func_quote_for_eval_result" } # func_append_quoted may be replaced by extended shell implementation # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "${@}"` } # func_arith may be replaced by extended shell implementation # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` } # func_len may be replaced by extended shell implementation # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` } # func_lo2o may be replaced by extended shell implementation # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` } # func_xform may be replaced by extended shell implementation # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # Display the features supported by this script. func_features () { echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Option defaults: opt_debug=: opt_dry_run=false opt_config=false opt_preserve_dup_deps=false opt_features=false opt_finish=false opt_help=false opt_help_all=false opt_silent=: opt_verbose=: opt_silent=false opt_verbose=false # Parse options once, thoroughly. This comes as soon as possible in the # script to make things like `--version' happen as quickly as we can. { # this just eases exit handling while test $# -gt 0; do opt="$1" shift case $opt in --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" $opt_debug ;; --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) opt_config=: func_config ;; --dlopen|-dlopen) optarg="$1" opt_dlopen="${opt_dlopen+$opt_dlopen }$optarg" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) opt_features=: func_features ;; --finish) opt_finish=: set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help_all=: opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_mode="$optarg" case $optarg in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_silent=false func_append preserve_args " $opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $opt" ;; --silent|--quiet) opt_silent=: func_append preserve_args " $opt" opt_verbose=false ;; --verbose|-v) opt_verbose=: func_append preserve_args " $opt" opt_silent=false ;; --tag) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_tag="$optarg" func_append preserve_args " $opt $optarg" func_enable_tag "$optarg" shift ;; -\?|-h) func_usage ;; --help) func_help ;; --version) func_version ;; # Separate optargs to long options: --*=*) func_split_long_opt "$opt" set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-n*|-v*) func_split_short_opt "$opt" set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) set dummy "$opt" ${1+"$@"}; shift; break ;; esac done # Validate options: # save first non-option argument if test "$#" -gt 0; then nonopt="$opt" shift fi # preserve --debug test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test "$opt_mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$opt_mode' for more information." } # Bail if the options were screwed $exit_cmd $EXIT_FAILURE } ## ----------- ## ## Main. ## ## ----------- ## # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case "$lt_sysroot:$1" in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result="=$func_stripname_result" ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$lt_sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $opt_debug # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result="" if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result" ; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $opt_debug if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $opt_debug # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $opt_debug if test -z "$2" && test -n "$1" ; then func_error "Could not determine host file name corresponding to" func_error " \`$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result="$1" fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $opt_debug if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " \`$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result="$3" fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $opt_debug case $4 in $1 ) func_to_host_path_result="$3$func_to_host_path_result" ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via `$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $opt_debug $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $opt_debug case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result="$1" } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result="$func_convert_core_msys_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via `$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $opt_debug if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd="func_convert_path_${func_stripname_result}" fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $opt_debug func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result="$1" } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_msys_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_mode_compile arg... func_mode_compile () { $opt_debug # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj="$func_basename_result" } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac echo $ECHO "Try \`$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test "$opt_help" = :; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | sed -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | sed '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "\`$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument \`$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and \`=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test "x$prev" = x-m && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename="" if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname" ; then func_basename "$dlprefile_dlname" dlprefile_dlbasename="$func_basename_result" else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename" ; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $opt_debug sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $opt_debug match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive which possess that section. Heuristic: eliminate # all those which have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $opt_debug if func_cygming_gnu_implib_p "$1" ; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1" ; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result="" fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" if test "$lock_old_archive_extraction" = yes; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test "$lock_old_archive_extraction" = yes; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ which is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options which match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include /* declarations of non-ANSI functions */ #if defined(__MINGW32__) # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined(__CYGWIN__) # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined (other platforms) ... */ #endif /* portability defines, excluding path handling macros */ #if defined(_MSC_VER) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC # ifndef _INTPTR_T_DEFINED # define _INTPTR_T_DEFINED # define intptr_t int # endif #elif defined(__MINGW32__) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined(__CYGWIN__) # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined (other platforms) ... */ #endif #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined(LT_DEBUGWRAPPER) static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -e 's/\([\\"]\)/\\\1/g' \ -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $opt_debug case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir="$arg" prev= continue ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps ; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." else echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test "$prefer_static_libs" = yes || test "$prefer_static_libs,$installed" = "built,no"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib="$l" done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$lt_sysroot$libdir" absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi case "$host" in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path="$deplib" ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. func_append verstring ":${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd1 in $cmds; do IFS="$save_ifs" # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test "$try_normal_branch" = yes \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=${output_objdir}/${output_la}.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " ${wl}-bind_at_load" func_append finalize_command " ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=no ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test "x$bindir" != x ; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) func_append RM " $arg"; rmforce=yes ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then odir="$objdir" else odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" test "$opt_mode" = uninstall && odir="$dir" # Remember odir for removal later, being careful to avoid duplicates if test "$opt_mode" = clean; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case "$opt_mode" in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 geographiclib-1.21/configure0000755000175000017500000212012411745620415015772 0ustar frankiefrankie#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for GeographicLib 1.21. # # Report bugs to . # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and charles@karney.com $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='GeographicLib' PACKAGE_TARNAME='geographiclib' PACKAGE_VERSION='1.21' PACKAGE_STRING='GeographicLib 1.21' PACKAGE_BUGREPORT='charles@karney.com' PACKAGE_URL='' ac_unique_file="src/Geodesic.cpp" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS POW_LIB CXXCPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED LIBTOOL am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC LT_AGE LT_REVISION LT_CURRENT MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_os target_vendor target_cpu target host_os host_vendor host_cpu host build_os build_vendor build_cpu build target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_maintainer_mode enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_gnu_ld with_sysroot enable_libtool_lock ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP CXX CXXFLAGS CCC CXXCPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures GeographicLib 1.21 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/geographiclib] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of GeographicLib 1.21:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF GeographicLib configure 1.21 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp # ac_fn_cxx_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## --------------------------------- ## ## Report this to charles@karney.com ## ## --------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by GeographicLib $as_me 1.21, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- am__api_version='1.11' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='geographiclib' VERSION='1.21' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE ac_config_headers="$ac_config_headers include/GeographicLib/Config-ac.h" LT_CURRENT=12 LT_REVISION=0 LT_AGE=3 DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CXX_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 $as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4' macro_revision='1.3293' ltmain="$ac_aux_dir/ltmain.sh" # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; pic_mode="$withval" else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' lt_prog_compiler_pic='-Xcompiler -fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ F* | *Sun*Fortran*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test x"$lt_cv_prog_compiler__b" = xyes; then archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; haiku*) version_type=linux need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if ${ac_cv_prog_CXXCPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 $as_echo "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu else _lt_caught_CXX_error=yes fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= compiler_needs_object_CXX=no export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_flag_spec_ld_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no inherit_rpath_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds reload_flag_CXX=$reload_flag reload_cmds_CXX=$reload_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC compiler_CXX=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes file_list_spec_CXX='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec_CXX='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. always_export_symbols_CXX=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty # executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' ${wl}-bernotok' allow_undefined_flag_CXX=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' fi archive_cmds_need_lc_CXX=yes # This is similar to how AIX traditionally builds its shared # libraries. archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_CXX=' ' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=yes file_list_spec_CXX='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' enable_shared_with_static_runtimes_CXX=yes # Don't use ranlib old_postinstall_cmds_CXX='chmod 644 $oldlib' postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' export_dynamic_flag_spec_CXX='${wl}--export-all-symbols' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec_CXX='' fi link_all_deplibs_CXX=yes allow_undefined_flag_CXX="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" if test "$lt_cv_apple_cc_single_mod" != "yes"; then archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi else ld_shlibs_CXX=no fi ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd[12]*) # C++ shared libraries reported to be fairly broken before # switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; gnu*) ;; haiku*) archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs_CXX=yes ;; hpux9*) hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='${wl}-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) ;; *) export_dynamic_flag_spec_CXX='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: inherit_rpath_CXX=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [1-5].* | *pgcpp\ [1-5].*) prelink_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' old_archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' hardcode_libdir_flag_spec_CXX='-R$libdir' whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object_CXX=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) ld_shlibs_CXX=yes ;; openbsd2*) # C++ shared libraries are fairly broken ld_shlibs_CXX=no ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no hardcode_direct_absolute_CXX=yes archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='${wl}-E' whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else ld_shlibs_CXX=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) case $host in osf3*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' ;; *) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' ;; esac hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then no_undefined_flag_CXX=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='${wl}-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_CXX='${wl}-z,text' allow_undefined_flag_CXX='${wl}-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ '"$old_archive_cmds_CXX" reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ '"$reload_cmds_CXX" ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test "$ld_shlibs_CXX" = no && can_build_shared=no GCC_CXX="$GXX" LD_CXX="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; esac if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX="${prev}${p}" else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX="${prev}${p}" else postdeps_CXX="${postdeps_CXX} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$predep_objects_CXX"; then predep_objects_CXX="$p" else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX="$p" else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken case $host_os in interix[3-9]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac compiler_lib_search_dirs_CXX= if test -n "${compiler_lib_search_path_CXX}"; then compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic_CXX='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static_CXX= ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix[4-9]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) # IBM XL 8.0, 9.0 on PPC and BlueGene lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-qpic' lt_prog_compiler_static_CXX='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works_CXX=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works_CXX=yes fi else lt_cv_prog_compiler_static_works_CXX=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then : else lt_prog_compiler_static_CXX= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' case $host_os in aix[4-9]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' ;; esac ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test "$ld_shlibs_CXX" = no && can_build_shared=no with_gnu_ld_CXX=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc_CXX=no else lt_cv_archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 $as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; haiku*) version_type=linux need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || test -n "$runpath_var_CXX" || test "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct_CXX" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no && test "$hardcode_minus_L_CXX" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 $as_echo "$hardcode_action_CXX" >&6; } if test "$hardcode_action_CXX" = relink || test "$inherit_rpath_CXX" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_commands="$ac_config_commands libtool" # Only expand once: # Checks for header files. for ac_header in float.h do : ac_fn_c_check_header_mongrel "$LINENO" "float.h" "ac_cv_header_float_h" "$ac_includes_default" if test "x$ac_cv_header_float_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FLOAT_H 1 _ACEOF fi done # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } if ${ac_cv_header_stdbool_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; /* See body of main program for 'e'. */ char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ _Bool q = true; _Bool *pq = &q; int main () { bool e = &s; *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdbool_h=yes else ac_cv_header_stdbool_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 $as_echo "$ac_cv_header_stdbool_h" >&6; } ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" if test "x$ac_cv_type__Bool" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 _ACEOF fi if test $ac_cv_header_stdbool_h = yes; then $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long double" >&5 $as_echo_n "checking for long double... " >&6; } if ${ac_cv_type_long_double+:} false; then : $as_echo_n "(cached) " >&6 else if test "$GCC" = yes; then ac_cv_type_long_double=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* The Stardent Vistra knows sizeof (long double), but does not support it. */ long double foo = 0.0L; int main () { static int test_array [1 - 2 * !(/* On Ultrix 4.3 cc, long double is 4 and double is 8. */ sizeof (double) <= sizeof (long double))]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_long_double=yes else ac_cv_type_long_double=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_double" >&5 $as_echo "$ac_cv_type_long_double" >&6; } if test $ac_cv_type_long_double = yes; then $as_echo "#define HAVE_LONG_DOUBLE 1" >>confdefs.h fi # Checks for library functions. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strtod" >&5 $as_echo_n "checking for working strtod... " >&6; } if ${ac_cv_func_strtod+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_strtod=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #ifndef strtod double strtod (); #endif int main() { { /* Some versions of Linux strtod mis-parse strings with leading '+'. */ char *string = " +69"; char *term; double value; value = strtod (string, &term); if (value != 69 || term != (string + 4)) return 1; } { /* Under Solaris 2.4, strtod returns the wrong value for the terminating character under some conditions. */ char *string = "NaN"; char *term; strtod (string, &term); if (term != string && *(term - 1) == 0) return 1; } return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_strtod=yes else ac_cv_func_strtod=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strtod" >&5 $as_echo "$ac_cv_func_strtod" >&6; } if test $ac_cv_func_strtod = no; then case " $LIBOBJS " in *" strtod.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS strtod.$ac_objext" ;; esac ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow" if test "x$ac_cv_func_pow" = xyes; then : fi if test $ac_cv_func_pow = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 $as_echo_n "checking for pow in -lm... " >&6; } if ${ac_cv_lib_m_pow+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pow (); int main () { return pow (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_pow=yes else ac_cv_lib_m_pow=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 $as_echo "$ac_cv_lib_m_pow" >&6; } if test "x$ac_cv_lib_m_pow" = xyes; then : POW_LIB=-lm else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find library containing definition of pow" >&5 $as_echo "$as_me: WARNING: cannot find library containing definition of pow" >&2;} fi fi fi for ac_func in strtol do : ac_fn_c_check_func "$LINENO" "strtol" "ac_cv_func_strtol" if test "x$ac_cv_func_strtol" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRTOL 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing floor" >&5 $as_echo_n "checking for library containing floor... " >&6; } if ${ac_cv_search_floor+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char floor (); int main () { return floor (); ; return 0; } _ACEOF for ac_lib in '' m; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_floor=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_floor+:} false; then : break fi done if ${ac_cv_search_floor+:} false; then : else ac_cv_search_floor=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_floor" >&5 $as_echo "$ac_cv_search_floor" >&6; } ac_res=$ac_cv_search_floor if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pow" >&5 $as_echo_n "checking for library containing pow... " >&6; } if ${ac_cv_search_pow+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pow (); int main () { return pow (); ; return 0; } _ACEOF for ac_lib in '' m; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_pow=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_pow+:} false; then : break fi done if ${ac_cv_search_pow+:} false; then : else ac_cv_search_pow=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pow" >&5 $as_echo "$ac_cv_search_pow" >&6; } ac_res=$ac_cv_search_pow if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sqrt" >&5 $as_echo_n "checking for library containing sqrt... " >&6; } if ${ac_cv_search_sqrt+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char sqrt (); int main () { return sqrt (); ; return 0; } _ACEOF for ac_lib in '' m; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_sqrt=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_sqrt+:} false; then : break fi done if ${ac_cv_search_sqrt+:} false; then : else ac_cv_search_sqrt=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sqrt" >&5 $as_echo "$ac_cv_search_sqrt" >&6; } ac_res=$ac_cv_search_sqrt if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi # Check endianness { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac ac_config_files="$ac_config_files Makefile src/Makefile include/Makefile tools/Makefile doc/Makefile man/Makefile matlab/Makefile python/Makefile cmake/Makefile examples/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by GeographicLib $as_me 1.21, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ GeographicLib config.status 1.21 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_ld_CXX='`$ECHO "$hardcode_libdir_flag_spec_ld_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib \ compiler_lib_search_dirs \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ LD_CXX \ reload_flag_CXX \ compiler_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_static_CXX \ lt_cv_prog_compiler_c_o_CXX \ export_dynamic_flag_spec_CXX \ whole_archive_flag_spec_CXX \ compiler_needs_object_CXX \ with_gnu_ld_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_flag_spec_ld_CXX \ hardcode_libdir_separator_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX \ file_list_spec_CXX \ compiler_lib_search_dirs_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec \ reload_cmds_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ export_symbols_cmds_CXX \ prelink_cmds_CXX \ postlink_cmds_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "include/GeographicLib/Config-ac.h") CONFIG_HEADERS="$CONFIG_HEADERS include/GeographicLib/Config-ac.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "matlab/Makefile") CONFIG_FILES="$CONFIG_FILES matlab/Makefile" ;; "python/Makefile") CONFIG_FILES="$CONFIG_FILES python/Makefile" ;; "cmake/Makefile") CONFIG_FILES="$CONFIG_FILES cmake/Makefile" ;; "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, # Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool 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 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="CXX " # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # If ld is used when linking, flag to hardcode \$libdir into a binary # during linking. This must work even if \$libdir does not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects postdep_objects=$lt_postdep_objects predeps=$lt_predeps postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" cat <<_LT_EOF >> "$ofile" # ### BEGIN LIBTOOL TAG CONFIG: CXX # The linker used to build libraries. LD=$lt_LD_CXX # How to create reloadable object files. reload_flag=$lt_reload_flag_CXX reload_cmds=$lt_reload_cmds_CXX # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds_CXX # A language specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU compiler? with_gcc=$GCC_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object_CXX # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld_CXX # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # If ld is used when linking, flag to hardcode \$libdir into a binary # during linking. This must work even if \$libdir does not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_CXX # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic_CXX # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath_CXX # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_CXX # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds_CXX # Specify filename containing input files. file_list_spec=$lt_file_list_spec_CXX # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects_CXX postdep_objects=$lt_postdep_objects_CXX predeps=$lt_predeps_CXX postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # ### END LIBTOOL TAG CONFIG: CXX _LT_EOF ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi geographiclib-1.21/CMakeLists.txt0000644000175000017500000003065211745620415016627 0ustar frankiefrankie# $Id: a3ad2e3a9ae71b3bc393ca9a3f1ab2277f171d35 $ cmake_minimum_required (VERSION 2.6) project (GeographicLib) # Version information set (GeographicLib_VERSION_MAJOR 1) set (GeographicLib_VERSION_MINOR 21) set (GeographicLib_VERSION "${GeographicLib_VERSION_MAJOR}.${GeographicLib_VERSION_MINOR}") # The library version tracks the numbering given by libtool in the # autoconf set up. set (LIBVERSION 9) set (LIBVERSIONFULL 9.3.0) # Set CMAKE_INSTALL_PREFIX from first element of CMAKE_PREFIX_PATH if (WIN32) if (DEFINED CMAKE_PREFIX_PATH AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) list (GET CMAKE_PREFIX_PATH 0 CMAKE_INSTALL_PREFIX) set (CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME} CACHE PATH "Installation directory for GeographicLib" FORCE) endif () message (STATUS "CMAKE_INSTALL_PREFIX set to ${CMAKE_INSTALL_PREFIX}") endif () # User-settable cache variables # (1) Build as a shared library? On Windows systems, this is typically # more trouble than it's worth. if (WIN32) option (GEOGRAPHIC_SHARED_LIB "Build GeographicLib as a shared library" OFF) else () option (GEOGRAPHIC_SHARED_LIB "Build GeographicLib as a shared library" ON) endif () # (2) Compiler the Matlab interfaces? Skip Matlab compilation if OFF option (MATLAB_COMPILER "Compiler for matlab/octave interface: mex or mkoctfile or OFF" OFF) # (3) Where to look for data files. Various classes look in the geoids, # gravity, magnetic, subdirectories of ${GEOGRAPHICLIB_DATA}. if (WIN32) # The binary installers for the data files for Windows are created # with Inno Setup which uses {commonappdata}. On most Windows # systems this is # "C:/Documents and Settings/All Users/Application Data", while on # newer systems (Windows 7), it is C:/ProgramData. However the # longer name "works" on all Windows systems. set (GEOGRAPHICLIB_DATA "C:/Documents and Settings/All Users/Application Data/GeographicLib" CACHE PATH "Location for data for GeographicLib") else () set (GEOGRAPHICLIB_DATA "${CMAKE_INSTALL_PREFIX}/share/GeographicLib" CACHE PATH "Location for data for GeographicLib") endif () # (4) Compiler the Matlab interfaces? Skip Matlab compilation if OFF if (WIN32) option (GEOGRAPHICLIB_EXAMPLES "Build example programs in examples directory" OFF) elseif () option (GEOGRAPHICLIB_EXAMPLES "Build example programs in examples directory" ON) endif () # The debug version of the library is called Geographic_d. set (CMAKE_DEBUG_POSTFIX _d) # Determine system properties include (CheckTypeSize) check_type_size ("long double" LONG_DOUBLE BUILTIN_TYPES_ONLY) include (TestBigEndian) test_big_endian (WORDS_BIGENDIAN) # Create a Config.h to expose system information to the compiler configure_file ( "${PROJECT_SOURCE_DIR}/include/GeographicLib/Config.h.in" "${PROJECT_BINARY_DIR}/include/GeographicLib/Config.h" ) # The documentation depends on doxygen. In addition, the man pages are # written as pod files and converted to nroff format, C++ code, and # html. Because this require tools that may not be available on an # end-user's system, the creation of the final documentation is # therefore only done in "MAINTAINER" mode. The maintainer runs "make # distrib-all" which installs the transformed documentation files into # the source tree. if (NOT WIN32) set (DOXYGEN_SKIP_DOT ON) find_package (Doxygen) find_program (HAVE_POD2MAN pod2man) find_program (HAVE_POD2HTML pod2html) find_program (HAVE_DOXYGEN doxygen) endif () if (NOT WIN32 AND HAVE_POD2MAN AND HAVE_POD2HTML AND DOXYGEN_FOUND) set (MAINTAINER ON CACHE BOOL "Allow build of additional components") else () set (MAINTAINER OFF CACHE BOOL "Allow build of additional components") endif () if (MAINTAINER) add_custom_target (distrib-all) add_dependencies (distrib-all distrib-man distrib-doc) endif () # Look for the tool to compile the Matlab interfaces. if (MATLAB_COMPILER) if (WIN32) set (MATLAB_COMPILER_EXT ".bat") else () set (MATLAB_COMPILER_EXT "") endif () find_program (MEX "${MATLAB_COMPILER}${MATLAB_COMPILER_EXT}") if (MATLAB_COMPILER MATCHES "mex") get_filename_component (MATLABDIR "${MEX}" REALPATH) get_filename_component (MATLABDIR "${MATLABDIR}" PATH) find_program (MEXEXTPROG "mexext${MATLAB_COMPILER_EXT}" PATHS "${MATLABDIR}") execute_process (COMMAND "${MEXEXTPROG}" OUTPUT_VARIABLE MEXEXT OUTPUT_STRIP_TRAILING_WHITESPACE) else () set (MEXEXT "mex") endif () if (NOT MEX) message (WARNING "Cannot find Matlab compiler ${MATLAB_COMPILER}${MATLAB_COMPILER_EXT}") elseif (NOT MEXEXT) set (MEX OFF) message (WARNING "Cannot determine extension for Matlab compiled code") endif () endif () # Set a default build type for single-configuration cmake generators if # no build type is set. if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) set (CMAKE_BUILD_TYPE Release) endif () # On non-Windows machine, make the compiler more picky. if (NOT WIN32) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") endif () # The list of tools (to be installed into, e.g., /usr/local/bin) set (TOOLS CartConvert ConicProj GeodesicProj GeoConvert Geod GeoidEval Gravity MagneticField Planimeter TransverseMercatorProj) # The list of scripts (to be installed into, e.g., /usr/local/sbin) set (SCRIPTS geographiclib-get-geoids geographiclib-get-gravity geographiclib-get-magnetic) # Set the include directories. Look in ${PROJECT_BINARY_DIR}/include # first because that's where Config.h will be include_directories ("${PROJECT_BINARY_DIR}/include") include_directories (include) # The list of subdirectories to process add_subdirectory (src) add_subdirectory (include/GeographicLib) add_subdirectory (tools) add_subdirectory (man) add_subdirectory (doc) add_subdirectory (matlab) add_subdirectory (python/geographiclib) if (GEOGRAPHICLIB_EXAMPLES) add_subdirectory (examples) endif () # config file support for find_package(GeographicLib). This only # supports finding GeographicLib in the "install" tree (as opposed to # the "build" tree). The process installs geographiclib-config.cmake in # ${INSTALL_CMAKE_DIR} and @GEOGRAPHICLIB_ROOT_DIR@ is the relative path # to the root from there. (Thus the whole install tree can be # relocated.) if (WIN32) set (INSTALL_CMAKE_DIR "cmake") set (GEOGRAPHICLIB_ROOT_DIR "..") else () set (INSTALL_CMAKE_DIR "share/cmake/${PROJECT_NAME}-${GeographicLib_VERSION}") set (GEOGRAPHICLIB_ROOT_DIR "../../..") endif () configure_file (cmake/geographiclib-config.cmake.in "${PROJECT_BINARY_DIR}/cmake/geographiclib-config.cmake" @ONLY) configure_file (cmake/geographiclib-config-version.cmake.in "${PROJECT_BINARY_DIR}/cmake/geographiclib-config-version.cmake" @ONLY) install (FILES "${PROJECT_BINARY_DIR}/cmake/geographiclib-config.cmake" "${PROJECT_BINARY_DIR}/cmake/geographiclib-config-version.cmake" DESTINATION "${INSTALL_CMAKE_DIR}") # Make information about the cmake targets (the library and the tools) # available. install (EXPORT depends FILE geographiclib-depends.cmake DESTINATION "${INSTALL_CMAKE_DIR}") # Packaging support; we deal with # (1) a source distribution: cmake make a tar.gz file and the zip file # is created from this. Only the maintainer can do this, because of # the need to generate additional documentation files. # (2) a binary distribution: code is included for Linux, Apple, and # Windows, but only the Windows distribution has been exercised. # Need to ensure that system dlls get included in a binary distribution if (NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS) # Visual Studio Express does include redistributable components so # squelch the warning. set (CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON) endif () include (InstallRequiredSystemLibraries) # The configuration of CPack is via variable that need to be set before # the include (CPack). set (CPACK_PACKAGE_VERSION_MAJOR ${GeographicLib_VERSION_MAJOR}) set (CPACK_PACKAGE_VERSION_MINOR ${GeographicLib_VERSION_MINOR}) set (CPACK_PACKAGE_VERSION_PATCH 0) set (CPACK_PACKAGE_CONTACT charles@karney.com) set (CPACK_PACKAGE_VENDOR "GeographicLib") set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Geographic library, utilities, and documentation") # The list of files to be excluded from the source distribution. set (CPACK_SOURCE_IGNORE_FILES "#" "~\$" "/\\\\.git" "${PROJECT_SOURCE_DIR}/BUILD" "${PROJECT_SOURCE_DIR}/(tests|testdata|cgi-bin|.*\\\\.cache)/" "${PROJECT_SOURCE_DIR}/(distrib|.*-distrib|.*-installer|geodesic-papers)/" "${PROJECT_SOURCE_DIR}/[^/]*\\\\.(html|kmz)\$" "${PROJECT_SOURCE_DIR}/(autogen|biblio|js-compress)\\\\.sh\$" "${PROJECT_SOURCE_DIR}/(geodesic-biblio.txt|makefile-admin)\$" ) set (CPACK_SOURCE_GENERATOR TGZ) set (CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE.txt) set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${GeographicLib_VERSION}") set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}") if (WIN32) # The Windows binary packager is NSIS. Set the necessary variables # for this. set (CPACK_NSIS_CONTACT "charles@karney.com") set (CPACK_NSIS_URL_INFO_ABOUT "http://geographiclib.sf.net") set (CPACK_NSIS_HELP_LINK "mailto:charles@karney.com") if (CMAKE_SIZEOF_VOID_P EQUAL 8) # Hardcode the prefix for Visual Studio 10 set (CPACK_NSIS_INSTALL_ROOT "C:\\\\pkg-vc10-x64") set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}-win64") set (CPACK_NSIS_PACKAGE_NAME "${PROJECT_NAME} x64 ${GeographicLib_VERSION}") set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${PROJECT_NAME}-x64-${GeographicLib_VERSION}") else () # Hardcode the prefix for Visual Studio 10 set (CPACK_NSIS_INSTALL_ROOT "C:\\\\pkg-vc10") set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}-win32") set (CPACK_NSIS_PACKAGE_NAME "${PROJECT_NAME} ${GeographicLib_VERSION}") set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${PROJECT_NAME}-${GeographicLib_VERSION}") endif () set (CPACK_NSIS_DISPLAY_NAME ${CPACK_NSIS_PACKAGE_NAME}) set (CPACK_NSIS_EXTRA_INSTALL_COMMANDS " CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Library Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\GeographicLib\\\\html\\\\index.html\\\" CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Utility Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\GeographicLib\\\\html\\\\utilities.html\\\" ") set (CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS " !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Library Documentation.lnk\\\" Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Utility Documentation.lnk\\\" ") set (CPACK_NSIS_MODIFY_PATH ON) elseif (APPLE) # Not tested set (CPACK_GENERATOR DMG) set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}-darwin") else () # Not tested set (CPACK_GENERATOR TGZ) endif () include (CPack) # Another maintainer-specific target is building the source distribution # via the target dist. This calls package_source to make a tar.gz file. # However this needs to be touched up to support the vanilla Makefiles # provided with GeographicLib. This entails # (1) creating Makefile (which includes Makefile.mk); # (2) creating a bare-bones Config.h (with just the version information); # (3) making sure that make thinks the generated documentation files are # up-to-date. # Then a new tar.gz file and zip file are created. To avoid potential # problems with directory permissions, tar and zip are told only to # archive the files. if (MAINTAINER) add_custom_target (dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source COMMAND cd _CPack_Packages/Linux-Source/TGZ/${CPACK_SOURCE_PACKAGE_FILE_NAME} && echo include Makefile.mk > Makefile && echo "\\#define" GEOGRAPHICLIB_VERSION_STRING \\"${GeographicLib_VERSION}\\" > include/GeographicLib/Config.h COMMAND cd _CPack_Packages/Linux-Source/TGZ/${CPACK_SOURCE_PACKAGE_FILE_NAME} && touch man/*.usage man/*.1 man/*.1.html && touch doc/html/index.html COMMAND cd _CPack_Packages/Linux-Source/TGZ && find ${CPACK_SOURCE_PACKAGE_FILE_NAME} -type f | tar cfzT ${CMAKE_BINARY_DIR}/${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz - COMMAND rm -f ${CPACK_SOURCE_PACKAGE_FILE_NAME}.zip && cd _CPack_Packages/Linux-Source/TGZ && find ${CPACK_SOURCE_PACKAGE_FILE_NAME} -type f | zip -q ${CMAKE_BINARY_DIR}/${CPACK_SOURCE_PACKAGE_FILE_NAME}.zip -@ ) add_dependencies (dist distrib-all) endif () # Add a test target; the tests are in tools. enable_testing () geographiclib-1.21/configure.ac0000644000175000017500000000277111745620415016356 0ustar frankiefrankiednl dnl Copyright (C) 2009, Francesco P. Lovergine dnl $Id: 681a427014d2d61ab6b066354ed7b0ef245f75c3 $ AC_INIT([GeographicLib],[1.21],[charles@karney.com]) AC_CANONICAL_SYSTEM AC_PREREQ(2.61) AC_CONFIG_SRCDIR(src/Geodesic.cpp) AC_CONFIG_MACRO_DIR(m4) AM_INIT_AUTOMAKE dnl dnl This directive is deprecated by someone, but I prefer to avoid dnl running autotools if not required explicitly. The reason is dnl the need to be in sync with autoconf/automake. dnl AM_MAINTAINER_MODE AC_CONFIG_HEADERS(include/GeographicLib/Config-ac.h) dnl Library code modified: REVISION++ dnl Interfaces changed/added/removed: CURRENT++ REVISION=0 dnl Interfaces added: AGE++ dnl Interfaces removed: AGE=0 LT_CURRENT=12 LT_REVISION=0 LT_AGE=3 AC_SUBST(LT_CURRENT) AC_SUBST(LT_REVISION) AC_SUBST(LT_AGE) AC_ARG_PROGRAM AC_PROG_CPP AC_PROG_MAKE_SET AC_PROG_INSTALL AC_PROG_CXX AC_PROG_LIBTOOL # Checks for header files. AC_CHECK_HEADERS([float.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL AC_C_INLINE AC_TYPE_LONG_DOUBLE # Checks for library functions. AC_FUNC_STRTOD AC_CHECK_FUNCS([strtol]) AC_SEARCH_LIBS([floor],[m]) AC_SEARCH_LIBS([pow],[m]) AC_SEARCH_LIBS([sqrt],[m]) # Check endianness AC_C_BIGENDIAN dnl dnl Add here new file to be generated dnl AC_CONFIG_FILES([ Makefile src/Makefile include/Makefile tools/Makefile doc/Makefile man/Makefile matlab/Makefile python/Makefile cmake/Makefile examples/Makefile ]) AC_OUTPUT geographiclib-1.21/config.guess0000755000175000017500000012761511745620415016415 0ustar frankiefrankie#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. timestamp='2009-11-20' # This file 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 2 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, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[456]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: geographiclib-1.21/install-sh0000755000175000017500000003253711745620415016077 0ustar frankiefrankie#!/bin/sh # install - install a program, script, or datafile scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # Protect names starting with `-'. case $dst in -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; -*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: geographiclib-1.21/00README.txt0000644000175000017500000001251111745620415015717 0ustar frankiefrankie# $Id: 1001171ae9372d1bfc31646763709bc4e4f279e1 $ A library for geographic projections. Written by Charles Karney and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/ Files 00README.txt -- this file AUTHORS -- the authors of the library LICENSE.txt -- the MIT/X11 License INSTALL -- brief installation instructions NEWS -- a history of changes include/GeographicLib/ and src/ Config.h.in, Config.h -- system dependent configuration Constants.hpp -- WGS84 constants Math.hpp -- math routines Accumulator.hpp -- quad precision adder Utility.hpp -- I/O and date routines PolarStereographic.[ch]pp -- polar stereographic projection TransverseMercator.[ch]pp -- transverse Mercator projection UTMUPS.[ch]pp -- UTM and UPS MGRS.[ch]pp -- MGRS TransverseMercatorExact.[ch]pp -- exact TM projection EllipticFunction.[ch]pp -- elliptic functions GeoCoords.[ch]pp -- hold geographic location DMS.[ch]pp -- handle degrees minutes seconds Geocentric.[ch]pp -- geocentric coordinates LocalCartesian.[ch]pp -- local cartesian coordinates Geodesic.[ch]pp -- geodesic calculations GeodesicLine.[ch]pp -- calculations on a single geodesic PolygonArea.[ch]pp -- polygon area AzimuthalEquidistant.[ch]pp -- azimuthal equidistant projection Gnomonic.[ch]pp -- gnomonic projection CassiniSoldner.[ch]pp -- Cassini-Soldner equidistant projection Geoid.[ch]pp -- geoid heights Gravity{Model,Circle}.[ch]pp -- gravity models Magnetic{Model,Circle}.[ch]pp -- geomagentic models {Spherical,Circular}Engine.[ch]pp -- spherical harmonic sums SphericalHarmonic{,1,2}.hpp -- frontend for spherical harmonics LambertConformalConic.[ch]pp -- Lambert conformal conic projection AlbersEqualArea.[ch]pp -- Albers equal area projection Gnomonic.[ch]pp -- Ellipsoidal gnomonic projection OSGB.[ch]pp -- Ordnance Survey grid system examples/ example-*.cpp -- simple usage examples for all the classes GeoidToGTX.cpp -- a parallelization example tools/ GeoConvert.cpp -- geographic conversion utility TransverseMercatorTest.cpp -- TM tester Geod.cpp -- geodesic utility CartConvert.cpp -- convert to geocentric and local cartesian EquidistantTest.cpp -- exercise AzimuthalEquidistant and CassiniSoldner GeoidEval.cpp -- evaluate geoid heights Gravity.cpp -- evaluate gravity MagneticField.cpp -- evaluate magnetic field Planimeter.cpp -- computer polygon areas geographiclib-get-geoids -- download geoid datasets geographiclib-get-magnetic -- download geomagnetic models windows/ GeographicLib-vc9.sln -- MS Studio 2008 solution Geographic-vc9.vcproj -- project for library GeoConvert-vc9.vcproj -- project for GeoConvert TransverseMercatorTest-vc9.vcproj -- project for TransverseMercatorTest Geod-vc9.vcproj -- project for Geod Planimeter-vc9.vcproj -- project for Planimeter CartConvert-vc9.vcproj -- project for CartConvert EquidistantTest-vc9.vcproj -- project for EquidistantTest GeoidEval-vc9.vcproj -- project for GeoidEval Gravity-vc9.vcproj -- project for Gravity MagneticField-vc9.vcproj -- project for MagneticField also files for MS Studio 2005 (with vc8) also files for MS Studio 2010 (with vc10) maxima/ tm.mac -- Maxima code for high precision TM ellint.mac -- Maxima code for elliptic functions needed by tm.mac tmseries.mac -- Maxima code for series approximations for TM geod.mac -- Maxima code for series approximates for Geodesic matlab/ geographiclibinterface.m -- Matlab code to compile Matlab interfaces utmupsforward.{cpp,m} -- Matlab code to convert geographic to UTM/UPS utmupsreverse.{cpp,m} -- Matlab code to convert UTM/UPS to geographic mgrsforward.{cpp,m} -- Matlab code to convert UTM/UPS to MGRS mgrsreverse.{cpp,m} -- Matlab code to convert MGRS to UTM/UPS geodesicdirect.{cpp,m} -- Matlab code for the direct geodesic problem geodesicinverse.{cpp,m} -- Matlab code for the inverse geodesic problem geodesicline.{cpp,m} -- Matlab code for geodesic lines geoidheight.{cpp,m} -- Matlab code to look up geoid heights polygonarea.{cpp,m} -- Matlab code for polygon areas doc/ doxyfile.in -- Doxygen config file Geographic.doc -- main page of Doxygen documentation geodseries30.html -- geodesic series to 30th order tmseries30.html -- transverse Mercator series to 30th order html/* -- directory with built documentation scripts/*.html -- demonstrations of the Javascript interface scripts/GeographicLib/*.js -- Javascript implementation of geodesics man/ *.pod -- plain old documentation *.1 -- man pages in nroff format *.1.html -- man pages in html format *.usage -- documentation for incorporation into executables python/GeographicLib/*.py -- Python implementation of geodesics Makefile.mk -- Unix/Linux makefiles configure -- autoconf configuration script CMakeLists.txt -- cmake configuration files cmake/ FindGeographicLib.cmake -- cmake find script *.cmake.in -- cmake config templates geographiclib-1.21/config.sub0000755000175000017500000010316711745620415016054 0ustar frankiefrankie#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. timestamp='2009-11-20' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file 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 2 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, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | ubicom32 \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tile*) basic_machine=tile-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: geographiclib-1.21/missing0000755000175000017500000002623311745620415015466 0ustar frankiefrankie#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2009-04-28.21; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # 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 2, 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 . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; tar*) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar*) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: geographiclib-1.21/Makefile.am0000644000175000017500000000250511745620415016117 0ustar frankiefrankie# # Makefile.am # # Copyright (C) 2009, Francesco P. Lovergine # $Id: 9e9190d7a798cd96abe4d009adc10535e2fffe73 $ AUTOMAKE_OPTIONS = foreign ACLOCAL_AMFLAGS = -I m4 SUBDIRS = src man tools doc include matlab python cmake examples EXTRA_DIST = AUTHORS 00README.txt LICENSE.txt NEWS INSTALL \ Makefile.mk CMakeLists.txt windows maxima doc dist-hook: find $(distdir)/maxima -type f -name '*.lsp' | xargs rm -rf ; \ find $(distdir)/windows -mindepth 1 -type d | xargs rm -rf ; \ find $(distdir)/windows -type f \ ! \( -name '*.sln' -o -name '*.vc*proj' -o -name '*.mk' \)| \ xargs rm -f ; \ find $(distdir) \ \( -name .svn -o -name '.git*' -o -name CVS -o -name Makefile -o -name '*~' -o -name '*#*' -o -name 'CMakeFiles' -o -name '*.log' -o -name '*.tmp' -o -name '*.pyc' -o -name '*.bak' -o -name '*.BAK' -o -name geographiclib.js \)| \ xargs rm -rf ; \ echo include Makefile.mk > $(distdir)/Makefile echo '#define' GEOGRAPHICLIB_VERSION_STRING \ \"$(PACKAGE_VERSION)\" > $(distdir)/include/GeographicLib/Config.h # Custom rules all-local: man doc install-data-local: install-doc # install-matlab doc: man $(MAKE) -C doc doc install-doc: $(MAKE) -C doc install-doc man: $(MAKE) -C man man # install-matlab: # $(MAKE) -C matlab install-matlab .PHONY: doc install-doc man install-matlab install-python geographiclib-1.21/Makefile.in0000644000175000017500000006003011745620415016125 0ustar frankiefrankie# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Makefile.am # # Copyright (C) 2009, Francesco P. Lovergine # $Id: 9e9190d7a798cd96abe4d009adc10535e2fffe73 $ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = . DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/configure \ $(top_srcdir)/include/GeographicLib/Config-ac.h.in AUTHORS \ INSTALL NEWS config.guess config.sub depcomp install-sh \ ltmain.sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d "$(distdir)" \ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr "$(distdir)"; }; } am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POW_LIB = @POW_LIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign ACLOCAL_AMFLAGS = -I m4 SUBDIRS = src man tools doc include matlab python cmake examples EXTRA_DIST = AUTHORS 00README.txt LICENSE.txt NEWS INSTALL \ Makefile.mk CMakeLists.txt windows maxima doc all: all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): include/GeographicLib/Config-ac.h: include/GeographicLib/stamp-h1 @if test ! -f $@; then \ rm -f include/GeographicLib/stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) include/GeographicLib/stamp-h1; \ else :; fi include/GeographicLib/stamp-h1: $(top_srcdir)/include/GeographicLib/Config-ac.h.in $(top_builddir)/config.status @rm -f include/GeographicLib/stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status include/GeographicLib/Config-ac.h $(top_srcdir)/include/GeographicLib/Config-ac.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f include/GeographicLib/stamp-h1 touch $@ distclean-hdr: -rm -f include/GeographicLib/Config-ac.h include/GeographicLib/stamp-h1 mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @$(am__cd) '$(distuninstallcheck_dir)' \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile all-local installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr \ distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-data-local install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am all-local am--refresh check check-am clean \ clean-generic clean-libtool ctags ctags-recursive dist \ dist-all dist-bzip2 dist-gzip dist-hook dist-lzma dist-shar \ dist-tarZ dist-xz dist-zip distcheck distclean \ distclean-generic distclean-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-data-local install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-recursive uninstall uninstall-am dist-hook: find $(distdir)/maxima -type f -name '*.lsp' | xargs rm -rf ; \ find $(distdir)/windows -mindepth 1 -type d | xargs rm -rf ; \ find $(distdir)/windows -type f \ ! \( -name '*.sln' -o -name '*.vc*proj' -o -name '*.mk' \)| \ xargs rm -f ; \ find $(distdir) \ \( -name .svn -o -name '.git*' -o -name CVS -o -name Makefile -o -name '*~' -o -name '*#*' -o -name 'CMakeFiles' -o -name '*.log' -o -name '*.tmp' -o -name '*.pyc' -o -name '*.bak' -o -name '*.BAK' -o -name geographiclib.js \)| \ xargs rm -rf ; \ echo include Makefile.mk > $(distdir)/Makefile echo '#define' GEOGRAPHICLIB_VERSION_STRING \ \"$(PACKAGE_VERSION)\" > $(distdir)/include/GeographicLib/Config.h # Custom rules all-local: man doc install-data-local: install-doc # install-matlab doc: man $(MAKE) -C doc doc install-doc: $(MAKE) -C doc install-doc man: $(MAKE) -C man man # install-matlab: # $(MAKE) -C matlab install-matlab .PHONY: doc install-doc man install-matlab install-python # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: geographiclib-1.21/Makefile.mk0000644000175000017500000000304511745620414016130 0ustar frankiefrankie# $Id: e41e5a29e46933b242fce49416e474403fc4bb65 $ MAKEFILE := $(lastword $(MAKEFILE_LIST)) MAKE := $(MAKE) -f $(MAKEFILE) SUBDIRS = src man tools doc ALLDIRS = include $(SUBDIRS) maxima matlab python windows cmake all: src man tools $(SUBDIRS): $(MAKE) -C $@ tools: src install: install-headers install-lib install-tools install-man install-cmake \ install-doc install-matlab install-python clean: clean-src clean-tools clean-doc clean-man clean-matlab clean-python maintainer-clean: clean maintainer-clean-doc maintainer-clean-man install-headers: $(MAKE) -C include install install-lib: $(MAKE) -C src install install-tools: src $(MAKE) -C tools install install-cmake: $(MAKE) -C cmake install install-doc: doc $(MAKE) -C doc install install-man: man $(MAKE) -C man install install-matlab: matlab $(MAKE) -C matlab install install-python: python $(MAKE) -C python install clean-src: $(MAKE) -C src clean clean-tools: $(MAKE) -C tools clean clean-doc: $(MAKE) -C doc clean clean-man: $(MAKE) -C man clean clean-matlab: matlab $(MAKE) -C matlab clean clean-python: python $(MAKE) -C python clean maintainer-clean-doc: $(MAKE) -C doc maintainer-clean maintainer-clean-man: $(MAKE) -C man maintainer-clean VERSION:=$(shell grep '\bVERSION=' configure | cut -f2 -d\' | head -1) .PHONY: all $(SUBDIRS) install \ install-headers install-lib install-tools install-cmake install-man \ install-matlab install-python \ clean clean-src clean-tools clean-doc clean-man clean-matlab \ clean-python maintainer-clean maintainer-clean-doc maintainer-clean-man geographiclib-1.21/LICENSE.txt0000644000175000017500000000215211745620415015704 0ustar frankiefrankieThis license applies to GeographicLib, versions 1.12 and later. Copyright (c) 2008-2012, Charles Karney Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. geographiclib-1.21/matlab/0002755000175000017500000000000011757437426015336 5ustar frankiefrankiegeographiclib-1.21/matlab/geocentricforward.cpp0000644000175000017500000000557411745620415021547 0ustar frankiefrankie/** * \file geocentricforward.cpp * \brief Matlab mex file for geographic to UTM/UPS conversions * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic geocentricforward.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic geocentricforward.cpp // $Id: 4b6a1a65868ee6d55166cbedd0206140b4eb06a5 $ #include #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 1) mexErrMsgTxt("One input argument required."); else if (nrhs > 3) mexErrMsgTxt("More than three input arguments specified."); else if (nrhs == 2) mexErrMsgTxt("Must specify flattening with the major radius."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("geodetic coordinates are not of type double."); if (!(mxGetN(prhs[0]) == 3 || mxGetN(prhs[0]) == 2)) mexErrMsgTxt("geodetic coordinates must be an M x 3 or M x 2 matrix."); double a = Constants::WGS84_a(), f = Constants::WGS84_f(); if (nrhs == 3) { if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) && mxGetNumberOfElements(prhs[1]) == 1 )) mexErrMsgTxt("Major radius is not a real scalar."); a = mxGetScalar(prhs[1]); if (!( mxIsDouble(prhs[2]) && !mxIsComplex(prhs[2]) && mxGetNumberOfElements(prhs[2]) == 1 )) mexErrMsgTxt("Flattening is not a real scalar."); f = mxGetScalar(prhs[2]); } int m = mxGetM(prhs[0]); double* lat = mxGetPr(prhs[0]); double* lon = lat + m; bool haveh = mxGetN(prhs[0]) == 3; double* h = haveh ? lat + 2*m : NULL; plhs[0] = mxCreateDoubleMatrix(m, 3, mxREAL); double* x = mxGetPr(plhs[0]); std::fill(x, x + 3*m, Math::NaN()); double* y = x + m; double* z = x + 2*m; double* rot = NULL; bool rotp = nlhs == 2; if (rotp) { plhs[1] = mxCreateDoubleMatrix(m, 9, mxREAL); rot = mxGetPr(plhs[1]); std::fill(rot, rot + 9*m, Math::NaN()); } try { std::vector rotv(rotp ? 9 : 0); const Geocentric c(a, f); for (int i = 0; i < m; ++i) { if (!(abs(lat[i]) > 90) && !(lon[i] < -180 || lon[i] > 360)) { c.Forward(lat[i], lon[i], haveh ? h[i] : 0.0, x[i], y[i], z[i], rotv); if (rotp) { for (int k = 0; k < 9; ++k) rot[m * k + i] = rotv[k]; } } } } catch (const std::exception& e) { mexErrMsgTxt(e.what()); } } geographiclib-1.21/matlab/utmupsforward.m0000644000175000017500000000277411745620415020433 0ustar frankiefrankiefunction [utmups, scale] = utmupsforward(latlong, setzone) %utmupsforward Convert geographic coordinates to UTM/UPS % % [utmups, scale] = utmupsforward(latlong) % [utmups, scale] = utmupsforward(latlong, setzone) % % latlong is an M x 2 matrix % latitude = latlong(:,1) in degrees % longitude = latlong(:,2) in degrees % % utmups is an M x 4 matrix % easting = utmups(:,1) in meters % northing = utmups(:,2) in meters % zone = utmups(:,3) % hemi = utmups(:,4) % scale is an M x 2 matrix % gamma = scale(:,1) meridian convergence in degrees % k = scale(:,2) scale % % zone = 0 for UPS, zone = [1,60] for UTM % hemi = 0 for southern hemisphere, hemi = 1 for northern hemisphere % % setzone is an zone override flag with legal values % 0, use UPS % [1,60], use the corresponding UTM zone % -1, use the standard assigment (the default) % -2, use closest UTM zone % % This is an interface to the GeographicLib C++ routine % UTMUPS::Forward % See the documentation on this function for more information: % http://geographiclib.sf.net/html/classGeographicLib_1_1UTMUPS.html error('Error: executing .m file instead of compiled routine'); end % utmupsforward.m % Matlab .m file for geographic to UTM/UPS conversions % % Copyright (c) Charles Karney (2010, 2011) and licensed % under the MIT/X11 License. For more information, see % http://geographiclib.sourceforge.net/ % % $Id: 8160e1e84c6c5fb707b89cc429562926805bc3f3 $ geographiclib-1.21/matlab/geodesicinverse.cpp0000644000175000017500000000624211745620415021207 0ustar frankiefrankie/** * \file geodesicinverse.cpp * \brief Matlab mex file for geographic to UTM/UPS conversions * * Copyright (c) Charles Karney (2010, 2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic geodesicinverse.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic geodesicinverse.cpp // $Id: d12c1b02556b3e154c216cacd112deaab845ee1b $ #include #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 1) mexErrMsgTxt("One input argument required."); else if (nrhs > 3) mexErrMsgTxt("More than three input arguments specified."); else if (nrhs == 2) mexErrMsgTxt("Must specify flattening with the major radius."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("latlong coordinates are not of type double."); if (mxGetN(prhs[0]) != 4) mexErrMsgTxt("latlong coordinates must be M x 4 matrix."); double a = Constants::WGS84_a(), f = Constants::WGS84_f(); if (nrhs == 3) { if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) && mxGetNumberOfElements(prhs[1]) == 1 )) mexErrMsgTxt("Major radius is not a real scalar."); a = mxGetScalar(prhs[1]); if (!( mxIsDouble(prhs[2]) && !mxIsComplex(prhs[2]) && mxGetNumberOfElements(prhs[2]) == 1 )) mexErrMsgTxt("Flattening is not a real scalar."); f = mxGetScalar(prhs[2]); } int m = mxGetM(prhs[0]); double* lat1 = mxGetPr(prhs[0]); double* lon1 = lat1 + m; double* lat2 = lat1 + 2*m; double* lon2 = lat1 + 3*m; plhs[0] = mxCreateDoubleMatrix(m, 3, mxREAL); double* azi1 = mxGetPr(plhs[0]); std::fill(azi1, azi1 + 3*m, Math::NaN()); double* azi2 = azi1 + m; double* s12 = azi1 + 2*m; double* a12 = NULL; double* m12 = NULL; double* M12 = NULL; double* M21 = NULL; double* S12 = NULL; bool aux = nlhs == 2; if (aux) { plhs[1] = mxCreateDoubleMatrix(m, 5, mxREAL); a12 = mxGetPr(plhs[1]); std::fill(a12, a12 + 5*m, Math::NaN()); m12 = a12 + m; M12 = a12 + 2*m; M21 = a12 + 3*m; S12 = a12 + 4*m; } try { const Geodesic g(a, f); for (int i = 0; i < m; ++i) { if (!(abs(lat1[i]) > 90 || abs(lat2[i]) > 90) && !(lon1[i] < -180 || lon1[i] > 360 || lon2[i] < -180 || lon2[i] > 360)) { if (aux) a12[i] = g.Inverse(lat1[i], lon1[i], lat2[i], lon2[i], s12[i], azi1[i], azi2[i], m12[i], M12[i], M21[i], S12[i]); else g.Inverse(lat1[i], lon1[i], lat2[i], lon2[i], s12[i], azi1[i], azi2[i]); } } } catch (const std::exception& e) { mexErrMsgTxt(e.what()); } } geographiclib-1.21/matlab/geoidheight.m0000644000175000017500000000316311745620415017762 0ustar frankiefrankiefunction [height, gradient] = geoidheight(latlong, geoidname, geoiddir) %geoidheight Compute geoid height % % CAUTION: THIS MAY CAUSE MATLAB TO CRASH!! This occurs when the interface % is compiled with Visual Studio 2008. % % [height, gradient] = geoidheight(latlong) % [height, gradient] = geoidheight(latlong, geoidname) % [height, gradient] = geoidheight(latlong, geoidname, geoiddir) % % latlong is an M x 2 matrix % latitude = latlong(:,1) in degrees % longitude = latlong(:,2) in degrees % geoidname is the name of the geoid; choices are (default egm96-5) % egm84-30 egm84-15 % egm96-15 egm96-5 % egm2008-5 egm2008-2_5 egm2008-1 % geoiddir is the directory containing the geoid models (default empty % string meaning system default) % % height is an M x 1 matrix % geoidheight = height(:,1) height of geoid in meters % gradient is the gradient of the geoid height % gradn = gradient(:,1) gradient of height in northerly direction % grade = gradient(:,2) gradient of height in easterly direction % % This is an interface to the GeographicLib C++ routine % Geoid::operator() % See the documentation on this function for more information: % http://geographiclib.sf.net/html/classGeographicLib_1_1Geoid.html error('Error: executing .m file instead of compiled routine'); end % geoidheight.m % Matlab .m file for looking up geoid heights % % Copyright (c) Charles Karney (2010, 2011) and licensed % under the MIT/X11 License. For more information, see % http://geographiclib.sourceforge.net/ % % $Id: 519a47a6a226677a008a17b23e1acaf44ddd8c03 $ geographiclib-1.21/matlab/localcartesianforward.m0000644000175000017500000000344511745620415022056 0ustar frankiefrankiefunction [cartesian, rot] = localcartesianforward(origin, geodetic, a, f) %localcartesianforward Convert geographic coordinates to local cartesian % % [cartesian, rot] = localcartesianforward(origin, geodetic) % [cartesian, rot] = localcartesianforward(origin, geodetic, a, f) % % origin is a 1 x 3 or 1 x 2 matrix % lat0 = origin(1,1) in degrees % lon0 = origin(1,2) in degrees % h0 = origin(1,3) in meters (default 0 m) % geodetic is an M x 3 or M x 2 matrix of geodetic coordinates % lat = geodetic(:,1) in degrees % lon = geodetic(:,2) in degrees % h = geodetic(:,3) in meters (default 0 m) % % cartesian is an M x 3 matrix of local cartesian coordinates % x = cartesian(:,1) in meters % y = cartesian(:,2) in meters % z = cartesian(:,3) in meters % rot is an M x 9 matrix % M = rot(:,1:9) rotation matrix in row major order. Pre-multiplying % a unit vector in local cartesian coordinates at (lat, lon, h) % by M transforms the vector to local cartesian coordinates at % (lat0, lon0, h0) % % a = major radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % This is an interface to the GeographicLib C++ routine % LocalCartesian::Forward % See the documentation on this function for more information: % http://geographiclib.sf.net/html/classGeographicLib_1_1LocalCartesian.html error('Error: executing .m file instead of compiled routine'); end % localcartesianforward.m % Matlab .m file for geographic to local cartesian conversions % % Copyright (c) Charles Karney (2011) and licensed under % the MIT/X11 License. For more information, see % http://geographiclib.sourceforge.net/ % % $Id: fdc671d6023a46268b868154bf94777c9b14f5fa $ geographiclib-1.21/matlab/utmupsforward.cpp0000644000175000017500000000536111745620415020754 0ustar frankiefrankie/** * \file utmupsforward.cpp * \brief Matlab mex file for geographic to UTM/UPS conversions * * Copyright (c) Charles Karney (2010) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic utmupsforward.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic utmupsforward.cpp // $Id: 53830253ba4e2c0a9e1d904d0649dffecb8ce3b1 $ #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 1) mexErrMsgTxt("One input argument required."); else if (nrhs > 2) mexErrMsgTxt("More than two input arguments specified."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("latlong coordinates are not of type double."); if (mxGetN(prhs[0]) != 2) mexErrMsgTxt("latlong coordinates must be M x 2 matrix."); int setzone; if (nrhs == 1) setzone = UTMUPS::STANDARD; else { if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) && mxGetNumberOfElements(prhs[1]) == 1 )) mexErrMsgTxt("setzone is not an integer."); double rzone = mxGetScalar(prhs[1]); setzone = int(rzone); if (double(setzone) != rzone) mexErrMsgTxt("setzone is not an integer."); if (setzone < UTMUPS::MINPSEUDOZONE || setzone > UTMUPS::MAXZONE) mexErrMsgTxt("setzone outside the legal range."); } int m = mxGetM(prhs[0]); double* lat = mxGetPr(prhs[0]); double* lon = lat + m; plhs[0] = mxCreateDoubleMatrix(m, 4, mxREAL); double* x = mxGetPr(plhs[0]); double* y = x + m; double* zone = x + 2*m; double* hemi = x + 3*m; double* gamma = NULL; double* k = NULL; bool scale = nlhs == 2; if (scale) { plhs[1] = mxCreateDoubleMatrix(m, 2, mxREAL); gamma = mxGetPr(plhs[1]); k = gamma + m; } for (int i = 0; i < m; ++i) { int ZONE; bool HEMI; try { if (scale) UTMUPS::Forward(lat[i], lon[i], ZONE, HEMI, x[i], y[i], gamma[i], k[i], setzone); else UTMUPS::Forward(lat[i], lon[i], ZONE, HEMI, x[i], y[i], setzone); zone[i] = ZONE; hemi[i] = HEMI ? 1 : 0; } catch (const std::exception& e) { mexWarnMsgTxt(e.what()); x[i] = y[i] = Math::NaN(); if (scale) gamma[i] = k[i] = Math::NaN(); zone[i] = UTMUPS::INVALID; hemi[i] = 0; } } } geographiclib-1.21/matlab/geocentricreverse.cpp0000644000175000017500000000511511745620415021545 0ustar frankiefrankie/** * \file geocentricreverse.cpp * \brief Matlab mex file for UTM/UPS to geographic conversions * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic geocentricreverse.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic geocentricreverse.cpp // $Id: 9ae273ec91d65570bc2839b153f047ecfcf8c91f $ #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 1) mexErrMsgTxt("One input argument required."); else if (nrhs > 3) mexErrMsgTxt("More than three input arguments specified."); else if (nrhs == 2) mexErrMsgTxt("Must specify flattening with the major radius."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("geocentric coordinates are not of type double."); if (mxGetN(prhs[0]) != 3) mexErrMsgTxt("geocentric coordinates must be M x 3 matrix."); double a = Constants::WGS84_a(), f = Constants::WGS84_f(); if (nrhs == 3) { if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) && mxGetNumberOfElements(prhs[1]) == 1 )) mexErrMsgTxt("Major radius is not a real scalar."); a = mxGetScalar(prhs[1]); if (!( mxIsDouble(prhs[2]) && !mxIsComplex(prhs[2]) && mxGetNumberOfElements(prhs[2]) == 1 )) mexErrMsgTxt("Flattening is not a real scalar."); f = mxGetScalar(prhs[2]); } int m = mxGetM(prhs[0]); double* x = mxGetPr(prhs[0]); double* y = x + m; double* z = x + 2*m; plhs[0] = mxCreateDoubleMatrix(m, 3, mxREAL); double* lat = mxGetPr(plhs[0]); double* lon = lat + m; double* h = lat + 2*m; double* rot = NULL; bool rotp = nlhs == 2; if (rotp) { plhs[1] = mxCreateDoubleMatrix(m, 9, mxREAL); rot = mxGetPr(plhs[1]); } try { std::vector rotv(rotp ? 9 : 0); const Geocentric c(a, f); for (int i = 0; i < m; ++i) { c.Reverse(x[i], y[i], z[i], lat[i], lon[i], h[i], rotv); if (rotp) { for (int k = 0; k < 9; ++k) rot[m * k + i] = rotv[k]; } } } catch (const std::exception& e) { mexErrMsgTxt(e.what()); } } geographiclib-1.21/matlab/mgrsreverse.m0000644000175000017500000000262311745620415020046 0ustar frankiefrankiefunction [utmups, prec] = mgrsreverse(utmups) %mgrsreverse Convert UTM/UPS coordinates to MGRS % % [utmups, prec] = mgrsreverse(mgrs) % % mgrs is a M x 1 cell array of MGRS strings, e.g., % mgrsreverse({ '38SMB4488'; '12TUK3393' }) % % utmups is an M x 4 matrix % easting = utmups(:,1) in meters % northing = utmups(:,2) in meters % zone = utmups(:,3) % hemi = utmups(:,4) % prec is an M x 1 matrix % precision = prec(:,1) % = half the number of trailing digits in the MGRS string % % zone = 0 for UPS, zone = [1,60] for UTM. % hemi = 0 for southern hemisphere, hemi = 1 for northern hemisphere % prec = precision, half the number of trailing digits % % The position is the center of the MGRS square. To obtain the % SW corner subtract 0.5 * 10^(5-prec) from the easting and northing. % % This is an interface to the GeographicLib C++ routine % MGRS::Reverse % See the documentation on this function for more information: % http://geographiclib.sf.net/html/classGeographicLib_1_1MGRS.html error('Error: executing .m file instead of compiled routine'); end % mgrsreverse.m % Matlab .m file for MGRS to UTM/UPS conversions % % Copyright (c) Charles Karney (2010, 2011) and % licensed under the MIT/X11 License. For more information, see % http://geographiclib.sourceforge.net/ % % $Id: b04bd9800243ee766cb0d63b0318bc42464c410c $ geographiclib-1.21/matlab/localcartesianforward.cpp0000644000175000017500000000672611745620415022411 0ustar frankiefrankie/** * \file localcartesianforward.cpp * \brief Matlab mex file for geographic to UTM/UPS conversions * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic localcartesianforward.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic localcartesianforward.cpp // $Id: e58202b672e8578b5d8b3ff97c899544c1a7bbe7 $ #include #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 2) mexErrMsgTxt("Two input arguments required."); else if (nrhs > 4) mexErrMsgTxt("More than four input arguments specified."); else if (nrhs == 3) mexErrMsgTxt("Must specify flattening with the major radius."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("origin is not of type double."); if (!( mxGetM(prhs[0]) == 1 && (mxGetN(prhs[0]) == 2 || mxGetN(prhs[0]) == 3) )) mexErrMsgTxt("origin be 1 x 3 or 1 x 2 matrix."); double* origin = mxGetPr(prhs[0]); double lat0 = origin[0], lon0 = origin[1], h0 = mxGetN(prhs[0]) == 3 ? origin[2] : 0; if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) )) mexErrMsgTxt("geodetic coordinates are not of type double."); if (!(mxGetN(prhs[1]) == 3 || mxGetN(prhs[1]) == 2)) mexErrMsgTxt("geodetic coordinates must be an M x 3 or M x 2 matrix."); double a = Constants::WGS84_a(), f = Constants::WGS84_f(); if (nrhs == 4) { if (!( mxIsDouble(prhs[2]) && !mxIsComplex(prhs[2]) && mxGetNumberOfElements(prhs[2]) == 1 )) mexErrMsgTxt("Major radius is not a real scalar."); a = mxGetScalar(prhs[2]); if (!( mxIsDouble(prhs[3]) && !mxIsComplex(prhs[3]) && mxGetNumberOfElements(prhs[3]) == 1 )) mexErrMsgTxt("Flattening is not a real scalar."); f = mxGetScalar(prhs[3]); } int m = mxGetM(prhs[1]); double* lat = mxGetPr(prhs[1]); double* lon = lat + m; bool haveh = mxGetN(prhs[1]) == 3; double* h = haveh ? lat + 2*m : NULL; plhs[0] = mxCreateDoubleMatrix(m, 3, mxREAL); double* x = mxGetPr(plhs[0]); std::fill(x, x + 3*m, Math::NaN()); double* y = x + m; double* z = x + 2*m; double* rot = NULL; bool rotp = nlhs == 2; if (rotp) { plhs[1] = mxCreateDoubleMatrix(m, 9, mxREAL); rot = mxGetPr(plhs[1]); std::fill(rot, rot + 9*m, Math::NaN()); } try { std::vector rotv(rotp ? 9 : 0); const Geocentric c(a, f); if (abs(lat0) > 90) throw GeographicErr("Invalid latitude"); if (lon0 < -180 || lon0 > 360) throw GeographicErr("Invalid longitude"); const LocalCartesian l(lat0, lon0, h0, c); for (int i = 0; i < m; ++i) { if (!(abs(lat[i]) > 90) && !(lon[i] < -180 || lon[i] > 360)) { l.Forward(lat[i], lon[i], haveh ? h[i] : 0.0, x[i], y[i], z[i], rotv); if (rotp) { for (int k = 0; k < 9; ++k) rot[m * k + i] = rotv[k]; } } } } catch (const std::exception& e) { mexErrMsgTxt(e.what()); } } geographiclib-1.21/matlab/CMakeLists.txt0000644000175000017500000000572411745620415020071 0ustar frankiefrankie# $Id: 8da4ccf20ab1de73f6ac4c2d60d6857229a076af $ # Set up the matlab interface. The .m files just contain the # documentation. The .cpp files implement the interface. file (GLOB MATLAB_FILES *.m) file (GLOB MATLAB_INTERFACES *.cpp) # Both sets of files get installed install (FILES ${MATLAB_FILES} ${MATLAB_INTERFACES} DESTINATION libexec/GeographicLib/matlab) # If MEX then compile the interface routines. On non-Windows # systems, an attempt is made to minimize the number of addition target # generated. For some reason this does not work with Windows systems. # On Windows systems, need also to copy the shared library to where the # mex files live (in the build and install trees). if (MEX) if (WIN32) include (InstallRequiredSystemLibraries) install (PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION libexec/GeographicLib/matlab) add_custom_target (matlab-all) else () set (INTERFACE_LIST) endif () foreach (INTERFACE ${MATLAB_INTERFACES}) get_filename_component (TARGET ${INTERFACE} NAME_WE) set (TARGET_INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.${MEXEXT}) if (WIN32) add_custom_target (matlab-${TARGET} DEPENDS ${TARGET_INTERFACE}) add_custom_command (OUTPUT ${TARGET_INTERFACE} COMMAND ${MEX} -I${PROJECT_BINARY_DIR}/include -I${PROJECT_SOURCE_DIR}/include -L${PROJECT_BINARY_DIR}/src/Release -lGeographic ${INTERFACE} COMMENT "Building matlab interface for ${TARGET}" DEPENDS ${INTERFACE} Geographic) add_dependencies (matlab-${TARGET} Geographic) add_dependencies (matlab-all matlab-${TARGET}) install (PROGRAMS ${TARGET_INTERFACE} DESTINATION libexec/GeographicLib/matlab CONFIGURATIONS Release) else () set (INTERFACE_LIST ${INTERFACE_LIST} ${TARGET_INTERFACE}) add_custom_command (OUTPUT ${TARGET_INTERFACE} COMMAND ${MEX} --mex -I${PROJECT_BINARY_DIR}/include -I${PROJECT_SOURCE_DIR}/include -L${PROJECT_BINARY_DIR}/src -lGeographic -Wl,-rpath=${CMAKE_INSTALL_PREFIX}/lib ${INTERFACE} COMMENT "Building matlab interface for ${TARGET}" DEPENDS ${INTERFACE} Geographic) endif () endforeach () if (NOT WIN32) add_custom_target (matlab-all DEPENDS ${INTERFACE_LIST}) add_dependencies (matlab-all Geographic) install (PROGRAMS ${INTERFACE_LIST} DESTINATION libexec/GeographicLib/matlab CONFIGURATIONS Release) endif () if (WIN32 AND GEOGRAPHIC_SHARED_LIB) get_target_property (GEOGRAPHIC_LIBRARY_FILE Geographic LOCATION_RELEASE) add_custom_command (TARGET matlab-all POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${GEOGRAPHIC_LIBRARY_FILE} ./) get_filename_component (GEOGRAPHIC_LIBRARY_NAME ${GEOGRAPHIC_LIBRARY_FILE} NAME) install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${GEOGRAPHIC_LIBRARY_NAME} DESTINATION libexec/GeographicLib/matlab CONFIGURATIONS Release) endif () endif () geographiclib-1.21/matlab/utmupsreverse.cpp0000644000175000017500000000435411745620415020764 0ustar frankiefrankie/** * \file utmupsreverse.cpp * \brief Matlab mex file for UTM/UPS to geographic conversions * * Copyright (c) Charles Karney (2010) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic utmupsreverse.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic utmupsreverse.cpp // $Id: 097c8ccdb535c826583b1d640d08e79bd1ad6c38 $ #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs != 1) mexErrMsgTxt("One input argument required."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("utmups coordinates are not of type double."); if (mxGetN(prhs[0]) != 4) mexErrMsgTxt("utmups coordinates must be M x 4 matrix."); int m = mxGetM(prhs[0]); double* x = mxGetPr(prhs[0]); double* y = x + m; double* zone = x + 2*m; double* hemi = x + 3*m; plhs[0] = mxCreateDoubleMatrix(m, 2, mxREAL); double* lat = mxGetPr(plhs[0]); double* lon = lat + m; double* gamma = NULL; double* k = NULL; bool scale = nlhs == 2; if (scale) { plhs[1] = mxCreateDoubleMatrix(m, 2, mxREAL); gamma = mxGetPr(plhs[1]); k = gamma + m; } for (int i = 0; i < m; ++i) { try { int ZONE = int(zone[i]); if (double(ZONE) != zone[i]) throw GeographicErr("Zone is not an integer"); bool HEMI = (hemi[i] != 0); if (HEMI && (hemi[i] != 1)) throw GeographicErr("Hemisphere is not 0 or 1"); if (scale) UTMUPS::Reverse(ZONE, HEMI, x[i], y[i], lat[i], lon[i], gamma[i], k[i]); else UTMUPS::Reverse(ZONE, HEMI, x[i], y[i], lat[i], lon[i]); } catch (const std::exception& e) { mexWarnMsgTxt(e.what()); lat[i] = lon[i] = Math::NaN(); if (scale) gamma[i] = k[i] = Math::NaN(); } } } geographiclib-1.21/matlab/polygonarea.cpp0000644000175000017500000000524711745620415020355 0ustar frankiefrankie/** * \file polygonarea.cpp * \brief Matlab mex file for computing the area of a geodesicpolygon * * Copyright (c) Charles Karney (2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic polygonarea.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic polygonarea.cpp // $Id: cbdd83aa0963df0a278c3c4254a8935c3d77828b $ #include #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 1) mexErrMsgTxt("One input argument required."); else if (nrhs > 3) mexErrMsgTxt("More than three input arguments specified."); else if (nrhs == 2) mexErrMsgTxt("Must specify flattening with the major radius."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("latlong coordinates are not of type double."); if (mxGetN(prhs[0]) != 2) mexErrMsgTxt("latlong coordinates must be M x 2 matrix."); double a = Constants::WGS84_a(), f = Constants::WGS84_f(); if (nrhs == 3) { if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) && mxGetNumberOfElements(prhs[1]) == 1 )) mexErrMsgTxt("Major radius is not a real scalar."); a = mxGetScalar(prhs[1]); if (!( mxIsDouble(prhs[2]) && !mxIsComplex(prhs[2]) && mxGetNumberOfElements(prhs[2]) == 1 )) mexErrMsgTxt("Flattening is not a real scalar."); f = mxGetScalar(prhs[2]); } int m = mxGetM(prhs[0]); double* lat = mxGetPr(prhs[0]); double* lon = lat + m; plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL); double* area = mxGetPr(plhs[0]); double* perimeter = NULL; bool perimeterp = nlhs == 2; if (perimeterp) { plhs[1] = mxCreateDoubleMatrix(1, 1, mxREAL); perimeter = mxGetPr(plhs[1]); } try { const Geodesic g(a, f); PolygonArea p(g, false); for (int i = 0; i < m; ++i) { if (abs(lat[i]) > 90) throw GeographicErr("Invalid latitude"); if (lon[i] < -180 || lon[i] > 360) throw GeographicErr("Invalid longitude"); p.AddPoint(lat[i], lon[i]); } double tp, ta; p.Compute(false, true, tp, ta); *area = ta; if (perimeterp) *perimeter = tp; } catch (const std::exception& e) { mexErrMsgTxt(e.what()); } } geographiclib-1.21/matlab/polygonarea.m0000644000175000017500000000262211745620415020021 0ustar frankiefrankiefunction [area, perimeter] = polygonarea(latlong, a, f) %polygonarea Compute area of a geodesic polygon % % [area, perimeter] = polygonarea(latlong) % [area, perimeter] = polygonarea(latlong, a, f) % % latlong is an M x 2 matrix % latitude of vertices = latlong(:,1) in degrees % longitude of vertices = latlong(:,2) in degrees % % area is the area in meters^2 % perimeter is the perimeter in meters % % a = major radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % Only simple polygons (which do not intersect themselves) are supported. % There is no need to "close" the polygon. Counter-clockwise traversal % counts as a positive area. A polygon may encircle one or both poles. % The total area of the WGS84 ellipsoid is given by % 8 * polygonarea([ 0 0; 0 90; 90 0 ]) % % This is an interface to the GeographicLib C++ class % Geodesic::PolygonArea % See the documentation on this function for more information: % http://geographiclib.sf.net/html/classGeographicLib_1_1PolygonArea error('Error: executing .m file instead of compiled routine'); end % polygonarea.m % Matlab .m file for finding polygon areas % % Copyright (c) Charles Karney (2011) and % licensed under the MIT/X11 License. For more information, see % http://geographiclib.sourceforge.net/ % % $Id: 6e5fb482c0c2c1d543c110f912fc42888877906e $ geographiclib-1.21/matlab/utmupsreverse.m0000644000175000017500000000235111745620415020431 0ustar frankiefrankiefunction [latlong, scale] = utmupsreverse(utmups) %utmupsreverse Convert UTM/UPS coordinates to geographic % % [latlong, scale] = utmupsreverse(utmups) % % utmups is an M x 4 matrix % easting = utmups(:,1) in meters % northing = utmups(:,2) in meters % zone = utmups(:,3) % hemi = utmups(:,4) % % zone = 0 for UPS, zone = [1,60] for UTM % hemi = 0 for southern hemisphere, hemi = 1 for northern hemisphere. % % latlong is an M x 2 matrix % latitude = latlong(:,1) in degrees % longitude = latlong(:,2) in degrees % scale is an M x 2 matrix % gamma = scale(:,1) meridian convergence in degrees % k = scale(:,2) scale % % This is an interface to the GeographicLib C++ routine % UTMUPS::Reverse % See the documentation on this function for more information: % http://geographiclib.sf.net/html/classGeographicLib_1_1MGRS.html error('Error: executing .m file instead of compiled routine'); end % utmupsreverse.m % Matlab .m file for UTM/UPS to geographic conversions % % Copyright (c) Charles Karney (2010, 2011) and % licensed under the MIT/X11 License. For more information, see % http://geographiclib.sourceforge.net/ % % $Id: 98449c5ba8fd3017faab27c68f942a28096fa848 $ geographiclib-1.21/matlab/geoidheight.cpp0000644000175000017500000000630511745620415020311 0ustar frankiefrankie/** * \file geoidheight.cpp * \brief Matlab mex file for geographic to UTM/UPS conversions * * Copyright (c) Charles Karney (2010) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic geoidheight.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic geoidheight.cpp // $Id: f57e9aa3c45ed9f63687fdba9bb6f79000895174 $ #include #include #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 1) mexErrMsgTxt("One input argument required."); else if (nrhs > 3) mexErrMsgTxt("More than three input arguments specified."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("latlong coordinates are not of type double."); if (mxGetN(prhs[0]) != 2) mexErrMsgTxt("latlong coordinates must be M x 2 matrix."); int m = mxGetM(prhs[0]); double* lat = mxGetPr(prhs[0]); double* lon = lat + m; plhs[0] = mxCreateDoubleMatrix(m, 1, mxREAL); double* h = mxGetPr(plhs[0]); std::fill(h, h + m, Math::NaN()); double* gradn = NULL; double* grade = NULL; bool gradient = nlhs == 2; if (gradient) { plhs[1] = mxCreateDoubleMatrix(m, 2, mxREAL); gradn = mxGetPr(plhs[1]); std::fill(gradn, gradn + 2*m, Math::NaN()); grade = gradn + m; } string geoidname("egm96-5"); if (nrhs > 1) { if (!mxIsChar(prhs[1])) mexErrMsgTxt("geoid name must be a string."); if (mxGetM(prhs[1]) == 0) mexErrMsgTxt("geoid name cannot be empty."); if (mxGetM(prhs[1]) != 1) mexErrMsgTxt("geoid name cannot be a vector of strings."); int n = mxGetN(prhs[1]); if (n < 1) mexErrMsgTxt("geoid name cannot be empty."); mxChar* ptr = mxGetChars(prhs[1]); geoidname.resize(n); for (int i = 0; i < n; ++i) geoidname[i] = ptr[i]; } string geoiddir(""); if (nrhs > 2) { if (!mxIsChar(prhs[2])) mexErrMsgTxt("geoid directory must be a string."); if (mxGetM(prhs[2]) > 1) mexErrMsgTxt("geoid directory cannot be a vector of strings."); int n = mxGetN(prhs[2]); if (n > 0 && mxGetM(prhs[2]) == 1) { mxChar* ptr = mxGetChars(prhs[2]); geoiddir.resize(n); for (int i = 0; i < n; ++i) geoiddir[i] = ptr[i]; } // else string is empty and do nothing } try { const Geoid g(geoidname, geoiddir); for (int i = 0; i < m; ++i) { if (!(abs(lat[i]) > 90) && !(lon[i] < -180 || lon[i] > 360)) { // g() can throw an exception, e.g., because of an I/O failure. Treat // this as fatal. if (gradient) h[i] = g(lat[i], lon[i], gradn[i], grade[i]); else h[i] = g(lat[i], lon[i]); } } } catch (const std::exception& e) { mexErrMsgTxt(e.what()); } } geographiclib-1.21/matlab/localcartesianreverse.cpp0000644000175000017500000000626111745620415022412 0ustar frankiefrankie/** * \file localcartesianreverse.cpp * \brief Matlab mex file for UTM/UPS to geographic conversions * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic localcartesianreverse.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic localcartesianreverse.cpp // $Id: 10fe61f546a91a36af5ce60d35bc9e13df21c769 $ #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 2) mexErrMsgTxt("Two input arguments required."); else if (nrhs > 4) mexErrMsgTxt("More than four input arguments specified."); else if (nrhs == 3) mexErrMsgTxt("Must specify flattening with the major radius."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("origin is not of type double."); if (!( mxGetM(prhs[0]) == 1 && (mxGetN(prhs[0]) == 2 || mxGetN(prhs[0]) == 3) )) mexErrMsgTxt("origin be 1 x 3 or 1 x 2 matrix."); double* origin = mxGetPr(prhs[0]); double lat0 = origin[0], lon0 = origin[1], h0 = mxGetN(prhs[0]) == 3 ? origin[2] : 0; if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) )) mexErrMsgTxt("local cartesian coordinates are not of type double."); if (mxGetN(prhs[1]) != 3) mexErrMsgTxt("local cartesian coordinates must be M x 3 matrix."); double a = Constants::WGS84_a(), f = Constants::WGS84_f(); if (nrhs == 4) { if (!( mxIsDouble(prhs[2]) && !mxIsComplex(prhs[2]) && mxGetNumberOfElements(prhs[2]) == 1 )) mexErrMsgTxt("Major radius is not a real scalar."); a = mxGetScalar(prhs[2]); if (!( mxIsDouble(prhs[3]) && !mxIsComplex(prhs[3]) && mxGetNumberOfElements(prhs[3]) == 1 )) mexErrMsgTxt("Flattening is not a real scalar."); f = mxGetScalar(prhs[3]); } int m = mxGetM(prhs[1]); double* x = mxGetPr(prhs[1]); double* y = x + m; double* z = x + 2*m; plhs[0] = mxCreateDoubleMatrix(m, 3, mxREAL); double* lat = mxGetPr(plhs[0]); double* lon = lat + m; double* h = lat + 2*m; double* rot = NULL; bool rotp = nlhs == 2; if (rotp) { plhs[1] = mxCreateDoubleMatrix(m, 9, mxREAL); rot = mxGetPr(plhs[1]); } try { std::vector rotv(rotp ? 9 : 0); const Geocentric c(a, f); if (abs(lat0) > 90) throw GeographicErr("Invalid latitude"); if (lon0 < -180 || lon0 > 360) throw GeographicErr("Invalid longitude"); const LocalCartesian l(lat0, lon0, h0, c); for (int i = 0; i < m; ++i) { l.Reverse(x[i], y[i], z[i], lat[i], lon[i], h[i], rotv); if (rotp) { for (int k = 0; k < 9; ++k) rot[m * k + i] = rotv[k]; } } } catch (const std::exception& e) { mexErrMsgTxt(e.what()); } } geographiclib-1.21/matlab/geodesicline.cpp0000644000175000017500000000677711745620415020500 0ustar frankiefrankie/** * \file geodesicline.cpp * \brief Matlab mex file for geographic to UTM/UPS conversions * * Copyright (c) Charles Karney (2010, 2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic geodesicline.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic geodesicline.cpp // $Id: f9bab46d15d25940301b5b91f79ac9f610277f8c $ #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 4) mexErrMsgTxt("Four input arguments required."); else if (nrhs > 6) mexErrMsgTxt("More than three input arguments specified."); else if (nrhs == 5) mexErrMsgTxt("Must specify flattening with the major radius."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) && mxGetNumberOfElements(prhs[0]) == 1 )) mexErrMsgTxt("lat1 is not a real scalar."); double lat1 = mxGetScalar(prhs[0]); if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) && mxGetNumberOfElements(prhs[1]) == 1 )) mexErrMsgTxt("lon1 is not a real scalar."); double lon1 = mxGetScalar(prhs[1]); if (!( mxIsDouble(prhs[2]) && !mxIsComplex(prhs[2]) && mxGetNumberOfElements(prhs[2]) == 1 )) mexErrMsgTxt("azi1 is not a real scalar."); double azi1 = mxGetScalar(prhs[2]); if (!( mxIsDouble(prhs[3]) && !mxIsComplex(prhs[3]) )) mexErrMsgTxt("distances are not of type double."); if (mxGetN(prhs[3]) != 1) mexErrMsgTxt("distances must be M x 1 matrix."); double a = Constants::WGS84_a(), f = Constants::WGS84_f(); if (nrhs == 6) { if (!( mxIsDouble(prhs[4]) && !mxIsComplex(prhs[4]) && mxGetNumberOfElements(prhs[4]) == 1 )) mexErrMsgTxt("Major radius is not a real scalar."); a = mxGetScalar(prhs[4]); if (!( mxIsDouble(prhs[5]) && !mxIsComplex(prhs[5]) && mxGetNumberOfElements(prhs[5]) == 1 )) mexErrMsgTxt("Flattening is not a real scalar."); f = mxGetScalar(prhs[5]); } int m = mxGetM(prhs[3]); double* s12 = mxGetPr(prhs[3]); plhs[0] = mxCreateDoubleMatrix(m, 3, mxREAL); double* lat2 = mxGetPr(plhs[0]); double* lon2 = lat2 + m; double* azi2 = lat2 + 2*m; double* a12 = NULL; double* m12 = NULL; double* M12 = NULL; double* M21 = NULL; double* S12 = NULL; bool aux = nlhs == 2; if (aux) { plhs[1] = mxCreateDoubleMatrix(m, 5, mxREAL); a12 = mxGetPr(plhs[1]); m12 = a12 + m; M12 = a12 + 2*m; M21 = a12 + 3*m; S12 = a12 + 4*m; } try { const Geodesic g(a, f); if (abs(lat1) > 90) throw GeographicErr("Invalid latitude"); if (lon1 < -180 || lon1 > 360) throw GeographicErr("Invalid longitude"); if (azi1 < -180 || azi1 > 360) throw GeographicErr("Invalid azimuth"); const GeodesicLine l(g, lat1, lon1, azi1); for (int i = 0; i < m; ++i) if (aux) a12[i] = l.Position(s12[i], lat2[i], lon2[i], azi2[i], m12[i], M12[i], M21[i], S12[i]); else l.Position(s12[i], lat2[i], lon2[i], azi2[i]); } catch (const std::exception& e) { mexErrMsgTxt(e.what()); } } geographiclib-1.21/matlab/mgrsforward.cpp0000644000175000017500000000461211745620415020365 0ustar frankiefrankie/** * \file mgrsforward.cpp * \brief Matlab mex file for UTM/UPS to MGRS conversions * * Copyright (c) Charles Karney (2010) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic mgrsforward.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic mgrsforward.cpp // $Id: 30421c0aa01eeec69a89f3332dfba997451204e9 $ #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 1) mexErrMsgTxt("One input argument required."); else if (nrhs > 2) mexErrMsgTxt("More than two input arguments specified."); else if (nlhs > 1) mexErrMsgTxt("Only one output argument can be specified."); if (!mxIsDouble(prhs[0])) mexErrMsgTxt("utmups coordinates are not of type double."); if (mxGetN(prhs[0]) != 4) mexErrMsgTxt("utmups coordinates must be M x 4 matrix."); int prec; if (nrhs == 1) prec = 5; else { if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) && mxGetNumberOfElements(prhs[1]) == 1 )) mexErrMsgTxt("Precision is not an integer."); double rprec = mxGetScalar(prhs[1]); prec = int(rprec); if (double(prec) != rprec) mexErrMsgTxt("Precision is not an integer."); if (prec < 0 || prec > 11) mexErrMsgTxt("Precision outside the legal range [0, 11]."); } int m = mxGetM(prhs[0]); double* x = mxGetPr(prhs[0]); double* y = x + m; double* zone = x + 2*m; double* hemi = x + 3*m; string mgrsstr; plhs[0] = mxCreateCellArray(1, &m); mxArray* mgrs = plhs[0]; for (int i = 0; i < m; ++i) { try { mgrsstr = "INVALID"; int ZONE = int(zone[i]); if (double(ZONE) != zone[i]) throw GeographicErr("Zone is not an integer"); bool HEMI = (hemi[i] != 0); if (HEMI && (hemi[i] != 1)) throw GeographicErr("Hemisphere is not 0 or 1"); MGRS::Forward(ZONE, HEMI, x[i], y[i], prec, mgrsstr); } catch (const std::exception& e) { mexWarnMsgTxt(e.what()); } mxSetCell(mgrs, i, mxCreateString(mgrsstr.c_str())); } } geographiclib-1.21/matlab/geodesicdirect.cpp0000644000175000017500000000621011745620415021001 0ustar frankiefrankie/** * \file geodesicdirect.cpp * \brief Matlab mex file for geographic to UTM/UPS conversions * * Copyright (c) Charles Karney (2010, 2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic geodesicdirect.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic geodesicdirect.cpp // $Id: 8865cbe511d3dd56c0eed73e62ec32d5b5d35f99 $ #include #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 1) mexErrMsgTxt("One input argument required."); else if (nrhs > 3) mexErrMsgTxt("More than three input arguments specified."); else if (nrhs == 2) mexErrMsgTxt("Must specify flattening with the major radius."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("geodesic coordinates are not of type double."); if (mxGetN(prhs[0]) != 4) mexErrMsgTxt("geodesic coordinates must be M x 4 matrix."); double a = Constants::WGS84_a(), f = Constants::WGS84_f(); if (nrhs == 3) { if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) && mxGetNumberOfElements(prhs[1]) == 1 )) mexErrMsgTxt("Major radius is not a real scalar."); a = mxGetScalar(prhs[1]); if (!( mxIsDouble(prhs[2]) && !mxIsComplex(prhs[2]) && mxGetNumberOfElements(prhs[2]) == 1 )) mexErrMsgTxt("Flattening is not a real scalar."); f = mxGetScalar(prhs[2]); } int m = mxGetM(prhs[0]); double* lat1 = mxGetPr(prhs[0]); double* lon1 = lat1 + m; double* azi1 = lat1 + 2*m; double* s12 = lat1 + 3*m; plhs[0] = mxCreateDoubleMatrix(m, 3, mxREAL); double* lat2 = mxGetPr(plhs[0]); std::fill(lat2, lat2 + 3*m, Math::NaN()); double* lon2 = lat2 + m; double* azi2 = lat2 + 2*m; double* a12 = NULL; double* m12 = NULL; double* M12 = NULL; double* M21 = NULL; double* S12 = NULL; bool aux = nlhs == 2; if (aux) { plhs[1] = mxCreateDoubleMatrix(m, 5, mxREAL); a12 = mxGetPr(plhs[1]); std::fill(a12, a12 + 5*m, Math::NaN()); m12 = a12 + m; M12 = a12 + 2*m; M21 = a12 + 3*m; S12 = a12 + 4*m; } try { const Geodesic g(a, f); for (int i = 0; i < m; ++i) { if (!(abs(lat1[i]) > 90) && !(lon1[i] < -180 || lon1[i] > 360) && !(azi1[i] < -180 || azi1[i] > 360)) { if (aux) a12[i] = g.Direct(lat1[i], lon1[i], azi1[i], s12[i], lat2[i], lon2[i], azi2[i], m12[i], M12[i], M21[i], S12[i]); else g.Direct(lat1[i], lon1[i], azi1[i], s12[i], lat2[i], lon2[i], azi2[i]); } } } catch (const std::exception& e) { mexErrMsgTxt(e.what()); } } geographiclib-1.21/matlab/geographiclibinterface.m0000644000175000017500000000556111745620415022166 0ustar frankiefrankiefunction geographiclibinterface(incdir, libdir); % geographiclibinterface Use mex to compile interface to GeographicLib % % geographiclibinterface % geographiclibinterface(INSTALLDIR) % geographiclibinterface(INCDIR, LIBDIR) % % With one argument the library is looked for in INSTALLDIR/lib and the % include files in INSTALLDIR/include. % % With no arguments, INSTALLDIR is taked to be '/usr/local', on Unix and % Linux systems, and 'C:/Program Files/GeographicLib', on Windows systems % % With two arguments, the library is looked for in LIBDIR and the include % files in INCDIR. % % This has been tested with % % Octave 3.2.3 and g++ 4.4.4 under Linux % Matlab 2007a and Visual Studio 2005 under Windows % Matlab 2008a and Visual Studio 2005 under Windows % Matlab 2008a and Visual Studio 2008 under Windows (*) % Matlab 2010b and Visual Studio 2005 under Windows % Matlab 2010b and Visual Studio 2008 under Windows (*) % Matlab 2010b and Visual Studio 2010 under Windows % % (*) Note that geoidheight compiled with Visual Studio 2008 causes Matlab % to CRASH. The crash happens on the second call. % % Run 'mex -setup' to configure the C++ compiler for Matlab to use. % % Copyright (c) Charles Karney (2010, 2011) and licensed % under the MIT/X11 License. For more information, see % http://geographiclib.sf.net/html/other.html#matlab % % $Id: b277d1bf94adefbdb95fba08d5db4cc128b72e48 $ funs = {'geodesicdirect', 'geodesicinverse', 'geodesicline', ... 'geoidheight', ... 'utmupsforward', 'utmupsreverse', ... 'mgrsforward', 'mgrsreverse', ... 'geocentricforward', 'geocentricreverse', ... 'localcartesianforward', 'localcartesianreverse', ... 'polygonarea'}; lib='Geographic'; if (ispc && ... strcmp(mex.getCompilerConfigurations().Manufacturer, 'Microsoft') && ... strcmp(mex.getCompilerConfigurations().Version, '9.0')) warning(['geoidheight compiled with Visual Studio 2008 ',... 'causes Matlab to CRASH']); end if (nargin < 2) if (nargin == 0) if ispc, installdir = 'C:/Program Files/GeographicLib'; else installdir = '/usr/local'; end else installdir = incdir; end incdir=[installdir '/include']; libdir=[installdir '/lib']; end testheader = [incdir '/GeographicLib/Constants.hpp']; if (~ exist(testheader, 'file')) error(['Cannot find ' testheader]); end fprintf('Compiling Matlab interface to GeographicLib\n'); fprintf('Include directory: %s\nLibrary directory: %s\n', incdir, libdir); for i=1:size(funs,2), fprintf('Compiling %s...', funs{i}); if ispc, mex( ['-I' incdir], ['-L' libdir], ['-l' lib], [funs{i} '.cpp'] ); else mex( ['-I' incdir], ['-L' libdir], ['-l' lib], ['-Wl,-rpath=' libdir], ... [funs{i} '.cpp'] ); end fprintf(' done.\n'); end end geographiclib-1.21/matlab/localcartesianreverse.m0000644000175000017500000000344011745620415022060 0ustar frankiefrankiefunction [geodetic, rot] = localcartesianreverse(origin, cartesian, a, f) %localcartesianreverse Convert local cartesian coordinates to geographic % % [geodetic, rot] = localcartesianreverse(origin, cartesian) % [geodetic, rot] = localcartesianreverse(origin, cartesian, a, f) % % origin is a 1 x 3 or 1 x 2 matrix % lat0 = origin(1,1) in degrees % lon0 = origin(1,2) in degrees % h0 = origin(1,3) in meters (default 0 m) % cartesian is an M x 3 matrix of local cartesian coordinates % x = cartesian(:,1) in meters % y = cartesian(:,2) in meters % z = cartesian(:,3) in meters % % geodetic is an M x 3 matrix of geodetic coordinates % lat = geodetic(:,1) in degrees % lon = geodetic(:,2) in degrees % h = geodetic(:,3) in meters % rot is an M x 9 matrix % M = rot(:,1:9) rotation matrix in row major order. Pre-multiplying % a unit vector in local cartesian coordinates at (lat0, lon0, h0) % by the transpose of M transforms the vector to local cartesian % coordinates at (lat, lon, h). % % a = major radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % This is an interface to the GeographicLib C++ routine % LocalCartesian::Reverse % See the documentation on this function for more information: % http://geographiclib.sf.net/html/classGeographicLib_1_1LocalCartesian.html error('Error: executing .m file instead of compiled routine'); end % localcartesianreverse.m % Matlab .m file for local cartesian to geographic conversions % % Copyright (c) Charles Karney (2011) and % licensed under the MIT/X11 License. For more information, see % http://geographiclib.sourceforge.net/ % % $Id: d125a552e78aaec23ab0069c078301fa3e66569f $ geographiclib-1.21/matlab/Makefile.am0000644000175000017500000000245111745620415017357 0ustar frankiefrankie# # Makefile.am # # Copyright (C) 2011, Charles Karney # $Id: 472c249909687bc3d74ec316a8a7d06e778fd826 $ MATLAB_INTERFACE = \ $(srcdir)/geodesicdirect.cpp \ $(srcdir)/geodesicinverse.cpp \ $(srcdir)/geodesicline.cpp \ $(srcdir)/geoidheight.cpp \ $(srcdir)/mgrsforward.cpp \ $(srcdir)/mgrsreverse.cpp \ $(srcdir)/utmupsforward.cpp \ $(srcdir)/utmupsreverse.cpp \ $(srcdir)/geocentricforward.cpp \ $(srcdir)/geocentricreverse.cpp \ $(srcdir)/localcartesianforward.cpp \ $(srcdir)/localcartesianreverse.cpp \ $(srcdir)/polygonarea.cpp MATLAB_DOC = \ $(srcdir)/geodesicdirect.m \ $(srcdir)/geodesicinverse.m \ $(srcdir)/geodesicline.m \ $(srcdir)/geoidheight.m \ $(srcdir)/mgrsforward.m \ $(srcdir)/mgrsreverse.m \ $(srcdir)/utmupsforward.m \ $(srcdir)/utmupsreverse.m \ $(srcdir)/geocentricforward.m \ $(srcdir)/geocentricreverse.m \ $(srcdir)/localcartesianforward.m \ $(srcdir)/localcartesianreverse.m \ $(srcdir)/polygonarea.m MATLAB_COMPILESCRIPT = $(srcdir)/geographiclibinterface.m MATLAB_ALL = $(MATLAB_INTERFACE) $(MATLAB_DOC) $(MATLAB_COMPILESCRIPT) matlabdir=$(libexecdir)/GeographicLib/matlab install: $(INSTALL) -d $(DESTDIR)$(matlabdir) $(INSTALL) -m 644 $(MATLAB_ALL) $(DESTDIR)$(matlabdir) clean-local: rm -rf *.mex* *.oct EXTRA_DIST = Makefile.mk CMakeLists.txt $(MATLAB_ALL) geographiclib-1.21/matlab/Makefile.in0000644000175000017500000002573311745620415017400 0ustar frankiefrankie# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Makefile.am # # Copyright (C) 2011, Charles Karney # $Id: 472c249909687bc3d74ec316a8a7d06e778fd826 $ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = matlab DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POW_LIB = @POW_LIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MATLAB_INTERFACE = \ $(srcdir)/geodesicdirect.cpp \ $(srcdir)/geodesicinverse.cpp \ $(srcdir)/geodesicline.cpp \ $(srcdir)/geoidheight.cpp \ $(srcdir)/mgrsforward.cpp \ $(srcdir)/mgrsreverse.cpp \ $(srcdir)/utmupsforward.cpp \ $(srcdir)/utmupsreverse.cpp \ $(srcdir)/geocentricforward.cpp \ $(srcdir)/geocentricreverse.cpp \ $(srcdir)/localcartesianforward.cpp \ $(srcdir)/localcartesianreverse.cpp \ $(srcdir)/polygonarea.cpp MATLAB_DOC = \ $(srcdir)/geodesicdirect.m \ $(srcdir)/geodesicinverse.m \ $(srcdir)/geodesicline.m \ $(srcdir)/geoidheight.m \ $(srcdir)/mgrsforward.m \ $(srcdir)/mgrsreverse.m \ $(srcdir)/utmupsforward.m \ $(srcdir)/utmupsreverse.m \ $(srcdir)/geocentricforward.m \ $(srcdir)/geocentricreverse.m \ $(srcdir)/localcartesianforward.m \ $(srcdir)/localcartesianreverse.m \ $(srcdir)/polygonarea.m MATLAB_COMPILESCRIPT = $(srcdir)/geographiclibinterface.m MATLAB_ALL = $(MATLAB_INTERFACE) $(MATLAB_DOC) $(MATLAB_COMPILESCRIPT) matlabdir = $(libexecdir)/GeographicLib/matlab EXTRA_DIST = Makefile.mk CMakeLists.txt $(MATLAB_ALL) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu matlab/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu matlab/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ clean-local distclean distclean-generic distclean-libtool \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am install: $(INSTALL) -d $(DESTDIR)$(matlabdir) $(INSTALL) -m 644 $(MATLAB_ALL) $(DESTDIR)$(matlabdir) clean-local: rm -rf *.mex* *.oct # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: geographiclib-1.21/matlab/Makefile.mk0000644000175000017500000000120611745620415017366 0ustar frankiefrankie# $Id: 2e3bb10fb00f675941b80294bf69a64d97a1f29b $ FUNCTIONS = utmupsforward utmupsreverse mgrsforward mgrsreverse \ geodesicdirect geodesicinverse geodesicline \ geoidheight geocentricforward geocentricreverse \ localcartesianforward localcartesianreverse polygonarea MATLAB_COMPILESCRIPT = geographiclibinterface.m MATLABFILES = $(addsuffix .cpp,$(FUNCTIONS)) $(addsuffix .m,$(FUNCTIONS)) \ $(MATLAB_COMPILESCRIPT) DEST = $(PREFIX)/libexec/GeographicLib/matlab INSTALL = install -b all: @: install: test -d $(DEST) || mkdir -p $(DEST) $(INSTALL) -m 644 $(MATLABFILES) $(DEST)/ clean: rm -f *.mex* *.oct .PHONY: all install clean geographiclib-1.21/matlab/mgrsreverse.cpp0000644000175000017500000000423011745620415020370 0ustar frankiefrankie/** * \file mgrsreverse.cpp * \brief Matlab mex file for UTM/UPS to MGRS conversions * * Copyright (c) Charles Karney (2010) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic mgrsreverse.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic mgrsreverse.cpp // $Id: fea6af03d0363148520e514fd8374020871160b9 $ #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs != 1) mexErrMsgTxt("One input argument required."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!mxIsCell(prhs[0]) || mxGetN(prhs[0]) != 1) mexErrMsgTxt("mgrs coordinates should be in a M x 1 cell array."); int m = mxGetM(prhs[0]); plhs[0] = mxCreateDoubleMatrix(m, 4, mxREAL); double* x = mxGetPr(plhs[0]); double* y = x + m; double* zone = x + 2*m; double* hemi = x + 3*m; double* prec = NULL; bool precp = nlhs == 2; if (precp) { plhs[1] = mxCreateDoubleMatrix(m, 1, mxREAL); prec = mxGetPr(plhs[1]); } string mgrsstr; for (int i = 0; i < m; ++i) { try { mxArray* mgrs = mxGetCell(prhs[0], i); if (!mxIsChar(mgrs) || mxGetM(mgrs) != 1) throw GeographicErr("Cell element not a string"); int n = mxGetN(mgrs); mxChar* mgrschar = mxGetChars(mgrs); mgrsstr.resize(n); for (int k = 0; k < n; ++k) mgrsstr[k] = mgrschar[k]; int ZONE, PREC; bool HEMI; MGRS::Reverse(mgrsstr, ZONE, HEMI, x[i], y[i], PREC); zone[i] = ZONE; hemi[i] = HEMI ? 1 : 0; if (precp) prec[i] = PREC; } catch (const std::exception& e) { mexWarnMsgTxt(e.what()); x[i] = y[i] = Math::NaN(); zone[i] = UTMUPS::INVALID; hemi[i] = 0; if (precp) prec[i] = -1; } } } geographiclib-1.21/matlab/geocentricforward.m0000644000175000017500000000304311745620415021206 0ustar frankiefrankiefunction [geocentric, rot] = geocentricforward(geodetic, a, f) %geocentricforward Convert geographic coordinates to geocentric % % [geocentric, rot] = geocentricforward(geodetic) % [geocentric, rot] = geocentricforward(geodetic, a, f) % % geodetic is an M x 3 or M x 2 matrix of geodetic coordinates % lat = geodetic(:,1) in degrees % lon = geodetic(:,2) in degrees % h = geodetic(:,3) in meters (default 0 m) % % geocentric is an M x 3 matrix of geocentric coordinates % x = geocentric(:,1) in meters % y = geocentric(:,2) in meters % z = geocentric(:,3) in meters % rot is an M x 9 matrix % M = rot(:,1:9) rotation matrix in row major order. Pre-multiplying % a unit vector in local cartesian coordinates (east, north, up) % by M transforms the vector to geocentric coordinates. % % a = major radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % This is an interface to the GeographicLib C++ routine % Geocentric::Forward % See the documentation on this function for more information: % http://geographiclib.sf.net/html/classGeographicLib_1_1Geocentric.html error('Error: executing .m file instead of compiled routine'); end % geocentricforward.m % Matlab .m file for geographic to geocentric conversions % % Copyright (c) Charles Karney (2011) and licensed under % the MIT/X11 License. For more information, see % http://geographiclib.sourceforge.net/ % % $Id: 387cbf93121f049b4c2398c520072c86d6767fe7 $ geographiclib-1.21/matlab/geodesicdirect.m0000644000175000017500000000311711745620415020456 0ustar frankiefrankiefunction [latlong, aux] = geodesicdirect(geodesic, a, f) %geodesicdirect Solve direct geodesic problem % % [latlong, aux] = geodesicdirect(geodesic) % [latlong, aux] = geodesicdirect(geodesic, a, f) % % geodesic is an M x 4 matrix % latitude of point 1 = latlong(:,1) in degrees % longitude of point 1 = latlong(:,2) in degrees % azimuth at point 1 = latlong(:,3) in degrees % distance to point 2 = latlong(:,4) in meters % % latlong is an M x 3 matrix % latitude of point 2 = geodesic(:,1) in degrees % longitude of point 2 = geodesic(:,2) in degrees % azimuth at point 2 = geodesic(:,3) in degrees % aux is an M x 5 matrix % spherical arc length = aux(:,1) in degrees % reduced length = aux(:,2) in meters % geodesic scale 1 to 2 = aux(:,3) % geodesic scale 2 to 1 = aux(:,4) % area under geodesic = aux(:,5) in meters^2 % % a = major radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % This is an interface to the GeographicLib C++ routine % Geodesic::Direct % See the documentation on this function for more information: % http://geographiclib.sf.net/html/classGeographicLib_1_1Geodesic.html error('Error: executing .m file instead of compiled routine'); end % geodesicdirect.m % Matlab .m file for solving direct geodesic problem % % Copyright (c) Charles Karney (2010, 2011) and % licensed under the MIT/X11 License. For more information, see % http://geographiclib.sourceforge.net/ % % $Id: edeee2fe9d9c273cfa9d7512139223f70c464cc1 $ geographiclib-1.21/matlab/geodesicline.m0000644000175000017500000000343611745620415020137 0ustar frankiefrankiefunction [latlong, aux] = geodesicline(lat1, lon1, azi1, distances, a, f) %geodesicline Compute points along a geodesic % % [latlong, aux] = geodesicline(lat1, lon1, azi1, distances) % [latlong, aux] = geodesicline(lat1, lon1, azi1, distances, a, f) % % lat1 is the latitude of point 1 (scalar) in degrees % lon1 is the longitude of point 1 (scalar) in degrees % azi1 is the azimuth at point 1 (scalar) in degrees % distances is an M x 1 vector of distances to point 2 in meters % % latlong is an M x 3 matrix % latitude of point 2 = geodesic(:,1) in degrees % longitude of point 2 = geodesic(:,2) in degrees % azimuth at point 2 = geodesic(:,3) in degrees % aux is an M x 5 matrix % spherical arc length = aux(:,1) in degrees % reduced length = aux(:,2) in meters % geodesic scale 1 to 2 = aux(:,3) % geodesic scale 2 to 1 = aux(:,4) % area under geodesic = aux(:,5) in meters^2 % % a = major radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % The result is the same as produced by % geodesicdirect([repmat([lat1, lon1, azi1],size(distances)), ... % distances], a, f) % % This is an interface to the GeographicLib C++ routine % GeodesicLine::Position % See the documentation on this function for more information: % http://geographiclib.sf.net/html/classGeographicLib_1_1GeodesicLine.html error('Error: executing .m file instead of compiled routine'); end % geodesicline.m % Matlab .m file for computing points along a geodesic % % Copyright (c) Charles Karney (2010, 2011) and % licensed under the MIT/X11 License. For more information, see % http://geographiclib.sourceforge.net/ % % $Id: 49924160d0b03dc6e7c930fc43c9850808cc527f $ geographiclib-1.21/matlab/mgrsforward.m0000644000175000017500000000220211745620415020030 0ustar frankiefrankiefunction mgrs = mgrsforward(utmups, prec) %mgrsforward Convert UTM/UPS coordinates to MGRS % % mgrs = mgrsforward(utmups) % mgrs = mgrsforward(utmups, prec) % % utmups is an M x 4 matrix % easting = utmups(:,1) in meters % northing = utmups(:,2) in meters % zone = utmups(:,3) % hemi = utmups(:,4) % % zone = 0 for UPS, zone = [1,60] for UTM % hemi = 0 for southern hemisphere, hemi = 1 for northern hemisphere % prec = half the number of trailing digits in the MGRS string % (default 5) % % mgrs is a M x 1 cell array of MGRS strings. % % This is an interface to the GeographicLib C++ routine % MGRS::Forward % See the documentation on this function for more information: % http://geographiclib.sf.net/html/classGeographicLib_1_1MGRS.html error('Error: executing .m file instead of compiled routine'); end % mgrsforward.m % Matlab .m file for UTM/UPS to MGRS conversions % % Copyright (c) Charles Karney (2010, 2011) and % licensed under the MIT/X11 License. For more information, see % http://geographiclib.sourceforge.net/ % % $Id: 57f3730b6e64bd895c1644a69b90a39388a1f816 $ geographiclib-1.21/matlab/geodesicinverse.m0000644000175000017500000000314311745620415020656 0ustar frankiefrankiefunction [geodesic, aux] = geodesicinverse(latlong, a, f) %geodesicinverse Solve inverse geodesic problem % % [geodesic, aux] = geodesicinverse(latlong) % [geodesic, aux] = geodesicinverse(latlong, a, f) % % latlong is an M x 4 matrix % latitude of point 1 = latlong(:,1) in degrees % longitude of point 1 = latlong(:,2) in degrees % latitude of point 2 = latlong(:,3) in degrees % longitude of point 2 = latlong(:,4) in degrees % % geodesic is an M x 3 matrix % azimuth at point 1 = geodesic(:,1) in degrees % azimuth at point 2 = geodesic(:,2) in degrees % distance between points 1 and 2 = geodesic(:,3) in meters % aux is an M x 5 matrix % spherical arc length = aux(:,1) in degrees % reduced length = aux(:,2) in meters % geodesic scale 1 to 2 = aux(:,3) % geodesic scale 2 to 1 = aux(:,4) % area under geodesic = aux(:,5) in meters^2 % % a = major radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % This is an interface to the GeographicLib C++ routine % Geodesic::Inverse % See the documentation on this function for more information: % http://geographiclib.sf.net/html/classGeographicLib_1_1Geodesic.html error('Error: executing .m file instead of compiled routine'); end % geodesicinverse.m % Matlab .m file for solving inverse geodesic problem % % Copyright (c) Charles Karney (2010, 2011) and % licensed under the MIT/X11 License. For more information, see % http://geographiclib.sourceforge.net/ % % $Id: 44fec214f6813db5c4fb8a24cfede46d2586309d $ geographiclib-1.21/matlab/geocentricreverse.m0000644000175000017500000000305211745620415021215 0ustar frankiefrankiefunction [geodetic, rot] = geocentricreverse(geocentric, a, f) %geocentricreverse Convert geocentric coordinates to geographic % % [geodetic, rot] = geocentricreverse(geocentric) % [geodetic, rot] = geocentricreverse(geocentric, a, f) % % geocentric is an M x 3 matrix of geocentric coordinates % x = geocentric(:,1) in meters % y = geocentric(:,2) in meters % z = geocentric(:,3) in meters % % geodetic is an M x 3 matrix of geodetic coordinates % lat = geodetic(:,1) in degrees % lon = geodetic(:,2) in degrees % h = geodetic(:,3) in meters % rot is an M x 9 matrix % M = rot(:,1:9) rotation matrix in row major order. Pre-multiplying % a unit vector in geocentric coordinates by the transpose of M % transforms the vector to local cartesian coordinates % (east, north, up). % % a = major radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % This is an interface to the GeographicLib C++ routine % Geocentric::Reverse % See the documentation on this function for more information: % http://geographiclib.sf.net/html/classGeographicLib_1_1Geocentric.html error('Error: executing .m file instead of compiled routine'); end % geocentricreverse.m % Matlab .m file for geocentric to geographic conversions % % Copyright (c) Charles Karney (2011) and % licensed under the MIT/X11 License. For more information, see % http://geographiclib.sourceforge.net/ % % $Id: f43cd7eb9b7d5d48f4de6b30d2d7c9c5b0742583 $ geographiclib-1.21/maxima/0002755000175000017500000000000011757437426015352 5ustar frankiefrankiegeographiclib-1.21/maxima/geod.mac0000644000175000017500000004335011745620415016742 0ustar frankiefrankie/* Compute the series expansions for the spheroidal geodesic problem. Written by Charles Karney http://geographiclib.sourceforge.net/ $Id: 35d5f547992b5bd4e6a53ef7060f6fbfc23b2e25 $ References: Charles F. F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011. preprint http://arxiv.org/abs/1102.1215 resource page http://geographiclib.sf.net/geod.html Charles F. F. Karney, Algorithms for geodesics, Sept. 2011. preprint http://arxiv.org/abs/1109.4448 There are 4 sections in this file (1) Functions to compute the expansions (2) Functions to print C++ code (3) Functions to display the results (4) Calls to the above. Edit the section at the end, to modify what is done. As distributed this code computes the 8th order series. This takes less that 10 secs. To run the code, start Maxima and enter load("geod.mac")$ */ /* EXPANSIONS FOR INTEGRALS */ taylordepth:5$ ataylor(expr,var,ord):=expand(ratdisrep(taylor(expr,var,0,ord)))$ jtaylor(expr,var1,var2,ord):=expand(subst([zz=1], ratdisrep(taylor(subst([var1=zz*var1,var2=zz*var2],expr),zz,0,ord))))$ /* Express I1 = integrate( sqrt(1+k2*sin(sigma1)^2), sigma1, 0, sigma ) as a series A1 * ( sigma + sum(C1[l] * sin(2*l*sigma), l, 1, maxpow) ) valid for k2 small. It is convenient to write k2 = 4 * eps / (1 - eps)^2 and to expand (1 - eps) * I1 retaining terms up to order eps^maxpow in A1 and C1[l]. This leads to a series where half the terms drop out. */ computeI1(maxpow):=block([sintegrand,sintegrandexp,s,sigma,tau1,k2,eps], sintegrand:sqrt(1+k2*sin(sigma)^2), /* Multiplicative factor 1/(1-eps) */ sintegrandexp:ataylor( (1-eps)*subst([k2=4*eps/(1-eps)^2],sintegrand), eps,maxpow), s:trigreduce(integrate(sintegrandexp,sigma)), s:s-subst(sigma=0,s), A1:expand(subst(sigma=2*%pi,s)/(2*%pi)), tau1:ataylor(s/A1,eps,maxpow), for i:1 thru maxpow do C1[i]:coeff(tau1,sin(2*i*sigma)), if expand(tau1-sigma-sum(C1[i]*sin(2*i*sigma),i,1,maxpow)) # 0 then error("left over terms in B1"), A1:A1/(1-eps), 'done)$ /* Write tau1 = sigma + sum(C1[l] * sin(2*l*sigma), l, 1, maxpow) and revert this to obtain sigma = tau1 + sum(C1p[l] * sin(2*tau1), l, 1, maxpow) retaining terms up to order eps^maxpow in tp[l]. Write tau = sigma + B1(sigma) sigma = tau + B1p(tau) B1(sigma) = sum(C1[l] * sin(2*l*sigma), l, 1, inf) B1p(tau) = sum(C1p[l] * sin(2*tau), l, 1, inf) Then the Lagrange Inversion Theorem J. L. Lagrange, Nouvelle methode pour resoudre les equations litterales par le moyen des series, Mem. de l'Acad. Roy. des Sciences de Berlin 24, 251-326 (1768, publ. 1770), Sec. 16, http://books.google.com/books?id=YywPAAAAIAAJ&pg=PA25 gives B1p(tau) = sum( (-1)^n/n! * diff( B1(tau)^n, tau, n-1 ), n, 1, inf) Call this after computeI1(maxpow)$ */ revertI1(maxpow):=block([tau,eps,tauacc:1,sigacc:0], for n:1 thru maxpow do ( tauacc:trigreduce(ataylor( -sum(C1[j]*sin(2*j*tau),j,1,maxpow-n+1)*tauacc/n, eps,maxpow)), sigacc:sigacc+expand(diff(tauacc,tau,n-1))), for i:1 thru maxpow do C1p[i]:coeff(sigacc,sin(2*i*tau)), if expand(sigacc-sum(C1p[i]*sin(2*i*tau),i,1,maxpow)) # 0 then error("left over terms in B1p"), 'done)$ /* Express I2 = integrate( 1/sqrt(1+k2*sin(sigma1)^2), sigma1, 0, sigma ) as a series A2 * ( sigma + sum(C2[l] * sin(2*l*sigma), l, 1, maxpow) ) valid for k2 small. It is convenient to write k2 = 4 * eps / (1 - eps)^2 and to expand 1/(1 - eps) * I2 retaining terms up to order eps^maxpow in A2 and C2[l]. This leads to a series where half the terms drop out. */ computeI2(maxpow):=block([sintegrand,sintegrandexp,s,sigma,tau1,k2,eps], sintegrand:1/sqrt(1+k2*sin(sigma)^2), /* Multiplicative factor (1-eps) */ sintegrandexp:ataylor( 1/(1-eps)*subst([k2=4*eps/(1-eps)^2],sintegrand), eps,maxpow), s:trigreduce(integrate(sintegrandexp,sigma)), s:s-subst(sigma=0,s), A2:expand(subst(sigma=2*%pi,s)/(2*%pi)), tau1:ataylor(s/A2,eps,maxpow), for i:1 thru maxpow do C2[i]:coeff(tau1,sin(2*i*sigma)), if expand(tau1-sigma-sum(C2[i]*sin(2*i*sigma),i,1,maxpow)) # 0 then error("left over terms in B2"), A2:A2*(1-eps), 'done)$ /* Express I3 = integrate( (2-f)/(1+(1-f)*sqrt(1+k2*sin(sigma1)^2)), sigma1, 0, sigma ) as a series A3 * ( sigma + sum(C3[l] * sin(2*l*sigma), l, 1, maxpow-1) ) valid for f and k2 small. It is convenient to write k2 = 4 * eps / (1 - eps)^2 and f = 2*n/(1+n) and expand in eps and n. This procedure leads to a series where the coefficients of eps^j are terminating series in n. */ computeI3(maxpow):=block([int,intexp,dlam,eta,del,eps,nu,f,z,n], maxpow:maxpow-1, int:subst([k2=4*eps/(1-eps)^2], (2-f)/(1+(1-f)*sqrt(1+k2*sin(sigma)^2))), int:subst([f=2*n/(1+n)],int), intexp:jtaylor(int,n,eps,maxpow), dlam:trigreduce(integrate(intexp,sigma)), dlam:dlam-subst(sigma=0,dlam), A3:expand(subst(sigma=2*%pi,dlam)/(2*%pi)), eta:jtaylor(dlam/A3,n,eps,maxpow), A3:jtaylor(A3,n,eps,maxpow), for i:1 thru maxpow do C3[i]:coeff(eta,sin(2*i*sigma)), if expand(eta-sigma-sum(C3[i]*sin(2*i*sigma),i,1,maxpow)) # 0 then error("left over terms in B3"), 'done)$ /* Express I4 = -integrate( (t(ep2) - t(k2*sin(sigma1)^2)) / (ep2 - k2*sin(sigma1)^2) * sin(sigma1)/2, sigma1, pi/2, sigma ) where t(x) = sqrt(1+1/x)*asinh(sqrt(x)) + x as a series sum(C4[l] * cos((2*l+1)*sigma), l, 0, maxpow-1) ) valid for ep2 and k2 small. */ computeI4(maxpow):=block([int,t,intexp,area, x,ep2,k2], maxpow:maxpow-1, t : sqrt(1+1/x) * asinh(sqrt(x)) + x, int:-(tf(ep2) - tf(k2*sin(sigma)^2)) / (ep2 - k2*sin(sigma)^2) * sin(sigma)/2, int:subst([tf(ep2)=subst([x=ep2],t), tf(k2*sin(sigma)^2)=subst([x=k2*sin(sigma)^2],t)], int), int:subst([abs(sin(sigma))=sin(sigma)],int), intexp:jtaylor(int,ep2,k2,maxpow), area:trigreduce(integrate(intexp,sigma)), area:expand(area-subst(sigma=%pi/2,area)), for i:0 thru maxpow do C4[i]:coeff(area,cos((2*i+1)*sigma)), if expand(area-sum(C4[i]*cos((2*i+1)*sigma),i,0,maxpow)) # 0 then error("left over terms in I4"), 'done)$ /* Call all of the above */ computeall():=( computeI1(maxpow), revertI1(maxpow), computeI2(maxpow), computeI3(maxpow), computeI4(maxpow))$ /* FORMAT FOR C++ */ /* If nA1, nC1, nC1p, nA2, nA3, nC3 are compile-time constants indicating the required order, the compiler will include only the needed code. STATIC_ASSERT is a macro to cause a compile-time error if the assertion is false. */ codeA1(maxpow):=block([tab2:" ",tab3:" "], print(" // The scale factor A1-1 = mean value of I1-1 Math::real Geodesic::A1m1f(real eps) throw() { real eps2 = sq(eps), t; switch (nA1/2) {"), for n:0 thru entier(maxpow/2) do block([ q:horner(ataylor(subst([eps=sqrt(eps2)],A1*(1-eps)-1),eps2,n)), linel:600], print(concat(tab2,"case ",string(n),":")), print(concat(tab3,"t = ",string(q),";")), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"STATIC_ASSERT(nA1 >= ",string(0), " && nA1 <= ",string(maxpow),", \"Bad value of nA1\");")), print(concat(tab3,"t = 0;")), print(" } return (t + eps) / (1 - eps); }"), 'done)$ codeC1(maxpow):=block([tab2:" ",tab3:" "], print(" // The coefficients C1[l] in the Fourier expansion of B1 void Geodesic::C1f(real eps, real c[]) throw() { real eps2 = sq(eps), d = eps; switch (nC1) {"), for n:0 thru maxpow do ( print(concat(tab2,"case ",string(n),":")), for m:1 thru n do block([q:d*horner( subst([eps=sqrt(eps2)],ataylor(C1[m],eps,n)/eps^m)), linel:600], if m>1 then print(concat(tab3,"d *= eps;")), print(concat(tab3,"c[",string(m),"] = ",string(q),";"))), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"STATIC_ASSERT(nC1 >= ",string(0), " && nC1 <= ",string(maxpow),", \"Bad value of nC1\");")), print(" } }"), 'done)$ codeC1p(maxpow):=block([tab2:" ",tab3:" "], print(" // The coefficients C1p[l] in the Fourier expansion of B1p void Geodesic::C1pf(real eps, real c[]) throw() { real eps2 = sq(eps), d = eps; switch (nC1p) {"), for n:0 thru maxpow do ( print(concat(tab2,"case ",string(n),":")), for m:1 thru n do block([q:d*horner( subst([eps=sqrt(eps2)],ataylor(C1p[m],eps,n)/eps^m)), linel:600], if m>1 then print(concat(tab3,"d *= eps;")), print(concat(tab3,"c[",string(m),"] = ",string(q),";"))), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"STATIC_ASSERT(nC1p >= ",string(0), " && nC1p <= ",string(maxpow),", \"Bad value of nC1p\");")), print(" } }"), 'done)$ codeA2(maxpow):=block([tab2:" ",tab3:" "], print(" // The scale factor A2-1 = mean value of I2-1 Math::real Geodesic::A2m1f(real eps) throw() { real eps2 = sq(eps), t; switch (nA2/2) {"), for n:0 thru entier(maxpow/2) do block([ q:horner(ataylor(subst([eps=sqrt(eps2)],A2/(1-eps)-1),eps2,n)), linel:600], print(concat(tab2,"case ",string(n),":")), print(concat(tab3,"t = ",string(q),";")), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"STATIC_ASSERT(nA2 >= ",string(0), " && nA2 <= ",string(maxpow),", \"Bad value of nA2\");")), print(concat(tab3,"t = 0;")), print(" } return t * (1 - eps) - eps; }"), 'done)$ codeC2(maxpow):=block([tab2:" ",tab3:" "], print(" // The coefficients C2[l] in the Fourier expansion of B2 void Geodesic::C2f(real eps, real c[]) throw() { real eps2 = sq(eps), d = eps; switch (nC2) {"), for n:0 thru maxpow do ( print(concat(tab2,"case ",string(n),":")), for m:1 thru n do block([q:d*horner( subst([eps=sqrt(eps2)],ataylor(C2[m],eps,n)/eps^m)), linel:600], if m>1 then print(concat(tab3,"d *= eps;")), print(concat(tab3,"c[",string(m),"] = ",string(q),";"))), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"STATIC_ASSERT(nC2 >= ",string(0), " && nC2 <= ",string(maxpow),", \"Bad value of nC2\");")), print(" } }"), 'done)$ codeA3(maxpow):=block([tab2:" ",tab3:" "], print(" // The scale factor A3 = mean value of I3 void Geodesic::A3coeff() throw() { switch (nA3) {"), for nn:0 thru maxpow do block( [q:if nn=0 then 0 else jtaylor(subst([n=_n],A3),_n,eps,nn-1), linel:600], print(concat(tab2,"case ",string(nn),":")), for i : 0 thru nn-1 do print(concat(tab3,"_A3x[",i,"] = ", string(horner(coeff(q,eps,i))),";")), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"STATIC_ASSERT(nA3 >= ",string(0), " && nA3 <= ",string(maxpow),", \"Bad value of nA3\");")), print(" } }"), 'done)$ codeC3(maxpow):=block([tab2:" ",tab3:" "], print(" // The coefficients C3[l] in the Fourier expansion of B3 void Geodesic::C3coeff() throw() { switch (nC3) {"), for nn:0 thru maxpow do block([c], print(concat(tab2,"case ",string(nn),":")), c:0, for m:1 thru nn-1 do block( [q:if nn = 0 then 0 else jtaylor(subst([n=_n],C3[m]),_n,eps,nn-1), linel:600], for j:m thru nn-1 do ( print(concat(tab3,"_C3x[",c,"] = ", string(horner(coeff(q,eps,j))),";")), c:c+1) ), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"STATIC_ASSERT(nC3 >= ",string(0), " && nC3 <= ",string(maxpow),", \"Bad value of nC3\");")), print(" } }"), 'done)$ codeC4(maxpow):=block([tab2:" ",tab3:" "], print(" // The coefficients C4[l] in the Fourier expansion of I4 void Geodesic::C4coeff() throw() { switch (nC4) {"), for nn:0 thru maxpow do block([c], print(concat(tab2,"case ",string(nn),":")), c:0, for m:0 thru nn-1 do block( [q:jtaylor(subst([ep2=_ep2],C4[m]),_ep2,k2,nn-1), linel:600], for j:m thru nn-1 do ( print(concat(tab3,"_C4x[",c,"] = ", string(horner(coeff(q,k2,j))),";")), c:c+1) ), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"STATIC_ASSERT(nC3 >= ",string(0), " && nC4 <= ",string(maxpow),", \"Bad value of nC4\");")), print(" } }"), 'done)$ printcode():=( print(""), print(concat(" // Generated by Maxima on ",timedate())), print(""), codeA1(maxpow), print(""), codeC1(maxpow), print(""), codeC1p(maxpow), print(""), codeA2(maxpow), print(""), codeC2(maxpow), print(""), codeA3(maxpow), print(""), codeC3(maxpow), print(""), codeC4(maxpow))$ /* FORMAT FOR DISPLAY */ dispA1(ord):=block( [tt:ataylor(A1*(1-eps),eps,ord),ttt,linel:600], for j:2 step 2 thru ord do (ttt:coeff(tt,eps,j), print(concat(if j = 2 then "A1 = (1 " else " ", if ttt>0 then "+ " else "- ", string(abs(ttt)), " * ", string(eps^j), if j=ord or j = ord-1 then ") / (1 - eps);" else ""))))$ dispC1(ord):=for i:1 thru ord do block([tt:ataylor(C1[i],eps,ord),ttt,linel:600], print(), for j:i step 2 thru ord do (ttt:coeff(tt,eps,j), print(concat( if j = i then concat("C1[",string(i),"] = ") else " ", if ttt>0 then "+ " else "- ", string(abs(ttt)), " * ", string(eps^j), if j=ord or j=ord-1 then ";" else ""))))$ dispC1p(ord):=for i:1 thru ord do block([tt:ataylor(C1p[i],eps,ord),ttt,linel:600], print(), for j:i step 2 thru ord do (ttt:coeff(tt,eps,j), print(concat( if j = i then concat("C1p[",string(i),"] = ") else " ", if ttt>0 then "+ " else "- ", string(abs(ttt)), " * ", string(eps^j), if j=ord or j=ord-1 then ";" else ""))))$ dispA2(ord):=block( [tt:ataylor(A2/(1-eps),eps,ord),ttt,linel:600], for j:2 step 2 thru ord do (ttt:coeff(tt,eps,j), print(concat(if j = 2 then "A2 = (1 " else " ", if ttt>0 then "+ " else "- ", string(abs(ttt)), " * ", string(eps^j), if j=ord or j = ord-1 then ") * (1 - eps);" else ""))))$ dispC2(ord):=for i:1 thru ord do block([tt:ataylor(C2[i],eps,ord),ttt,linel:600], print(), for j:i step 2 thru ord do (ttt:coeff(tt,eps,j), print(concat( if j = i then concat("C2[",string(i),"] = ") else " ", if ttt>0 then "+ " else "- ", string(abs(ttt)), " * ", string(eps^j), if j=ord or j=ord-1 then ";" else ""))))$ dispA3(ord):=(ord:ord-1,block( [tt:jtaylor(A3,n,eps,ord),ttt,t4,linel:600,s], for j:1 thru ord do (ttt:expand(coeff(tt,eps,j)), if ttt # 0 then block([a:taylor(ttt+n^(ord+1),n,0,ord+1),paren,s], paren : is(length(a) > 2), s:if j=1 then "A3 = 1" else " ", if subst([n=1],part(a,1)) > 0 then s:concat(s," + ") else (s:concat(s," - "), a:-a), if paren then s:concat(s,"("), for k:1 thru length(a)-1 do block([term:part(a,k),nn], nn:subst([n=1],term), term:term/nn, if nn > 0 and k > 1 then s:concat(s," + ") else if nn < 0 then (s:concat(s," - "), nn:-nn), if lopow(term,n) = 0 then s:concat(s,string(nn)) else ( if nn # 1 then s:concat(s,string(nn)," * "), s:concat(s,string(term)) )), if paren then s:concat(s,")"), s:concat(s," * ", string(eps^j)), print(concat(s,if j = ord then ";" else ""))))))$ dispC3(ord):=(ord:ord-1,for i:1 thru ord do block([tt:jtaylor(C3[i],eps,n,ord), ttt,t4,linel:600], for j:i thru ord do ( ttt:coeff(tt,eps,j), if ttt # 0 then block([a:taylor(ttt+n^(ord+1),n,0,ord+1),paren,s], paren : is(length(a) > 2), s:if j = i then concat("C3[",i,"] = ") else " ", if subst([n=1],part(a,1)) > 0 then s:concat(s,"+ ") else (s:concat(s,"- "), a:-a), if paren then s:concat(s,"("), for k:1 thru length(a)-1 do block([term:part(a,k),nn], nn:subst([n=1],term), term:term/nn, if nn > 0 and k > 1 then s:concat(s," + ") else if nn < 0 then (s:concat(s," - "), nn:-nn), if lopow(term,n) = 0 then s:concat(s,string(nn)) else ( if nn # 1 then s:concat(s,string(nn)," * "), s:concat(s,string(term)) )), if paren then s:concat(s,")"), s:concat(s," * ", string(eps^j)), print(concat(s,if j = ord then ";" else ""))))))$ dispC4(ord):=(ord:ord-1,for i:0 thru ord do block([tt:jtaylor(C4[i],ep2,k2,ord), ttt,t4,linel:600], tt:expand(subst([z=1],tt)), for j:i thru ord do ( ttt:coeff(tt,k2,j), if ttt # 0 then block([a:taylor(ttt+ep2^(ord+1),ep2,0,ord+1),paren,s], paren : is(length(a) > 2), s:if j = i then concat("C4[",i,"] = ") else " ", if subst([ep2=1],part(a,1)) > 0 then s:concat(s,"+ ") else (s:concat(s,"- "), a:-a), if paren then s:concat(s,"("), for k:1 thru length(a)-1 do block([term:part(a,k),nn], nn:subst([ep2=1],term), term:term/nn, if nn > 0 and k > 1 then s:concat(s," + ") else if nn < 0 then (s:concat(s," - "), nn:-nn), if lopow(term,ep2) = 0 then s:concat(s,string(nn)) else ( if nn # 1 then s:concat(s,string(nn)," * "), s:concat(s,string(term)) )), if paren then s:concat(s,")"), if j>0 then s:concat(s," * ", string(k2^j)), print(concat(s,if j = ord then ";" else ""))))))$ dispseries():=( print(""), print(concat("// Generated by Maxima on ",timedate())), print(""), dispA1(maxpow), print(""), dispC1(maxpow), print(""), dispC1p(maxpow), print(""), dispA2(maxpow), print(""), dispC2(maxpow), print(""), dispA3(maxpow), print(""), dispC3(maxpow), print(""), dispC4(maxpow), print(""))$ /* CALL THE FUNCTIONS */ /* Timings for computeall(n) n time(s) 8 4 10 8 12 16 20 128 30 771 (13m) */ maxpow:8$ computeall()$ printcode()$ dispseries()$ geographiclib-1.21/maxima/Makefile.mk0000644000175000017500000000027511745620415017407 0ustar frankiefrankie# $Id: 51c7fc1cd5e30c0da414d752529eca09a8f036b9 $ MAXIMA = tm ellint tmseries geod MAXIMASOURCES = $(addsuffix .mac,$(MAXIMA)) all: @: install: @: clean: @: .PHONY: all install clean geographiclib-1.21/maxima/tmseries.mac0000644000175000017500000001571211745620415017660 0ustar frankiefrankie/* Compute series approximations for Transverse Mercator Projection Written by Charles Karney http://geographiclib.sourceforge.net/ $Id: c790f624c09d809837ba853444e8f82db01a1665 $ Reference: Charles F. F. Karney, Transverse Mercator with an accuracy of a few nanometers, J. Geodesy 85(8), 475-485 (Aug. 2011). DOI 10.1007/s00190-011-0445-3 preprint http://arxiv.org/abs/1002.1417 resource page http://geographiclib.sf.net/tm.html Compute coefficient for forward and inverse trigonometric series for conversion from conformal latitude to rectifying latitude. This prints out assignments which with minor editing are suitable for insertion into C++ code. (N.B. n^3 in the output means n*n*n; 3/5 means 0.6.) To run, start maxima and enter writefile("tmseries.out")$ load("tmseries.mac")$ closefile()$ With maxpow = 6, the output (after about 5 secs) is A=a/(n+1)*(1+n^2/4+n^4/64+n^6/256); alpha[1]=n/2-2*n^2/3+5*n^3/16+41*n^4/180-127*n^5/288+7891*n^6/37800; alpha[2]=13*n^2/48-3*n^3/5+557*n^4/1440+281*n^5/630-1983433*n^6/1935360; alpha[3]=61*n^3/240-103*n^4/140+15061*n^5/26880+167603*n^6/181440; alpha[4]=49561*n^4/161280-179*n^5/168+6601661*n^6/7257600; alpha[5]=34729*n^5/80640-3418889*n^6/1995840; alpha[6]=+212378941*n^6/319334400; beta[1]=n/2-2*n^2/3+37*n^3/96-n^4/360-81*n^5/512+96199*n^6/604800; beta[2]=n^2/48+n^3/15-437*n^4/1440+46*n^5/105-1118711*n^6/3870720; beta[3]=17*n^3/480-37*n^4/840-209*n^5/4480+5569*n^6/90720; beta[4]=4397*n^4/161280-11*n^5/504-830251*n^6/7257600; beta[5]=4583*n^5/161280-108847*n^6/3991680; beta[6]=+20648693*n^6/638668800; Notation of output matches that of L. Krueger, Konforme Abbildung des Erdellipsoids in der Ebene Royal Prussian Geodetic Institute, New Series 52, 172 pp. (1912). with gamma replaced by alpha. Alter maxpow to generate more or less terms for the series approximations to the forward and reverse projections. This has been tested out to maxpow = 30; but this takes a long time (see below). */ /* Timing: maxpow time 4 2s 6 5s 8 11s 10 24s 12 52s 20 813s = 14m 30 13535s = 226m */ maxpow:6$ /* Max power for forward and reverse projections */ /* Notation e = eccentricity e2 = e^2 = f*(2-f) n = third flattening = f/(2-f) phi = (complex) geodetic latitude zetap = Gauss-Schreiber TM = complex conformal latitude psi = Mercator = complex isometric latitude zeta = scaled UTM projection = complex rectifying latitude */ taylordepth:6$ triginverses:'all$ /* revert var2 = expr(var1) = series in eps to var1 = revertexpr(var2) = series in eps Require that expr(var1) = var1 to order eps^0. This throws in a trigreduce to convert to multiple angle trig functions. */ reverta(expr,var1,var2,eps,pow):=block([tauacc:1,sigacc:0,dsig], dsig:ratdisrep(taylor(expr-var1,eps,0,pow)), dsig:subst([var1=var2],dsig), for n:1 thru pow do (tauacc:trigreduce(ratdisrep(taylor( -dsig*tauacc/n,eps,0,pow))), sigacc:sigacc+expand(diff(tauacc,var2,n-1))), var2+sigacc)$ /* Expansion for atan(x+eps) for small eps. Equivalent to taylor(atan(x + eps), eps, 0, maxpow) but tidied up a bit. */ atanexp(x,eps):=''(ratdisrep(taylor(atan(x+eps),eps,0,maxpow)))$ /* Convert from n to e^2 */ e2:4*n/(1+n)^2$ /* zetap in terms of phi. The expansion of atan(sinh( asinh(tan(phi)) + e * atanh(e * sin(phi)) )) */ zetap_phi:block([psiv,tanzetap,zetapv,qq,e], /* Here qq = atanh(sin(phi)) = asinh(tan(phi)) */ psiv:qq-e*atanh(e*tanh(qq)), psiv:subst([e=sqrt(e2),qq=atanh(sin(phi))], ratdisrep(taylor(psiv,e,0,2*maxpow))) +asinh(sin(phi)/cos(phi))-atanh(sin(phi)), tanzetap:subst([abs(cos(phi))=cos(phi),sqrt(sin(phi)^2+cos(phi)^2)=1], ratdisrep(taylor(sinh(psiv),n,0,maxpow)))+tan(phi)-sin(phi)/cos(phi), zetapv:atanexp(tan(phi),tanzetap-tan(phi)), zetapv:subst([cos(phi)=sqrt(1-sin(phi)^2), tan(phi)=sin(phi)/sqrt(1-sin(phi)^2)], (zetapv-phi)/cos(phi))*cos(phi)+phi, zetapv:ratdisrep(taylor(zetapv,n,0,maxpow)), expand(trigreduce(zetapv)))$ /* phi in terms of zetap */ phi_zetap:reverta(zetap_phi,phi,zetap,n,maxpow)$ /* Mean radius of meridian */ a1:expand(integrate( ratdisrep(taylor((1+n)*(1-e2)/(1-e2*sin(phi)^2)^(3/2), n,0,maxpow)), phi, 0, %pi/2)/(%pi/2))/(1+n)$ /* zeta in terms of phi. The expansion of zeta = pi/(2*a1) * int( (1-e^2)/(1-e^2*sin(phi)^2)^(3/2) ) */ zeta_phi:block([zetav], zetav:integrate(trigreduce(ratdisrep(taylor( (1-e2)/(1-e2*sin(phi)^2)^(3/2)/a1, n,0,maxpow))),phi), expand(zetav))$ /* phi in terms of zeta */ phi_zeta:reverta(zeta_phi,phi,zeta,n,maxpow)$ /* zeta in terms of zetap */ /* This is slow. The next version speeds it up a little. zeta_zetap:expand(trigreduce(ratdisrep( taylor(subst([phi=phi_zetap],zeta_phi),n,0,maxpow))))$ */ zeta_zetap:block([phiv:phi_zetap,zetav:expand(zeta_phi),acc:0], for i:0 thru maxpow do ( phiv:ratdisrep(taylor(phiv,n,0,maxpow-i)), acc:acc + expand(n^i * trigreduce(ratdisrep(taylor( subst([phi=phiv],coeff(zetav,n,i)),n,0,maxpow-i))))), acc)$ /* zetap in terms of zeta */ /* This is slow. The next version speeds it up a little. zetap_zeta:expand(trigreduce(ratdisrep( taylor(subst([phi=phi_zeta],zetap_phi),n,0,maxpow))))$ */ zetap_zeta:block([phiv:phi_zeta,zetapv:expand(zetap_phi),acc:0], for i:0 thru maxpow do ( phiv:ratdisrep(taylor(phiv,n,0,maxpow-i)), acc:acc + expand(n^i * trigreduce(ratdisrep(taylor( subst([phi=phiv],coeff(zetapv,n,i)),n,0,maxpow-i))))), acc)$ printa1():=block([], print(concat("A=",string(a/(n+1)),"*(", string(taylor(a1*(1+n),n,0,maxpow)),");")), 0)$ printtxf():=block([alpha:zeta_zetap,t], for i:1 thru maxpow do (t:coeff(alpha,sin(2*i*zetap)), print(concat("alpha[",i,"]=",string(taylor(t,n,0,maxpow)),";")), alpha:alpha-expand(t*sin(2*i*zetap))), /* should return zero */ alpha:alpha-zetap)$ printtxr():=block([beta:zetap_zeta,t], for i:1 thru maxpow do (t:coeff(beta,sin(2*i*zeta)), print(concat("beta[",i,"]=",string(taylor(-t,n,0,maxpow)),";")), beta:beta-expand(t*sin(2*i*zeta))), /* should return zero */ beta:beta-zeta)$ printseries():=[printa1(),printtxf(),printtxr()]$ /* Define array functions which are be read by tm.mac */ defarrayfuns():=block([aa:a1*(1+n),alpha:zeta_zetap,beta:zetap_zeta,t], for i:1 thru maxpow do ( define(a1_a[i](n),ratdisrep(taylor(aa,n,0,i))/(1+n)), t:expand(ratdisrep(taylor(alpha,n,0,i))), define(zeta_a[i](zp,n), zp+sum(coeff(t,sin(2*k*zetap))*sin(2*k*zp),k,1,i)), t:diff(t,zetap), define(zeta_d[i](zp,n), 1+sum(coeff(t,cos(2*k*zetap))*cos(2*k*zp),k,1,i)), t:expand(ratdisrep(taylor(beta,n,0,i))), define(zetap_a[i](z,n), z+sum(coeff(t,sin(2*k*zeta))*sin(2*k*z),k,1,i)), t:diff(t,zeta), define(zetap_d[i](z,n), 1+sum(coeff(t,cos(2*k*zeta))*cos(2*k*z),k,1,i))))$ printseries()$ /* defarrayfuns()$ save("tmseries.lsp",maxpow,arrays)$ */ geographiclib-1.21/maxima/ellint.mac0000644000175000017500000000663011745620415017313 0ustar frankiefrankie/* Written by Charles Karney http://geographiclib.sourceforge.net/ $Id: 23c6d3303abe67aa05500f9f794547c8f3f122a5 $ */ /* Implementation of methods given in B. C. Carlson Computation of elliptic integrals Numerical Algorithms 10, 13-26 (1995) */ /* fpprec:120$ Should be set outside */ etol:0.1b0^fpprec$ /* For Carlson */ ca:sqrt(etol)$ /* For Bulirsch */ eps:0.1b0^fpprec$ /* For eirx */ pi:bfloat(%pi)$ ratprint:false$ rf(x,y,z) := block( [a0:(x+y+z)/3, q,x0:x,y0:y,z0:z,an,ln,xx,yy,zz,n,e2,e3], q:(3*etol)^(-1/6)*max(abs(a0-x),abs(a0-y),abs(a0-z)), an:a0, n:0, while q >= abs(an) do ( n:n+1, ln:sqrt(x0)*sqrt(y0)+sqrt(y0)*sqrt(z0)+sqrt(z0)*sqrt(x0), an:(an+ln)/4, x0:(x0+ln)/4, y0:(y0+ln)/4, z0:(z0+ln)/4, q:q/4), xx:(a0-x)/(4^n*an), yy:(a0-y)/(4^n*an), zz:-xx-yy, e2:xx*yy-zz^2, e3:xx*yy*zz, (1-e2/10+e3/14+e2^2/24-3*e2*e3/44) / sqrt(an))$ rd(x,y,z) := block( [a0:(x+y+3*z)/5, q,x0:x,y0:y,z0:z,an,ln,xx,yy,zz,n,e2,e3,e4,e5,s], q:(etol/4)^(-1/6)*max(abs(a0-x),abs(a0-y),abs(a0-z)), an:a0, n:0, s:0, while q >= abs(an) do ( ln:sqrt(x0)*sqrt(y0)+sqrt(y0)*sqrt(z0)+sqrt(z0)*sqrt(x0), s:s+1/(4^n*sqrt(z0)*(z0+ln)), n:n+1, an:(an+ln)/4, x0:(x0+ln)/4, y0:(y0+ln)/4, z0:(z0+ln)/4, q:q/4), xx:(a0-x)/(4^n*an), yy:(a0-y)/(4^n*an), zz:-(xx+yy)/3, e2:xx*yy-6*zz^2, e3:(3*xx*yy-8*zz^2)*zz, e4:3*(xx*yy-zz^2)*zz^2, e5:xx*yy*zz^3, (1-3*e2/14+e3/6+9*e2^2/88-3*e4/22-9*e2*e3/52+3*e5/26)/(4^n*an*sqrt(an)) +3*s)$ /* R_G(x,y,0) */ rg0(x,y) := block( [x0:sqrt(x),y0:sqrt(y),xn,yn,t,s,n], xn:x0, yn:y0, n:0, s:0, while abs(xn-yn) >= 2.7b0 * sqrt(etol) * abs(xn) do ( t:(xn+yn)/2, yn:sqrt(xn*yn), xn:t, n:n+1, s:s+(xn-yn)^2*2^(n-2)), ((x0+y0)^2/4 - s)*pi/(2*(xn+yn)) )$ /* k^2 = m */ ec(m):=2*rg0(1b0-m,1b0)$ kc(m):=rf(0b0,1b0-m,1b0)$ /* Implementation of methods given in Roland Bulirsch Numerical Calculation of Elliptic Integrals and Elliptic Functions Numericshe Mathematik 7, 78-90 (1965) */ sncndn(x,mc):=block([bo, a, b, c, d, l, sn, cn, dn, m, n], local(m, n), if mc # 0 then ( bo:is(mc < 0b0), if bo then ( d:1-mc, mc:-mc/d, d:sqrt(d), x:d*x), dn:a:1, for i:0 thru 12 do ( l:i, m[i]:a, n[i]:mc:sqrt(mc), c:(a+mc)/2, if abs(a-mc)<=ca*a then return(false), mc:a*mc, a:c ), x:c*x, sn:sin(x), cn:sin(pi/2-x), if sn#0b0 then ( a:cn/sn, c:a*c, for i:l step -1 thru 0 do ( b:m[i], a:c*a, c:dn*c, dn:(n[i]+a)/(b+a), a:c/b ), a:1/sqrt(c*c+1b0), sn:if sn<0b0 then -a else a, cn:c*sn ), if bo then ( a:dn, dn:cn, cn:a, sn:sn/d ) ) else /* mc = 0 */ ( sn:tanh(x), dn:cn:sech(x) /* d:exp(x), a:1/d, b:a+d, cn:dn:2/b, if x < 0.3b0 then ( d:x*x*x*x, d:(d*(d*(d*(d+93024b0)+3047466240b0)+24135932620800b0)+ 20274183401472000b0)/60822550204416000b0, sn:cn*(x*x*x*d+sin(x)) ) else sn:(d-a)/b */ ), [sn,cn,dn] )$ /* Versions of incomplete functions in terms of Jacobi elliptic function with u = am(phi) real and in [0,K(m)] */ eirx(sn,cn,dn,m,ec):=block([t], t:if abs(sn) < eps then abs(sn) else (rf((cn/sn)^2,(dn/sn)^2,1/sn^2)-m/3b0*rd((cn/sn)^2,(dn/sn)^2,1/sn^2)), if cn < 0 then t:2*ec - t, if sn < 0 then t:-t, t)$ geographiclib-1.21/maxima/tm.mac0000644000175000017500000003060211745620415016440 0ustar frankiefrankie/* Arbitrary precision Transverse Mercator Projection Written by Charles Karney http://geographiclib.sourceforge.net/ $Id: 688c810de1f36d1e2239f39a973835acfc5a8649 $ Reference: Charles F. F. Karney, Transverse Mercator with an accuracy of a few nanometers, J. Geodesy 85(8), 475-485 (Aug. 2011). DOI 10.1007/s00190-011-0445-3 preprint http://arxiv.org/abs/1002.1417 resource page http://geographiclib.sf.net/tm.html The parameters for the transformation are set by setparams(a,invf,k0)$ sets the major radius, inverse flattening, and central scale factor. The default is setparams(6378137b0, 298.257223563b0, 0.9996b0)$ appropriate for UTM applications. tm(lat,lon); takes lat and lon args (in degrees) and returns [x, y, convergence, scale] [x, y] do not include false eastings/northings but do include the scale factor k0. convergence is in degrees. ll(x,y); takes x and y args (in meters) and returns [lat, lon, convergence, scale]. Example: $ maxima Maxima 5.15.0 http://maxima.sourceforge.net Using Lisp CLISP 2.43 (2007-11-18) Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) load("tm.mac")$ (%i2) tm(10b0,20b0); (%o2) [2.235209504622466691587930831718465965864199221939781808953597771095103\ 6690000464b6, 1.17529734503138466792126931904154130080533935727351398258511134\ 68541970512119385b6, 3.6194756227592979778565787394402350354250845160819430786\ 093514889500602612857052b0, 1.062074627142564335518604915718789933200854739344\ 8664109599248189291146283796933b0] (%i3) ll(%[1],%[2]); (%o3) [1.0b1, 2.0b1, 3.6194756227592979778565787394402350354250845160819430786\ 093514889500602612857053b0, 1.062074627142564335518604915718789933200854739344\ 8664109599248189291146283796933b0] (%i4) float(%o2); (%o4) [2235209.504622467, 1175297.345031385, 3.619475622759298, 1.062074627142564] (%i5) float(%o3); (%o5) [10.0, 20.0, 3.619475622759298, 1.062074627142564] This implements GeographicLib::TransverseMercatorExact (i.e., Lee, 1976) using bfloats. However fewer changes from Lee 1976 have been made since we rely more heavily on the high precision to deal with problem cases. To change the precision, change fpprec below and reload. */ fpprec:80$ load("ellint.mac")$ /* Load elliptic functions */ tol:0.1b0^fpprec$ tol1:0.1b0*sqrt(tol)$ /* For Newton's method */ tol2:sqrt(0.01*tol*tol1)$ /* Also for Newton's method but more conservative */ ahypover:log(10b0^fpprec)+2$ pi:bfloat(%pi)$ degree:pi/180$ ratprint:false$ debugprint:false$ setparams(a1,invf,k1):=(a:bfloat(a1),f:1/bfloat(invf),k0:bfloat(k1), e2:f*(2-f), e:sqrt(e2), kcu:kc(e2), kcv:kc(1-e2), ecu:ec(e2), ecv:ec(1-e2), n:f/(2-f), 'done)$ setparams(6378137b0, 298.257223563b0, 0.9996b0)$ /* WGS 84 */ /* setparams(6378388b0, 297b0, 0.9996b0)$ International */ /* setparams(1/ec(0.01b0), 30*sqrt(11b0)+100, 1b0)$ testing, eps = 0.1*/ /* Interpret x_y(y) as x <- y, i.e., "transform quantity y to quantity x" Let phi = geodetic latitude psi = isometric latitude ( + i * lambda ) sigma = TM coords thom = Thompson coords */ /* sqrt(x^2 + y^2) -- Real only */ hypot(x,y):=sqrt(x^2 + y^2)$ /* log(1 + x) -- Real only */ log1p(x) := block([y : 1b0+x], if y = 1b0 then x else x*log(y)/(y - 1))$ /* Real only */ /* Some versions of Maxima have a buggy atanh atnh(x) := block([y : abs(x)], y : log1p(2 * y/(1 - y))/2, if x < 0 then -y else y)$ */ atnh(x) := atanh(x)$ /* exp(x)-1 -- Real only */ expm1(x) := block([y : exp(bfloat(x)),z], z : y - 1b0, if abs(x) > 1b0 then z else if z = 0b0 then x else x * z/log(y))$ /* Real only */ /* Some versions of Maxima have a buggy sinh */ snh(x) := block([u : expm1(x)], (u / (u + 1)) * (u + 2) /2); /* Real only */ psi_phi(phi):=block([s:sin(phi)], asinh(s/max(cos(phi),0.1b0*tol)) - e * atnh(e * s))$ /* Real only */ phi_psi(psi):=block([q:psi,t,dq], for i do ( t:tanh(q), dq : -(q - e * atnh(e * t) - psi) * (1 - e2 * t^2) / (1 - e2), q : q + dq, if debugprint then print(float(q), float(dq)), if abs(dq) < tol1 then return(false)), atan(snh(q)))$ psi_thom_comb(w):=block([jacr:sncndn(bfloat(realpart(w)),1-e2), jaci:sncndn(bfloat(imagpart(w)),e2),d,d1,d2], d:(1-e2)*(jaci[2]^2 + e2 * (jacr[1] * jaci[1])^2)^2, d1:sqrt(jacr[2]^2 + (1-e2) * (jacr[1] * jaci[1])^2), d2:sqrt(e2 * jacr[2]^2 + (1-e2) * jaci[2]^2), [ (if d1 > 0b0 then asinh(jacr[1]*jaci[3]/ d1) else signnum(snu) * ahypover) - (if d2 > 0b0 then e * asinh(e * jacr[1] / d2) else signnum(snu) * ahypover) + %i * (if d1 > 0b0 and d2 > 0b0 then atan2(jacr[3]*jaci[1],jacr[2]*jaci[2]) - e * atan2(e*jacr[2]*jaci[1],jacr[3]*jaci[2]) else 0), jacr[2]*jacr[3]*jaci[3]*(jaci[2]^2-e2*(jacr[1]*jaci[1])^2)/d -%i * jacr[1]*jaci[1]*jaci[2]*((jacr[3]*jaci[3])^2+e2*jacr[2]^2)/d] )$ psi_thom(w):=block([tt:psi_thom_comb(w)],tt[1])$ inv_diff_psi_thom(w):=block([tt:psi_thom_comb(w)],tt[2])$ w0a(psi):=block([lam:bfloat(imagpart(psi)),psia:bfloat(realpart(psi))], rectform(kcu/(pi/2)*( atan2(snh(psia),cos(lam)) +%i*asinh(sin(lam)/sqrt(cos(lam)^2 + snh(psia)^2)))))$ w0c(psi):=block([m,a,dlam], dlam:bfloat(imagpart(psi))-pi/2*(1-e), psi:bfloat(realpart(psi)), m:sqrt(psi^2+dlam^2)*3/(1-e2)/e, a:if m = 0b0 then 0 else atan2(dlam-psi, psi+dlam) - 0.75b0*pi, m:m^(1/3), a:a/3, m*cos(a)+%i*(m*sin(a)+kcv))$ w0d(psi):=block([psir:-realpart(psi)/e+1b0,lam:(pi/2-imagpart(psi))/e,uu,vv], uu:asinh(sin(lam)/sqrt(cos(lam)^2+snh(psir)^2))*(1+e2/2), vv:atan2(cos(lam), snh(psir)) *(1+e2/2), (-uu+kcu) + %i * (-vv+kcv))$ w0m(psi):=if realpart(psi)<-e/2*pi/2 and imagpart(psi)>pi/2*(1-2*e) and realpart(psi) < imagpart(psi)-(pi/2*(1-e)) then w0d(psi) else if realpart(psi)pi/2*(1-2*e) then w0c(psi) else w0a(psi)$ w0(psi):=w0m(psi)$ thom_psi(psi):=block([w:w0(psi),dw,v,vv], if not(abs(psi-pi/2*(1-e)*%i) < e * tol^0.6b0) then for i do ( if i > 100 then error("too many iterations"), vv:psi_thom_comb(w), v:vv[1], dw:-rectform((v-psi)*vv[2]), w:w+dw, dw:abs(dw), if debugprint then print(float(w),float(dw)), /* error is approx dw^2/2 */ if dw < tol2 then return(false) ), w )$ sigma_thom_comb(w):=block([u:bfloat(realpart(w)),v:bfloat(imagpart(w)), jacr,jaci,phi,iu,iv,den,den1,er,ei,dnr,dni], jacr:sncndn(u,1-e2),jaci:sncndn(v,e2), er:eirx(jacr[1],jacr[2],jacr[3],e2,ecu), ei:eirx(jaci[1],jaci[2],jaci[3],1-e2,ecv), den:e2*jacr[2]^2+(1-e2)*jaci[2]^2, den1:(1-e2)*(jaci[2]^2 + e2 * (jacr[1] * jaci[1])^2)^2, dnr:jacr[3]*jaci[2]*jaci[3], dni:-e2*jacr[1]*jacr[2]*jaci[1], [ er - e2*jacr[1]*jacr[2]*jacr[3]/den + %i*(v - ei + (1-e2)*jaci[1]*jaci[2]*jaci[3]/den), (dnr^2-dni^2)/den1 + %i * 2*dnr*dni/den1])$ sigma_thom(w):=block([tt:sigma_thom_comb(w)],tt[1])$ inv_diff_sigma_thom(w):=block([tt:sigma_thom_comb(w)],tt[2])$ wx0a(sigma):=rectform(sigma*kcu/ecu)$ wx0b(sigma):=block([m,aa], sigma:rectform(sigma-%i*(kcv-ecv)), m:abs(sigma)*3/(1-e2), aa:atan2(imagpart(sigma),realpart(sigma)), if aa<-pi/2 then aa:aa+2*pi, aa:aa-pi, rectform(m^(1/3)*(cos(aa/3b0)+%i*sin(aa/3b0))+%i*kcv))$ wx0c(sigma):=rectform(1/(sigma-(ecu+%i*(kcv-ecv))) + kcu+%i*kcv)$ wx0m(sigma):=block([eta:bfloat(imagpart(sigma)), xi:bfloat(realpart(sigma))], if eta > 1.25b0 * (kcv-ecv) or (xi < -0.25*ecu and xi < eta-(kcv-ecv)) then wx0c(sigma) else if (eta > 0.75b0 * (kcv-ecv) and xi < 0.25b0 * ecu) or eta > kcv-ecv or xi < 0 then wx0b(sigma) else wx0a(sigma))$ wx0(sigma):=wx0m(sigma)$ thom_sigma(sigma):=block([w:wx0(sigma),dw,v,vv], for i do ( if i > 100 then error("too many iterations"), vv:sigma_thom_comb(w), v:vv[1], dw:-rectform((v-sigma)*vv[2]), w:w+dw, dw:abs(dw), if debugprint then print(float(w),float(dw)), /* error is approx dw^2/2 */ if dw < tol2 then return(false) ), w )$ /* Lee/Thompson's method forward */ tm(phi,lam):=block([psi,thom,jacr,jaci,sigma,gam,scale,c], phi:phi*degree, lam:lam*degree, psi:psi_phi(phi), thom:thom_psi(psi+%i*lam), jacr:sncndn(bfloat(realpart(thom)),1-e2), jaci:sncndn(bfloat(imagpart(thom)),e2), sigma:sigma_thom(thom), c:cos(phi), if c > tol1 then ( gam:atan2((1-e2)*jacr[1]*jaci[1]*jaci[2], jacr[2]*jacr[3]*jaci[3]), scale:sqrt(1-e2 + e2 * c^2)/c* sqrt(((1-e2)*jaci[1]^2 + (jacr[2]*jaci[3])^2)/ (e2*jacr[2]^2 + (1-e2)*jaci[2]^2))) else (gam : lam, scale : 1b0), [imagpart(sigma)*k0*a,realpart(sigma)*k0*a,gam/degree,k0*scale])$ /* Lee/Thompson's method reverse */ ll(x,y):=block([sigma,thom,jacr,jaci,psi,lam,phi,gam,scale,c], sigma:y/(a*k0)+%i*x/(a*k0), thom:thom_sigma(sigma), jacr:sncndn(bfloat(realpart(thom)),1-e2), jaci:sncndn(bfloat(imagpart(thom)),e2), psi:psi_thom(thom), lam:bfloat(imagpart(psi)), psi:bfloat(realpart(psi)), phi:phi_psi(psi), c:cos(phi), if c > tol1 then ( gam:atan2((1-e2)*jacr[1]*jaci[1]*jaci[2], jacr[2]*jacr[3]*jaci[3]), scale:sqrt(1-e2 + e2 * c^2)/c* sqrt(((1-e2)*jaci[1]^2 + (jacr[2]*jaci[3])^2)/ (e2*jacr[2]^2 + (1-e2)*jaci[2]^2))) else (gam : lam, scale : 1b0), [phi/degree,lam/degree,gam/degree,k0*scale])$ /* Return lat/lon/x/y for a point specified in Thompson coords */ /* Pick u in [0, kcu] and v in [0, kcv] */ lltm(u,v):=block([jacr,jaci,psi,lam,phi,c,gam,scale,sigma,x,y], u:bfloat(u), v:bfloat(v), jacr:sncndn(u,1-e2), jaci:sncndn(v,e2), psi:psi_thom(u+%i*v), sigma:sigma_thom(u+%i*v), x:imagpart(sigma)*k0*a,y:realpart(sigma)*k0*a, lam:bfloat(imagpart(psi)), psi:bfloat(realpart(psi)), phi:phi_psi(psi), c:cos(phi), if c > tol1 then ( gam:atan2((1-e2)*jacr[1]*jaci[1]*jaci[2], jacr[2]*jacr[3]*jaci[3]), scale:sqrt(1-e2 + e2 * c^2)/c* sqrt(((1-e2)*jaci[1]^2 + (jacr[2]*jaci[3])^2)/ (e2*jacr[2]^2 + (1-e2)*jaci[2]^2))) else (gam : lam, scale : 1b0), [phi/degree,lam/degree,x,y,gam/degree,k0*scale])$ /* Gauss-Krueger series to order n^i forward Uses the array functions a1_a[i](n), zeta_a[i](z,n), zeta_d[i](z,n), zetap_a[i](s,n), zetap_d[i](s,n), defined in tmseries.mac. */ tms(phi,lam,i):=block([psi,xip,etap,z,sigma,sp,gam,k,b1], phi:phi*degree, lam:lam*degree, psi:psi_phi(phi), xip:atan2(snh(psi), cos(lam)), etap:asinh(sin(lam)/hypot(snh(psi),cos(lam))), k:sqrt(1 - e2*sin(phi)^2)/(cos(phi)*hypot(snh(psi),cos(lam))), gam:atan(tan(xip)*tanh(etap)), z:xip+%i*etap, b1:a1_a[i](n), sigma:rectform(b1*zeta_a[i](z,n)), sp:rectform(zeta_d[i](z,n)), gam : gam - atan2(imagpart(sp),realpart(sp)), k : k * b1 * cabs(sp), [imagpart(sigma)*k0*a,realpart(sigma)*k0*a,gam/degree,k*k0])$ /* Gauss-Krueger series to order n^i reverse */ lls(x,y,i):=block([sigma,b1,s,z,zp,xip,etap,s,c,r,gam,k,lam,psi,phi], sigma:y/(a*k0)+%i*x/(a*k0), b1:a1_a[i](n), s:rectform(sigma/b1), z:rectform(zetap_a[i](s,n)), zp:rectform(zetap_d[i](s,n)), gam : atan2(imagpart(zp), realpart(zp)), k : b1 / cabs(zp), xip:realpart(z), etap:imagpart(z), s:snh(etap), c:cos(xip), r:hypot(s, c), lam:atan2(s, c), psi : asinh(sin(xip)/r), phi :phi_psi(psi), k : k * sqrt(1 - e2*sin(phi)^2) * r/cos(phi), gam : gam + atan(tan(xip) * tanh(etap)), [phi/degree,lam/degree,gam/degree,k*k0])$ /* Approx geodesic distance valid for small displacements */ dist(phi0,lam0,phi,lam):=block([dphi,dlam,nn,hlon,hlat], dphi:(phi-phi0)*degree, dlam:(lam-lam0)*degree, phi0:phi0*degree, lam0:lam0*degree, nn : 1/sqrt(1 - e2 * sin(phi0)^2), hlon : cos(phi0) * nn, hlat : (1 - e2) * nn^3, a * hypot(dphi*hlat, dlam*hlon))$ /* Compute truncation errors for all truncation levels */ check(phi,lam):=block([vv,x,y,gam,k,vf,vb,errf,errr,err2,errlist], phi:min(90-0.01b0,phi), lam:min(90-0.01b0,lam), vv:tm(phi,lam), errlist:[], x:vv[1], y:vv[2], gam:vv[3], k:vv[4], for i:1 thru maxpow do ( vf:tms(phi,lam,i), errf:hypot(vf[1]-x,vf[2]-y)/k, errfg:abs(vf[3]-gam), errfk:abs((vf[4]-k)/k), vb:lls(x,y,i), errr:dist(phi,lam,vb[1],vb[2]), errrg:abs(vb[3]-gam), errrk:abs((vb[4]-k)/k), errlist:append(errlist, [max(errf, errr), max(errfg, errrg), max(errfk, errrk)])), errlist)$ /* Max of output of check over a set of points */ checka(lst):=block([errlist:[],errx], for i:1 thru 3*maxpow do errlist:cons(0b0,errlist), for vv in lst do ( errx:check(vv[1],vv[2]), for i:1 thru 3*maxpow do errlist[i]:max(errlist[i],errx[i])), errlist)$ geographiclib-1.21/python/0002755000175000017500000000000011757437426015417 5ustar frankiefrankiegeographiclib-1.21/python/geographiclib/0002755000175000017500000000000011757437426020216 5ustar frankiefrankiegeographiclib-1.21/python/geographiclib/geodesiccapability.py0000644000175000017500000000221111745620415024373 0ustar frankiefrankie# geodesiccapability.py # # This gathers the capability constants need by geodesic.py and # geodesicline.py. See the documentation for the # GeographicLib::Geodesic class for more information at # # http://geographiclib.sourceforge.net/html/annotated.html # # Copyright (c) Charles Karney (2011) and licensed # under the MIT/X11 License. For more information, see # http://geographiclib.sourceforge.net/ # # $Id: 91d8d768ad86c1d65a1d9b5f67ad310466670a49 $ ###################################################################### class GeodesicCapability(object): """ Capability constants shared between Geodesic and GeodesicLine. """ CAP_NONE = 0 CAP_C1 = 1<<0 CAP_C1p = 1<<1 CAP_C2 = 1<<2 CAP_C3 = 1<<3 CAP_C4 = 1<<4 CAP_ALL = 0x1F OUT_ALL = 0x7F80 NONE = 0 LATITUDE = 1<<7 | CAP_NONE LONGITUDE = 1<<8 | CAP_C3 AZIMUTH = 1<<9 | CAP_NONE DISTANCE = 1<<10 | CAP_C1 DISTANCE_IN = 1<<11 | CAP_C1 | CAP_C1p REDUCEDLENGTH = 1<<12 | CAP_C1 | CAP_C2 GEODESICSCALE = 1<<13 | CAP_C1 | CAP_C2 AREA = 1<<14 | CAP_C4 ALL = OUT_ALL| CAP_ALL geographiclib-1.21/python/geographiclib/geodesic.py0000644000175000017500000011512011745620415022335 0ustar frankiefrankie# geodesic.py # # This is a rather literal translation of the GeographicLib::Geodesic # class to python. See the documentation for the C++ class for more # information at # # http://geographiclib.sourceforge.net/html/annotated.html # # The algorithms are derived in # # Charles F. F. Karney, # Geodesics on an ellipsoid of revolution, Feb. 2011, # http://arxiv.org/abs/1102.1215 # errata: http://geographiclib.sourceforge.net/geod-errata.html # # Charles F. F. Karney, # Algorithms for geodesics, Sept. 2011, # http://arxiv.org/abs/1109.4448 # # Copyright (c) Charles Karney (2011, 2012) and # licensed under the MIT/X11 License. For more information, see # http://geographiclib.sourceforge.net/ # # $Id: 95edebf1ac240458e1ba8a63577c589f330f849d $ ###################################################################### import math from geographiclib.geomath import Math from geographiclib.constants import Constants from geographiclib.geodesiccapability import GeodesicCapability class Geodesic(object): """ Solve geodesic problems. The following illustrates its use import sys sys.path.append("/usr/local/lib/python/site-packages"); from geographiclib.geodesic import Geodesic # The geodesic inverse problem Geodesic.WGS84.Inverse(-41.32, 174.81, 40.96, -5.50) # The geodesic direct problem Geodesic.WGS84.Direct(40.6, -73.8, 45, 10000e3) # How to obtain several points along a geodesic line = Geodesic.WGS84.Line(40.6, -73.8, 45) line.Position( 5000e3) line.Position(10000e3) # Computing the area of a geodesic polygon def p(lat,lon): return {'lat': lat, 'lon': lon} Geodesic.WGS84.Area([p(0, 0), p(0, 90), p(90, 0)]) Documentation on these routines is available via help(Geodesic.__init__) help(Geodesic.Inverse) help(Geodesic.Direct) help(Geodesic.Line) help(line.Position) help(Geodesic.Area) """ GEOD_ORD = 6 nA1_ = GEOD_ORD nC1_ = GEOD_ORD nC1p_ = GEOD_ORD nA2_ = GEOD_ORD nC2_ = GEOD_ORD nA3_ = GEOD_ORD nA3x_ = nA3_ nC3_ = GEOD_ORD nC3x_ = (nC3_ * (nC3_ - 1)) / 2 nC4_ = GEOD_ORD nC4x_ = (nC4_ * (nC4_ + 1)) / 2 maxit_ = 50 tiny_ = math.sqrt(Math.minval) tol0_ = Math.epsilon tol1_ = 200 * tol0_ tol2_ = math.sqrt(Math.epsilon) xthresh_ = 1000 * tol2_ CAP_NONE = GeodesicCapability.CAP_NONE CAP_C1 = GeodesicCapability.CAP_C1 CAP_C1p = 1<<1 CAP_C2 = 1<<2 CAP_C3 = 1<<3 CAP_C4 = 1<<4 CAP_ALL = 0x1F OUT_ALL = 0x7F80 NONE = 0 LATITUDE = 1<<7 | CAP_NONE LONGITUDE = 1<<8 | CAP_C3 AZIMUTH = 1<<9 | CAP_NONE DISTANCE = 1<<10 | CAP_C1 DISTANCE_IN = 1<<11 | CAP_C1 | CAP_C1p REDUCEDLENGTH = 1<<12 | CAP_C1 | CAP_C2 GEODESICSCALE = 1<<13 | CAP_C1 | CAP_C2 AREA = 1<<14 | CAP_C4 ALL = OUT_ALL| CAP_ALL def SinCosSeries(sinp, sinx, cosx, c, n): # Evaluate # y = sinp ? sum(c[i] * sin( 2*i * x), i, 1, n) : # sum(c[i] * cos((2*i+1) * x), i, 0, n-1) : # using Clenshaw summation. N.B. c[0] is unused for sin series # Approx operation count = (n + 5) mult and (2 * n + 2) add k = (n + sinp) # Point to one beyond last element ar = 2 * (cosx - sinx) * (cosx + sinx) # 2 * cos(2 * x) y1 = 0 # accumulators for sum if n & 1: k -= 1; y0 = c[k] else: y0 = 0 # Now n is even n //= 2 while n: # while n--: n -= 1 # Unroll loop x 2, so accumulators return to their original role k -= 1; y1 = ar * y0 - y1 + c[k] k -= 1; y0 = ar * y1 - y0 + c[k] return ( 2 * sinx * cosx * y0 if sinp # sin(2 * x) * y0 else cosx * (y0 - y1) ) # cos(x) * (y0 - y1) SinCosSeries = staticmethod(SinCosSeries) def AngNormalize(x): # Place angle in [-180, 180). Assumes x is in [-540, 540). return (x - 360 if x >= 180 else (x + 360 if x < -180 else x)) AngNormalize = staticmethod(AngNormalize) def AngRound(x): # The makes the smallest gap in x = 1/16 - nextafter(1/16, 0) = 1/2^57 # for reals = 0.7 pm on the earth if x is an angle in degrees. (This # is about 1000 times more resolution than we get with angles around 90 # degrees.) We use this to avoid having to deal with near singular # cases when x is non-zero but tiny (e.g., 1.0e-200). z = 0.0625 # 1/16 y = abs(x) # The compiler mustn't "simplify" z - (z - y) to y y = z - (z - y) if y < z else y return -y if x < 0 else y AngRound = staticmethod(AngRound) def SinCosNorm(sinx, cosx): r = math.hypot(sinx, cosx) return sinx/r, cosx/r SinCosNorm = staticmethod(SinCosNorm) def Astroid(x, y): # Solve k^4+2*k^3-(x^2+y^2-1)*k^2-2*y^2*k-y^2 = 0 for positive root k. # This solution is adapted from Geocentric::Reverse. p = Math.sq(x) q = Math.sq(y) r = (p + q - 1) / 6 if not(q == 0 and r <= 0): # Avoid possible division by zero when r = 0 by multiplying equations # for s and t by r^3 and r, resp. S = p * q / 4 # S = r^3 * s r2 = Math.sq(r) r3 = r * r2 # The discrimant of the quadratic equation for T3. This is zero on # the evolute curve p^(1/3)+q^(1/3) = 1 disc = S * (S + 2 * r3) u = r if (disc >= 0): T3 = S + r3 # Pick the sign on the sqrt to maximize abs(T3). This minimizes loss # of precision due to cancellation. The result is unchanged because # of the way the T is used in definition of u. T3 += -math.sqrt(disc) if T3 < 0 else math.sqrt(disc) # T3 = (r * t)^3 # N.B. cbrt always returns the real root. cbrt(-8) = -2. T = Math.cbrt(T3) # T = r * t # T can be zero; but then r2 / T -> 0. u += T + (r2 / T if T != 0 else 0) else: # T is complex, but the way u is defined the result is real. ang = math.atan2(math.sqrt(-disc), -(S + r3)) # There are three possible cube roots. We choose the root which # avoids cancellation. Note that disc < 0 implies that r < 0. u += 2 * r * math.cos(ang / 3) v = math.sqrt(Math.sq(u) + q) # guaranteed positive # Avoid loss of accuracy when u < 0. uv = q / (v - u) if u < 0 else u + v # u+v, guaranteed positive w = (uv - q) / (2 * v) # positive? # Rearrange expression for k to avoid loss of accuracy due to # subtraction. Division by 0 not possible because uv > 0, w >= 0. k = uv / (math.sqrt(uv + Math.sq(w)) + w) # guaranteed positive else: # q == 0 && r <= 0 # y = 0 with |x| <= 1. Handle this case directly. # for y small, positive root is k = abs(y)/sqrt(1-x^2) k = 0 return k Astroid = staticmethod(Astroid) def A1m1f(eps): eps2 = Math.sq(eps) t = eps2*(eps2*(eps2+4)+64)/256 return (t + eps) / (1 - eps) A1m1f = staticmethod(A1m1f) def C1f(eps, c): eps2 = Math.sq(eps) d = eps c[1] = d*((6-eps2)*eps2-16)/32 d *= eps c[2] = d*((64-9*eps2)*eps2-128)/2048 d *= eps c[3] = d*(9*eps2-16)/768 d *= eps c[4] = d*(3*eps2-5)/512 d *= eps c[5] = -7*d/1280 d *= eps c[6] = -7*d/2048 C1f = staticmethod(C1f) def C1pf(eps, c): eps2 = Math.sq(eps) d = eps c[1] = d*(eps2*(205*eps2-432)+768)/1536 d *= eps c[2] = d*(eps2*(4005*eps2-4736)+3840)/12288 d *= eps c[3] = d*(116-225*eps2)/384 d *= eps c[4] = d*(2695-7173*eps2)/7680 d *= eps c[5] = 3467*d/7680 d *= eps c[6] = 38081*d/61440 C1pf = staticmethod(C1pf) def A2m1f(eps): eps2 = Math.sq(eps) t = eps2*(eps2*(25*eps2+36)+64)/256 return t * (1 - eps) - eps A2m1f = staticmethod(A2m1f) def C2f(eps, c): eps2 = Math.sq(eps) d = eps c[1] = d*(eps2*(eps2+2)+16)/32 d *= eps c[2] = d*(eps2*(35*eps2+64)+384)/2048 d *= eps c[3] = d*(15*eps2+80)/768 d *= eps c[4] = d*(7*eps2+35)/512 d *= eps c[5] = 63*d/1280 d *= eps c[6] = 77*d/2048 C2f = staticmethod(C2f) def __init__(self, a, f): """ Construct a Geodesic object for ellipsoid with major radius a and flattening f. """ self._a = float(a) self._f = float(f) if f <= 1 else 1.0/f self._f1 = 1 - self._f self._e2 = self._f * (2 - self._f) self._ep2 = self._e2 / Math.sq(self._f1) # e2 / (1 - e2) self._n = self._f / ( 2 - self._f) self._b = self._a * self._f1 # authalic radius squared self._c2 = (Math.sq(self._a) + Math.sq(self._b) * (1 if self._e2 == 0 else (Math.atanh(math.sqrt(self._e2)) if self._e2 > 0 else math.atan(math.sqrt(-self._e2))) / math.sqrt(abs(self._e2))))/2 # The sig12 threshold for "really short" self._etol2 = 10 * Geodesic.tol2_ / max(0.1, math.sqrt(abs(self._e2))) if not(Math.isfinite(self._a) and self._a > 0): raise ValueError("Major radius is not positive") if not(Math.isfinite(self._b) and self._b > 0): raise ValueError("Minor radius is not positive") self._A3x = range(Geodesic.nA3x_) self._C3x = range(Geodesic.nC3x_) self._C4x = range(Geodesic.nC4x_) self.A3coeff() self.C3coeff() self.C4coeff() def A3coeff(self): _n = self._n self._A3x[0] = 1 self._A3x[1] = (_n-1)/2 self._A3x[2] = (_n*(3*_n-1)-2)/8 self._A3x[3] = ((-_n-3)*_n-1)/16 self._A3x[4] = (-2*_n-3)/64 self._A3x[5] = -3/128.0 def C3coeff(self): _n = self._n self._C3x[0] = (1-_n)/4 self._C3x[1] = (1-_n*_n)/8 self._C3x[2] = ((3-_n)*_n+3)/64 self._C3x[3] = (2*_n+5)/128 self._C3x[4] = 3/128.0 self._C3x[5] = ((_n-3)*_n+2)/32 self._C3x[6] = ((-3*_n-2)*_n+3)/64 self._C3x[7] = (_n+3)/128 self._C3x[8] = 5/256.0 self._C3x[9] = (_n*(5*_n-9)+5)/192 self._C3x[10] = (9-10*_n)/384 self._C3x[11] = 7/512.0 self._C3x[12] = (7-14*_n)/512 self._C3x[13] = 7/512.0 self._C3x[14] = 21/2560.0 def C4coeff(self): _ep2 = self._ep2 self._C4x[0] = (_ep2*(_ep2*(_ep2*((832-640*_ep2)*_ep2-1144)+1716)-3003)+ 30030)/45045 self._C4x[1] = (_ep2*(_ep2*((832-640*_ep2)*_ep2-1144)+1716)-3003)/60060 self._C4x[2] = (_ep2*((208-160*_ep2)*_ep2-286)+429)/18018 self._C4x[3] = ((104-80*_ep2)*_ep2-143)/10296 self._C4x[4] = (13-10*_ep2)/1430 self._C4x[5] = -1/156.0 self._C4x[6] = (_ep2*(_ep2*(_ep2*(640*_ep2-832)+1144)-1716)+3003)/540540 self._C4x[7] = (_ep2*(_ep2*(160*_ep2-208)+286)-429)/108108 self._C4x[8] = (_ep2*(80*_ep2-104)+143)/51480 self._C4x[9] = (10*_ep2-13)/6435 self._C4x[10] = 5/3276.0 self._C4x[11] = (_ep2*((208-160*_ep2)*_ep2-286)+429)/900900 self._C4x[12] = ((104-80*_ep2)*_ep2-143)/257400 self._C4x[13] = (13-10*_ep2)/25025 self._C4x[14] = -1/2184.0 self._C4x[15] = (_ep2*(80*_ep2-104)+143)/2522520 self._C4x[16] = (10*_ep2-13)/140140 self._C4x[17] = 5/45864.0 self._C4x[18] = (13-10*_ep2)/1621620 self._C4x[19] = -1/58968.0 self._C4x[20] = 1/792792.0 def A3f(self, eps): # Evaluation sum(_A3c[k] * eps^k, k, 0, nA3x_-1) by Horner's method v = 0 for i in range(Geodesic.nA3x_-1, -1, -1): v = eps * v + self._A3x[i] return v def C3f(self, eps, c): # Evaluation C3 coeffs by Horner's method # Elements c[1] thru c[nC3_ - 1] are set j = Geodesic.nC3x_; k = Geodesic.nC3_ - 1 while k: t = 0 for i in range(Geodesic.nC3_ - k): j -= 1 t = eps * t + self._C3x[j] c[k] = t k -= 1 mult = 1 for k in range(1, Geodesic.nC3_): mult *= eps c[k] *= mult def C4f(self, k2, c): # Evaluation C4 coeffs by Horner's method # Elements c[0] thru c[nC4_ - 1] are set j = Geodesic.nC4x_; k = Geodesic.nC4_ while k: t = 0 for i in range(Geodesic.nC4_ - k + 1): j -= 1 t = k2 * t + self._C4x[j] k -= 1 c[k] = t mult = 1 for k in range(1, Geodesic.nC4_): mult *= k2 c[k] *= mult # return s12b, m12a, m0, M12, M21 def Lengths(self, eps, sig12, ssig1, csig1, ssig2, csig2, cbet1, cbet2, scalep, # Scratch areas of the right size C1a, C2a): # Return m12a = (reduced length)/_a; also calculate s12b = distance/_b, # and m0 = coefficient of secular term in expression for reduced length. Geodesic.C1f(eps, C1a) Geodesic.C2f(eps, C2a) A1m1 = Geodesic.A1m1f(eps) AB1 = (1 + A1m1) * ( Geodesic.SinCosSeries(True, ssig2, csig2, C1a, Geodesic.nC1_) - Geodesic.SinCosSeries(True, ssig1, csig1, C1a, Geodesic.nC1_)) A2m1 = Geodesic.A2m1f(eps) AB2 = (1 + A2m1) * ( Geodesic.SinCosSeries(True, ssig2, csig2, C2a, Geodesic.nC2_) - Geodesic.SinCosSeries(True, ssig1, csig1, C2a, Geodesic.nC2_)) cbet1sq = Math.sq(cbet1) cbet2sq = Math.sq(cbet2) w1 = math.sqrt(1 - self._e2 * cbet1sq) w2 = math.sqrt(1 - self._e2 * cbet2sq) # Make sure it's OK to have repeated dummy arguments m0x = A1m1 - A2m1 J12 = m0x * sig12 + (AB1 - AB2) m0 = m0x # Missing a factor of _a. # Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure accurate # cancellation in the case of coincident points. m12a = ((w2 * (csig1 * ssig2) - w1 * (ssig1 * csig2)) - self._f1 * csig1 * csig2 * J12) # Missing a factor of _b s12b = (1 + A1m1) * sig12 + AB1 if scalep: csig12 = csig1 * csig2 + ssig1 * ssig2 J12 *= self._f1 M12 = csig12 + (self._e2 * (cbet1sq - cbet2sq) * ssig2 / (w1 + w2) - csig2 * J12) * ssig1 / w1 M21 = csig12 - (self._e2 * (cbet1sq - cbet2sq) * ssig1 / (w1 + w2) - csig1 * J12) * ssig2 / w2 else: M12 = M21 = Math.nan return s12b, m12a, m0, M12, M21 # return sig12, salp1, calp1, salp2, calp2 def InverseStart(self, sbet1, cbet1, sbet2, cbet2, lam12, # Scratch areas of the right size C1a, C2a): # Return a starting point for Newton's method in salp1 and calp1 (function # value is -1). If Newton's method doesn't need to be used, return also # salp2 and calp2 and function value is sig12. sig12 = -1; salp2 = calp2 = Math.nan # Return values # bet12 = bet2 - bet1 in [0, pi); bet12a = bet2 + bet1 in (-pi, 0] sbet12 = sbet2 * cbet1 - cbet2 * sbet1 cbet12 = cbet2 * cbet1 + sbet2 * sbet1 # Volatile declaration needed to fix inverse cases # 88.202499451857 0 -88.202499451857 179.981022032992859592 # 89.262080389218 0 -89.262080389218 179.992207982775375662 # 89.333123580033 0 -89.333123580032997687 179.99295812360148422 # which otherwise fail with g++ 4.4.4 x86 -O3 sbet12a = sbet2 * cbet1 sbet12a += cbet2 * sbet1 shortline = cbet12 >= 0 and sbet12 < 0.5 and lam12 <= math.pi / 6 omg12 = (lam12 if not shortline else lam12 / math.sqrt(1 - self._e2 * Math.sq((cbet1 + cbet2) / 2))) somg12 = math.sin(omg12); comg12 = math.cos(omg12) salp1 = cbet2 * somg12 calp1 = ( sbet12 + cbet2 * sbet1 * Math.sq(somg12) / (1 + comg12) if comg12 >= 0 else sbet12a - cbet2 * sbet1 * Math.sq(somg12) / (1 - comg12)) ssig12 = math.hypot(salp1, calp1) csig12 = sbet1 * sbet2 + cbet1 * cbet2 * comg12 if shortline and ssig12 < self._etol2: # really short lines salp2 = cbet1 * somg12 calp2 = sbet12 - cbet1 * sbet2 * Math.sq(somg12) / (1 + comg12) salp2, calp2 = Geodesic.SinCosNorm(salp2, calp2) # Set return value sig12 = math.atan2(ssig12, csig12) elif csig12 >= 0 or ssig12 >= 3 * abs(self._f) * math.pi * Math.sq(cbet1): # Nothing to do, zeroth order spherical approximation is OK pass else: # Scale lam12 and bet2 to x, y coordinate system where antipodal point # is at origin and singular point is at y = 0, x = -1. # real y, lamscale, betscale # Volatile declaration needed to fix inverse case # 56.320923501171 0 -56.320923501171 179.664747671772880215 # which otherwise fails with g++ 4.4.4 x86 -O3 # volatile real x if self._f >= 0: # In fact f == 0 does not get here # x = dlong, y = dlat k2 = Math.sq(sbet1) * self._ep2 eps = k2 / (2 * (1 + math.sqrt(1 + k2)) + k2) lamscale = self._f * cbet1 * self.A3f(eps) * math.pi betscale = lamscale * cbet1 x = (lam12 - math.pi) / lamscale y = sbet12a / betscale else: # _f < 0 # x = dlat, y = dlong cbet12a = cbet2 * cbet1 - sbet2 * sbet1 bet12a = math.atan2(sbet12a, cbet12a) # real m12a, m0, dummy # In the case of lon12 = 180, this repeats a calculation made in # Inverse. dummy, m12a, m0, dummy, dummy = self.Lengths( self._n, math.pi + bet12a, sbet1, -cbet1, sbet2, cbet2, cbet1, cbet2, dummy, False, C1a, C2a) x = -1 + m12a/(self._f1 * cbet1 * cbet2 * m0 * math.pi) betscale = (sbet12a / x if x < -real(0.01) else -self._f * Math.sq(cbet1) * math.pi) lamscale = betscale / cbet1 y = (lam12 - math.pi) / lamscale if y > -Geodesic.tol1_ and x > -1 - Geodesic.xthresh_: # strip near cut if self._f >= 0: salp1 = min(1.0, -x); calp1 = - math.sqrt(1 - Math.sq(salp1)) else: calp1 = max((0.0 if x > -Geodesic.tol1_ else -1.0), x) salp1 = math.sqrt(1 - Math.sq(calp1)) else: # Estimate alp1, by solving the astroid problem. # # Could estimate alpha1 = theta + pi/2, directly, i.e., # calp1 = y/k; salp1 = -x/(1+k); for _f >= 0 # calp1 = x/(1+k); salp1 = -y/k; for _f < 0 (need to check) # # However, it's better to estimate omg12 from astroid and use # spherical formula to compute alp1. This reduces the mean number of # Newton iterations for astroid cases from 2.24 (min 0, max 6) to 2.12 # (min 0 max 5). The changes in the number of iterations are as # follows: # # change percent # 1 5 # 0 78 # -1 16 # -2 0.6 # -3 0.04 # -4 0.002 # # The histogram of iterations is (m = number of iterations estimating # alp1 directly, n = number of iterations estimating via omg12, total # number of trials = 148605): # # iter m n # 0 148 186 # 1 13046 13845 # 2 93315 102225 # 3 36189 32341 # 4 5396 7 # 5 455 1 # 6 56 0 # # Because omg12 is near pi, estimate work with omg12a = pi - omg12 k = Geodesic.Astroid(x, y) omg12a = lamscale * ( -x * k/(1 + k) if self._f >= 0 else -y * (1 + k)/k ) somg12 = math.sin(omg12a); comg12 = -math.cos(omg12a) # Update spherical estimate of alp1 using omg12 instead of lam12 salp1 = cbet2 * somg12 calp1 = sbet12a - cbet2 * sbet1 * Math.sq(somg12) / (1 - comg12) salp1, calp1 = Geodesic.SinCosNorm(salp1, calp1) return sig12, salp1, calp1, salp2, calp2 # return lam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, eps, # domg12, dlam12 def Lambda12(self, sbet1, cbet1, sbet2, cbet2, salp1, calp1, diffp, # Scratch areas of the right size C1a, C2a, C3a): if sbet1 == 0 and calp1 == 0: # Break degeneracy of equatorial line. This case has already been # handled. calp1 = -Geodesic.tiny_ # sin(alp1) * cos(bet1) = sin(alp0) salp0 = salp1 * cbet1 calp0 = math.hypot(calp1, salp1 * sbet1) # calp0 > 0 # real somg1, comg1, somg2, comg2, omg12, lam12 # tan(bet1) = tan(sig1) * cos(alp1) # tan(omg1) = sin(alp0) * tan(sig1) = tan(omg1)=tan(alp1)*sin(bet1) ssig1 = sbet1; somg1 = salp0 * sbet1 csig1 = comg1 = calp1 * cbet1 ssig1, csig1 = Geodesic.SinCosNorm(ssig1, csig1) # SinCosNorm(somg1, comg1); -- don't need to normalize! # Enforce symmetries in the case abs(bet2) = -bet1. Need to be careful # about this case, since this can yield singularities in the Newton # iteration. # sin(alp2) * cos(bet2) = sin(alp0) salp2 = salp0 / cbet2 if cbet2 != cbet1 else salp1 # calp2 = sqrt(1 - sq(salp2)) # = sqrt(sq(calp0) - sq(sbet2)) / cbet2 # and subst for calp0 and rearrange to give (choose positive sqrt # to give alp2 in [0, pi/2]). calp2 = (math.sqrt(Math.sq(calp1 * cbet1) + ((cbet2 - cbet1) * (cbet1 + cbet2) if cbet1 < -sbet1 else (sbet1 - sbet2) * (sbet1 + sbet2))) / cbet2 if cbet2 != cbet1 or abs(sbet2) != -sbet1 else abs(calp1)) # tan(bet2) = tan(sig2) * cos(alp2) # tan(omg2) = sin(alp0) * tan(sig2). ssig2 = sbet2; somg2 = salp0 * sbet2 csig2 = comg2 = calp2 * cbet2 ssig2, csig2 = Geodesic.SinCosNorm(ssig2, csig2) # SinCosNorm(somg2, comg2); -- don't need to normalize! # sig12 = sig2 - sig1, limit to [0, pi] sig12 = math.atan2(max(csig1 * ssig2 - ssig1 * csig2, 0.0), csig1 * csig2 + ssig1 * ssig2) # omg12 = omg2 - omg1, limit to [0, pi] omg12 = math.atan2(max(comg1 * somg2 - somg1 * comg2, 0.0), comg1 * comg2 + somg1 * somg2) # real B312, h0 k2 = Math.sq(calp0) * self._ep2 eps = k2 / (2 * (1 + math.sqrt(1 + k2)) + k2) self.C3f(eps, C3a) B312 = (Geodesic.SinCosSeries(True, ssig2, csig2, C3a, Geodesic.nC3_-1) - Geodesic.SinCosSeries(True, ssig1, csig1, C3a, Geodesic.nC3_-1)) h0 = -self._f * self.A3f(eps) domg12 = salp0 * h0 * (sig12 + B312) lam12 = omg12 + domg12 if diffp: if calp2 == 0: dlam12 = - 2 * math.sqrt(1 - self._e2 * Math.sq(cbet1)) / sbet1 else: dummy, dlam12, dummy, dummy, dummy = self.Lengths( eps, sig12, ssig1, csig1, ssig2, csig2, cbet1, cbet2, False, C1a, C2a) dlam12 /= calp2 * cbet2 else: dlam12 = Math.nan return (lam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, eps, domg12, dlam12) # return a12, s12, azi1, azi2, m12, M12, M21, S12 def GenInverse(self, lat1, lon1, lat2, lon2, outmask): a12 = s12 = azi1 = azi2 = m12 = M12 = M21 = S12 = Math.nan # return vals outmask &= Geodesic.OUT_ALL lon1 = Geodesic.AngNormalize(lon1) lon12 = Geodesic.AngNormalize(Geodesic.AngNormalize(lon2) - lon1) # If very close to being on the same meridian, then make it so. # Not sure this is necessary... lon12 = Geodesic.AngRound(lon12) # Make longitude difference positive. lonsign = 1 if lon12 >= 0 else -1 lon12 *= lonsign if lon12 == 180: lonsign = 1 # If really close to the equator, treat as on equator. lat1 = Geodesic.AngRound(lat1) lat2 = Geodesic.AngRound(lat2) # Swap points so that point with higher (abs) latitude is point 1 swapp = 1 if abs(lat1) >= abs(lat2) else -1 if swapp < 0: lonsign *= -1 lat2, lat1 = lat1, lat2 # Make lat1 <= 0 latsign = 1 if lat1 < 0 else -1 lat1 *= latsign lat2 *= latsign # Now we have # # 0 <= lon12 <= 180 # -90 <= lat1 <= 0 # lat1 <= lat2 <= -lat1 # # longsign, swapp, latsign register the transformation to bring the # coordinates to this canonical form. In all cases, 1 means no change was # made. We make these transformations so that there are few cases to # check, e.g., on verifying quadrants in atan2. In addition, this # enforces some symmetries in the results returned. # real phi, sbet1, cbet1, sbet2, cbet2, s12x, m12x phi = lat1 * Math.degree # Ensure cbet1 = +epsilon at poles sbet1 = self._f1 * math.sin(phi) cbet1 = Geodesic.tiny_ if lat1 == -90 else math.cos(phi) sbet1, cbet1 = Geodesic.SinCosNorm(sbet1, cbet1) phi = lat2 * Math.degree # Ensure cbet2 = +epsilon at poles sbet2 = self._f1 * math.sin(phi) cbet2 = Geodesic.tiny_ if abs(lat2) == 90 else math.cos(phi) sbet2, cbet2 = Geodesic.SinCosNorm(sbet2, cbet2) # If cbet1 < -sbet1, then cbet2 - cbet1 is a sensitive measure of the # |bet1| - |bet2|. Alternatively (cbet1 >= -sbet1), abs(sbet2) + sbet1 is # a better measure. This logic is used in assigning calp2 in Lambda12. # Sometimes these quantities vanish and in that case we force bet2 = +/- # bet1 exactly. An example where is is necessary is the inverse problem # 48.522876735459 0 -48.52287673545898293 179.599720456223079643 # which failed with Visual Studio 10 (Release and Debug) if cbet1 < -sbet1: if cbet2 == cbet1: sbet2 = sbet1 if sbet2 < 0 else -sbet1 else: if abs(sbet2) == -sbet1: cbet2 = cbet1 lam12 = lon12 * Math.degree slam12 = 0 if lon12 == 180 else math.sin(lam12) clam12 = math.cos(lam12) # lon12 == 90 isn't interesting # real a12, sig12, calp1, salp1, calp2, salp2 # index zero elements of these arrays are unused C1a = range(Geodesic.nC1_ + 1) C2a = range(Geodesic.nC2_ + 1) C3a = range(Geodesic.nC3_) meridian = lat1 == -90 or slam12 == 0 if meridian: # Endpoints are on a single full meridian, so the geodesic might lie on # a meridian. calp1 = clam12; salp1 = slam12 # Head to the target longitude calp2 = 1; salp2 = 0 # At the target we're heading north # tan(bet) = tan(sig) * cos(alp) ssig1 = sbet1; csig1 = calp1 * cbet1 ssig2 = sbet2; csig2 = calp2 * cbet2 # sig12 = sig2 - sig1 sig12 = math.atan2(max(csig1 * ssig2 - ssig1 * csig2, 0.0), csig1 * csig2 + ssig1 * ssig2) s12x, m12x, dummy, M12, M21 = self.Lengths( self._n, sig12, ssig1, csig1, ssig2, csig2, cbet1, cbet2, (outmask & Geodesic.GEODESICSCALE) != 0, C1a, C2a) # Add the check for sig12 since zero length geodesics might yield m12 < # 0. Test case was # # echo 20.001 0 20.001 0 | Geod -i # # In fact, we will have sig12 > pi/2 for meridional geodesic which is # not a shortest path. if sig12 < 1 or m12x >= 0: m12x *= self._a s12x *= self._b a12 = sig12 / Math.degree else: # m12 < 0, i.e., prolate and too close to anti-podal meridian = False # end if meridian: #real omg12 if (not meridian and sbet1 == 0 and # and sbet2 == 0 # Mimic the way Lambda12 works with calp1 = 0 (self._f <= 0 or lam12 <= math.pi - self._f * math.pi)): # Geodesic runs along equator calp1 = calp2 = 0; salp1 = salp2 = 1 s12x = self._a * lam12 m12x = self._b * math.sin(lam12 / self._f1) if outmask & Geodesic.GEODESICSCALE: M12 = M21 = math.cos(lam12 / self._f1) a12 = lon12 / self._f1 sig12 = omg12 = lam12 / self._f1 elif not meridian: # Now point1 and point2 belong within a hemisphere bounded by a # meridian and geodesic is neither meridional or equatorial. # Figure a starting point for Newton's method sig12, salp1, calp1, salp2, calp2 = self.InverseStart( sbet1, cbet1, sbet2, cbet2, lam12, C1a, C2a) if sig12 >= 0: # Short lines (InverseStart sets salp2, calp2) wm = math.sqrt(1 - self._e2 * Math.sq((cbet1 + cbet2) / 2)) s12x = sig12 * self._a * wm m12x = (Math.sq(wm) * self._a / self._f1 * math.sin(sig12 * self._f1 / wm)) if outmask & Geodesic.GEODESICSCALE: M12 = M21 = math.cos(sig12 * self._f1 / wm) a12 = sig12 / Math.degree omg12 = lam12 / wm else: # Newton's method # real ssig1, csig1, ssig2, csig2, eps ov = numit = trip = 0 while numit < Geodesic.maxit_: (nlam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, eps, omg12, dv) = self.Lambda12( sbet1, cbet1, sbet2, cbet2, salp1, calp1, trip < 1, C1a, C2a, C3a) v = nlam12 - lam12 if not(abs(v) > Geodesic.tiny_) or not(trip < 1): if not(abs(v) <= max(Geodesic.tol1_, ov)): numit = Geodesic.maxit_ break dalp1 = -v/dv sdalp1 = math.sin(dalp1); cdalp1 = math.cos(dalp1) nsalp1 = salp1 * cdalp1 + calp1 * sdalp1 calp1 = calp1 * cdalp1 - salp1 * sdalp1 salp1 = max(0.0, nsalp1) salp1, calp1 = Geodesic.SinCosNorm(salp1, calp1) # In some regimes we don't get quadratic convergence because slope # -> 0. So use convergence conditions based on epsilon instead of # sqrt(epsilon). The first criterion is a test on abs(v) against # 100 * epsilon. The second takes credit for an anticipated # reduction in abs(v) by v/ov (due to the latest update in alp1) and # checks this against epsilon. if not(abs(v) >= Geodesic.tol1_ and Math.sq(v) >= ov * Geodesic.tol0_): trip += 1 ov = abs(v) numit += 1 if numit >= Geodesic.maxit_: # Signal failure. return a12, s12, azi1, azi2, m12, M12, M21, S12 s12x, m12x, dummy, M12, M21 = self.Lengths( eps, sig12, ssig1, csig1, ssig2, csig2, cbet1, cbet2, (outmask & Geodesic.GEODESICSCALE) != 0, C1a, C2a) m12x *= self._a s12x *= self._b a12 = sig12 / Math.degree omg12 = lam12 - omg12 # end elif not meridian if outmask & Geodesic.DISTANCE: s12 = 0 + s12x # Convert -0 to 0 if outmask & Geodesic.REDUCEDLENGTH: m12 = 0 + m12x # Convert -0 to 0 if outmask & Geodesic.AREA: # From Lambda12: sin(alp1) * cos(bet1) = sin(alp0) salp0 = salp1 * cbet1 calp0 = math.hypot(calp1, salp1 * sbet1) # calp0 > 0 # real alp12 if calp0 != 0 and salp0 != 0: # From Lambda12: tan(bet) = tan(sig) * cos(alp) ssig1 = sbet1; csig1 = calp1 * cbet1 ssig2 = sbet2; csig2 = calp2 * cbet2 k2 = Math.sq(calp0) * self._ep2 # Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0). A4 = Math.sq(self._a) * calp0 * salp0 * self._e2 ssig1, csig1 = Geodesic.SinCosNorm(ssig1, csig1) ssig2, csig2 = Geodesic.SinCosNorm(ssig2, csig2) C4a = range(Geodesic.nC4_) self.C4f(k2, C4a) B41 = Geodesic.SinCosSeries(False, ssig1, csig1, C4a, Geodesic.nC4_) B42 = Geodesic.SinCosSeries(False, ssig2, csig2, C4a, Geodesic.nC4_) S12 = A4 * (B42 - B41) else: # Avoid problems with indeterminate sig1, sig2 on equator S12 = 0 if (not meridian and omg12 < 0.75 * math.pi and # Long difference too big sbet2 - sbet1 < 1.75): # Lat difference too big # Use tan(Gamma/2) = tan(omg12/2) # * (tan(bet1/2)+tan(bet2/2))/(1+tan(bet1/2)*tan(bet2/2)) # with tan(x/2) = sin(x)/(1+cos(x)) somg12 = math.sin(omg12); domg12 = 1 + math.cos(omg12) dbet1 = 1 + cbet1; dbet2 = 1 + cbet2 alp12 = 2 * math.atan2( somg12 * ( sbet1 * dbet2 + sbet2 * dbet1 ), domg12 * ( sbet1 * sbet2 + dbet1 * dbet2 ) ) else: # alp12 = alp2 - alp1, used in atan2 so no need to normalize salp12 = salp2 * calp1 - calp2 * salp1 calp12 = calp2 * calp1 + salp2 * salp1 # The right thing appears to happen if alp1 = +/-180 and alp2 = 0, viz # salp12 = -0 and alp12 = -180. However this depends on the sign # being attached to 0 correctly. The following ensures the correct # behavior. if salp12 == 0 and calp12 < 0: salp12 = Geodesic.tiny_ * calp1 calp12 = -1 alp12 = math.atan2(salp12, calp12) S12 += self._c2 * alp12 S12 *= swapp * lonsign * latsign # Convert -0 to 0 S12 += 0 # Convert calp, salp to azimuth accounting for lonsign, swapp, latsign. if swapp < 0: salp2, salp1 = salp1, salp2 calp2, calp1 = calp1, calp2 if outmask & Geodesic.GEODESICSCALE: M21, M12 = M12, M21 salp1 *= swapp * lonsign; calp1 *= swapp * latsign salp2 *= swapp * lonsign; calp2 *= swapp * latsign if outmask & Geodesic.AZIMUTH: # minus signs give range [-180, 180). 0- converts -0 to +0. azi1 = 0 - math.atan2(-salp1, calp1) / Math.degree azi2 = 0 - math.atan2(-salp2, calp2) / Math.degree # Returned value in [0, 180] return a12, s12, azi1, azi2, m12, M12, M21, S12 def CheckPosition(lat, lon): if not (abs(lat) <= 90): raise ValueError("latitude " + str(lat) + " not in [-90, 90]") if not (lon >= -180 and lon <= 360): raise ValueError("longitude " + str(lon) + " not in [-180, 360]") return Geodesic.AngNormalize(lon) CheckPosition = staticmethod(CheckPosition) def CheckAzimuth(azi): if not (azi >= -180 and azi <= 360): raise ValueError("azimuth " + str(azi) + " not in [-180, 360]") return Geodesic.AngNormalize(azi) CheckAzimuth = staticmethod(CheckAzimuth) def CheckDistance(s): if not (Math.isfinite(s)): raise ValueError("distance " + str(s) + " not a finite number") CheckDistance = staticmethod(CheckDistance) def Inverse(self, lat1, lon1, lat2, lon2, outmask = DISTANCE | AZIMUTH): """ Solve the inverse geodesic problem. Compute geodesic between (lat1, lon1) and (lat2, lon2). Return a dictionary with (some) of the following entries: lat1 latitude of point 1 lon1 longitude of point 1 azi1 azimuth of line at point 1 lat2 latitude of point 2 lon2 longitude of point 2 azi2 azimuth of line at point 2 s12 distance from 1 to 2 a12 arc length on auxiliary sphere from 1 to 2 m12 reduced length of geodesic M12 geodesic scale 2 relative to 1 M21 geodesic scale 1 relative to 2 S12 area between geodesic and equator outmask determines which fields get included and if outmask is omitted, then only the basic geodesic fields are computed. The mask is an or'ed combination of the following values Geodesic.LATITUDE Geodesic.LONGITUDE Geodesic.AZIMUTH Geodesic.DISTANCE Geodesic.REDUCEDLENGTH Geodesic.GEODESICSCALE Geodesic.AREA Geodesic.ALL """ lon1 = Geodesic.CheckPosition(lat1, lon1) lon2 = Geodesic.CheckPosition(lat2, lon2) result = {'lat1': lat1, 'lon1': lon1, 'lat2': lat2, 'lon2': lon2} a12, s12, azi1, azi2, m12, M12, M21, S12 = self.GenInverse( lat1, lon1, lat2, lon2, outmask) outmask &= Geodesic.OUT_ALL result['a12'] = a12 if outmask & Geodesic.DISTANCE: result['s12'] = s12 if outmask & Geodesic.AZIMUTH: result['azi1'] = azi1; result['azi2'] = azi2 if outmask & Geodesic.REDUCEDLENGTH: result['m12'] = m12 if outmask & Geodesic.GEODESICSCALE: result['M12'] = M12; result['M21'] = M21 if outmask & Geodesic.AREA: result['S12'] = S12 return result # return a12, lat2, lon2, azi2, s12, m12, M12, M21, S12 def GenDirect(self, lat1, lon1, azi1, arcmode, s12_a12, outmask): from geographiclib.geodesicline import GeodesicLine line = GeodesicLine( self, lat1, lon1, azi1, # Automatically supply DISTANCE_IN if necessary outmask | ( Geodesic.NONE if arcmode else Geodesic.DISTANCE_IN)) return line.GenPosition(arcmode, s12_a12, outmask) def Direct(self, lat1, lon1, azi1, s12, outmask = LATITUDE | LONGITUDE | AZIMUTH): """ Solve the direct geodesic problem. Compute geodesic starting at (lat1, lon1) with azimuth azi1 and length s12. Return a dictionary with (some) of the following entries: lat1 latitude of point 1 lon1 longitude of point 1 azi1 azimuth of line at point 1 lat2 latitude of point 2 lon2 longitude of point 2 azi2 azimuth of line at point 2 s12 distance from 1 to 2 a12 arc length on auxiliary sphere from 1 to 2 m12 reduced length of geodesic M12 geodesic scale 2 relative to 1 M21 geodesic scale 1 relative to 2 S12 area between geodesic and equator outmask determines which fields get included and if outmask is omitted, then only the basic geodesic fields are computed. The mask is an or'ed combination of the following values Geodesic.LATITUDE Geodesic.LONGITUDE Geodesic.AZIMUTH Geodesic.DISTANCE Geodesic.REDUCEDLENGTH Geodesic.GEODESICSCALE Geodesic.AREA Geodesic.ALL """ lon1 = Geodesic.CheckPosition(lat1, lon1) azi1 = Geodesic.CheckAzimuth(azi1) Geodesic.CheckDistance(s12) result = {'lat1': lat1, 'lon1': lon1, 'azi1': azi1, 's12': s12} a12, lat2, lon2, azi2, s12, m12, M12, M21, S12 = self.GenDirect( lat1, lon1, azi1, False, s12, outmask) outmask &= Geodesic.OUT_ALL result['a12'] = a12 if outmask & Geodesic.LATITUDE: result['lat2'] = lat2 if outmask & Geodesic.LONGITUDE: result['lon2'] = lon2 if outmask & Geodesic.AZIMUTH: result['azi2'] = azi2 if outmask & Geodesic.REDUCEDLENGTH: result['m12'] = m12 if outmask & Geodesic.GEODESICSCALE: result['M12'] = M12; result['M21'] = M21 if outmask & Geodesic.AREA: result['S12'] = S12 return result def Line(self, lat1, lon1, azi1, caps = ALL): """ Return a GeodesicLine object to compute points along a geodesic starting at lat1, lon1, with azimuth azi1. caps is an or'ed combination of bit the following values indicating the capabilities of the return object Geodesic.LATITUDE Geodesic.LONGITUDE Geodesic.AZIMUTH Geodesic.DISTANCE Geodesic.REDUCEDLENGTH Geodesic.GEODESICSCALE Geodesic.AREA Geodesic.DISTANCE_IN Geodesic.ALL """ from geographiclib.geodesicline import GeodesicLine lon1 = Geodesic.CheckPosition(lat1, lon1) azi1 = Geodesic.CheckAzimuth(azi1) return GeodesicLine( self, lat1, lon1, azi1, # Automatically supply DISTANCE_IN caps | Geodesic.DISTANCE_IN) def Area(self, points, polyline = False): """ Compute the area of a geodesic polygon given by points, an array of dictionaries with entries lat and lon. Return a dictionary with entries number the number of verices perimeter the perimeter area the area (counter-clockwise traversal positive) There is no need to "close" the polygon. If polyline is set to True, then the points define a polyline instead of a polygon, the length is returned as the perimeter, and the area is not returned. """ from geographiclib.polygonarea import PolygonArea for p in points: Geodesic.CheckPosition(p['lat'], p['lon']) num, perimeter, area = PolygonArea.Area(self, points, polyline) result = {'number': num, 'perimeter': perimeter} if not polyline: result['area'] = area return result Geodesic.WGS84 = Geodesic(Constants.WGS84_a, Constants.WGS84_f) geographiclib-1.21/python/geographiclib/geomath.py0000644000175000017500000000423511745620415022203 0ustar frankiefrankie# geomath.py # # This is a rather literal translation of the GeographicLib::Math class # to python. See the documentation for the C++ class for more # information at # # http://geographiclib.sourceforge.net/html/annotated.html # # Copyright (c) Charles Karney (2011) and licensed # under the MIT/X11 License. For more information, see # http://geographiclib.sourceforge.net/ # # $Id: 9c5444e65f8541f8528ef2a504465e5565987c15 $ ###################################################################### import sys import math class Math(object): """ Additional math routines for GeographicLib. This defines constants: epsilon, difference between 1 and the next bigger number minval, minimum positive number maxval, maximum finite number degree, the number of radians in a degree nan, not a number int, infinity """ epsilon = math.pow(2.0, -52) minval = math.pow(2.0, -1022) maxval = math.pow(2.0, 1023) * (2 - epsilon) degree = math.pi/180 nan = float("nan") inf = float("inf") def sq(x): """Square a number""" return x * x sq = staticmethod(sq) def cbrt(x): """Real cube root of a number""" y = math.pow(abs(x), 1/3.0) return y if x >= 0 else -y cbrt = staticmethod(cbrt) def log1p(x): """log(1 + x) accurate for small x (missing from python 2.5.2)""" if sys.version_info > (2, 6): return math.log1p(x) y = 1 + x z = y - 1 # Here's the explanation for this magic: y = 1 + z, exactly, and z # approx x, thus log(y)/z (which is nearly constant near z = 0) returns # a good approximation to the true log(1 + x)/x. The multiplication x * # (log(y)/z) introduces little additional error. return x if z == 0 else x * math.log(y) / z log1p = staticmethod(log1p) def atanh(x): """atanh(x) (missing from python 2.5.2)""" if sys.version_info > (2, 6): return math.atanh(x) y = abs(x) # Enforce odd parity y = Math.log1p(2 * y/(1 - y))/2 return -y if x < 0 else y atanh = staticmethod(atanh) def isfinite(x): """Test for finiteness""" return abs(x) <= Math.maxval isfinite = staticmethod(isfinite) geographiclib-1.21/python/geographiclib/CMakeLists.txt0000644000175000017500000000126611745620415022746 0ustar frankiefrankie# $Id: 1cd13969a90a73112ab8c4bd44fc2194ff0af9ff $ # Install the python files. # Probably full-time python users should install the python package from # http://pypi.python.org/pypi/geographiclib file (GLOB PYTHON_FILES *.py) install (FILES ${PYTHON_FILES} DESTINATION lib/python/site-packages/geographiclib) # Only install setup.py under Windows because the installation tree is, # e.g., c:/Program Files/GeographicLib/lib/python/site-packages. Don't # install on other systems where this command would create, e.g., # /usr/local/lib/python/site-packages/setup.py which is likely to cause # conflicts. if (WIN32) install (FILES ../setup.py DESTINATION lib/python/site-packages) endif () geographiclib-1.21/python/geographiclib/constants.py0000644000175000017500000000133211745620415022566 0ustar frankiefrankie# constants.py # # This is a translation of the GeographicLib::Constants class to python. # See the documentation for the C++ class for more information at # # http://geographiclib.sourceforge.net/html/annotated.html # # Copyright (c) Charles Karney (2011) and licensed # under the MIT/X11 License. For more information, see # http://geographiclib.sourceforge.net/ # # $Id: dd3c90107aedf80bead4c3f5c670df2b3eed7492 $ ###################################################################### class Constants(object): """ WGS84 constants: WGS84_a, the equatorial radius in meters WGS84_f, the flattening of the ellipsoid """ WGS84_a = 6378137.0 # meters WGS84_f = 1/298.257223563 geographiclib-1.21/python/geographiclib/accumulator.py0000644000175000017500000000616411745620415023101 0ustar frankiefrankie# accumulator.py # # This is a rather literal translation of the GeographicLib::Accumulator # class from to python. See the documentation for the C++ class for # more information at # # http://geographiclib.sourceforge.net/html/annotated.html # # Copyright (c) Charles Karney (2011) and licensed # under the MIT/X11 License. For more information, see # http://geographiclib.sourceforge.net/ # # $Id: bbf905e5f404f97b10497ac32fa02b4203cb0c7d $ ###################################################################### class Accumulator(object): """Like math.fsum, but allows a running sum""" def sum(u, v): # Error free transformation of a sum. Note that t can be the same as one # of the first two arguments. s = u + v up = s - v vpp = s - up up -= u vpp -= v t = -(up + vpp) # u + v = s + t # = round(u + v) + t return s, t sum = staticmethod(sum) def Set(self, y = 0.0): if type(self) == type(y): self._s, self._t = y._s, y._t else: self._s, self._t = float(y), 0.0 def __init__(self, y = 0.0): self.Set(y) def Add(self, y): # Here's Shewchuk's solution... # hold exact sum as [s, t, u] y, u = Accumulator.sum(y, self._t) # Accumulate starting at self._s, self._t = Accumulator.sum(y, self._s) # least significant end # Start is _s, _t decreasing and non-adjacent. Sum is now (s + t + u) # exactly with s, t, u non-adjacent and in decreasing order (except # for possible zeros). The following code tries to normalize the # result. Ideally, we want _s = round(s+t+u) and _u = round(s+t+u - # _s). The follow does an approximate job (and maintains the # decreasing non-adjacent property). Here are two "failures" using # 3-bit floats: # # Case 1: _s is not equal to round(s+t+u) -- off by 1 ulp # [12, -1] - 8 -> [4, 0, -1] -> [4, -1] = 3 should be [3, 0] = 3 # # Case 2: _s+_t is not as close to s+t+u as it shold be # [64, 5] + 4 -> [64, 8, 1] -> [64, 8] = 72 (off by 1) # should be [80, -7] = 73 (exact) # # "Fixing" these problems is probably not worth the expense. The # representation inevitably leads to small errors in the accumulated # values. The additional errors illustrated here amount to 1 ulp of # the less significant word during each addition to the Accumulator # and an additional possible error of 1 ulp in the reported sum. # # Incidentally, the "ideal" representation described above is not # canonical, because _s = round(_s + _t) may not be true. For # example, with 3-bit floats: # # [128, 16] + 1 -> [160, -16] -- 160 = round(145). # But [160, 0] - 16 -> [128, 16] -- 128 = round(144). # if self._s == 0: # This implies t == 0, self._s = u # so result is u else: self._t += u # otherwise just accumulate u to t. def Sum(self, y = 0.0): if y == 0.0: return self._s else: b = Accumulator(self) b.Add(y) return b._s def Negate(self): self._s *= -1 self._t *= -1 geographiclib-1.21/python/geographiclib/polygonarea.py0000644000175000017500000001245611745620415023103 0ustar frankiefrankie# polygonarea.py # # This is a rather literal translation of the GeographicLib::PolygonArea # class to python. See the documentation for the C++ class for more # information at # # http://geographiclib.sourceforge.net/html/annotated.html # # Copyright (c) Charles Karney (2011) and licensed # under the MIT/X11 License. For more information, see # http://geographiclib.sourceforge.net/ # # $Id: 4a2cf9d0cb7eeb7c9c3a2248f44e84a04e4e0b35 $ ###################################################################### import math from geographiclib.geomath import Math from geographiclib.accumulator import Accumulator class PolygonArea(object): """Area of a geodesic polygon""" def transit(lon1, lon2): # Return 1 or -1 if crossing prime meridian in east or west direction. # Otherwise return zero. from geographiclib.geodesic import Geodesic lon1 = Geodesic.AngNormalize(lon1) lon2 = Geodesic.AngNormalize(lon2) # treat lon12 = -180 as an eastward geodesic, so convert to 180. lon12 = -Geodesic.AngNormalize(lon1 - lon2) # In (-180, 180] cross = (1 if lon1 < 0 and lon2 >= 0 and lon12 > 0 else (-1 if lon2 < 0 and lon1 >= 0 and lon12 < 0 else 0)) return cross transit = staticmethod(transit) def __init__(self, earth, polyline = False): from geographiclib.geodesic import Geodesic self._earth = earth self._area0 = 4 * math.pi * earth._c2 self._polyline = polyline self._mask = Geodesic.DISTANCE | (0 if self._polyline else Geodesic.AREA) if not self._polyline: self._areasum = Accumulator() self._perimetersum = Accumulator() self.Clear() def Clear(self): self._num = 0 self._crossings = 0 if not self._polyline: self._areasum.Set(0) self._perimetersum.Set(0) self._lat0 = self._lon0 = self._lat1 = self._lon1 = 0 def AddPoint(self, lat, lon): if self._num == 0: self._lat0 = self._lat1 = lat self._lon0 = self._lon1 = lon else: t, s12, t, t, t, t, t, S12 = self._earth.GenInverse( self._lat1, self._lon1, lat, lon, self._mask) self._perimetersum.Add(s12) if not self._polyline: self._areasum.Add(S12) self._crossings += PolygonArea.transit(self._lon1, lon) self._lat1 = lat self._lon1 = lon self._num += 1 # return number, perimeter, area def Compute(self, reverse, sign): if self._polyline: area = Math.nan if self._num < 2: perimeter = 0 if not self._polyline: area = 0 return self._num, perimeter, area if self._polyline: perimeter = self._perimetersum.Sum() return self._num, perimeter, area t, s12, t, t, t, t, t, S12 = self._earth.GenInverse( self._lat1, self._lon1, self._lat0, self._lon0, self._mask) perimeter = self._perimetersum.Sum(s12) tempsum = Accumulator(self._areasum) tempsum.Add(S12) crossings = self._crossings + PolygonArea.transit(self._lon1, self._lon0) if crossings & 1: tempsum.Add( (1 if tempsum < 0 else -1) * self._area0/2 ) # area is with the clockwise sense. If !reverse convert to # counter-clockwise convention. if not reverse: tempsum.Negate() # If sign put area in (-area0/2, area0/2], else put area in [0, area0) if sign: if tempsum.Sum() > self._area0/2: tempsum.Add( -self._area0 ) elif tempsum.Sum() <= -self._area0/2: tempsum.Add( +self._area0 ) else: if tempsum.Sum() >= self._area0: tempsum.Add( -self._area0 ) elif tempsum.Sum() < 0: tempsum.Add( +self._area0 ) area = 0 + tempsum.Sum() return self._num, perimeter, area # return number, perimeter, area def TestCompute(self, lat, lon, reverse, sign): if self._polyline: area = Math.nan if self._num == 0: perimeter = 0 if not self._polyline: area = 0 return 1, perimeter, area perimeter = self._perimetersum.Sum() tempsum = 0 if self._polyline else self._areasum.Sum() crossings = self._crossings; num = self._num + 1 for i in ([0] if self._polyline else [0, 1]): t, s12, t, t, t, t, t, S12 = self._earth.GenInverse( self._lat1 if i == 0 else lat, self._lon1 if i == 0 else lon, self._lat0 if i != 0 else lat, self._lon0 if i != 0 else lon, self._mask) perimeter += s12 if not self._polyline: tempsum += S12 crossings += PolygonArea.transit(self._lon1 if i == 0 else lon, self._lon0 if i != 0 else lon) if self._polyline: return num, perimeter, area if crossings & 1: tempsum += (1 if tempsum < 0 else -1) * self._area0/2 # area is with the clockwise sense. If !reverse convert to # counter-clockwise convention. if not reverse: tempsum *= -1 # If sign put area in (-area0/2, area0/2], else put area in [0, area0) if sign: if tempsum > self._area0/2: tempsum -= self._area0 elif tempsum <= -self._area0/2: tempsum += self._area0 else: if tempsum >= self._area0: tempsum -= self._area0 elif tempsum < 0: tempsum += self._area0 area = 0 + tempsum return num, perimeter, area def Area(earth, points, polyline): poly = PolygonArea(earth, polyline) for p in points: poly.AddPoint(p['lat'], p['lon']) return poly.Compute(False, True) Area = staticmethod(Area) geographiclib-1.21/python/geographiclib/geodesicline.py0000644000175000017500000003124011745620415023205 0ustar frankiefrankie# geodesicline.py # # This is a rather literal translation of the # GeographicLib::GeodesicLine class to python. See the documentation # for the C++ class for more information at # # http://geographiclib.sourceforge.net/html/annotated.html # # The algorithms are derived in # # Charles F. F. Karney, # Geodesics on an ellipsoid of revolution, Feb. 2011, # http://arxiv.org/abs/1102.1215 # errata: http://geographiclib.sourceforge.net/geod-errata.html # # Charles F. F. Karney, # Algorithms for geodesics, Sept. 2011, # http://arxiv.org/abs/1109.4448 # # Copyright (c) Charles Karney (2011) and licensed # under the MIT/X11 License. For more information, see # http://geographiclib.sourceforge.net/ # # $Id: d5d0b60d8d88eaea0cdc504a6b73fc6fb6049f0c $ ###################################################################### import math from geographiclib.geomath import Math from geographiclib.geodesiccapability import GeodesicCapability class GeodesicLine(object): """Points on a geodesic path""" def __init__(self, geod, lat1, lon1, azi1, caps = GeodesicCapability.ALL): from geographiclib.geodesic import Geodesic self._a = geod._a self._f = geod._f self._b = geod._b self._c2 = geod._c2 self._f1 = geod._f1 self._caps = caps | Geodesic.LATITUDE | Geodesic.AZIMUTH azi1 = Geodesic.AngNormalize(azi1) # Guard against underflow in salp0 azi1 = Geodesic.AngRound(azi1) lon1 = Geodesic.AngNormalize(lon1) self._lat1 = lat1 self._lon1 = lon1 self._azi1 = azi1 # alp1 is in [0, pi] alp1 = azi1 * Math.degree # Enforce sin(pi) == 0 and cos(pi/2) == 0. Better to face the ensuing # problems directly than to skirt them. self._salp1 = 0 if azi1 == -180 else math.sin(alp1) self._calp1 = 0 if abs(azi1) == 90 else math.cos(alp1) # real cbet1, sbet1, phi phi = lat1 * Math.degree # Ensure cbet1 = +epsilon at poles sbet1 = self._f1 * math.sin(phi) cbet1 = Geodesic.tiny_ if abs(lat1) == 90 else math.cos(phi) sbet1, cbet1 = Geodesic.SinCosNorm(sbet1, cbet1) # Evaluate alp0 from sin(alp1) * cos(bet1) = sin(alp0), self._salp0 = self._salp1 * cbet1 # alp0 in [0, pi/2 - |bet1|] # Alt: calp0 = hypot(sbet1, calp1 * cbet1). The following # is slightly better (consider the case salp1 = 0). self._calp0 = math.hypot(self._calp1, self._salp1 * sbet1) # Evaluate sig with tan(bet1) = tan(sig1) * cos(alp1). # sig = 0 is nearest northward crossing of equator. # With bet1 = 0, alp1 = pi/2, we have sig1 = 0 (equatorial line). # With bet1 = pi/2, alp1 = -pi, sig1 = pi/2 # With bet1 = -pi/2, alp1 = 0 , sig1 = -pi/2 # Evaluate omg1 with tan(omg1) = sin(alp0) * tan(sig1). # With alp0 in (0, pi/2], quadrants for sig and omg coincide. # No atan2(0,0) ambiguity at poles since cbet1 = +epsilon. # With alp0 = 0, omg1 = 0 for alp1 = 0, omg1 = pi for alp1 = pi. self._ssig1 = sbet1; self._somg1 = self._salp0 * sbet1 self._csig1 = self._comg1 = (cbet1 * self._calp1 if sbet1 != 0 or self._calp1 != 0 else 1) # sig1 in (-pi, pi] self._ssig1, self._csig1 = Geodesic.SinCosNorm(self._ssig1, self._csig1) self._somg1, self._comg1 = Geodesic.SinCosNorm(self._somg1, self._comg1) self._k2 = Math.sq(self._calp0) * geod._ep2 eps = self._k2 / (2 * (1 + math.sqrt(1 + self._k2)) + self._k2) if self._caps & Geodesic.CAP_C1: self._A1m1 = Geodesic.A1m1f(eps) self._C1a = range(Geodesic.nC1_ + 1) Geodesic.C1f(eps, self._C1a) self._B11 = Geodesic.SinCosSeries( True, self._ssig1, self._csig1, self._C1a, Geodesic.nC1_) s = math.sin(self._B11); c = math.cos(self._B11) # tau1 = sig1 + B11 self._stau1 = self._ssig1 * c + self._csig1 * s self._ctau1 = self._csig1 * c - self._ssig1 * s # Not necessary because C1pa reverts C1a # _B11 = -SinCosSeries(true, _stau1, _ctau1, _C1pa, nC1p_) if self._caps & Geodesic.CAP_C1p: self._C1pa = range(Geodesic.nC1p_ + 1) Geodesic.C1pf(eps, self._C1pa) if self._caps & Geodesic.CAP_C2: self._A2m1 = Geodesic.A2m1f(eps) self._C2a = range(Geodesic.nC2_ + 1) Geodesic.C2f(eps, self._C2a) self._B21 = Geodesic.SinCosSeries( True, self._ssig1, self._csig1, self._C2a, Geodesic.nC2_) if self._caps & Geodesic.CAP_C3: self._C3a = range(Geodesic.nC3_) geod.C3f(eps, self._C3a) self._A3c = -self._f * self._salp0 * geod.A3f(eps) self._B31 = Geodesic.SinCosSeries( True, self._ssig1, self._csig1, self._C3a, Geodesic.nC3_-1) if self._caps & Geodesic.CAP_C4: self._C4a = range(Geodesic.nC4_) geod.C4f(self._k2, self._C4a) # Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0) self._A4 = Math.sq(self._a) * self._calp0 * self._salp0 * geod._e2 self._B41 = Geodesic.SinCosSeries( False, self._ssig1, self._csig1, self._C4a, Geodesic.nC4_) # return a12, lat2, lon2, azi2, s12, m12, M12, M21, S12 def GenPosition(self, arcmode, s12_a12, outmask): from geographiclib.geodesic import Geodesic a12 = lat2 = lon2 = azi2 = s12 = m12 = M12 = M21 = S12 = Math.nan outmask &= self._caps & Geodesic.OUT_ALL if not (arcmode or (self._caps & Geodesic.DISTANCE_IN & Geodesic.OUT_ALL)): # Uninitialized or impossible distance calculation requested return a12, lat2, lon2, azi2, s12, m12, M12, M21, S12 # Avoid warning about uninitialized B12. B12 = 0; AB1 = 0 if arcmode: # Interpret s12_a12 as spherical arc length sig12 = s12_a12 * Math.degree s12a = abs(s12_a12) s12a -= 180 * math.floor(s12a / 180) ssig12 = 0 if s12a == 0 else math.sin(sig12) csig12 = 0 if s12a == 90 else math.cos(sig12) else: # Interpret s12_a12 as distance tau12 = s12_a12 / (self._b * (1 + self._A1m1)) s = math.sin(tau12); c = math.cos(tau12) # tau2 = tau1 + tau12 B12 = - Geodesic.SinCosSeries(True, self._stau1 * c + self._ctau1 * s, self._ctau1 * c - self._stau1 * s, self._C1pa, Geodesic.nC1p_) sig12 = tau12 - (B12 - self._B11) ssig12 = math.sin(sig12); csig12 = math.cos(sig12) # real omg12, lam12, lon12 # real ssig2, csig2, sbet2, cbet2, somg2, comg2, salp2, calp2 # sig2 = sig1 + sig12 ssig2 = self._ssig1 * csig12 + self._csig1 * ssig12 csig2 = self._csig1 * csig12 - self._ssig1 * ssig12 if outmask & ( Geodesic.DISTANCE | Geodesic.REDUCEDLENGTH | Geodesic.GEODESICSCALE): if arcmode: B12 = Geodesic.SinCosSeries(True, ssig2, csig2, self._C1a, Geodesic.nC1_) AB1 = (1 + self._A1m1) * (B12 - self._B11) # sin(bet2) = cos(alp0) * sin(sig2) sbet2 = self._calp0 * ssig2 # Alt: cbet2 = hypot(csig2, salp0 * ssig2) cbet2 = math.hypot(self._salp0, self._calp0 * csig2) if cbet2 == 0: # I.e., salp0 = 0, csig2 = 0. Break the degeneracy in this case cbet2 = csig2 = Geodesic.tiny_ # tan(omg2) = sin(alp0) * tan(sig2) somg2 = self._salp0 * ssig2; comg2 = csig2 # No need to normalize # tan(alp0) = cos(sig2)*tan(alp2) salp2 = self._salp0; calp2 = self._calp0 * csig2 # No need to normalize # omg12 = omg2 - omg1 omg12 = math.atan2(somg2 * self._comg1 - comg2 * self._somg1, comg2 * self._comg1 + somg2 * self._somg1) if outmask & Geodesic.DISTANCE: s12 = self._b * ((1 + self._A1m1) * sig12 + AB1) if arcmode else s12_a12 if outmask & Geodesic.LONGITUDE: lam12 = omg12 + self._A3c * ( sig12 + (Geodesic.SinCosSeries(True, ssig2, csig2, self._C3a, Geodesic.nC3_-1) - self._B31)) lon12 = lam12 / Math.degree # Can't use AngNormalize because longitude might have wrapped multiple # times. lon12 = lon12 - 360 * math.floor(lon12/360 + 0.5) lon2 = Geodesic.AngNormalize(self._lon1 + lon12) if outmask & Geodesic.LATITUDE: lat2 = math.atan2(sbet2, self._f1 * cbet2) / Math.degree if outmask & Geodesic.AZIMUTH: # minus signs give range [-180, 180). 0- converts -0 to +0. azi2 = 0 - math.atan2(-salp2, calp2) / Math.degree if outmask & (Geodesic.REDUCEDLENGTH | Geodesic.GEODESICSCALE): ssig1sq = Math.sq(self._ssig1) ssig2sq = Math.sq( ssig2) w1 = math.sqrt(1 + self._k2 * ssig1sq) w2 = math.sqrt(1 + self._k2 * ssig2sq) B22 = Geodesic.SinCosSeries(True, ssig2, csig2, self._C2a, Geodesic.nC2_) AB2 = (1 + self._A2m1) * (B22 - self._B21) J12 = (self._A1m1 - self._A2m1) * sig12 + (AB1 - AB2) if outmask & Geodesic.REDUCEDLENGTH: # Add parens around (_csig1 * ssig2) and (_ssig1 * csig2) to ensure # accurate cancellation in the case of coincident points. m12 = self._b * ((w2 * (self._csig1 * ssig2) - w1 * (self._ssig1 * csig2)) - self._csig1 * csig2 * J12) if outmask & Geodesic.GEODESICSCALE: M12 = csig12 + (self._k2 * (ssig2sq - ssig1sq) * ssig2 / (w1 + w2) - csig2 * J12) * self._ssig1 / w1 M21 = csig12 - (self._k2 * (ssig2sq - ssig1sq) * self._ssig1 / (w1 + w2) - self._csig1 * J12) * ssig2 / w2 if outmask & Geodesic.AREA: B42 = Geodesic.SinCosSeries(False, ssig2, csig2, self._C4a, Geodesic.nC4_) # real salp12, calp12 if self._calp0 == 0 or self._salp0 == 0: # alp12 = alp2 - alp1, used in atan2 so no need to normalized salp12 = salp2 * self._calp1 - calp2 * self._salp1 calp12 = calp2 * self._calp1 + salp2 * self._salp1 # The right thing appears to happen if alp1 = +/-180 and alp2 = 0, viz # salp12 = -0 and alp12 = -180. However this depends on the sign being # attached to 0 correctly. The following ensures the correct behavior. if salp12 == 0 and calp12 < 0: salp12 = Geodesic.tiny_ * self._calp1 calp12 = -1 else: # tan(alp) = tan(alp0) * sec(sig) # tan(alp2-alp1) = (tan(alp2) -tan(alp1)) / (tan(alp2)*tan(alp1)+1) # = calp0 * salp0 * (csig1-csig2) / (salp0^2 + calp0^2 * csig1*csig2) # If csig12 > 0, write # csig1 - csig2 = ssig12 * (csig1 * ssig12 / (1 + csig12) + ssig1) # else # csig1 - csig2 = csig1 * (1 - csig12) + ssig12 * ssig1 # No need to normalize salp12 = self._calp0 * self._salp0 * ( self._csig1 * (1 - csig12) + ssig12 * self._ssig1 if csig12 <= 0 else ssig12 * (self._csig1 * ssig12 / (1 + csig12) + self._ssig1)) calp12 = (Math.sq(self._salp0) + Math.sq(self._calp0) * self._csig1 * csig2) S12 = self._c2 * math.atan2(salp12, calp12) + self._A4 * (B42 - self._B41) a12 = s12_a12 if arcmode else sig12 / Math.degree return a12, lat2, lon2, azi2, s12, m12, M12, M21, S12 def Position(self, s12, outmask = GeodesicCapability.LATITUDE | GeodesicCapability.LONGITUDE | GeodesicCapability.AZIMUTH): """ Return the point a distance s12 along the geodesic line. Return a dictionary with (some) of the following entries: lat1 latitude of point 1 lon1 longitude of point 1 azi1 azimuth of line at point 1 lat2 latitude of point 2 lon2 longitude of point 2 azi2 azimuth of line at point 2 s12 distance from 1 to 2 a12 arc length on auxiliary sphere from 1 to 2 m12 reduced length of geodesic M12 geodesic scale 2 relative to 1 M21 geodesic scale 1 relative to 2 S12 area between geodesic and equator outmask determines which fields get included and if outmask is omitted, then only the basic geodesic fields are computed. The mask is an or'ed combination of the following values Geodesic.LATITUDE Geodesic.LONGITUDE Geodesic.AZIMUTH Geodesic.DISTANCE Geodesic.REDUCEDLENGTH Geodesic.GEODESICSCALE Geodesic.AREA Geodesic.ALL """ from geographiclib.geodesic import Geodesic Geodesic.CheckDistance(s12) result = {'lat1': self._lat1, 'lon1': self._lon1, 'azi1': self._azi1, 's12': s12} a12, lat2, lon2, azi2, s12, m12, M12, M21, S12 = self.GenPosition( False, s12, outmask) outmask &= Geodesic.OUT_ALL result['a12'] = a12 if outmask & Geodesic.LATITUDE: result['lat2'] = lat2 if outmask & Geodesic.LONGITUDE: result['lon2'] = lon2 if outmask & Geodesic.AZIMUTH: result['azi2'] = azi2 if outmask & Geodesic.REDUCEDLENGTH: result['m12'] = m12 if outmask & Geodesic.GEODESICSCALE: result['M12'] = M12; result['M21'] = M21 if outmask & Geodesic.AREA: result['S12'] = S12 return result geographiclib-1.21/python/geographiclib/__init__.py0000644000175000017500000000000011745620415022300 0ustar frankiefrankiegeographiclib-1.21/python/Makefile.am0000644000175000017500000000165011745620415017440 0ustar frankiefrankie# # Makefile.am # # Copyright (C) 2011, Charles Karney # $Id: 9b974cbcac490c66540bdd090786d14e12719d82 $ PACKAGE=geographiclib PYTHON_FILES = \ $(srcdir)/$(PACKAGE)/__init__.py \ $(srcdir)/$(PACKAGE)/geomath.py \ $(srcdir)/$(PACKAGE)/constants.py \ $(srcdir)/$(PACKAGE)/accumulator.py \ $(srcdir)/$(PACKAGE)/geodesiccapability.py \ $(srcdir)/$(PACKAGE)/geodesic.py \ $(srcdir)/$(PACKAGE)/geodesicline.py \ $(srcdir)/$(PACKAGE)/polygonarea.py pythondir=$(libdir)/python/site-packages/$(PACKAGE) install: $(INSTALL) -d $(DESTDIR)$(pythondir) $(INSTALL) -m 644 $(PYTHON_FILES) $(DESTDIR)$(pythondir) # Don't install setup.py because it ends up in e.g., # /usr/local/lib/python/site-packages/setup.py # $(INSTALL) -m 644 setup.py $(DESTDIR)$(pythondir)/../ clean-local: rm -rf *.pyc $(PACKAGE)/*.pyc EXTRA_DIST = Makefile.mk $(PACKAGE)/CMakeLists.txt $(PYTHON_FILES) setup.py \ MANIFEST.in README.txt geographiclib-1.21/python/Makefile.in0000644000175000017500000002511311745620415017451 0ustar frankiefrankie# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Makefile.am # # Copyright (C) 2011, Charles Karney # $Id: 9b974cbcac490c66540bdd090786d14e12719d82 $ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = python DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = geographiclib PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POW_LIB = @POW_LIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ PYTHON_FILES = \ $(srcdir)/$(PACKAGE)/__init__.py \ $(srcdir)/$(PACKAGE)/geomath.py \ $(srcdir)/$(PACKAGE)/constants.py \ $(srcdir)/$(PACKAGE)/accumulator.py \ $(srcdir)/$(PACKAGE)/geodesiccapability.py \ $(srcdir)/$(PACKAGE)/geodesic.py \ $(srcdir)/$(PACKAGE)/geodesicline.py \ $(srcdir)/$(PACKAGE)/polygonarea.py pythondir = $(libdir)/python/site-packages/$(PACKAGE) EXTRA_DIST = Makefile.mk $(PACKAGE)/CMakeLists.txt $(PYTHON_FILES) setup.py \ MANIFEST.in README.txt all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu python/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu python/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ clean-local distclean distclean-generic distclean-libtool \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am install: $(INSTALL) -d $(DESTDIR)$(pythondir) $(INSTALL) -m 644 $(PYTHON_FILES) $(DESTDIR)$(pythondir) # Don't install setup.py because it ends up in e.g., # /usr/local/lib/python/site-packages/setup.py # $(INSTALL) -m 644 setup.py $(DESTDIR)$(pythondir)/../ clean-local: rm -rf *.pyc $(PACKAGE)/*.pyc # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: geographiclib-1.21/python/Makefile.mk0000644000175000017500000000115311745620415017450 0ustar frankiefrankie# $Id: 74272e0080b7bb7ccfad039d79f938781045eea9 $ MODULES = __init__ geomath constants accumulator geodesiccapability \ geodesic geodesicline polygonarea PACKAGE = geographiclib PYTHON_FILES = $(patsubst %,$(PACKAGE)/%.py,$(MODULES)) DEST = $(PREFIX)/lib/python/site-packages/$(PACKAGE) INSTALL = install -b all: @: install: test -d $(DEST) || mkdir -p $(DEST) $(INSTALL) -m 644 $(PYTHON_FILES) $(DEST)/ # Don't install setup.py because it ends up in e.g., # /usr/local/lib/python/site-packages/setup.py # $(INSTALL) -m 644 setup.py $(DEST)/../ clean: rm -f *.pyc $(PACKAGE)/*.pyc .PHONY: all install clean geographiclib-1.21/python/README.txt0000644000175000017500000000060211745620415017076 0ustar frankiefrankie# $Id: 92df59eea0946f2839236c682bd67a621193e67d $ This is a python implementation of the geodesic routines from GeographicLib. This contains implementations of the classes - GeographicLib::Math - GeographicLib::Accumulator - GeographicLib::Geodesic - GeographicLib::GeodesicLine - GeographicLib::PolygonArea For more information on GeographicLib, see http://geographiclib.sf.net geographiclib-1.21/python/MANIFEST.in0000644000175000017500000000001111745620415017130 0ustar frankiefrankie# empty! geographiclib-1.21/python/setup.py0000644000175000017500000000251711745620415017121 0ustar frankiefrankie# setup.py, config file for distutils # # To install this package, execute # # python setup.py install # # in this directory. To upload the latest version to the python # repository run # # python setup.py sdist --formats gztar,zip upload # # The initial version of this file was provided by # Andrew MacIntyre . # # $Id: e5d240fa0c0790fdbbc0c3ff654325abf8f9ec71 $ from distutils.core import setup setup(name="geographiclib", version="1.20", description= "A translation of the GeographicLib::Geodesic class to Python", author="Charles Karney", author_email="charles@karney.com", url="http://geographiclib.sourceforge.net/", packages=["geographiclib"], data_files=[], license="MIT", keywords="gis geographical earth distance geodesic", classifiers=["Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Scientific/Engineering :: GIS", "Topic :: Software Development :: Libraries :: Python Modules", ], ) geographiclib-1.21/AUTHORS0000644000175000017500000000014611745620415015132 0ustar frankiefrankieCharles Karney Francesco Paolo Lovergine (autoconfiscation) geographiclib-1.21/INSTALL0000644000175000017500000000025611745620415015115 0ustar frankiefrankie# $Id: 81231982ade5ead96deeb78912e17c5cf4bdb4b6 $ For installation instructions, open doc/html/install.html or http://geographiclib.sourceforge.net/html/install.html geographiclib-1.21/examples/0002755000175000017500000000000011757437425015713 5ustar frankiefrankiegeographiclib-1.21/examples/example-GravityCircle.cpp0000644000175000017500000000235111745620414022603 0ustar frankiefrankie// Example of using the GeographicLib::GravityCircle class // $Id: dc7c895cc248cee01a434ea3df1b31771ffb6ad2 $ #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { GravityModel grav("egm96"); double lat = 27.99, lon0 = 86.93, h = 8820; // Mt Everest { // Slow method of evaluating the values at several points on a circle of // latitude. for (int i = -5; i <= 5; ++i) { double lon = lon0 + i * 0.2; double gx, gy, gz; grav.Gravity(lat, lon, h, gx, gy, gz); cout << lon << " " << gx << " " << gy << " " << gz << "\n"; } } { // Fast method of evaluating the values at several points on a circle of // latitude using GravityCircle. GravityCircle circ = grav.Circle(lat, h); for (int i = -5; i <= 5; ++i) { double lon = lon0 + i * 0.2; double gx, gy, gz; circ.Gravity(lon, gx, gy, gz); cout << lon << " " << gx << " " << gy << " " << gz << "\n"; } } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-UTMUPS.cpp0000644000175000017500000000214111745620414021066 0ustar frankiefrankie// Example of using the GeographicLib::UTMUPS class // $Id: 83d5ba7eb8c9ce1963cb9499a6ee404329e74f3a $ #include #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { // See also example-GeoCoords.cpp { // Sample forward calculation double lat = 33.3, lon = 44.4; // Baghdad int zone; bool northp; double x, y; UTMUPS::Forward(lat, lon, zone, northp, x, y); string zonestr = UTMUPS::EncodeZone(zone, northp); cout << fixed << setprecision(2) << zonestr << " " << x << " " << y << "\n"; } { // Sample reverse calculation string zonestr = "38N"; int zone; bool northp; UTMUPS::DecodeZone(zonestr, zone, northp); double x = 444e3, y = 3688e3; double lat, lon; UTMUPS::Reverse(zone, northp, x, y, lat, lon); cout << lat << " " << lon << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-MagneticCircle.cpp0000644000175000017500000000235611745620414022712 0ustar frankiefrankie// Example of using the GeographicLib::MagneticCircle class // $Id: d499f22160be523e01c0a6e3c740dbe828aa918d $ #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { MagneticModel mag("wmm2010"); double lat = 27.99, lon0 = 86.93, h = 8820, t = 2012; // Mt Everest { // Slow method of evaluating the values at several points on a circle of // latitude. for (int i = -5; i <= 5; ++i) { double lon = lon0 + i * 0.2; double Bx, By, Bz; mag(t, lat, lon, h, Bx, By, Bz); cout << lon << " " << Bx << " " << By << " " << Bz << "\n"; } } { // Fast method of evaluating the values at several points on a circle of // latitude using MagneticCircle. MagneticCircle circ = mag.Circle(t, lat, h); for (int i = -5; i <= 5; ++i) { double lon = lon0 + i * 0.2; double Bx, By, Bz; circ(lon, Bx, By, Bz); cout << lon << " " << Bx << " " << By << " " << Bz << "\n"; } } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-AzimuthalEquidistant.cpp0000644000175000017500000000205111745620414024202 0ustar frankiefrankie// Example of using the GeographicLib::AzimuthalEquidistant class // $Id: d018fda4dc3289b06b9e6fe8cda16638430d9213 $ #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { Geodesic geod(Constants::WGS84_a(), Constants::WGS84_f()); // Alternatively: const Geodesic& geod = Geodesic::WGS84; const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris AzimuthalEquidistant proj(geod); { // Sample forward calculation double lat = 50.9, lon = 1.8; // Calais double x, y; proj.Forward(lat0, lon0, lat, lon, x, y); cout << x << " " << y << "\n"; } { // Sample reverse calculation double x = -38e3, y = 230e3; double lat, lon; proj.Reverse(lat0, lon0, x, y, lat, lon); cout << lat << " " << lon << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-GeographicErr.cpp0000644000175000017500000000063311745620414022556 0ustar frankiefrankie// Example of using the GeographicLib::GeographicErr class // $Id: aaa4cf5e9b5070f9a6307a59daabf578880b85d3 $ #include #include using namespace std; using namespace GeographicLib; int main() { try { throw GeographicErr("Test throwing an exception"); } catch (const GeographicErr& e) { cout << "Caught exception: " << e.what() << "\n"; } return 0; } geographiclib-1.21/examples/example-MGRS.cpp0000644000175000017500000000210311745620414020577 0ustar frankiefrankie// Example of using the GeographicLib::MGRS class // $Id: 011e73554cd2851ef396442f1ec8392207b101c3 $ #include #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { // See also example-GeoCoords.cpp { // Sample forward calculation double lat = 33.3, lon = 44.4; // Baghdad int zone; bool northp; double x, y; UTMUPS::Forward(lat, lon, zone, northp, x, y); string mgrs; MGRS::Forward(zone, northp, x, y, 5, mgrs); cout << mgrs << "\n"; } { // Sample reverse calculation string mgrs = "38SMB4488"; int zone, prec; bool northp; double x, y; MGRS::Reverse(mgrs, zone, northp, x, y, prec); double lat, lon; UTMUPS::Reverse(zone, northp, x, y, lat, lon); cout << prec << " " << lat << " " << lon << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-Constants.cpp0000644000175000017500000000071411745620414022011 0ustar frankiefrankie// Example of using the GeographicLib::Constants class // $Id: c32f14d43abd9e969043dd0506b00c2458763419 $ #include #include #include using namespace std; using namespace GeographicLib; int main() { try { cout << Constants::WGS84_a() << " 1/" << 1/Constants::WGS84_f() << "\n"; } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-SphericalEngine.cpp0000644000175000017500000000205611745620414023076 0ustar frankiefrankie// Example of using the GeographicLib::SphericalEngine class // $Id: 08fe16ba3619311b15fc58956511a88c37886f91 $ #include #include #include #include using namespace std; using namespace GeographicLib; int main() { // See also example-SphericHarmonic.cpp try { int N = 3; // The maxium degree double ca[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients vector C(ca, ca + (N + 1) * (N + 2) / 2); double sa[] = {6, 5, 4, 3, 2, 1}; // sine coefficients vector S(sa, sa + N * (N + 1) / 2); SphericalEngine::coeff c[1]; c[0] = SphericalEngine::coeff(C, S, N); double f[] = {1}; double x = 2, y = 3, z = 1, a = 1; double v, vx, vy, vz; v = SphericalEngine::Value (c, f, x, y, z, a, vx, vy, vz); cout << v << " " << vx << " " << vy << " " << vz << "\n"; } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-Accumulator.cpp0000644000175000017500000000133411745620414022313 0ustar frankiefrankie// Example of using the GeographicLib::Accumulator class // $Id: cd6505cf47fbae653b439ba63ea927050cbf0a45 $ #include #include #include using namespace std; using namespace GeographicLib; int main() { try { // Compare using Accumulator and ordinary summation for a sum of large and // small terms. double sum = 0; Accumulator acc = 0; sum += 1e20; sum += 1; sum += 2; sum += 100; sum += 5000; sum += -1e20; acc += 1e20; acc += 1; acc += 2; acc += 100; acc += 5000; acc += -1e20; cout << sum << " " << acc() << "\n"; } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-PolarStereographic.cpp0000644000175000017500000000205111745620414023626 0ustar frankiefrankie// Example of using the GeographicLib::PolarStereographic class // $Id: 76bd97693e4f711118164cc0cde1db7f5ca70e12 $ #include #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { PolarStereographic proj(Constants::WGS84_a(), Constants::WGS84_f(), Constants::UPS_k0()); // Alternatively: // const PolarStereographic& proj = PolarStereographic::UPS; bool northp = true; { // Sample forward calculation double lat = 61.2, lon = -149.9; // Anchorage double x, y; proj.Forward(northp, lat, lon, x, y); cout << x << " " << y << "\n"; } { // Sample reverse calculation double x = -1637e3, y = 2824e3; double lat, lon; proj.Reverse(northp, x, y, lat, lon); cout << lat << " " << lon << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-LambertConformalConic.cpp0000644000175000017500000000304011745620414024233 0ustar frankiefrankie// Example of using the GeographicLib::LambertConformalConic class // $Id: 5cb2532e2709bcafee50974307836930069b0cff $ #include #include #include using namespace std; using namespace GeographicLib; int main() { try { // Define the Pennsylvania South state coordinate system EPSG:3364 const double a = Constants::WGS84_a(), f = 1/298.257222101, // GRS80 lat1 = 40 + 58/60.0, lat2 = 39 + 56/60.0, // standard parallels k1 = 1, // scale lat0 = 39 + 20/60.0, lon0 =-77 - 45/60.0, // origin fe = 600000, fn = 0; // false easting and northing // Set up basic projection const LambertConformalConic PASouth(a, f, lat1, lat2, k1); double x0, y0; // Transform origin point PASouth.Forward(lon0, lat0, lon0, x0, y0); x0 -= fe; y0 -= fn; { // Sample conversion from geodetic to PASouth grid double lat = 39.95, lon = -75.17; // Philadelphia double x, y; PASouth.Forward(lon0, lat, lon, x, y); x -= x0; y -= y0; std::cout << x << " " << y << "\n"; } { // Sample conversion from PASouth grid to geodetic double x = 820e3, y = 72e3; double lat, lon; x += x0; y += y0; PASouth.Reverse(lon0, x, y, lat, lon); std::cout << lat << " " << lon << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/GeoidToGTX.cpp0000644000175000017500000000616111745620414020323 0ustar frankiefrankie// Write out a gtx file of geoid heights. For egm2008 at 1' resolution this // takes about 40 mins on a 8-processor Intel 2.66 GHz machine using OpenMP // (-DHAVE_OPENMP=1). // // For the format of gtx files, see // http://vdatum.noaa.gov/dev/gtx_info.html#dev_gtx_binary // // data is binary big-endian: // south latitude edge (degrees double) // west longitude edge (degrees double) // delta latitude (degrees double) // delta longitude (degrees double) // nlat = number of latitude rows (integer) // nlong = number of longitude columns (integer) // nlat * nlong geoid heights (meters float) #include #include #include #include #include #if HAVE_OPENMP #include #endif #include #include #include using namespace std; using namespace GeographicLib; int main(int argc, char* argv[]) { // Hardwired for 3 args: // 1 = the gravity model (e.g., egm2008) // 2 = intervals per degree // 3 = output GTX file if (argc != 4) { cerr << "Usage: " << argv[0] << " gravity-model intervals-per-degree output.gtx\n"; return 1; } try { string model(argv[1]); // Number of intervals per degree int ndeg = Utility::num(string(argv[2])); string filename(argv[3]); GravityModel g(model); int nlat = 180 * ndeg + 1, nlon = 360 * ndeg; double delta = 1 / double(ndeg), // Grid spacing latorg = -90, lonorg = -180; // Write results as floats in binary mode ofstream file(filename.c_str(), ios::binary); // Write header { double transform[] = {latorg, lonorg, delta, delta}; unsigned sizes[] = {nlat, nlon}; Utility::writearray(file, transform, 4); Utility::writearray(file, sizes, 2); } // Compute and store results for nbatch latitudes at a time const int nbatch = 64; vector< vector > N(nbatch, vector(nlon)); for (int ilat0 = 0; ilat0 < nlat; ilat0 += nbatch) { // Loop over batches int nlat0 = min(nlat, ilat0 + nbatch); #if HAVE_OPENMP #pragma omp parallel for #endif for (int ilat = ilat0; ilat < nlat0; ++ilat) { // Loop over latitudes double lat = latorg + (ilat / ndeg) + delta * (ilat - ndeg * (ilat / ndeg)), h = 0; GravityCircle c(g.Circle(lat, h, GravityModel::GEOID_HEIGHT)); for (int ilon = 0; ilon < nlon; ++ilon) { // Loop over longitudes double lon = lonorg + (ilon / ndeg) + delta * (ilon - ndeg * (ilon / ndeg)); N[ilat - ilat0][ilon] = float(c.GeoidHeight(lon)); } // longitude loop } // latitude loop -- end of parallel section for (int ilat = ilat0; ilat < nlat0; ++ilat) // write out data Utility::writearray(file, N[ilat - ilat0]); } // batch loop } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { cerr << "Caught unknown exception\n"; return 1; } return 0; } geographiclib-1.21/examples/example-Geoid.cpp0000644000175000017500000000134711745620414021067 0ustar frankiefrankie// Example of using the GeographicLib::Geoid class // $Id: 2ba4534ebb4c4853dc111932fe44b4bf85ac8149 $ #include #include #include using namespace std; using namespace GeographicLib; int main() { try { Geoid egm96("egm96-5"); // Convert height above egm96 to height above the ellipsoid double lat = 42, lon = -75, height_above_geoid = 20; double geoid_height = egm96(lat, lon), height_above_ellipsoid = (height_above_geoid + Geoid::GEOIDTOELLIPSOID * geoid_height); cout << height_above_ellipsoid << "\n"; } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/CMakeLists.txt0000644000175000017500000000241111745620414020434 0ustar frankiefrankie# $Id: 54590373678f8a602e370bb7a54265163f5b9d73 $ # Compile (but don't install) a bunch of tiny example programs. These # are mainly for including as examples within the doxygen documentation; # however, compiling them catches most obvious blunders. file (GLOB EXAMPLE_SOURCES example-*.cpp) set (EXAMPLES) foreach (EXAMPLE_SOURCE ${EXAMPLE_SOURCES}) get_filename_component (EXAMPLE ${EXAMPLE_SOURCE} NAME_WE) set (EXAMPLES ${EXAMPLES} ${EXAMPLE}) add_executable (${EXAMPLE} ${EXAMPLE_SOURCE}) target_link_libraries (${EXAMPLE} Geographic) endforeach () set (OTHER_EXAMPLES GeoidToGTX.cpp) foreach (EXAMPLE_SOURCE ${OTHER_EXAMPLES}) get_filename_component (EXAMPLE ${EXAMPLE_SOURCE} NAME_WE) set (EXAMPLES ${EXAMPLES} ${EXAMPLE}) add_executable (${EXAMPLE} ${EXAMPLE_SOURCE}) target_link_libraries (${EXAMPLE} Geographic) endforeach () find_package (OpenMP) if (OPENMP_FOUND OR OpenMP_FOUND) set_target_properties (GeoidToGTX PROPERTIES COMPILE_FLAGS ${OpenMP_CXX_FLAGS} COMPILE_DEFINITIONS HAVE_OPENMP=1) if (NOT WIN32) set_target_properties (GeoidToGTX PROPERTIES LINK_FLAGS ${OpenMP_CXX_FLAGS}) endif (NOT WIN32) endif (OPENMP_FOUND OR OpenMP_FOUND) add_custom_target (examples DEPENDS ${EXAMPLES}) add_dependencies (examples Geographic) geographiclib-1.21/examples/example-PolygonArea.cpp0000644000175000017500000000166411745620414022262 0ustar frankiefrankie// Example of using the GeographicLib::PolygonArea class // $Id: 103c4d2f060347fd499adc2e8487102c8b93d58f $ #include #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { Geodesic geod(Constants::WGS84_a(), Constants::WGS84_f()); // Alternatively: const Geodesic& geod = Geodesic::WGS84; PolygonArea poly(geod); poly.AddPoint( 52, 0); // London poly.AddPoint( 41,-74); // New York poly.AddPoint(-23,-43); // Rio de Janeiro poly.AddPoint(-26, 28); // Johannesburg double perimeter, area; unsigned n = poly.Compute(false, true, perimeter, area); cout << n << " " << perimeter << " " << area << "\n"; } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-Math.cpp0000644000175000017500000000066411745620414020732 0ustar frankiefrankie// Example of using the GeographicLib::Math class // $Id: 04519bb67e82229a86ee23002ddc27a6b5bb2939 $ #include #include #include using namespace std; using namespace GeographicLib; int main() { try { cout << Math::pi() << " " << Math::sq(Math::pi()) << "\n"; } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-Gnomonic.cpp0000644000175000017500000000200511745620414021601 0ustar frankiefrankie// Example of using the GeographicLib::Gnomonic class // $Id: 59ed16349fd55bdde98654feeb1225a046d85696 $ #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { Geodesic geod(Constants::WGS84_a(), Constants::WGS84_f()); // Alternatively: const Geodesic& geod = Geodesic::WGS84; const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris Gnomonic proj(geod); { // Sample forward calculation double lat = 50.9, lon = 1.8; // Calais double x, y; proj.Forward(lat0, lon0, lat, lon, x, y); cout << x << " " << y << "\n"; } { // Sample reverse calculation double x = -38e3, y = 230e3; double lat, lon; proj.Reverse(lat0, lon0, x, y, lat, lon); cout << lat << " " << lon << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-EllipticFunction.cpp0000644000175000017500000000150211745620414023304 0ustar frankiefrankie// Example of using the GeographicLib::EllipticFunction class // $Id: 304e818254ce2fd366c2efa4f7ef93643e8c208c $ #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { EllipticFunction ell(0.1); // parameter m = 0.1 // See Abramowitz and Stegun, table 17.1 cout << ell.K() << " " << ell.E() << "\n"; double phi = 20 * Math::degree(); // See Abramowitz and Stegun, table 17.6 with // alpha = asin(sqrt(m)) = 18.43 deg and phi = 20 deg cout << ell.E(phi) << " " << ell.E(sin(phi), cos(phi), sqrt(1 - ell.m() * Math::sq(sin(phi)))) << "\n"; } catch (const GeographicErr& e) { cout << "Caught exception: " << e.what() << "\n"; } return 0; } geographiclib-1.21/examples/example-Geodesic.cpp0000644000175000017500000000206311745620414021556 0ustar frankiefrankie// Example of using the GeographicLib::Geodesic class // $Id: c825b2bc016f758b52995e446ac77aa42e0f3fda $ #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { Geodesic geod(Constants::WGS84_a(), Constants::WGS84_f()); // Alternatively: const Geodesic& geod = Geodesic::WGS84; { // Sample direct calculation, travelling about NE from JFK double lat1 = 40.6, lon1 = -73.8, s12 = 5.5e6, azi1 = 51; double lat2, lon2; geod.Direct(lat1, lon1, azi1, s12, lat2, lon2); cout << lat2 << " " << lon2 << "\n"; } { // Sample inverse calculation, JFK to LHR double lat1 = 40.6, lon1 = -73.8, // JFK Airport lat2 = 51.6, lon2 = -0.5; // LHR Airport double s12; geod.Inverse(lat1, lon1, lat2, lon2, s12); cout << s12 << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-GeoCoords.cpp0000644000175000017500000000134711745620414021724 0ustar frankiefrankie// Example of using the GeographicLib::GeoCoords class // $Id: 3f9c326bb5293db26a153e6f5eab165146899a9e $ #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { // Miscellaneous conversions double lat = 33.3, lon = 44.4; GeoCoords c(lat, lon); cout << c.MGRSRepresentation(-3) << "\n"; c.Reset("18TWN0050"); cout << c.DMSRepresentation() << "\n"; cout << c.Latitude() << " " << c.Longitude() << "\n"; c.Reset("1d38'W 55d30'N"); cout << c.GeoRepresentation() << "\n"; } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-GravityModel.cpp0000644000175000017500000000112511745620414022440 0ustar frankiefrankie// Example of using the GeographicLib::GravityModel class // $Id: fde4f431ed9c43e9e0ec797e302f32a373cdd219 $ #include #include #include using namespace std; using namespace GeographicLib; int main() { try { GravityModel grav("egm96"); double lat = 27.99, lon = 86.93, h = 8820; // Mt Everest double gx, gy, gz; grav.Gravity(lat,lon, h, gx, gy, gz); cout << gx << " " << gy << " " << gz << "\n"; } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-MagneticModel.cpp0000644000175000017500000000127111745620414022544 0ustar frankiefrankie// Example of using the GeographicLib::MagneticModel class // $Id: ab27b155755e540d29e5e6bf550df8cdb00c74ba $ #include #include #include using namespace std; using namespace GeographicLib; int main() { try { MagneticModel mag("wmm2010"); double lat = 27.99, lon = 86.93, h = 8820, t = 2012; // Mt Everest double Bx, By, Bz; mag(t, lat,lon, h, Bx, By, Bz); double H, F, D, I; MagneticModel::FieldComponents(Bx, By, Bz, H, F, D, I); cout << H << " " << F << " " << D << " " << I << "\n"; } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/Makefile.am0000644000175000017500000000231311745620414017731 0ustar frankiefrankie# # Makefile.am # # Copyright (C) 2011, Charles Karney # $Id: 8f327ca307cc38126a2ecbca4df19f2c8eef2604 $ EXAMPLE_FILES = \ example-Accumulator.cpp \ example-AlbersEqualArea.cpp \ example-AzimuthalEquidistant.cpp \ example-CassiniSoldner.cpp \ example-CircularEngine.cpp \ example-Constants.cpp \ example-DMS.cpp \ example-EllipticFunction.cpp \ example-GeoCoords.cpp \ example-Geocentric.cpp \ example-Geodesic.cpp \ example-Geodesic-small.cpp \ example-GeodesicLine.cpp \ example-GeographicErr.cpp \ example-Geoid.cpp \ example-Gnomonic.cpp \ example-GravityCircle.cpp \ example-GravityModel.cpp \ example-LambertConformalConic.cpp \ example-LocalCartesian.cpp \ example-MGRS.cpp \ example-MagneticCircle.cpp \ example-MagneticModel.cpp \ example-Math.cpp \ example-NormalGravity.cpp \ example-OSGB.cpp \ example-PolarStereographic.cpp \ example-PolygonArea.cpp \ example-SphericalEngine.cpp \ example-SphericalHarmonic.cpp \ example-SphericalHarmonic1.cpp \ example-SphericalHarmonic2.cpp \ example-TransverseMercator.cpp \ example-TransverseMercatorExact.cpp \ example-UTMUPS.cpp \ example-Utility.cpp \ GeoidToGTX.cpp EXTRA_DIST = CMakeLists.txt $(EXAMPLE_FILES) geographiclib-1.21/examples/Makefile.in0000644000175000017500000002557511745620414017761 0ustar frankiefrankie# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Makefile.am # # Copyright (C) 2011, Charles Karney # $Id: 8f327ca307cc38126a2ecbca4df19f2c8eef2604 $ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = examples DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POW_LIB = @POW_LIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXAMPLE_FILES = \ example-Accumulator.cpp \ example-AlbersEqualArea.cpp \ example-AzimuthalEquidistant.cpp \ example-CassiniSoldner.cpp \ example-CircularEngine.cpp \ example-Constants.cpp \ example-DMS.cpp \ example-EllipticFunction.cpp \ example-GeoCoords.cpp \ example-Geocentric.cpp \ example-Geodesic.cpp \ example-Geodesic-small.cpp \ example-GeodesicLine.cpp \ example-GeographicErr.cpp \ example-Geoid.cpp \ example-Gnomonic.cpp \ example-GravityCircle.cpp \ example-GravityModel.cpp \ example-LambertConformalConic.cpp \ example-LocalCartesian.cpp \ example-MGRS.cpp \ example-MagneticCircle.cpp \ example-MagneticModel.cpp \ example-Math.cpp \ example-NormalGravity.cpp \ example-OSGB.cpp \ example-PolarStereographic.cpp \ example-PolygonArea.cpp \ example-SphericalEngine.cpp \ example-SphericalHarmonic.cpp \ example-SphericalHarmonic1.cpp \ example-SphericalHarmonic2.cpp \ example-TransverseMercator.cpp \ example-TransverseMercatorExact.cpp \ example-UTMUPS.cpp \ example-Utility.cpp \ GeoidToGTX.cpp EXTRA_DIST = CMakeLists.txt $(EXAMPLE_FILES) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu examples/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: geographiclib-1.21/examples/example-NormalGravity.cpp0000644000175000017500000000151611745620414022634 0ustar frankiefrankie// Example of using the GeographicLib::NormalGravity class // $Id: 8d0337072d40334e8147a50b1e6035d75d38c53c $ #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { NormalGravity grav(Constants::WGS84_a(), Constants::WGS84_GM(), Constants::WGS84_omega(), Constants::WGS84_f(), 0); // Alternatively: const NormalGravity& grav = NormalGravity::WGS84; double lat = 27.99, h = 8820; // Mt Everest double gammay, gammaz; grav.Gravity(lat, h, gammay, gammaz); cout << gammay << " " << gammaz << "\n"; } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-LocalCartesian.cpp0000644000175000017500000000214511745620414022721 0ustar frankiefrankie// Example of using the GeographicLib::LocalCartesian class // $Id: 0fd182a359b17d3b76ccd55f405b272a327a42e8 $ #include #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { Geocentric earth(Constants::WGS84_a(), Constants::WGS84_f()); // Alternatively: const Geocentric& earth = Geocentric::WGS84; const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris LocalCartesian proj(lat0, lon0, 0, earth); { // Sample forward calculation double lat = 50.9, lon = 1.8, h = 0; // Calais double x, y, z; proj.Forward(lat, lon, h, x, y, z); cout << x << " " << y << " " << z << "\n"; } { // Sample reverse calculation double x = -38e3, y = 230e3, z = -4e3; double lat, lon, h; proj.Reverse(x, y, z, lat, lon, h); cout << lat << " " << lon << " " << h << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-SphericalHarmonic.cpp0000644000175000017500000000162011745620414023425 0ustar frankiefrankie// Example of using the GeographicLib::SphericalHarmonic class // $Id: b7e4a45d66787db49d40aa7bc991ab686cc32d44 $ #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { int N = 3; // The maxium degree double ca[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients vector C(ca, ca + (N + 1) * (N + 2) / 2); double sa[] = {6, 5, 4, 3, 2, 1}; // sine coefficients vector S(sa, sa + N * (N + 1) / 2); double a = 1; SphericalHarmonic h(C, S, N, a); double x = 2, y = 3, z = 1; double v, vx, vy, vz; v = h(x, y, z, vx, vy, vz); cout << v << " " << vx << " " << vy << " " << vz << "\n"; } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-TransverseMercatorExact.cpp0000644000175000017500000000215711745620414024656 0ustar frankiefrankie// Example of using the GeographicLib::TransverseMercatorExact class // $Id: 047cbdcff7135fed1fecf5f50ff2195eda993fcb $ #include #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { TransverseMercatorExact proj(Constants::WGS84_a(), Constants::WGS84_f(), Constants::UTM_k0()); // Alternatively: // const TransverseMercatorExact& proj = TransverseMercatorExact::UTM; double lon0 = -75; // Central meridian for UTM zone 18 { // Sample forward calculation double lat = 40.3, lon = -74.7; // Princeton, NJ double x, y; proj.Forward(lon0, lat, lon, x, y); cout << x << " " << y << "\n"; } { // Sample reverse calculation double x = 25e3, y = 4461e3; double lat, lon; proj.Reverse(lon0, x, y, lat, lon); cout << lat << " " << lon << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-CircularEngine.cpp0000644000175000017500000000226711745620414022734 0ustar frankiefrankie// Example of using the GeographicLib::CircularEngine class // $Id: a742c5ccdb47b73fcd599dc1adda36a70450b5a5 $ #include #include #include #include #include using namespace std; using namespace GeographicLib; int main() { // This computes the same value as example-SphericalHarmonic.cpp using a // CircularEngine (which will be faster if many values on a circle of // latitude are to be found). try { int N = 3; // The maxium degree double ca[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients vector C(ca, ca + (N + 1) * (N + 2) / 2); double sa[] = {6, 5, 4, 3, 2, 1}; // sine coefficients vector S(sa, sa + N * (N + 1) / 2); double a = 1; SphericalHarmonic h(C, S, N, a); double x = 2, y = 3, z = 1, p = Math::hypot(x, y); CircularEngine circ = h.Circle(p, z, true); double v, vx, vy, vz; v = circ(x/p, y/p, vx, vy, vz); cout << v << " " << vx << " " << vy << " " << vz << "\n"; } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-Geocentric.cpp0000644000175000017500000000204411745620414022115 0ustar frankiefrankie// Example of using the GeographicLib::Geocentric class // $Id: fea8cd4d5464b6029d6a135a25230892f52f318f $ #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { Geocentric earth(Constants::WGS84_a(), Constants::WGS84_f()); // Alternatively: const Geocentric& earth = Geocentric::WGS84; { // Sample forward calculation double lat = 27.99, lon = 86.93, h = 8820; // Mt Everest double X, Y, Z; earth.Forward(lat, lon, h, X, Y, Z); cout << floor(X / 1000 + 0.5) << " " << floor(Y / 1000 + 0.5) << " " << floor(Z / 1000 + 0.5) << "\n"; } { // Sample reverse calculation double X = 302e3, Y = 5636e3, Z = 2980e3; double lat, lon, h; earth.Reverse(X, Y, Z, lat, lon, h); cout << lat << " " << lon << " " << h << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-GeodesicLine.cpp0000644000175000017500000000327211745620414022371 0ustar frankiefrankie// Example of using the GeographicLib::GeodesicLine class // $Id: df5c5ffe6534d46e343544430de8c13fc8119bfb $ #include #include #include #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { // Print waypoints between JFK and SIN Geodesic geod(Constants::WGS84_a(), Constants::WGS84_f()); // Alternatively: const Geodesic& geod = Geodesic::WGS84; double lat1 = 40.640, lon1 = -73.779, // JFK lat2 = 1.359, lon2 = 103.989; // SIN double s12, azi1, azi2, a12 = geod.Inverse(lat1, lon1, lat2, lon2, s12, azi1, azi2); const GeographicLib::GeodesicLine line(geod, lat1, lon1, azi1); // Alternatively // const GeographicLib::GeodesicLine line = geod.Line(lat1, lon1, azi1); double ds = 500e3; // Nominal distance between points = 500 km int num = int(ceil(s12 / ds)); // The number of intervals cout << fixed << setprecision(3); { // Use intervals of equal length double ds = s12 / num; for (int i = 0; i <= num; ++i) { double lat, lon; line.Position(i * ds, lat, lon); cout << i << " " << lat << " " << lon << "\n"; } } { // Slightly faster, use intervals of equal arc length double da = a12 / num; for (int i = 0; i <= num; ++i) { double lat, lon; line.ArcPosition(i * da, lat, lon); cout << i << " " << lat << " " << lon << "\n"; } } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-CassiniSoldner.cpp0000644000175000017500000000201311745620414022747 0ustar frankiefrankie// Example of using the GeographicLib::CassiniSoldner class // $Id: f1d1d192c9449d198226a19cfbdc37d0b14ea52f $ #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { Geodesic geod(Constants::WGS84_a(), Constants::WGS84_f()); // Alternatively: const Geodesic& geod = Geodesic::WGS84; const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris CassiniSoldner proj(lat0, lon0, geod); { // Sample forward calculation double lat = 50.9, lon = 1.8; // Calais double x, y; proj.Forward(lat, lon, x, y); cout << x << " " << y << "\n"; } { // Sample reverse calculation double x = -38e3, y = 230e3; double lat, lon; proj.Reverse(x, y, lat, lon); cout << lat << " " << lon << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-TransverseMercator.cpp0000644000175000017500000000211211745620414023660 0ustar frankiefrankie// Example of using the GeographicLib::TransverseMercator class // $Id: c01651412c934220e2293c344258773ac3d7131c $ #include #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { TransverseMercator proj(Constants::WGS84_a(), Constants::WGS84_f(), Constants::UTM_k0()); // Alternatively: const TransverseMercator& proj = TransverseMercator::UTM; double lon0 = -75; // Central meridian for UTM zone 18 { // Sample forward calculation double lat = 40.3, lon = -74.7; // Princeton, NJ double x, y; proj.Forward(lon0, lat, lon, x, y); cout << x << " " << y << "\n"; } { // Sample reverse calculation double x = 25e3, y = 4461e3; double lat, lon; proj.Reverse(lon0, x, y, lat, lon); cout << lat << " " << lon << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-Utility.cpp0000644000175000017500000000112611745620414021476 0ustar frankiefrankie// Example of using the GeographicLib::Utility class // $Id: 34856fc274a1db91814bb96768a6c8feee03dacc $ #include #include #include using namespace std; using namespace GeographicLib; int main() { try { int d1 = Utility::day(1939, 9, 3), // Britain declares war on Germany d2 = Utility::day(1945, 8, 15); // Japan surrenders cout << d2 - d1 << "\n"; // Length of Second World War for Britain } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-Geodesic-small.cpp0000644000175000017500000000100411745620414022656 0ustar frankiefrankie// Small example of using the GeographicLib::Geodesic class // $Id: 23959b26e8023e42f76afabf7a2d7b593666a71a $ #include #include using namespace std; using namespace GeographicLib; int main() { const Geodesic& geod = Geodesic::WGS84; // Distance from JFK to LHR double lat1 = 40.6, lon1 = -73.8, // JFK Airport lat2 = 51.6, lon2 = -0.5; // LHR Airport double s12; geod.Inverse(lat1, lon1, lat2, lon2, s12); cout << s12 / 1000 << " km\n"; return 0; } geographiclib-1.21/examples/example-SphericalHarmonic1.cpp0000644000175000017500000000214711745620414023513 0ustar frankiefrankie// Example of using the GeographicLib::SphericalHarmonic1 class // $Id: 9d964d2e64c201179a88e51697b508414ff8c800 $ #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { int N = 3, N1 = 2; // The maxium degrees double ca[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients vector C(ca, ca + (N + 1) * (N + 2) / 2); double sa[] = {6, 5, 4, 3, 2, 1}; // sine coefficients vector S(sa, sa + N * (N + 1) / 2); double cb[] = {1, 2, 3, 4, 5, 6}; vector C1(cb, cb + (N1 + 1) * (N1 + 2) / 2); double sb[] = {3, 2, 1}; vector S1(sb, sb + N1 * (N1 + 1) / 2); double a = 1; SphericalHarmonic1 h(C, S, N, C1, S1, N1, a); double tau = 0.1, x = 2, y = 3, z = 1; double v, vx, vy, vz; v = h(tau, x, y, z, vx, vy, vz); cout << v << " " << vx << " " << vy << " " << vz << "\n"; } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-SphericalHarmonic2.cpp0000644000175000017500000000243411745620414023513 0ustar frankiefrankie// Example of using the GeographicLib::SphericalHarmonic2 class // $Id: 123fa26549f23444cf8b29d2381f2a6e5e672b5f $ #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { int N = 3, N1 = 2, N2 = 1; // The maxium degrees double ca[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients vector C(ca, ca + (N + 1) * (N + 2) / 2); double sa[] = {6, 5, 4, 3, 2, 1}; // sine coefficients vector S(sa, sa + N * (N + 1) / 2); double cb[] = {1, 2, 3, 4, 5, 6}; vector C1(cb, cb + (N1 + 1) * (N1 + 2) / 2); double sb[] = {3, 2, 1}; vector S1(sb, sb + N1 * (N1 + 1) / 2); double cc[] = {2, 1}; vector C2(cc, cc + (N2 + 1)); vector S2; double a = 1; SphericalHarmonic2 h(C, S, N, N, N, C1, S1, N1, N1, N1, C2, S2, N2, N2, 0, a); double tau1 = 0.1, tau2 = 0.05, x = 2, y = 3, z = 1; double v, vx, vy, vz; v = h(tau1, tau2, x, y, z, vx, vy, vz); cout << v << " " << vx << " " << vy << " " << vz << "\n"; } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-OSGB.cpp0000644000175000017500000000170311745620414020566 0ustar frankiefrankie// Example of using the GeographicLib::OSGB class // $Id: 80feea12c2ebb7e594d8e17bf841c1a141cf3c36 $ #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { { // Sample forward calculation double lat = 55.5, lon = -1.64; // Embleton, Northumberland double x, y; OSGB::Forward(lat, lon, x, y); string gridref; OSGB::GridReference(x, y, 2, gridref); cout << x << " " << y << " " << gridref << "\n"; } { // Sample reverse calculation string gridref = "NU2222"; double x, y; int prec; OSGB::GridReference(gridref, x, y, prec); double lat, lon; OSGB::Reverse(x, y, lat, lon); cout << prec << " " << lat << " " << lon << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-DMS.cpp0000644000175000017500000000121311745620414020453 0ustar frankiefrankie// Example of using the GeographicLib::DMS class // $Id: c12828a51e75bb4a2a28f67768acdb405f63a197 $ #include #include #include using namespace std; using namespace GeographicLib; int main() { try { { string dms = "30d14'45.6\"S"; DMS::flag type; double ang = DMS::Decode(dms, type); cout << type << " " << ang << "\n"; } { double ang = -30.245715; string dms = DMS::Encode(ang, 6, DMS::LATITUDE); cout << dms << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/examples/example-AlbersEqualArea.cpp0000644000175000017500000000230011745620414023017 0ustar frankiefrankie// Example of using the GeographicLib::AlbersEqualArea class // $Id: 230027b09ff2dfa7940202913a6d965281818b99 $ #include #include #include using namespace std; using namespace GeographicLib; int main() { try { const double a = Constants::WGS84_a(), f = Constants::WGS84_f(), lat1 = 40 + 58/60.0, lat2 = 39 + 56/60.0, // standard parallels k1 = 1, // scale lon0 = -77 - 45/60.0; // Central meridan // Set up basic projection const AlbersEqualArea albers(a, f, lat1, lat2, k1); { // Sample conversion from geodetic to Albers Equal Area double lat = 39.95, lon = -75.17; // Philadelphia double x, y; albers.Forward(lon0, lat, lon, x, y); std::cout << x << " " << y << "\n"; } { // Sample conversion from Albers Equal Area grid to geodetic double x = 220e3, y = -53e3; double lat, lon; albers.Reverse(lon0, x, y, lat, lon); std::cout << lat << " " << lon << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } return 0; } geographiclib-1.21/windows/0002755000175000017500000000000011757437426015570 5ustar frankiefrankiegeographiclib-1.21/windows/ConicProj-vc8.vcproj0000644000175000017500000001556111745620415021374 0ustar frankiefrankie geographiclib-1.21/windows/GeoConvert-vc10.vcxproj0000644000175000017500000002005411745620415022013 0ustar frankiefrankie Debug Win32 Debug x64 Release Win32 Release x64 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034} Win32Proj GeoConvert GeoConvert Application true NotSet Application true NotSet Application false true NotSet Application false true NotSet true true $(SolutionDir)$(Configuration)64\ $(Configuration)64\ false false $(SolutionDir)$(Configuration)64\ $(Configuration)64\ Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) geographiclib-1.21/windows/Geographic-vc8.vcproj0000644000175000017500000002510411745620415021550 0ustar frankiefrankie geographiclib-1.21/windows/CartConvert-vc9.vcproj0000644000175000017500000001630711745620415021740 0ustar frankiefrankie geographiclib-1.21/windows/GeodesicProj-vc8.vcproj0000644000175000017500000001557511745620415022070 0ustar frankiefrankie geographiclib-1.21/windows/MagneticField-vc9.vcproj0000644000175000017500000001631711745620415022202 0ustar frankiefrankie geographiclib-1.21/windows/GeoConvert-vc9.vcproj0000644000175000017500000001630311745620415021555 0ustar frankiefrankie geographiclib-1.21/windows/GeoidEval-vc8.vcproj0000644000175000017500000001556111745620415021345 0ustar frankiefrankie geographiclib-1.21/windows/Planimeter-vc9.vcproj0000644000175000017500000001630311745620415021602 0ustar frankiefrankie geographiclib-1.21/windows/GeographicLib-vc8.sln0000644000175000017500000002562611745620415021501 0ustar frankiefrankieMicrosoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Geographic", "Geographic-vc8.vcproj", "{4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GeoConvert", "GeoConvert-vc8.vcproj", "{C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Geod", "Geod-vc8.vcproj", "{F1B64F66-7B95-4087-9619-4ABC20BEB591}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034} = {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GeoidEval", "GeoidEval-vc8.vcproj", "{0507FE91-AD45-4630-88EF-DABFA9A02FB4}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {F1B64F66-7B95-4087-9619-4ABC20BEB591} = {F1B64F66-7B95-4087-9619-4ABC20BEB591} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CartConvert", "CartConvert-vc8.vcproj", "{699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {0507FE91-AD45-4630-88EF-DABFA9A02FB4} = {0507FE91-AD45-4630-88EF-DABFA9A02FB4} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TransverseMercatorProj", "TransverseMercatorProj-vc8.vcproj", "{73FED050-34B7-40EE-96FA-6EABA84F6F9B}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65} = {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GeodesicProj", "GeodesicProj-vc8.vcproj", "{2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {73FED050-34B7-40EE-96FA-6EABA84F6F9B} = {73FED050-34B7-40EE-96FA-6EABA84F6F9B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Planimeter", "Planimeter-vc8.vcproj", "{AAA7F386-D98F-4E1C-BA16-628CEF1DB440}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A} = {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConicProj", "ConicProj-vc8.vcproj", "{62483C58-6125-4DB8-889D-23F5CB1D9744}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {AAA7F386-D98F-4E1C-BA16-628CEF1DB440} = {AAA7F386-D98F-4E1C-BA16-628CEF1DB440} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MagneticField", "MagneticField-vc8.vcproj", "{3D185FB1-192C-457B-A327-27CFAEB82D8A}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {62483C58-6125-4DB8-889D-23F5CB1D9744} = {62483C58-6125-4DB8-889D-23F5CB1D9744} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Gravity", "Gravity-vc8.vcproj", "{0FC0DED7-C708-468A-9E29-E7F245EE0C1C}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {3D185FB1-192C-457B-A327-27CFAEB82D8A} = {3D185FB1-192C-457B-A327-27CFAEB82D8A} EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Debug|Win32.ActiveCfg = Debug|Win32 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Debug|Win32.Build.0 = Debug|Win32 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Debug|x64.ActiveCfg = Debug|x64 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Debug|x64.Build.0 = Debug|x64 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Release|Win32.ActiveCfg = Release|Win32 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Release|Win32.Build.0 = Release|Win32 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Release|x64.ActiveCfg = Release|x64 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Release|x64.Build.0 = Release|x64 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Debug|Win32.ActiveCfg = Debug|Win32 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Debug|Win32.Build.0 = Debug|Win32 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Debug|x64.ActiveCfg = Debug|x64 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Debug|x64.Build.0 = Debug|x64 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Release|Win32.ActiveCfg = Release|Win32 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Release|Win32.Build.0 = Release|Win32 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Release|x64.ActiveCfg = Release|x64 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Release|x64.Build.0 = Release|x64 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Debug|Win32.ActiveCfg = Debug|Win32 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Debug|Win32.Build.0 = Debug|Win32 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Debug|x64.ActiveCfg = Debug|x64 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Debug|x64.Build.0 = Debug|x64 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Release|Win32.ActiveCfg = Release|Win32 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Release|Win32.Build.0 = Release|Win32 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Release|x64.ActiveCfg = Release|x64 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Release|x64.Build.0 = Release|x64 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Debug|Win32.ActiveCfg = Debug|Win32 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Debug|Win32.Build.0 = Debug|Win32 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Debug|x64.ActiveCfg = Debug|x64 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Debug|x64.Build.0 = Debug|x64 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Release|Win32.ActiveCfg = Release|Win32 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Release|Win32.Build.0 = Release|Win32 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Release|x64.ActiveCfg = Release|x64 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Release|x64.Build.0 = Release|x64 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Debug|Win32.ActiveCfg = Debug|Win32 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Debug|Win32.Build.0 = Debug|Win32 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Debug|x64.ActiveCfg = Debug|x64 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Debug|x64.Build.0 = Debug|x64 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Release|Win32.ActiveCfg = Release|Win32 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Release|Win32.Build.0 = Release|Win32 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Release|x64.ActiveCfg = Release|x64 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Release|x64.Build.0 = Release|x64 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Debug|Win32.ActiveCfg = Debug|Win32 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Debug|Win32.Build.0 = Debug|Win32 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Debug|x64.ActiveCfg = Debug|x64 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Debug|x64.Build.0 = Debug|x64 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Release|Win32.ActiveCfg = Release|Win32 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Release|Win32.Build.0 = Release|Win32 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Release|x64.ActiveCfg = Release|x64 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Release|x64.Build.0 = Release|x64 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Debug|Win32.ActiveCfg = Debug|Win32 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Debug|Win32.Build.0 = Debug|Win32 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Debug|x64.ActiveCfg = Debug|x64 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Debug|x64.Build.0 = Debug|x64 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Release|Win32.ActiveCfg = Release|Win32 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Release|Win32.Build.0 = Release|Win32 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Release|x64.ActiveCfg = Release|x64 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Release|x64.Build.0 = Release|x64 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Debug|Win32.ActiveCfg = Debug|Win32 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Debug|Win32.Build.0 = Debug|Win32 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Debug|x64.ActiveCfg = Debug|x64 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Debug|x64.Build.0 = Debug|x64 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Release|Win32.ActiveCfg = Release|Win32 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Release|Win32.Build.0 = Release|Win32 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Release|x64.ActiveCfg = Release|x64 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Release|x64.Build.0 = Release|x64 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Debug|Win32.ActiveCfg = Debug|Win32 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Debug|Win32.Build.0 = Debug|Win32 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Debug|x64.ActiveCfg = Debug|x64 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Debug|x64.Build.0 = Debug|x64 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Release|Win32.ActiveCfg = Release|Win32 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Release|Win32.Build.0 = Release|Win32 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Release|x64.ActiveCfg = Release|x64 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Release|x64.Build.0 = Release|x64 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Debug|Win32.ActiveCfg = Debug|Win32 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Debug|Win32.Build.0 = Debug|Win32 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Debug|x64.ActiveCfg = Debug|x64 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Debug|x64.Build.0 = Debug|x64 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Release|Win32.ActiveCfg = Release|Win32 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Release|Win32.Build.0 = Release|Win32 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Release|x64.ActiveCfg = Release|x64 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Release|x64.Build.0 = Release|x64 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Debug|Win32.ActiveCfg = Debug|Win32 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Debug|Win32.Build.0 = Debug|Win32 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Debug|x64.ActiveCfg = Debug|x64 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Debug|x64.Build.0 = Debug|x64 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Release|Win32.ActiveCfg = Release|Win32 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Release|Win32.Build.0 = Release|Win32 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Release|x64.ActiveCfg = Release|x64 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal geographiclib-1.21/windows/GeographicLib-vc9.sln0000644000175000017500000002562711745620415021503 0ustar frankiefrankieMicrosoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Geographic", "Geographic-vc9.vcproj", "{4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GeoConvert", "GeoConvert-vc9.vcproj", "{C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Geod", "Geod-vc9.vcproj", "{F1B64F66-7B95-4087-9619-4ABC20BEB591}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034} = {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GeoidEval", "GeoidEval-vc9.vcproj", "{0507FE91-AD45-4630-88EF-DABFA9A02FB4}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {F1B64F66-7B95-4087-9619-4ABC20BEB591} = {F1B64F66-7B95-4087-9619-4ABC20BEB591} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CartConvert", "CartConvert-vc9.vcproj", "{699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {0507FE91-AD45-4630-88EF-DABFA9A02FB4} = {0507FE91-AD45-4630-88EF-DABFA9A02FB4} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TransverseMercatorProj", "TransverseMercatorProj-vc9.vcproj", "{73FED050-34B7-40EE-96FA-6EABA84F6F9B}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65} = {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GeodesicProj", "GeodesicProj-vc9.vcproj", "{2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {73FED050-34B7-40EE-96FA-6EABA84F6F9B} = {73FED050-34B7-40EE-96FA-6EABA84F6F9B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Planimeter", "Planimeter-vc9.vcproj", "{AAA7F386-D98F-4E1C-BA16-628CEF1DB440}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A} = {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConicProj", "ConicProj-vc9.vcproj", "{62483C58-6125-4DB8-889D-23F5CB1D9744}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {AAA7F386-D98F-4E1C-BA16-628CEF1DB440} = {AAA7F386-D98F-4E1C-BA16-628CEF1DB440} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MagneticField", "MagneticField-vc9.vcproj", "{3D185FB1-192C-457B-A327-27CFAEB82D8A}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {62483C58-6125-4DB8-889D-23F5CB1D9744} = {62483C58-6125-4DB8-889D-23F5CB1D9744} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Gravity", "Gravity-vc9.vcproj", "{0FC0DED7-C708-468A-9E29-E7F245EE0C1C}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {3D185FB1-192C-457B-A327-27CFAEB82D8A} = {3D185FB1-192C-457B-A327-27CFAEB82D8A} EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Debug|Win32.ActiveCfg = Debug|Win32 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Debug|Win32.Build.0 = Debug|Win32 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Debug|x64.ActiveCfg = Debug|x64 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Debug|x64.Build.0 = Debug|x64 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Release|Win32.ActiveCfg = Release|Win32 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Release|Win32.Build.0 = Release|Win32 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Release|x64.ActiveCfg = Release|x64 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Release|x64.Build.0 = Release|x64 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Debug|Win32.ActiveCfg = Debug|Win32 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Debug|Win32.Build.0 = Debug|Win32 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Debug|x64.ActiveCfg = Debug|x64 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Debug|x64.Build.0 = Debug|x64 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Release|Win32.ActiveCfg = Release|Win32 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Release|Win32.Build.0 = Release|Win32 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Release|x64.ActiveCfg = Release|x64 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Release|x64.Build.0 = Release|x64 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Debug|Win32.ActiveCfg = Debug|Win32 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Debug|Win32.Build.0 = Debug|Win32 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Debug|x64.ActiveCfg = Debug|x64 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Debug|x64.Build.0 = Debug|x64 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Release|Win32.ActiveCfg = Release|Win32 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Release|Win32.Build.0 = Release|Win32 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Release|x64.ActiveCfg = Release|x64 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Release|x64.Build.0 = Release|x64 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Debug|Win32.ActiveCfg = Debug|Win32 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Debug|Win32.Build.0 = Debug|Win32 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Debug|x64.ActiveCfg = Debug|x64 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Debug|x64.Build.0 = Debug|x64 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Release|Win32.ActiveCfg = Release|Win32 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Release|Win32.Build.0 = Release|Win32 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Release|x64.ActiveCfg = Release|x64 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Release|x64.Build.0 = Release|x64 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Debug|Win32.ActiveCfg = Debug|Win32 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Debug|Win32.Build.0 = Debug|Win32 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Debug|x64.ActiveCfg = Debug|x64 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Debug|x64.Build.0 = Debug|x64 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Release|Win32.ActiveCfg = Release|Win32 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Release|Win32.Build.0 = Release|Win32 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Release|x64.ActiveCfg = Release|x64 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Release|x64.Build.0 = Release|x64 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Debug|Win32.ActiveCfg = Debug|Win32 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Debug|Win32.Build.0 = Debug|Win32 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Debug|x64.ActiveCfg = Debug|x64 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Debug|x64.Build.0 = Debug|x64 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Release|Win32.ActiveCfg = Release|Win32 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Release|Win32.Build.0 = Release|Win32 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Release|x64.ActiveCfg = Release|x64 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Release|x64.Build.0 = Release|x64 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Debug|Win32.ActiveCfg = Debug|Win32 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Debug|Win32.Build.0 = Debug|Win32 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Debug|x64.ActiveCfg = Debug|x64 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Debug|x64.Build.0 = Debug|x64 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Release|Win32.ActiveCfg = Release|Win32 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Release|Win32.Build.0 = Release|Win32 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Release|x64.ActiveCfg = Release|x64 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Release|x64.Build.0 = Release|x64 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Debug|Win32.ActiveCfg = Debug|Win32 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Debug|Win32.Build.0 = Debug|Win32 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Debug|x64.ActiveCfg = Debug|x64 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Debug|x64.Build.0 = Debug|x64 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Release|Win32.ActiveCfg = Release|Win32 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Release|Win32.Build.0 = Release|Win32 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Release|x64.ActiveCfg = Release|x64 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Release|x64.Build.0 = Release|x64 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Debug|Win32.ActiveCfg = Debug|Win32 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Debug|Win32.Build.0 = Debug|Win32 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Debug|x64.ActiveCfg = Debug|x64 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Debug|x64.Build.0 = Debug|x64 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Release|Win32.ActiveCfg = Release|Win32 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Release|Win32.Build.0 = Release|Win32 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Release|x64.ActiveCfg = Release|x64 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Release|x64.Build.0 = Release|x64 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Debug|Win32.ActiveCfg = Debug|Win32 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Debug|Win32.Build.0 = Debug|Win32 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Debug|x64.ActiveCfg = Debug|x64 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Debug|x64.Build.0 = Debug|x64 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Release|Win32.ActiveCfg = Release|Win32 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Release|Win32.Build.0 = Release|Win32 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Release|x64.ActiveCfg = Release|x64 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Release|x64.Build.0 = Release|x64 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Debug|Win32.ActiveCfg = Debug|Win32 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Debug|Win32.Build.0 = Debug|Win32 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Debug|x64.ActiveCfg = Debug|x64 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Debug|x64.Build.0 = Debug|x64 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Release|Win32.ActiveCfg = Release|Win32 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Release|Win32.Build.0 = Release|Win32 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Release|x64.ActiveCfg = Release|x64 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal geographiclib-1.21/windows/ConicProj-vc10.vcxproj0000644000175000017500000002005011745620415021622 0ustar frankiefrankie Debug Win32 Debug x64 Release Win32 Release x64 {62483C58-6125-4DB8-889D-23F5CB1D9744} Win32Proj ConicProj ConicProj Application true NotSet Application true NotSet Application false true NotSet Application false true NotSet true true $(SolutionDir)$(Configuration)64\ $(Configuration)64\ false false $(SolutionDir)$(Configuration)64\ $(Configuration)64\ Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) geographiclib-1.21/windows/GeoidEval-vc10.vcxproj0000644000175000017500000002005011745620415021573 0ustar frankiefrankie Debug Win32 Debug x64 Release Win32 Release x64 {0507FE91-AD45-4630-88EF-DABFA9A02FB4} Win32Proj GeoidEval GeoidEval Application true NotSet Application true NotSet Application false true NotSet Application false true NotSet true true $(SolutionDir)$(Configuration)64\ $(Configuration)64\ false false $(SolutionDir)$(Configuration)64\ $(Configuration)64\ Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) geographiclib-1.21/windows/TransverseMercatorProj-vc9.vcproj0000644000175000017500000001636311745620415024174 0ustar frankiefrankie geographiclib-1.21/windows/MagneticField-vc10.vcxproj0000644000175000017500000002007011745620415022431 0ustar frankiefrankie Debug Win32 Debug x64 Release Win32 Release x64 {3D185FB1-192C-457B-A327-27CFAEB82D8A} Win32Proj MagneticField MagneticField Application true NotSet Application true NotSet Application false true NotSet Application false true NotSet true true $(SolutionDir)$(Configuration)64\ $(Configuration)64\ false false $(SolutionDir)$(Configuration)64\ $(Configuration)64\ Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) geographiclib-1.21/windows/Planimeter-vc10.vcxproj0000644000175000017500000002005411745620415022040 0ustar frankiefrankie Debug Win32 Debug x64 Release Win32 Release x64 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440} Win32Proj Planimeter Planimeter Application true NotSet Application true NotSet Application false true NotSet Application false true NotSet true true $(SolutionDir)$(Configuration)64\ $(Configuration)64\ false false $(SolutionDir)$(Configuration)64\ $(Configuration)64\ Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) geographiclib-1.21/windows/Geod-vc9.vcproj0000644000175000017500000001625311745620415020364 0ustar frankiefrankie geographiclib-1.21/windows/Geod-vc10.vcxproj0000644000175000017500000002002411745620415020613 0ustar frankiefrankie Debug Win32 Debug x64 Release Win32 Release x64 {F1B64F66-7B95-4087-9619-4ABC20BEB591} Win32Proj Geod Geod Application true NotSet Application true NotSet Application false true NotSet Application false true NotSet true true $(SolutionDir)$(Configuration)64\ $(Configuration)64\ false false $(SolutionDir)$(Configuration)64\ $(Configuration)64\ Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) geographiclib-1.21/windows/Makefile.mk0000644000175000017500000000066111745620415017624 0ustar frankiefrankie# $Id: 959eb5fb059ac028bdef404e4cb187a4a81bb318 $ PROGRAMS = CartConvert \ ConicProj \ GeoConvert \ Geod \ GeodesicProj \ GeoidEval \ Gravity \ MagneticField \ Planimeter \ TransverseMercatorProj VSPROJECTS = $(addsuffix -vc8.vcproj,Geographic $(PROGRAMS)) \ $(addsuffix -vc9.vcproj,Geographic $(PROGRAMS)) \ $(addsuffix -vc10.vcxproj,Geographic $(PROGRAMS)) all: @: install: @: clean: @: .PHONY: all install clean geographiclib-1.21/windows/CartConvert-vc8.vcproj0000644000175000017500000001557111745620415021741 0ustar frankiefrankie geographiclib-1.21/windows/GeographicLib-vc10.sln0000644000175000017500000002565511745620415021554 0ustar frankiefrankieMicrosoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Geographic", "Geographic-vc10.vcxproj", "{4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GeoConvert", "GeoConvert-vc10.vcxproj", "{C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Geod", "Geod-vc10.vcxproj", "{F1B64F66-7B95-4087-9619-4ABC20BEB591}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034} = {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GeoidEval", "GeoidEval-vc10.vcxproj", "{0507FE91-AD45-4630-88EF-DABFA9A02FB4}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {F1B64F66-7B95-4087-9619-4ABC20BEB591} = {F1B64F66-7B95-4087-9619-4ABC20BEB591} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CartConvert", "CartConvert-vc10.vcxproj", "{699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {0507FE91-AD45-4630-88EF-DABFA9A02FB4} = {0507FE91-AD45-4630-88EF-DABFA9A02FB4} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TransverseMercatorProj", "TransverseMercatorProj-vc10.vcxproj", "{73FED050-34B7-40EE-96FA-6EABA84F6F9B}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65} = {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GeodesicProj", "GeodesicProj-vc10.vcxproj", "{2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {73FED050-34B7-40EE-96FA-6EABA84F6F9B} = {73FED050-34B7-40EE-96FA-6EABA84F6F9B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Planimeter", "Planimeter-vc10.vcxproj", "{AAA7F386-D98F-4E1C-BA16-628CEF1DB440}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A} = {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConicProj", "ConicProj-vc10.vcxproj", "{62483C58-6125-4DB8-889D-23F5CB1D9744}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {AAA7F386-D98F-4E1C-BA16-628CEF1DB440} = {AAA7F386-D98F-4E1C-BA16-628CEF1DB440} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MagneticField", "MagneticField-vc10.vcxproj", "{3D185FB1-192C-457B-A327-27CFAEB82D8A}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {62483C58-6125-4DB8-889D-23F5CB1D9744} = {62483C58-6125-4DB8-889D-23F5CB1D9744} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Gravity", "Gravity-vc10.vcxproj", "{0FC0DED7-C708-468A-9E29-E7F245EE0C1C}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {3D185FB1-192C-457B-A327-27CFAEB82D8A} = {3D185FB1-192C-457B-A327-27CFAEB82D8A} EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Debug|Win32.ActiveCfg = Debug|Win32 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Debug|Win32.Build.0 = Debug|Win32 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Debug|x64.ActiveCfg = Debug|x64 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Debug|x64.Build.0 = Debug|x64 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Release|Win32.ActiveCfg = Release|Win32 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Release|Win32.Build.0 = Release|Win32 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Release|x64.ActiveCfg = Release|x64 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Release|x64.Build.0 = Release|x64 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Debug|Win32.ActiveCfg = Debug|Win32 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Debug|Win32.Build.0 = Debug|Win32 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Debug|x64.ActiveCfg = Debug|x64 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Debug|x64.Build.0 = Debug|x64 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Release|Win32.ActiveCfg = Release|Win32 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Release|Win32.Build.0 = Release|Win32 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Release|x64.ActiveCfg = Release|x64 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Release|x64.Build.0 = Release|x64 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Debug|Win32.ActiveCfg = Debug|Win32 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Debug|Win32.Build.0 = Debug|Win32 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Debug|x64.ActiveCfg = Debug|x64 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Debug|x64.Build.0 = Debug|x64 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Release|Win32.ActiveCfg = Release|Win32 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Release|Win32.Build.0 = Release|Win32 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Release|x64.ActiveCfg = Release|x64 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Release|x64.Build.0 = Release|x64 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Debug|Win32.ActiveCfg = Debug|Win32 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Debug|Win32.Build.0 = Debug|Win32 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Debug|x64.ActiveCfg = Debug|x64 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Debug|x64.Build.0 = Debug|x64 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Release|Win32.ActiveCfg = Release|Win32 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Release|Win32.Build.0 = Release|Win32 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Release|x64.ActiveCfg = Release|x64 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Release|x64.Build.0 = Release|x64 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Debug|Win32.ActiveCfg = Debug|Win32 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Debug|Win32.Build.0 = Debug|Win32 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Debug|x64.ActiveCfg = Debug|x64 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Debug|x64.Build.0 = Debug|x64 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Release|Win32.ActiveCfg = Release|Win32 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Release|Win32.Build.0 = Release|Win32 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Release|x64.ActiveCfg = Release|x64 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Release|x64.Build.0 = Release|x64 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Debug|Win32.ActiveCfg = Debug|Win32 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Debug|Win32.Build.0 = Debug|Win32 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Debug|x64.ActiveCfg = Debug|x64 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Debug|x64.Build.0 = Debug|x64 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Release|Win32.ActiveCfg = Release|Win32 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Release|Win32.Build.0 = Release|Win32 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Release|x64.ActiveCfg = Release|x64 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Release|x64.Build.0 = Release|x64 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Debug|Win32.ActiveCfg = Debug|Win32 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Debug|Win32.Build.0 = Debug|Win32 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Debug|x64.ActiveCfg = Debug|x64 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Debug|x64.Build.0 = Debug|x64 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Release|Win32.ActiveCfg = Release|Win32 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Release|Win32.Build.0 = Release|Win32 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Release|x64.ActiveCfg = Release|x64 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Release|x64.Build.0 = Release|x64 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Debug|Win32.ActiveCfg = Debug|Win32 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Debug|Win32.Build.0 = Debug|Win32 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Debug|x64.ActiveCfg = Debug|x64 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Debug|x64.Build.0 = Debug|x64 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Release|Win32.ActiveCfg = Release|Win32 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Release|Win32.Build.0 = Release|Win32 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Release|x64.ActiveCfg = Release|x64 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Release|x64.Build.0 = Release|x64 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Debug|Win32.ActiveCfg = Debug|Win32 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Debug|Win32.Build.0 = Debug|Win32 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Debug|x64.ActiveCfg = Debug|x64 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Debug|x64.Build.0 = Debug|x64 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Release|Win32.ActiveCfg = Release|Win32 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Release|Win32.Build.0 = Release|Win32 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Release|x64.ActiveCfg = Release|x64 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Release|x64.Build.0 = Release|x64 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Debug|Win32.ActiveCfg = Debug|Win32 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Debug|Win32.Build.0 = Debug|Win32 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Debug|x64.ActiveCfg = Debug|x64 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Debug|x64.Build.0 = Debug|x64 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Release|Win32.ActiveCfg = Release|Win32 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Release|Win32.Build.0 = Release|Win32 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Release|x64.ActiveCfg = Release|x64 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Release|x64.Build.0 = Release|x64 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Debug|Win32.ActiveCfg = Debug|Win32 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Debug|Win32.Build.0 = Debug|Win32 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Debug|x64.ActiveCfg = Debug|x64 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Debug|x64.Build.0 = Debug|x64 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Release|Win32.ActiveCfg = Release|Win32 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Release|Win32.Build.0 = Release|Win32 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Release|x64.ActiveCfg = Release|x64 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal geographiclib-1.21/windows/Gravity-vc9.vcproj0000644000175000017500000001626711745620415021140 0ustar frankiefrankie geographiclib-1.21/windows/MagneticField-vc8.vcproj0000644000175000017500000001560111745620415022174 0ustar frankiefrankie geographiclib-1.21/windows/GeoConvert-vc8.vcproj0000644000175000017500000001556511745620415021565 0ustar frankiefrankie geographiclib-1.21/windows/ConicProj-vc9.vcproj0000644000175000017500000001627711745620415021402 0ustar frankiefrankie geographiclib-1.21/windows/Planimeter-vc8.vcproj0000644000175000017500000001556511745620415021612 0ustar frankiefrankie geographiclib-1.21/windows/Geographic-vc9.vcproj0000644000175000017500000002522211745620415021552 0ustar frankiefrankie geographiclib-1.21/windows/TransverseMercatorProj-vc10.vcxproj0000644000175000017500000002013411745620415024423 0ustar frankiefrankie Debug Win32 Debug x64 Release Win32 Release x64 {73FED050-34B7-40EE-96FA-6EABA84F6F9B} Win32Proj TransverseMercatorProj TransverseMercatorProj Application true NotSet Application true NotSet Application false true NotSet Application false true NotSet true true $(SolutionDir)$(Configuration)64\ $(Configuration)64\ false false $(SolutionDir)$(Configuration)64\ $(Configuration)64\ Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) geographiclib-1.21/windows/GeodesicProj-vc9.vcproj0000644000175000017500000001631311745620415022060 0ustar frankiefrankie geographiclib-1.21/windows/TransverseMercatorProj-vc8.vcproj0000644000175000017500000001564511745620415024175 0ustar frankiefrankie geographiclib-1.21/windows/Geographic-vc10.vcxproj0000644000175000017500000002570611745620415022021 0ustar frankiefrankie Debug Win32 Debug x64 Release Win32 Release x64 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} v4.0 ManagedCProj Geographic Geographic StaticLibrary true false NotSet StaticLibrary true false NotSet StaticLibrary false false NotSet StaticLibrary false false NotSet true $(ProjectName)_d true $(ProjectName)_d $(SolutionDir)$(Configuration)64\ $(Configuration)64\ false false $(SolutionDir)$(Configuration)64\ $(Configuration)64\ Level3 Disabled WIN32;_DEBUG;%(PreprocessorDefinitions) NotUsing ../include true Level3 Disabled WIN32;_DEBUG;%(PreprocessorDefinitions) NotUsing ../include true Level3 WIN32;NDEBUG;%(PreprocessorDefinitions) NotUsing ../include true Level3 WIN32;NDEBUG;%(PreprocessorDefinitions) NotUsing ../include true geographiclib-1.21/windows/Geod-vc8.vcproj0000644000175000017500000001553511745620415020365 0ustar frankiefrankie geographiclib-1.21/windows/GeoidEval-vc9.vcproj0000644000175000017500000001627711745620415021353 0ustar frankiefrankie geographiclib-1.21/windows/GeodesicProj-vc10.vcxproj0000644000175000017500000002006411745620415022316 0ustar frankiefrankie Debug Win32 Debug x64 Release Win32 Release x64 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A} Win32Proj GeodesicProj GeodesicProj Application true NotSet Application true NotSet Application false true NotSet Application false true NotSet true true $(SolutionDir)$(Configuration)64\ $(Configuration)64\ false false $(SolutionDir)$(Configuration)64\ $(Configuration)64\ Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) geographiclib-1.21/windows/Gravity-vc8.vcproj0000644000175000017500000001555111745620415021132 0ustar frankiefrankie geographiclib-1.21/windows/Gravity-vc10.vcxproj0000644000175000017500000002004011745620415021360 0ustar frankiefrankie Debug Win32 Debug x64 Release Win32 Release x64 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C} Win32Proj Gravity Gravity Application true NotSet Application true NotSet Application false true NotSet Application false true NotSet true true $(SolutionDir)$(Configuration)64\ $(Configuration)64\ false false $(SolutionDir)$(Configuration)64\ $(Configuration)64\ Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) geographiclib-1.21/windows/CartConvert-vc10.vcxproj0000644000175000017500000002006011745620415022167 0ustar frankiefrankie Debug Win32 Debug x64 Release Win32 Release x64 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65} Win32Proj CartConvert CartConvert Application true NotSet Application true NotSet Application false true NotSet Application false true NotSet true true $(SolutionDir)$(Configuration)64\ $(Configuration)64\ false false $(SolutionDir)$(Configuration)64\ $(Configuration)64\ Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) geographiclib-1.21/include/0002755000175000017500000000000011757437425015520 5ustar frankiefrankiegeographiclib-1.21/include/GeographicLib/0002755000175000017500000000000011757437425020217 5ustar frankiefrankiegeographiclib-1.21/include/GeographicLib/GeoCoords.hpp0000644000175000017500000004445711745620414022615 0ustar frankiefrankie/** * \file GeoCoords.hpp * \brief Header for GeographicLib::GeoCoords class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #ifndef GEOGRAPHICLIB_GEOCOORDS_HPP #define GEOGRAPHICLIB_GEOCOORDS_HPP \ "$Id: e706d3a35c3be0e2beaf39041cac29beb468a5aa $" #include #include namespace GeographicLib { /** * \brief Conversion between geographic coordinates * * This class stores a geographic position which may be set via the * constructors or Reset via * - latitude and longitude * - UTM or UPS coordinates * - a string representation of these or an MGRS coordinate string * * The state consists of the latitude and longitude and the supplied UTM or * UPS coordinates (possibly derived from the MGRS coordinates). If latitude * and longitude were given then the UTM/UPS coordinates follows the standard * conventions. * * The mutable state consists of the UTM or UPS coordinates for a alternate * zone. A method SetAltZone is provided to set the alternate UPS/UTM zone. * * Methods are provided to return the geographic coordinates, the input UTM * or UPS coordinates (and associated meridian convergence and scale), or * alternate UTM or UPS coordinates (and their associated meridian * convergence and scale). * * Once the input string has been parsed, you can print the result out in any * of the formats, decimal degrees, degrees minutes seconds, MGRS, UTM/UPS. * * Example of use: * \include example-GeoCoords.cpp * * GeoConvert is a command-line utility * providing access to the functionality of GeoCoords. **********************************************************************/ class GEOGRAPHIC_EXPORT GeoCoords { private: typedef Math::real real; real _lat, _long, _easting, _northing, _gamma, _k; bool _northp; int _zone; // See UTMUPS::zonespec mutable real _alt_easting, _alt_northing, _alt_gamma, _alt_k; mutable int _alt_zone; void CopyToAlt() const throw() { _alt_easting = _easting; _alt_northing = _northing; _alt_gamma = _gamma; _alt_k = _k; _alt_zone = _zone; } void UTMUPSString(int zone, real easting, real northing, int prec, std::string& utm) const; void FixHemisphere(); public: /** \name Initializing the GeoCoords object **********************************************************************/ ///@{ /** * The default constructor is equivalent to \e latitude = 90o, * \e longitude = 0o. **********************************************************************/ GeoCoords() throw() // This is the N pole : _lat(90) , _long(0) , _easting(2000000) , _northing(2000000) , _northp(true) , _zone(0) { CopyToAlt(); } /** * Construct from a string. * * @param[in] s 1-element, 2-element, or 3-element string representation of * the position. * @param[in] centerp governs the interpretation of MGRS coordinates (see * below). * @param[in] swaplatlong governs the interpretation of geographic * coordinates (see below). * * Parse as a string and interpret it as a geographic position. The input * string is broken into space (or comma) separated pieces and Basic * decision on which format is based on number of components * -# MGRS * -# "Lat Long" or "Long Lat" * -# "Zone Easting Northing" or "Easting Northing Zone" * * The following inputs are approximately the same (Ar Ramadi Bridge, Iraq) * - Latitude and Longitude * - 33.44 43.27 * - N33d26.4' E43d16.2' * - 43d16'12"E 33d26'24"N * - 43:16:12E 33:26:24 * - MGRS * - 38SLC301 * - 38SLC391014 * - 38SLC3918701405 * - 37SHT9708 * - UTM * - 38N 339188 3701405 * - 897039 3708229 37N * * Latitude and Longitude parsing. Latitude precedes longitude, unless a * N, S, E, W hemisphere designator is used on one or both coordinates. If * \e swaplatlong = true (default is false), then longitude precedes * latitude in the absence of a hemisphere designator. Thus (with \e * swaplatlong = false) * - 40 -75 * - N40 W75 * - -75 N40 * - 75W 40N * - E-75 -40S * . * are all the same position. The coordinates may be given in * decimal degrees, degrees and decimal minutes, degrees, minutes, * seconds, etc. Use d, ', and " to mark off the degrees, * minutes and seconds. Alternatively, use : to separate these * components. Thus * - 40d30'30" * - 40d30'30 * - 40d30.5' * - 40d30.5 * - 40:30:30 * - 40:30.5 * - 40.508333333 * . * all specify the same angle. The leading sign applies to all components * so -1d30 is -(1+30/60) = -1.5. Latitudes must be in the range [-90, 90] * and longitudes in the range [-180, 360]. Internally longitudes are * reduced to the range [-180, 180). * * UTM/UPS parsing. For UTM zones (-80 <= Lat <= 84), the zone designator * is made up of a zone number (for 1 to 60) and a hemisphere letter (N or * S), e.g., 38N. The latitude zone designer ([C–M] in the southern * hemisphere and [N–X] in the northern) should NOT be used. (This * is part of the MGRS coordinate.) The zone designator for the poles * (where UPS is employed) is a hemisphere letter by itself, i.e., N or S. * * MGRS parsing interprets the grid references as square area at the * specified precision (1m, 10m, 100m, etc.). If \e centerp = true (the * default), the center of this square is then taken to be the precise * position; thus: * - 38SMB = 38N 450000 3650000 * - 38SMB4484 = 38N 444500 3684500 * - 38SMB44148470 = 38N 444145 3684705 * . * Otherwise, the "south-west" corner of the square is used, i.e., * - 38SMB = 38N 400000 3600000 * - 38SMB4484 = 38N 444000 3684000 * - 38SMB44148470 = 38N 444140 3684700 **********************************************************************/ explicit GeoCoords(const std::string& s, bool centerp = true, bool swaplatlong = false) { Reset(s, centerp, swaplatlong); } /** * Construct from geographic coordinates. * * @param[in] latitude (degrees). * @param[in] longitude (degrees). * @param[in] zone if specified, force the UTM/UPS representation to use a * specified zone using the rules given in UTMUPS::zonespec. **********************************************************************/ GeoCoords(real latitude, real longitude, int zone = UTMUPS::STANDARD) { Reset(latitude, longitude, zone); } /** * Construct from UTM/UPS coordinates. * * @param[in] zone UTM zone (zero means UPS). * @param[in] northp hemisphere (true means north, false means south). * @param[in] easting (meters). * @param[in] northing (meters). **********************************************************************/ GeoCoords(int zone, bool northp, real easting, real northing) { Reset(zone, northp, easting, northing); } /** * Reset the location from a string. See * GeoCoords(const std::string& s, bool centerp, bool swaplatlong). **********************************************************************/ void Reset(const std::string& s, bool centerp = true, bool swaplatlong = false); /** * Reset the location in terms of geographic coordinates. See * GeoCoords(real latitude, real longitude, int zone). **********************************************************************/ void Reset(real latitude, real longitude, int zone = UTMUPS::STANDARD) { UTMUPS::Forward(latitude, longitude, _zone, _northp, _easting, _northing, _gamma, _k, zone); _lat = latitude; _long = longitude; if (_long >= 180) _long -= 360; CopyToAlt(); } /** * Reset the location in terms of UPS/UPS coordinates. See * GeoCoords(int zone, bool northp, real easting, real northing). **********************************************************************/ void Reset(int zone, bool northp, real easting, real northing) { UTMUPS::Reverse(zone, northp, easting, northing, _lat, _long, _gamma, _k); _zone = zone; _northp = northp; _easting = easting; _northing = northing; FixHemisphere(); CopyToAlt(); } ///@} /** \name Querying the GeoCoords object **********************************************************************/ ///@{ /** * @return latitude (degrees) **********************************************************************/ Math::real Latitude() const throw() { return _lat; } /** * @return longitude (degrees) **********************************************************************/ Math::real Longitude() const throw() { return _long; } /** * @return easting (meters) **********************************************************************/ Math::real Easting() const throw() { return _easting; } /** * @return northing (meters) **********************************************************************/ Math::real Northing() const throw() { return _northing; } /** * @return meridian convergence (degrees) for the UTM/UPS projection. **********************************************************************/ Math::real Convergence() const throw() { return _gamma; } /** * @return scale for the UTM/UPS projection. **********************************************************************/ Math::real Scale() const throw() { return _k; } /** * @return hemisphere (false means south, true means north). **********************************************************************/ bool Northp() const throw() { return _northp; } /** * @return hemisphere letter N or S. **********************************************************************/ char Hemisphere() const throw() { return _northp ? 'N' : 'S'; } /** * @return the zone corresponding to the input (return 0 for UPS). **********************************************************************/ int Zone() const throw() { return _zone; } ///@} /** \name Setting and querying the alternate zone **********************************************************************/ ///@{ /** * Specify alternate zone number. * * @param[in] zone zone number for the alternate representation. * * See UTMUPS::zonespec for more information on the interpretation of \e * zone. Note that \e zone == UTMUPS::STANDARD (the default) use the * standard UPS or UTM zone, UTMUPS::MATCH does nothing retaining the * existing alternate representation. Before this is called the alternate * zone is the input zone. **********************************************************************/ void SetAltZone(int zone = UTMUPS::STANDARD) const { if (zone == UTMUPS::MATCH) return; zone = UTMUPS::StandardZone(_lat, _long, zone); if (zone == _zone) CopyToAlt(); else { bool northp; UTMUPS::Forward(_lat, _long, _alt_zone, northp, _alt_easting, _alt_northing, _alt_gamma, _alt_k, zone); } } /** * @return current alternate zone (return 0 for UPS). **********************************************************************/ int AltZone() const throw() { return _alt_zone; } /** * @return easting (meters) for alternate zone. **********************************************************************/ Math::real AltEasting() const throw() { return _alt_easting; } /** * @return northing (meters) for alternate zone. **********************************************************************/ Math::real AltNorthing() const throw() { return _alt_northing; } /** * @return meridian convergence (degrees) for alternate zone. **********************************************************************/ Math::real AltConvergence() const throw() { return _alt_gamma; } /** * @return scale for alternate zone. **********************************************************************/ Math::real AltScale() const throw() { return _alt_k; } ///@} /** \name String representations of the GeoCoords object **********************************************************************/ ///@{ /** * String representation with latitude and longitude as signed decimal * degrees. * * @param[in] prec precision (relative to about 1m). * @param[in] swaplatlong if true give longitude first (default = false) * @return decimal latitude/longitude string representation. * * Precision specifies accuracy of representation as follows: * - prec = -5 (min), 1d * - prec = 0, 10-5d (about 1m) * - prec = 3, 10-8d * - prec = 9 (max), 10-14d **********************************************************************/ std::string GeoRepresentation(int prec = 0, bool swaplatlong = false) const; /** * String representation with latitude and longitude as degrees, minutes, * seconds, and hemisphere. * * @param[in] prec precision (relative to about 1m) * @param[in] swaplatlong if true give longitude first (default = false) * @param[in] dmssep if non-null, use as the DMS separator character * (instead of d, ', " delimiters). * @return DMS latitude/longitude string representation. * * Precision specifies accuracy of representation as follows: * - prec = -5 (min), 1d * - prec = -4, 0.1d * - prec = -3, 1' * - prec = -2, 0.1' * - prec = -1, 1" * - prec = 0, 0.1" (about 3m) * - prec = 1, 0.01" * - prec = 10 (max), 10-11" **********************************************************************/ std::string DMSRepresentation(int prec, bool swaplatlong, char dmssep) const; /** * String representation with latitude and longitude as degrees, minutes, * seconds, and hemisphere. * * @param[in] prec precision (relative to about 1m) * @param[in] swaplatlong if true give longitude first (default = false) * @return DMS latitude/longitude string representation. * * COMPATIBILITY NOTE: This function calls * DMSRepresentation(int, bool, char) const with a 3rd argument of * char(0). At some point, DMSRepresentation(int, bool) const and * will be withdrawn and the interface to * DMSRepresentation(int, bool, char) const changed so that its * arguments have default values. This will preserve source-level * compatibility. **********************************************************************/ std::string DMSRepresentation(int prec = 0, bool swaplatlong = false) const; /** * MGRS string. * * @param[in] prec precision (relative to about 1m). * @return MGRS string. * * This gives the coordinates of the enclosing grid square with size given * by the precision. Thus 38N 444180 3684790 converted to a MGRS * coordinate at precision -2 (100m) is 38SMB441847 and not 38SMB442848. * \e prec specifies the precision of the MGRS string as follows: * - prec = -5 (min), 100km * - prec = -4, 10km * - prec = -3, 1km * - prec = -2, 100m * - prec = -1, 10m * - prec = 0, 1m * - prec = 1, 0.1m * - prec = 6 (max), 1um **********************************************************************/ std::string MGRSRepresentation(int prec = 0) const; /** * UTM/UPS string. * * @param[in] prec precision (relative to about 1m) * @return UTM/UPS string representation: zone designator, easting, and * northing. * * Precision specifies accuracy of representation as follows: * - prec = -5 (min), 100km * - prec = -3, 1km * - prec = 0, 1m * - prec = 3, 1mm * - prec = 6, 1um * - prec = 9 (max), 1nm **********************************************************************/ std::string UTMUPSRepresentation(int prec = 0) const; /** * MGRS string for the alternate zone. See GeoCoords::MGRSRepresentation. **********************************************************************/ std::string AltMGRSRepresentation(int prec = 0) const; /** * UTM/UPS string for the alternate zone. See * GeoCoords::UTMUPSRepresentation. **********************************************************************/ std::string AltUTMUPSRepresentation(int prec = 0) const; ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the WGS84 ellipsoid (meters). * * (The WGS84 value is returned because the UTM and UPS projections are * based on this ellipsoid.) **********************************************************************/ Math::real MajorRadius() const throw() { return UTMUPS::MajorRadius(); } /** * @return \e f the flattening of the WGS84 ellipsoid. * * (The WGS84 value is returned because the UTM and UPS projections are * based on this ellipsoid.) **********************************************************************/ Math::real Flattening() const throw() { return UTMUPS::Flattening(); } ///@} /// \cond SKIP /** * DEPRECATED * @return \e r the inverse flattening of the ellipsoid. **********************************************************************/ Math::real InverseFlattening() const throw() { return UTMUPS::InverseFlattening(); } /// \endcond }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_GEOCOORDS_HPP geographiclib-1.21/include/GeographicLib/DMS.hpp0000644000175000017500000003633211745620414021345 0ustar frankiefrankie/** * \file DMS.hpp * \brief Header for GeographicLib::DMS class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_DMS_HPP) #define GEOGRAPHICLIB_DMS_HPP "$Id: 67770a78c105495a31a9d3755c811e938729c85a $" #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about dll vs string #pragma warning (push) #pragma warning (disable: 4251) #endif namespace GeographicLib { /** * \brief Convert between degrees and %DMS representation. * * Parse a string representing degree, minutes, and seconds and return the * angle in degrees and format an angle in degrees as degree, minutes, and * seconds. In addition, handle NANs and infinities on input and output. * * Example of use: * \include example-DMS.cpp **********************************************************************/ class GEOGRAPHIC_EXPORT DMS { private: typedef Math::real real; // Replace all occurrences of pat by c static void replace(std::string& s, const std::string& pat, char c) { std::string::size_type p = 0; while (true) { p = s.find(pat, p); if (p == std::string::npos) break; s.replace(p, pat.length(), 1, c); } } static const std::string hemispheres_; static const std::string signs_; static const std::string digits_; static const std::string dmsindicators_; static const std::string components_[3]; static Math::real NumMatch(const std::string& s); DMS(); // Disable constructor public: /** * Indicator for presence of hemisphere indicator (N/S/E/W) on latitudes * and longitudes. **********************************************************************/ enum flag { /** * No indicator present. * @hideinitializer **********************************************************************/ NONE = 0, /** * Latitude indicator (N/S) present. * @hideinitializer **********************************************************************/ LATITUDE = 1, /** * Longitude indicator (E/W) present. * @hideinitializer **********************************************************************/ LONGITUDE = 2, /** * Used in Encode to indicate output of an azimuth in [000, 360) with no * letter indicator. * @hideinitializer **********************************************************************/ AZIMUTH = 3, /** * Used in Encode to indicate output of a plain number. * @hideinitializer **********************************************************************/ NUMBER = 4, }; /** * Indicator for trailing units on an angle. **********************************************************************/ enum component { /** * Trailing unit is degrees. * @hideinitializer **********************************************************************/ DEGREE = 0, /** * Trailing unit is arc minutes. * @hideinitializer **********************************************************************/ MINUTE = 1, /** * Trailing unit is arc seconds. * @hideinitializer **********************************************************************/ SECOND = 2, }; /** * Convert a string in DMS to an angle. * * @param[in] dms string input. * @param[out] ind a DMS::flag value signaling the presence of a * hemisphere indicator. * @return angle (degrees). * * Degrees, minutes, and seconds are indicated by the characters d, ' * (single quote), " (double quote), and these components may only be * given in this order. Any (but not all) components may be omitted and * other symbols (e.g., the o symbol for degrees and the unicode * prime and double prime symbols for minutes and seconds) may be * substituted. The last component indicator may be omitted and is assumed * to be the next smallest unit (thus 33d10 is interpreted as 33d10'). The * final component may be a decimal fraction but the non-final components * must be integers. Instead of using d, ', and " to indicate * degrees, minutes, and seconds, : (colon) may be used to separate * these components (numbers must appear before and after each colon); thus * 50d30'10.3" may be written as 50:30:10.3, 5.5' may be written * 0:5.5, and so on. The integer parts of the minutes and seconds * components must be less than 60. A single leading sign is permitted. A * hemisphere designator (N, E, W, S) may be added to the beginning or end * of the string. The result is multiplied by the implied sign of the * hemisphere designator (negative for S and W). In addition \e ind is set * to DMS::LATITUDE if N or S is present, to DMS::LONGITUDE if E or W is * present, and to DMS::NONE otherwise. Throws an error on a malformed * string. No check is performed on the range of the result. Examples of * legal and illegal strings are * - LEGAL (all the entries on each line are equivalent) * - -20.51125, 20d30'40.5"S, -20d30'40.5, -20d30.675, * N-20d30'40.5", -20:30:40.5 * - 4d0'9, 4d9", 4d9'', 4:0:9, 004:00:09, 4.0025, 4.0025d, 4d0.15, * 04:.15 * - ILLEGAL (the exception thrown explains the problem) * - 4d5"4', 4::5, 4:5:, :4:5, 4d4.5'4", -N20.5, 1.8e2d, 4:60, * 4d-5' * * NOTE: At present, all the string handling in the C++ * implementation %GeographicLib is with 8-bit characters. The support for * unicode symbols for degrees, minutes, and seconds is therefore via the * UTF-8 encoding. (The * Javascript implementation of this class uses unicode natively, of * course.) * * Here is the list of Unicode symbols supported for degrees, minutes, * seconds: * - degrees: * - d, D lower and upper case letters * - U+00b0 degree symbol * - U+00ba masculine ordinal indicator * - U+2070 superscript zero * - minutes: * - ' apostrophe * - U+2032 prime * - U+00b4 acute accent * - seconds: * - " quotation mark * - U+2033 double prime * - ' ' any two consecutive symbols for minutes * . * The codes with a leading zero byte, e.g., U+00b0, are accepted in their * UTF-8 coded form 0xc2 0xb0 and as a single byte 0xb0. **********************************************************************/ static Math::real Decode(const std::string& dms, flag& ind); /** * Convert DMS to an angle. * * @param[in] d degrees. * @param[in] m arc minutes. * @param[in] s arc seconds. * @return angle (degrees) * * This does not propagate the sign on \e d to the other components, so * -3d20' would need to be represented as - DMS::Decode(3.0, 20.0) or * DMS::Decode(-3.0, -20.0). **********************************************************************/ static Math::real Decode(real d, real m = 0, real s = 0) throw() { return d + (m + s/real(60))/real(60); } /// \cond SKIP /** * DEPRECATED (use Utility::num, instead). * Convert a string to a real number. * * @param[in] str string input. * @return decoded number. **********************************************************************/ static Math::real Decode(const std::string& str) { return Utility::num(str); } /** * DEPRECATED (use Utility::fract, instead). * Convert a string to a real number treating the case where the string is * a simple fraction. * * @param[in] str string input. * @return decoded number. **********************************************************************/ static Math::real DecodeFraction(const std::string& str) { return Utility::fract(str); } /// \endcond /** * Convert a pair of strings to latitude and longitude. * * @param[in] dmsa first string. * @param[in] dmsb second string. * @param[out] lat latitude. * @param[out] lon longitude. * @param[in] swaplatlong if true assume longitude is given before latitude * in the absence of hemisphere designators (default false). * * By default, the \e lat (resp., \e lon) is assigned to the results of * decoding \e dmsa (resp., \e dmsb). However this is overridden if either * \e dmsa or \e dmsb contain a latitude or longitude hemisphere designator * (N, S, E, W). Throws an error if the decoded numbers are out of the * ranges [-90o, 90o] for latitude and * [-180o, 360o] for longitude and, in which case \e * lat and \e lon are unchanged. Finally the longitude is reduced to the * range [-180o, 180o). **********************************************************************/ static void DecodeLatLon(const std::string& dmsa, const std::string& dmsb, real& lat, real& lon, bool swaplatlong = false); /** * Convert a string to an angle in degrees. * * @param[in] angstr input string. * @return angle (degrees) * * No hemisphere designator is allowed and no check is done on the range of * the result. **********************************************************************/ static Math::real DecodeAngle(const std::string& angstr); /** * Convert a string to an azimuth in degrees. * * @param[in] azistr input string. * @return azimuth (degrees) * * A hemisphere designator E/W can be used; the result is multiplied by -1 * if W is present. Throws an error if the result is out of the range * [-180o, 360o]. Finally the azimuth is reduced to * the range [-180o, 180o). **********************************************************************/ static Math::real DecodeAzimuth(const std::string& azistr); /** * Convert angle (in degrees) into a DMS string (using d, ', and "). * * @param[in] angle input angle (degrees) * @param[in] trailing DMS::component value indicating the trailing units * on the string and this is given as a decimal number if necessary. * @param[in] prec the number of digits after the decimal point for the * trailing component. * @param[in] ind DMS::flag value indicated additional formatting. * @param[in] dmssep if non-null, use as the DMS separator character * (instead of d, ', " delimiters). * @return formatted string * * The interpretation of \e ind is as follows: * - ind == DMS::NONE, signed result no leading zeros on degrees except in * the units place, e.g., -8d03'. * - ind == DMS::LATITUDE, trailing N or S hemisphere designator, no sign, * pad degrees to 2 digits, e.g., 08d03'S. * - ind == DMS::LONGITUDE, trailing E or W hemisphere designator, no * sign, pad degrees to 3 digits, e.g., 008d03'W. * - ind == DMS::AZIMUTH, convert to the range [0, 360o), no * sign, pad degrees to 3 digits, , e.g., 351d57'. * . * The integer parts of the minutes and seconds components are always given * with 2 digits. **********************************************************************/ static std::string Encode(real angle, component trailing, unsigned prec, flag ind, char dmssep); /** * Convert angle (in degrees) into a DMS string (using d, ', and "). * * @param[in] angle input angle (degrees) * @param[in] trailing DMS::component value indicating the trailing units * on the string and this is given as a decimal number if necessary. * @param[in] prec the number of digits after the decimal point for the * trailing component. * @param[in] ind DMS::flag value indicated additional formatting. * @return formatted string * * COMPATIBILITY NOTE: This function calls * Encode(real, component, unsigned, flag, char) with a 5th * argument of char(0). At some point, * Encode(real, component, unsigned, flag) and will be withdrawn * and the interface to * Encode(real, component, unsigned, flag, char) changed so that * its 4th and 5th arguments have default values. This will * preserve source-level compatibility. **********************************************************************/ static std::string Encode(real angle, component trailing, unsigned prec, flag ind = NONE); /** * Convert angle into a DMS string (using d, ', and ") selecting the * trailing component based on the precision. * * @param[in] angle input angle (degrees) * @param[in] prec the precision relative to 1 degree. * @param[in] ind DMS::flag value indicated additional formatting. * @param[in] dmssep if non-null, use as the DMS separator character * (instead of d, ', " delimiters). * @return formatted string * * \e prec indicates the precision relative to 1 degree, e.g., \e prec = 3 * gives a result accurate to 0.1' and \e prec = 4 gives a result accurate * to 1". \e ind is interpreted as in DMS::Encode with the additional * facility that DMS::NUMBER represents \e angle as a number in fixed * format with precision \e prec. **********************************************************************/ static std::string Encode(real angle, unsigned prec, flag ind = NONE, char dmssep = char(0)) { return ind == NUMBER ? Utility::str(angle, int(prec)) : Encode(angle, prec < 2 ? DEGREE : (prec < 4 ? MINUTE : SECOND), prec < 2 ? prec : (prec < 4 ? prec - 2 : prec - 4), ind, dmssep); } /** * Split angle into degrees and minutes * * @param[in] ang angle (degrees) * @param[out] d degrees (an integer returned as a real) * @param[out] m arc minutes. **********************************************************************/ static void Encode(real ang, real& d, real& m) throw() { d = int(ang); m = 60 * (ang - d); } /** * Split angle into degrees and minutes and seconds. * * @param[in] ang angle (degrees) * @param[out] d degrees (an integer returned as a real) * @param[out] m arc minutes (an integer returned as a real) * @param[out] s arc seconds. **********************************************************************/ static void Encode(real ang, real& d, real& m, real& s) throw() { d = int(ang); ang = 60 * (ang - d); m = int(ang); s = 60 * (ang - m); } }; } // namespace GeographicLib #if defined(_MSC_VER) #pragma warning (pop) #endif #endif // GEOGRAPHICLIB_DMS_HPP geographiclib-1.21/include/GeographicLib/MagneticModel.hpp0000644000175000017500000003561411745620414023434 0ustar frankiefrankie/** * \file MagneticModel.hpp * \brief Header for GeographicLib::MagneticModel class * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_MAGNETICMODEL_HPP) #define GEOGRAPHICLIB_MAGNETICMODEL_HPP \ "$Id: 7f8c59ee3cdbfce252d1172c1bb4d7db7cf5ef38 $" #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about dll vs vector #pragma warning (push) #pragma warning (disable: 4251) #endif namespace GeographicLib { class MagneticCircle; /** * \brief Model of the earth's magnetic field * * Evaluate the earth's magnetic field according to a model. At present only * internal magnetic fields are handled. These are due to the earth's code * and crust; these vary slowly (over many years). Excluded are the effects * of currents in the ionosphere and magnetosphere which have daily and * annual variations. * * See \ref magnetic for details of how to install the magnetic model and the * data format. * * See * - General information: * - http://geomag.org/models/index.html * - WMM2010: * - http://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml * - http://ngdc.noaa.gov/geomag/WMM/data/WMM2010/WMM2010COF.zip * - IGRF11: * - http://ngdc.noaa.gov/IAGA/vmod/igrf.html * - http://ngdc.noaa.gov/IAGA/vmod/igrf11coeffs.txt * - http://ngdc.noaa.gov/IAGA/vmod/geomag70_linux.tar.gz * - EMM2010: * - http://ngdc.noaa.gov/geomag/EMM/index.html * - http://ngdc.noaa.gov/geomag/EMM/data/geomag/EMM2010_Sph_Windows_Linux.zip * * Example of use: * \include example-MagneticModel.cpp * * MagneticField is a command-line utility * providing access to the functionality of MagneticModel and MagneticCircle. **********************************************************************/ class GEOGRAPHIC_EXPORT MagneticModel { private: typedef Math::real real; static const int idlength_ = 8; std::string _name, _dir, _description, _date, _filename, _id; real _t0, _dt0, _tmin, _tmax, _a, _hmin, _hmax; int _Nmodels; SphericalHarmonic::normalization _norm; Geocentric _earth; std::vector< std::vector > _G; std::vector< std::vector > _H; std::vector _harm; void Field(real t, real lat, real lon, real h, bool diffp, real& Bx, real& By, real& Bz, real& Bxt, real& Byt, real& Bzt) const throw(); void ReadMetadata(const std::string& name); MagneticModel(const MagneticModel&); // copy constructor not allowed MagneticModel& operator=(const MagneticModel&); // nor copy assignment public: /** \name Setting up the magnetic model **********************************************************************/ ///@{ /** * Construct a magnetic model. * * @param[in] name the name of the model. * @param[in] path (optional) directory for data file. * @param[in] earth (optional) Geocentric object for converting * coordinates; default Geocentric::WGS84. * * A filename is formed by appending ".wmm" (World Magnetic Model) to the * name. If \e path is specified (and is non-empty), then the file is * loaded from directory, \e path. Otherwise the path is given by the * DefaultMagneticPath(). This may throw an exception because the file * does not exist, is unreadable, or is corrupt. * * This file contains the metadata which specifies the properties of the * model. The coefficients for the spherical harmonic sums are obtained * from a file obtained by appending ".cof" to metadata file (so the * filename ends in ".wwm.cof"). * * The model is not tied to a particular ellipsoidal model of the earth. * The final earth argument to the constructor specify an ellipsoid to * allow geodetic coordinates to the transformed into the spherical * coordinates used in the spherical harmonic sum. **********************************************************************/ explicit MagneticModel(const std::string& name, const std::string& path = "", const Geocentric& earth = Geocentric::WGS84); ///@} /** \name Compute the magnetic field **********************************************************************/ ///@{ /** * Evaluate the components of the geomagnetic field. * * @param[in] t the time (years). * @param[in] lat latitude of the point (degrees). * @param[in] lon longitude of the point (degrees). * @param[in] h the height of the point above the ellipsoid (meters). * @param[out] Bx the easterly component of the magnetic field (nanotesla). * @param[out] By the northerly component of the magnetic field (nanotesla). * @param[out] Bz the vertical (up) component of the magnetic field * (nanotesla). **********************************************************************/ void operator()(real t, real lat, real lon, real h, real& Bx, real& By, real& Bz) const throw() { real dummy; Field(t, lat, lon, h, false, Bx, By, Bz, dummy, dummy, dummy); } /** * Evaluate the components of the geomagnetic field and their time * derivatives * * @param[in] t the time (years). * @param[in] lat latitude of the point (degrees). * @param[in] lon longitude of the point (degrees). * @param[in] h the height of the point above the ellipsoid (meters). * @param[out] Bx the easterly component of the magnetic field (nanotesla). * @param[out] By the northerly component of the magnetic field (nanotesla). * @param[out] Bz the vertical (up) component of the magnetic field * (nanotesla). * @param[out] Bxt the rate of change of \e Bx (nT/yr). * @param[out] Byt the rate of change of \e By (nT/yr). * @param[out] Bzt the rate of change of \e Bz (nT/yr). **********************************************************************/ void operator()(real t, real lat, real lon, real h, real& Bx, real& By, real& Bz, real& Bxt, real& Byt, real& Bzt) const throw() { Field(t, lat, lon, h, true, Bx, By, Bz, Bxt, Byt, Bzt); } /** * Create a MagneticCircle object to allow the geomagnetic field at many * points with constant \e lat, \e h, and \e t and varying \e lon to be * computed efficiently. * * @param[in] t the time (years). * @param[in] lat latitude of the point (degrees). * @param[in] h the height of the point above the ellipsoid (meters). * @return a MagneticCircle object whose MagneticCircle::operator()(real * lon) member function computes the field at particular values of \e * lon. * * If the field at several points on a circle of latitude need to be * calculated then creating a MagneticCircle and using its member functions * will be substantially faster, especially for high-degree models. **********************************************************************/ MagneticCircle Circle(real t, real lat, real h) const; /** * Compute various quantities dependent on the magnetic field. * * @param[in] Bx the \e x (easterly) component of the magnetic field (nT). * @param[in] By the \e y (northerly) component of the magnetic field (nT). * @param[in] Bz the \e z (vertical, up positive) component of the magnetic * field (nT). * @param[out] H the horizontal magnetic field (nT). * @param[out] F the total magnetic field (nT). * @param[out] D the declination of the field (degrees east of north). * @param[out] I the inclination of the field (degrees down from * horizontal). **********************************************************************/ static void FieldComponents(real Bx, real By, real Bz, real& H, real& F, real& D, real& I) throw() { real Ht, Ft, Dt, It; FieldComponents(Bx, By, Bz, real(0), real(1), real(0), H, F, D, I, Ht, Ft, Dt, It); } /** * Compute various quantities dependent on the magnetic field and its rate * of change. * * @param[in] Bx the \e x (easterly) component of the magnetic field (nT). * @param[in] By the \e y (northerly) component of the magnetic field (nT). * @param[in] Bz the \e z (vertical, up positive) component of the magnetic * field (nT). * @param[in] Bxt the rate of change of \e Bx (nT/yr). * @param[in] Byt the rate of change of \e By (nT/yr). * @param[in] Bzt the rate of change of \e Bz (nT/yr). * @param[out] H the horizontal magnetic field (nT). * @param[out] F the total magnetic field (nT). * @param[out] D the declination of the field (degrees east of north). * @param[out] I the inclination of the field (degrees down from * horizontal). * @param[out] Ht the rate of change of \e H (nT/yr). * @param[out] Ft the rate of change of \e F (nT/yr). * @param[out] Dt the rate of change of \e D (degrees/yr). * @param[out] It the rate of change of \e I (degrees/yr). **********************************************************************/ static void FieldComponents(real Bx, real By, real Bz, real Bxt, real Byt, real Bzt, real& H, real& F, real& D, real& I, real& Ht, real& Ft, real& Dt, real& It) throw(); ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return the description of the magnetic model, if available, from the * Description file in the data file; if absent, return "NONE". **********************************************************************/ const std::string& Description() const throw() { return _description; } /** * @return date of the model, if available, from the ReleaseDate field in * the data file; if absent, return "UNKNOWN". **********************************************************************/ const std::string& DateTime() const throw() { return _date; } /** * @return full file name used to load the magnetic model. **********************************************************************/ const std::string& MagneticFile() const throw() { return _filename; } /** * @return "name" used to load the magnetic model (from the first argument * of the constructor, but this may be overridden by the model file). **********************************************************************/ const std::string& MagneticModelName() const throw() { return _name; } /** * @return directory used to load the magnetic model. **********************************************************************/ const std::string& MagneticModelDirectory() const throw() { return _dir; } /** * @return the minimum height above the ellipsoid (in meters) for which * this MagneticModel should be used. * * Because the model will typically provide useful results * slightly outside the range of allowed heights, no check of \e t * argument is made by MagneticModel::operator()() or * MagneticModel::Circle. **********************************************************************/ Math::real MinHeight() const throw() { return _hmin; } /** * @return the maximum height above the ellipsoid (in meters) for which * this MagneticModel should be used. * * Because the model will typically provide useful results * slightly outside the range of allowed heights, no check of \e t * argument is made by MagneticModel::operator()() or * MagneticModel::Circle. **********************************************************************/ Math::real MaxHeight() const throw() { return _hmax; } /** * @return the minimum time (in years) for which this MagneticModel should * be used. * * Because the model will typically provide useful results * slightly outside the range of allowed times, no check of \e t * argument is made by MagneticModel::operator()() or * MagneticModel::Circle. **********************************************************************/ Math::real MinTime() const throw() { return _tmin; } /** * @return the maximum time (in years) for which this MagneticModel should * be used. * * Because the model will typically provide useful results * slightly outside the range of allowed times, no check of \e t * argument is made by MagneticModel::operator()() or * MagneticModel::Circle. **********************************************************************/ Math::real MaxTime() const throw() { return _tmax; } /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value of \e a inherited from the Geocentric object used in the * constructor. **********************************************************************/ Math::real MajorRadius() const throw() { return _earth.MajorRadius(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the Geocentric object used in the constructor. **********************************************************************/ Math::real Flattening() const throw() { return _earth.Flattening(); } ///@} /** * @return the default path for magnetic model data files. * * This is the value of the environment variable MAGNETIC_PATH, if set; * otherwise, it is $GEOGRAPHICLIB_DATA/magnetic if the environment * variable GEOGRAPHICLIB_DATA is set; otherwise, it is a compile-time * default (/usr/local/share/GeographicLib/magnetic on non-Windows systems * and C:/Documents and Settings/All Users/Application * Data/GeographicLib/magnetic on Windows systems). **********************************************************************/ static std::string DefaultMagneticPath(); /** * @return the default name for the magnetic model. * * This is the value of the environment variable MAGNETIC_NAME, if set, * otherwise, it is "wmm2010". The MagneticModel class does not use this * function; it is just provided as a convenience for a calling program * when constructing a MagneticModel object. **********************************************************************/ static std::string DefaultMagneticName(); }; } // namespace GeographicLib #if defined(_MSC_VER) #pragma warning (pop) #endif #endif // GEOGRAPHICLIB_MAGNETICMODEL_HPP geographiclib-1.21/include/GeographicLib/NormalGravity.hpp0000644000175000017500000003322411745620414023515 0ustar frankiefrankie/** * \file NormalGravity.hpp * \brief Header for GeographicLib::NormalGravity class * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_NORMALGRAVITY_HPP) #define GEOGRAPHICLIB_NORMALGRAVITY_HPP \ "$Id: e4b65c9c5787d8ee14f476cbb518fd5007006344 $" #include #include namespace GeographicLib { /** * \brief The normal gravity of the earth * * "Normal" gravity refers to an idealization of the earth which is modeled * as an rotating ellipsoid. The eccentricity of the ellipsoid, the rotation * speed, and the distribution of mass within the ellipsoid are such that the * surface of the ellipsoid is a surface of constant potential (gravitational * plus centrifugal). The acceleration due to gravity is therefore * perpendicular to the surface of the ellipsoid. * * There is a closed solution to this problem which is implemented here. * Series "approximations" are only used to evaluate certain combinations of * elementary functions where use of the closed expression results in a loss * of accuracy for small arguments due to cancellation of the two leading * terms. However these series include sufficient terms to give full machine * precision. * * Definitions: * - V0, the gravitational contribution to the normal * potential; * - \e Phi, the rotational contribution to the normal potential; * - \e U = V0 + \e Phi, the total * potential; * - Gamma = grad V0, the acceleration due to * mass of the earth; * - f = grad \e Phi, the centrifugal acceleration; * - gamma = grad \e U = Gamma + f, the normal * acceleration; * - \e X, \e Y, \e Z, geocentric coordinates; * - \e x, \e y, \e z, local cartesian coordinates used to denote the east, * north and up directions. * * References: * - W. A. Heiskanen and H. Moritz, Physical Geodesy (Freeman, San * Francisco, 1967), Secs. 1-19, 2-7, 2-8 (2-9, 2-10), 6-2 (6-3). * - H. Moritz, Geodetic Reference System 1980, J. Geod. 54(3), 395-405 * (1980) http://dx.doi.org/10.1007/BF02521480 * * Example of use: * \include example-NormalGravity.cpp **********************************************************************/ class GEOGRAPHIC_EXPORT NormalGravity { private: static const int maxit_ = 10; typedef Math::real real; friend class GravityModel; real _a, _GM, _omega, _f, _J2, _omega2, _aomega2; real _e2, _ep2, _b, _E, _U0, _gammae, _gammap, _q0, _m, _k, _fstar; Geocentric _earth; static Math::real qf(real ep2) throw(); static Math::real qpf(real ep2) throw(); Math::real Jn(int n) const throw(); public: /** \name Setting up the normal gravity **********************************************************************/ ///@{ /** * Constructor for the normal gravity. * * @param[in] a equatorial radius (meters). * @param[in] GM mass constant of the ellipsoid * (meters3/seconds2); this is the product of \e G * the gravitational constant and \e M the mass of the earth (usually * including the mass of the earth's atmosphere). * @param[in] omega the angular velocity (rad s-1). * @param[in] f the flattening of the ellipsoid. * @param[in] J2 dynamical form factor. * * Exactly one of \e f and \e J2 should be positive and this will be used * to define the ellipsoid. The shape of the ellipsoid can be given in one * of two ways: * - geometrically, the ellipsoid is defined by the flattening \e f = * (\e a - \e b) / \e a, where \e a and \e b are the equatorial radius * and the polar semi-axis. * - physically, the ellipsoid is defined by the dynamical form factor * J2 = (\e C - \e A) / Ma2, where \e * A and \e C are the equatorial and polar moments of inertia and \e M is * the mass of the earth. **********************************************************************/ NormalGravity(real a, real GM, real omega, real f, real J2); /** * A default constructor for the normal gravity. This sets up an * uninitialized object and is used by GravityModel which constructs this * object before it has read in the parameters for the reference ellipsoid. **********************************************************************/ NormalGravity() : _a(-1) {} ///@} /** \name Compute the gravity **********************************************************************/ ///@{ /** * Evaluate the gravity on the surface of the ellipsoid. * * @param[in] lat the geographic latitude (degrees). * @return \e gamma the acceleration due to gravity, positive downwards * (m s-2). * * Due to the axial symmetry of the ellipsoid, the result is independent of * the value of the longitude. This acceleration is perpendicular to the * surface of the ellipsoid. It includes the effects of the earth's * rotation. **********************************************************************/ Math::real SurfaceGravity(real lat) const throw(); /** * Evaluate the gravity at an arbitrary point above (or below) the * ellipsoid. * * @param[in] lat the geographic latitude (degrees). * @param[in] h the height above the ellipsoid (meters). * @param[out] gammay the northerly component of the acceleration * (m s-2). * @param[out] gammaz the upward component of the acceleration * (m s-2); this is usually negative. * @return \e U the corresponding normal potential. * * Due to the axial symmetry of the ellipsoid, the result is independent of * the value of the longitude and the easterly component of the * acceleration vanishes, \e gammax = 0. The function includes the effects * of the earth's rotation. When \e h = 0, this function gives \e gammay = * 0 and the returned value matches that of NormalGravity::SurfaceGravity. **********************************************************************/ Math::real Gravity(real lat, real h, real& gammay, real& gammaz) const throw(); /** * Evaluate the components of the acceleration due to gravity and the * centrifugal acceleration in geocentric coordinates. * * @param[in] X geocentric coordinate of point (meters). * @param[in] Y geocentric coordinate of point (meters). * @param[in] Z geocentric coordinate of point (meters). * @param[out] gammaX the \e X component of the acceleration * (m s-2). * @param[out] gammaY the \e Y component of the acceleration * (m s-2). * @param[out] gammaZ the \e Z component of the acceleration * (m s-2). * @return \e U = V0 + \e Phi the sum of the * gravitational and centrifugal potentials * (m2 s-2). * * The acceleration given by gamma = grad \e U = grad * V0 + grad \e Phi = Gamma + f. **********************************************************************/ Math::real U(real X, real Y, real Z, real& gammaX, real& gammaY, real& gammaZ) const throw(); /** * Evaluate the components of the acceleration due to gravity alone in * geocentric coordinates. * * @param[in] X geocentric coordinate of point (meters). * @param[in] Y geocentric coordinate of point (meters). * @param[in] Z geocentric coordinate of point (meters). * @param[out] GammaX the \e X component of the acceleration due to gravity * (m s-2). * @param[out] GammaY the \e Y component of the acceleration due to gravity * (m s-2). * @param[out] GammaZ the \e Z component of the acceleration due to gravity * (m s-2). * @return V0 the gravitational potential * (m2 s-2). * * This function excludes the centrifugal acceleration and is appropriate * to use for space applications. In terrestrial applications, the * function NormalGravity::U (which includes this effect) should usually be * used. **********************************************************************/ Math::real V0(real X, real Y, real Z, real& GammaX, real& GammaY, real& GammaZ) const throw(); /** * Evaluate the centrifugal acceleration in geocentric coordinates. * * @param[in] X geocentric coordinate of point (meters). * @param[in] Y geocentric coordinate of point (meters). * @param[out] fX the \e X component of the centrifugal acceleration * (m s-2). * @param[out] fY the \e Y component of the centrifugal acceleration * (m s-2). * @return \e Phi the centrifugal potential (m2 s-2). * * \e Phi is independent of \e Z, thus \e fZ = 0. This function * NormalGravity::U sums the results of NormalGravity::V0 and * NormalGravity::Phi. **********************************************************************/ Math::real Phi(real X, real Y, real& fX, real& fY) const throw(); ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return true if the object has been initialized. **********************************************************************/ bool Init() const throw() { return _a > 0; } /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ Math::real MajorRadius() const throw() { return Init() ? _a : Math::NaN(); } /** * @return \e GM the mass constant of the ellipsoid * (m3 s-2). This is the value used in the * constructor. **********************************************************************/ Math::real MassConstant() const throw() { return Init() ? _GM : Math::NaN(); } /** * @return \e Jn the dynamical form factors of the ellipsoid. * * If \e n = 2 (the default), this is the value of J2 * used in the constructor. Otherwise it is the zonal coefficient of the * Legendre harmonic sum of the normal gravitational potential. Note that * \e Jn = 0 if \e is odd. In most gravity applications, fully * normalized Legendre functions are used and the corresponding coefficient * is Cn0 = -\e Jn / sqrt(2 \e n + 1). **********************************************************************/ Math::real DynamicalFormFactor(int n = 2) const throw() { return Init() ? ( n == 2 ? _J2 : Jn(n)) : Math::NaN(); } /** * @return \e omega the angular velocity of the ellipsoid * (rad s-1). This is the value used in the constructor. **********************************************************************/ Math::real AngularVelocity() const throw() { return Init() ? _omega : Math::NaN(); } /** * @return f the flattening of the ellipsoid (\e a - \e b)/\e a. **********************************************************************/ Math::real Flattening() const throw() { return Init() ? _f : Math::NaN(); } /** * @return gammae the normal gravity at equator * (m s-2). **********************************************************************/ Math::real EquatorialGravity() const throw() { return Init() ? _gammae : Math::NaN(); } /** * @return gammap the normal gravity at poles * (m s-2). **********************************************************************/ Math::real PolarGravity() const throw() { return Init() ? _gammap : Math::NaN(); } /** * @return f* the gravity flattening * (gammap - gammae) / * gammae. **********************************************************************/ Math::real GravityFlattening() const throw() { return Init() ? _fstar : Math::NaN(); } /** * @return U0 the constant normal potential for the * surface of the ellipsoid (m2 s-2). **********************************************************************/ Math::real SurfacePotential() const throw() { return Init() ? _U0 : Math::NaN(); } /** * @return the Geocentric object used by this instance. **********************************************************************/ const Geocentric& Earth() const throw() { return _earth; } ///@} /** * A global instantiation of NormalGravity for the WGS84 ellipsoid. **********************************************************************/ static const NormalGravity WGS84; /** * A global instantiation of NormalGravity for the GRS80 ellipsoid. **********************************************************************/ static const NormalGravity GRS80; }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_NORMALGRAVITY_HPP geographiclib-1.21/include/GeographicLib/Gnomonic.hpp0000644000175000017500000002450711745620414022474 0ustar frankiefrankie/** * \file Gnomonic.hpp * \brief Header for GeographicLib::Gnomonic class * * Copyright (c) Charles Karney (2010, 2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GNOMONIC_HPP) #define GEOGRAPHICLIB_GNOMONIC_HPP \ "$Id: f2e7e429e56165c314a518fada607c225132b945 $" #include #include #include namespace GeographicLib { /** * \brief %Gnomonic Projection. * * %Gnomonic projection centered at an arbitrary position \e C on the * ellipsoid. This projection is derived in Section 13 of * - C. F. F. Karney, * Geodesics * on an ellipsoid of revolution, * Feb. 2011; * preprint * arxiv:1102.1215v1. * . * See also Section 8 of * - C. F. F. Karney, * Algorithms for geodesics, * Sept. 2011; * preprint * arxiv:1109.4448. * . * The projection of \e P is defined as follows: compute the * geodesic line from \e C to \e P; compute the reduced length \e m12, * geodesic scale \e M12, and \e rho = m12/\e M12; finally \e x = \e * rho sin \e azi1; \e y = \e rho cos \e azi1, where \e azi1 is the azimuth * of the geodesic at \e C. The Gnomonic::Forward and Gnomonic::Reverse * methods also return the azimuth \e azi of the geodesic at \e P and * reciprocal scale \e rk in the azimuthal direction. The scale in the * radial direction if 1/rk2. * * For a sphere, \e rho is reduces to \e a tan(s12/a), where \e * s12 is the length of the geodesic from \e C to \e P, and the gnomonic * projection has the property that all geodesics appear as straight lines. * For an ellipsoid, this property holds only for geodesics interesting the * centers. However geodesic segments close to the center are approximately * straight. * * Consider a geodesic segment of length \e l. Let \e T be the point on the * geodesic (extended if necessary) closest to \e C the center of the * projection and \e t be the distance \e CT. To lowest order, the maximum * deviation (as a true distance) of the corresponding gnomonic line segment * (i.e., with the same end points) from the geodesic is
*
* (K(T) - K(C)) * l2 \e t / 32.
*
* where \e K is the Gaussian curvature. * * This result applies for any surface. For an ellipsoid of revolution, * consider all geodesics whose end points are within a distance \e r of \e * C. For a given \e r, the deviation is maximum when the latitude of \e C * is 45o, when endpoints are a distance \e r away, and when their * azimuths from the center are +/- 45o or +/- 135o. * To lowest order in \e r and the flattening \e f, the deviation is \e f * (r/2a)3 \e r. * * The conversions all take place using a Geodesic object (by default * Geodesic::WGS84). For more information on geodesics see \ref geodesic. * * CAUTION: The definition of this projection for a sphere is * standard. However, there is no standard for how it should be extended to * an ellipsoid. The choices are: * - Declare that the projection is undefined for an ellipsoid. * - Project to a tangent plane from the center of the ellipsoid. This * causes great ellipses to appear as straight lines in the projection; * i.e., it generalizes the spherical great circle to a great ellipse. * This was proposed by independently by Bowring and Williams in 1997. * - Project to the conformal sphere with the constant of integration chosen * so that the values of the latitude match for the center point and * perform a central projection onto the plane tangent to the conformal * sphere at the center point. This causes normal sections through the * center point to appear as straight lines in the projection; i.e., it * generalizes the spherical great circle to a normal section. This was * proposed by I. G. Letoval'tsev, Generalization of the %Gnomonic * Projection for a Spheroid and the Principal Geodetic Problems Involved * in the Alignment of Surface Routes, Geodesy and Aerophotography (5), * 271-274 (1963). * - The projection given here. This causes geodesics close to the center * point to appear as straight lines in the projection; i.e., it * generalizes the spherical great circle to a geodesic. * * Example of use: * \include example-Gnomonic.cpp * * GeodesicProj is a command-line utility * providing access to the functionality of AzimuthalEquidistant, Gnomonic, * and CassiniSoldner. **********************************************************************/ class GEOGRAPHIC_EXPORT Gnomonic { private: typedef Math::real real; Geodesic _earth; real _a, _f; static const real eps0_; static const real eps_; static const int numit_ = 5; public: /** * Constructor for Gnomonic. * * @param[in] earth the Geodesic object to use for geodesic calculations. * By default this uses the WGS84 ellipsoid. **********************************************************************/ explicit Gnomonic(const Geodesic& earth = Geodesic::WGS84) throw() : _earth(earth) , _a(_earth.MajorRadius()) , _f(_earth.Flattening()) {} /** * Forward projection, from geographic to gnomonic. * * @param[in] lat0 latitude of center point of projection (degrees). * @param[in] lon0 longitude of center point of projection (degrees). * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[out] x easting of point (meters). * @param[out] y northing of point (meters). * @param[out] azi azimuth of geodesic at point (degrees). * @param[out] rk reciprocal of azimuthal scale at point. * * \e lat0 and \e lat should be in the range [-90, 90] and \e lon0 and \e * lon should be in the range [-180, 360]. The scale of the projection is * 1/rk2 in the "radial" direction, \e azi clockwise from * true north, and is 1/\e rk in the direction perpendicular to this. If * the point lies "over the horizon", i.e., if \e rk <= 0, then NaNs are * returned for \e x and \e y (the correct values are returned for \e azi * and \e rk). A call to Forward followed by a call to Reverse will return * the original (\e lat, \e lon) (to within roundoff) provided the point in * not over the horizon. **********************************************************************/ void Forward(real lat0, real lon0, real lat, real lon, real& x, real& y, real& azi, real& rk) const throw(); /** * Reverse projection, from gnomonic to geographic. * * @param[in] lat0 latitude of center point of projection (degrees). * @param[in] lon0 longitude of center point of projection (degrees). * @param[in] x easting of point (meters). * @param[in] y northing of point (meters). * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] azi azimuth of geodesic at point (degrees). * @param[out] rk reciprocal of azimuthal scale at point. * * \e lat0 should be in the range [-90, 90] and \e lon0 should be in the * range [-180, 360]. \e lat will be in the range [-90, 90] and \e lon * will be in the range [-180, 180). The scale of the projection is 1/\e * rk2 in the "radial" direction, \e azi clockwise from true * north, and is 1/\e rk in the direction perpendicular to this. Even * though all inputs should return a valid \e lat and \e lon, it's possible * that the procedure fails to converge for very large \e x or \e y; in * this case NaNs are returned for all the output arguments. A call to * Reverse followed by a call to Forward will return the original (\e x, \e * y) (to roundoff). **********************************************************************/ void Reverse(real lat0, real lon0, real x, real y, real& lat, real& lon, real& azi, real& rk) const throw(); /** * Gnomonic::Forward without returning the azimuth and scale. **********************************************************************/ void Forward(real lat0, real lon0, real lat, real lon, real& x, real& y) const throw() { real azi, rk; Forward(lat0, lon0, lat, lon, x, y, azi, rk); } /** * Gnomonic::Reverse without returning the azimuth and scale. **********************************************************************/ void Reverse(real lat0, real lon0, real x, real y, real& lat, real& lon) const throw() { real azi, rk; Reverse(lat0, lon0, x, y, lat, lon, azi, rk); } /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value inherited from the Geodesic object used in the constructor. **********************************************************************/ Math::real MajorRadius() const throw() { return _earth.MajorRadius(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the Geodesic object used in the constructor. **********************************************************************/ Math::real Flattening() const throw() { return _earth.Flattening(); } ///@} /// \cond SKIP /** * DEPRECATED * @return \e r the inverse flattening of the ellipsoid. **********************************************************************/ Math::real InverseFlattening() const throw() { return _earth.InverseFlattening(); } /// \endcond }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_GNOMONIC_HPP geographiclib-1.21/include/GeographicLib/Geodesic.hpp0000644000175000017500000011163011745620414022437 0ustar frankiefrankie/** * \file Geodesic.hpp * \brief Header for GeographicLib::Geodesic class * * Copyright (c) Charles Karney (2009-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GEODESIC_HPP) #define GEOGRAPHICLIB_GEODESIC_HPP \ "$Id: c1b085aadd7b8eabe0f9518b29531a38c152d495 $" #include #if !defined(GEOD_ORD) /** * The order of the expansions used by Geodesic. **********************************************************************/ #define GEOD_ORD \ (GEOGRAPHICLIB_PREC == 1 ? 6 : (GEOGRAPHICLIB_PREC == 0 ? 3 : 7)) #endif namespace GeographicLib { class GeodesicLine; /** * \brief %Geodesic calculations * * The shortest path between two points on a ellipsoid at (\e lat1, \e lon1) * and (\e lat2, \e lon2) is called the geodesic. Its length is \e s12 and * the geodesic from point 1 to point 2 has azimuths \e azi1 and \e azi2 at * the two end points. (The azimuth is the heading measured clockwise from * north. \e azi2 is the "forward" azimuth, i.e., the heading that takes you * beyond point 2 not back to point 1.) * * Given \e lat1, \e lon1, \e azi1, and \e s12, we can determine \e lat2, \e * lon2, and \e azi2. This is the \e direct geodesic problem and its * solution is given by the function Geodesic::Direct. (If \e s12 is * sufficiently large that the geodesic wraps more than halfway around the * earth, there will be another geodesic between the points with a smaller \e * s12.) * * Given \e lat1, \e lon1, \e lat2, and \e lon2, we can determine \e azi1, \e * azi2, and \e s12. This is the \e inverse geodesic problem, whose solution * is given by Geodesic::Inverse. Usually, the solution to the inverse * problem is unique. In cases where there are multiple solutions (all with * the same \e s12, of course), all the solutions can be easily generated * once a particular solution is provided. * * The standard way of specifying the direct problem is the specify the * distance \e s12 to the second point. However it is sometimes useful * instead to specify the the arc length \e a12 (in degrees) on the auxiliary * sphere. This is a mathematical construct used in solving the geodesic * problems. The solution of the direct problem in this form is provide by * Geodesic::ArcDirect. An arc length in excess of 180o indicates * that the geodesic is not a shortest path. In addition, the arc length * between an equatorial crossing and the next extremum of latitude for a * geodesic is 90o. * * This class can also calculate several other quantities related to * geodesics. These are: * - reduced length. If we fix the first point and increase \e azi1 * by \e dazi1 (radians), the the second point is displaced \e m12 \e dazi1 * in the direction \e azi2 + 90o. The quantity \e m12 is * called the "reduced length" and is symmetric under interchange of the * two points. On a curved surface the reduced length obeys a symmetry * relation, \e m12 + \e m21 = 0. On a flat surface, we have \e m12 = \e * s12. The ratio s12/\e m12 gives the azimuthal scale for an * azimuthal equidistant projection. * - geodesic scale. Consider a reference geodesic and a second * geodesic parallel to this one at point 1 and separated by a small * distance \e dt. The separation of the two geodesics at point 2 is \e * M12 \e dt where \e M12 is called the "geodesic scale". \e M21 is * defined similarly (with the geodesics being parallel at point 2). On a * flat surface, we have \e M12 = \e M21 = 1. The quantity 1/\e M12 gives * the scale of the Cassini-Soldner projection. * - area. Consider the quadrilateral bounded by the following lines: * the geodesic from point 1 to point 2, the meridian from point 2 to the * equator, the equator from \e lon2 to \e lon1, the meridian from the * equator to point 1. The area of this quadrilateral is represented by \e * S12 with a clockwise traversal of the perimeter counting as a positive * area and it can be used to compute the area of any simple geodesic * polygon. * * Overloaded versions of Geodesic::Direct, Geodesic::ArcDirect, and * Geodesic::Inverse allow these quantities to be returned. In addition * there are general functions Geodesic::GenDirect, and Geodesic::GenInverse * which allow an arbitrary set of results to be computed. The quantities \e * m12, \e M12, \e M21 which all specify the behavior of nearby geodesics * obey addition rules. Let points 1, 2, and 3 all lie on a single geodesic, * then * - \e m13 = \e m12 \e M23 + \e m23 \e M21 * - \e M13 = \e M12 \e M23 - (1 - \e M12 \e M21) \e m23 / \e m12 * - \e M31 = \e M32 \e M21 - (1 - \e M23 \e M32) \e m12 / \e m23 * * Additional functionality is provided by the GeodesicLine class, which * allows a sequence of points along a geodesic to be computed. * * The calculations are accurate to better than 15 nm (15 nanometers). See * Sec. 9 of * arXiv:1102.1215v1 * for details. * * The algorithms are described in * - C. F. F. Karney, * Geodesics * on an ellipsoid of revolution, * Feb. 2011; * preprint * arXiv:1102.1215v1. * - C. F. F. Karney, * Algorithms for geodesics, * Sept. 2011; * preprint * arxiv:1109.4448. * . * For more information on geodesics see \ref geodesic. * * Example of use: * \include example-Geodesic.cpp * * Geod is a command-line utility providing access * to the functionality of Geodesic and GeodesicLine. **********************************************************************/ class GEOGRAPHIC_EXPORT Geodesic { private: typedef Math::real real; friend class GeodesicLine; static const int nA1_ = GEOD_ORD; static const int nC1_ = GEOD_ORD; static const int nC1p_ = GEOD_ORD; static const int nA2_ = GEOD_ORD; static const int nC2_ = GEOD_ORD; static const int nA3_ = GEOD_ORD; static const int nA3x_ = nA3_; static const int nC3_ = GEOD_ORD; static const int nC3x_ = (nC3_ * (nC3_ - 1)) / 2; static const int nC4_ = GEOD_ORD; static const int nC4x_ = (nC4_ * (nC4_ + 1)) / 2; static const unsigned maxit_ = 50; static const real tiny_; static const real tol0_; static const real tol1_; static const real tol2_; static const real xthresh_; enum captype { CAP_NONE = 0U, CAP_C1 = 1U<<0, CAP_C1p = 1U<<1, CAP_C2 = 1U<<2, CAP_C3 = 1U<<3, CAP_C4 = 1U<<4, CAP_ALL = 0x1FU, OUT_ALL = 0x7F80U, }; static real SinCosSeries(bool sinp, real sinx, real cosx, const real c[], int n) throw(); static inline real AngNormalize(real x) throw() { // Place angle in [-180, 180). Assumes x is in [-540, 540). return x >= 180 ? x - 360 : (x < -180 ? x + 360 : x); } static inline real AngRound(real x) throw() { // The makes the smallest gap in x = 1/16 - nextafter(1/16, 0) = 1/2^57 // for reals = 0.7 pm on the earth if x is an angle in degrees. (This // is about 1000 times more resolution than we get with angles around 90 // degrees.) We use this to avoid having to deal with near singular // cases when x is non-zero but tiny (e.g., 1.0e-200). const real z = real(0.0625); // 1/16 volatile real y = std::abs(x); // The compiler mustn't "simplify" z - (z - y) to y y = y < z ? z - (z - y) : y; return x < 0 ? -y : y; } static inline void SinCosNorm(real& sinx, real& cosx) throw() { real r = Math::hypot(sinx, cosx); sinx /= r; cosx /= r; } static real Astroid(real x, real y) throw(); real _a, _f, _f1, _e2, _ep2, _n, _b, _c2, _etol2; real _A3x[nA3x_], _C3x[nC3x_], _C4x[nC4x_]; void Lengths(real eps, real sig12, real ssig1, real csig1, real ssig2, real csig2, real cbet1, real cbet2, real& s12s, real& m12a, real& m0, bool scalep, real& M12, real& M21, real C1a[], real C2a[]) const throw(); real InverseStart(real sbet1, real cbet1, real sbet2, real cbet2, real lam12, real& salp1, real& calp1, real& salp2, real& calp2, real C1a[], real C2a[]) const throw(); real Lambda12(real sbet1, real cbet1, real sbet2, real cbet2, real salp1, real calp1, real& salp2, real& calp2, real& sig12, real& ssig1, real& csig1, real& ssig2, real& csig2, real& eps, real& domg12, bool diffp, real& dlam12, real C1a[], real C2a[], real C3a[]) const throw(); // These are Maxima generated functions to provide series approximations to // the integrals for the ellipsoidal geodesic. static real A1m1f(real eps) throw(); static void C1f(real eps, real c[]) throw(); static void C1pf(real eps, real c[]) throw(); static real A2m1f(real eps) throw(); static void C2f(real eps, real c[]) throw(); void A3coeff() throw(); real A3f(real eps) const throw(); void C3coeff() throw(); void C3f(real eps, real c[]) const throw(); void C4coeff() throw(); void C4f(real k2, real c[]) const throw(); public: /** * Bit masks for what calculations to do. These masks do double duty. * They signify to the GeodesicLine::GeodesicLine constructor and to * Geodesic::Line what capabilities should be included in the GeodesicLine * object. They also specify which results to return in the general * routines Geodesic::GenDirect and Geodesic::GenInverse routines. * GeodesicLine::mask is a duplication of this enum. **********************************************************************/ enum mask { /** * No capabilities, no output. * @hideinitializer **********************************************************************/ NONE = 0U, /** * Calculate latitude \e lat2. (It's not necessary to include this as a * capability to GeodesicLine because this is included by default.) * @hideinitializer **********************************************************************/ LATITUDE = 1U<<7 | CAP_NONE, /** * Calculate longitude \e lon2. * @hideinitializer **********************************************************************/ LONGITUDE = 1U<<8 | CAP_C3, /** * Calculate azimuths \e azi1 and \e azi2. (It's not necessary to * include this as a capability to GeodesicLine because this is included * by default.) * @hideinitializer **********************************************************************/ AZIMUTH = 1U<<9 | CAP_NONE, /** * Calculate distance \e s12. * @hideinitializer **********************************************************************/ DISTANCE = 1U<<10 | CAP_C1, /** * Allow distance \e s12 to be used as input in the direct geodesic * problem. * @hideinitializer **********************************************************************/ DISTANCE_IN = 1U<<11 | CAP_C1 | CAP_C1p, /** * Calculate reduced length \e m12. * @hideinitializer **********************************************************************/ REDUCEDLENGTH = 1U<<12 | CAP_C1 | CAP_C2, /** * Calculate geodesic scales \e M12 and \e M21. * @hideinitializer **********************************************************************/ GEODESICSCALE = 1U<<13 | CAP_C1 | CAP_C2, /** * Calculate area \e S12. * @hideinitializer **********************************************************************/ AREA = 1U<<14 | CAP_C4, /** * All capabilities. Calculate everything. * @hideinitializer **********************************************************************/ ALL = OUT_ALL| CAP_ALL, }; /** \name Constructor **********************************************************************/ ///@{ /** * Constructor for a ellipsoid with * * @param[in] a equatorial radius (meters). * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere. * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flattening * to 1/\e f. * * An exception is thrown if either of the axes of the ellipsoid is * non-positive. **********************************************************************/ Geodesic(real a, real f); ///@} /** \name Direct geodesic problem specified in terms of distance. **********************************************************************/ ///@{ /** * Perform the direct geodesic calculation where the length of the geodesic * is specify in terms of distance. * * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] azi1 azimuth at point 1 (degrees). * @param[in] s12 distance between point 1 and point 2 (meters); it can be * signed. * @param[out] lat2 latitude of point 2 (degrees). * @param[out] lon2 longitude of point 2 (degrees). * @param[out] azi2 (forward) azimuth at point 2 (degrees). * @param[out] m12 reduced length of geodesic (meters). * @param[out] M12 geodesic scale of point 2 relative to point 1 * (dimensionless). * @param[out] M21 geodesic scale of point 1 relative to point 2 * (dimensionless). * @param[out] S12 area under the geodesic (meters2). * @return \e a12 arc length of between point 1 and point 2 (degrees). * * \e lat1 should be in the range [-90, 90]; \e lon1 and \e azi1 should be * in the range [-180, 360]. The values of \e lon2 and \e azi2 returned * are in the range [-180, 180). * * If either point is at a pole, the azimuth is defined by keeping the * longitude fixed and writing \e lat = 90 - \e eps or -90 + \e eps and * taking the limit \e eps -> 0 from above. An arc length greater that 180 * degrees signifies a geodesic which is not a shortest path. (For a * prolate ellipsoid, an additional condition is necessary for a shortest * path: the longitudinal extent must not exceed of 180 degrees.) * * The following functions are overloaded versions of Geodesic::Direct * which omit some of the output parameters. Note, however, that the arc * length is always computed and returned as the function value. **********************************************************************/ Math::real Direct(real lat1, real lon1, real azi1, real s12, real& lat2, real& lon2, real& azi2, real& m12, real& M12, real& M21, real& S12) const throw() { real t; return GenDirect(lat1, lon1, azi1, false, s12, LATITUDE | LONGITUDE | AZIMUTH | REDUCEDLENGTH | GEODESICSCALE | AREA, lat2, lon2, azi2, t, m12, M12, M21, S12); } /** * See the documentation for Geodesic::Direct. **********************************************************************/ Math::real Direct(real lat1, real lon1, real azi1, real s12, real& lat2, real& lon2) const throw() { real t; return GenDirect(lat1, lon1, azi1, false, s12, LATITUDE | LONGITUDE, lat2, lon2, t, t, t, t, t, t); } /** * See the documentation for Geodesic::Direct. **********************************************************************/ Math::real Direct(real lat1, real lon1, real azi1, real s12, real& lat2, real& lon2, real& azi2) const throw() { real t; return GenDirect(lat1, lon1, azi1, false, s12, LATITUDE | LONGITUDE | AZIMUTH, lat2, lon2, azi2, t, t, t, t, t); } /** * See the documentation for Geodesic::Direct. **********************************************************************/ Math::real Direct(real lat1, real lon1, real azi1, real s12, real& lat2, real& lon2, real& azi2, real& m12) const throw() { real t; return GenDirect(lat1, lon1, azi1, false, s12, LATITUDE | LONGITUDE | AZIMUTH | REDUCEDLENGTH, lat2, lon2, azi2, t, m12, t, t, t); } /** * See the documentation for Geodesic::Direct. **********************************************************************/ Math::real Direct(real lat1, real lon1, real azi1, real s12, real& lat2, real& lon2, real& azi2, real& M12, real& M21) const throw() { real t; return GenDirect(lat1, lon1, azi1, false, s12, LATITUDE | LONGITUDE | AZIMUTH | GEODESICSCALE, lat2, lon2, azi2, t, t, M12, M21, t); } /** * See the documentation for Geodesic::Direct. **********************************************************************/ Math::real Direct(real lat1, real lon1, real azi1, real s12, real& lat2, real& lon2, real& azi2, real& m12, real& M12, real& M21) const throw() { real t; return GenDirect(lat1, lon1, azi1, false, s12, LATITUDE | LONGITUDE | AZIMUTH | REDUCEDLENGTH | GEODESICSCALE, lat2, lon2, azi2, t, m12, M12, M21, t); } ///@} /** \name Direct geodesic problem specified in terms of arc length. **********************************************************************/ ///@{ /** * Perform the direct geodesic calculation where the length of the geodesic * is specify in terms of arc length. * * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] azi1 azimuth at point 1 (degrees). * @param[in] a12 arc length between point 1 and point 2 (degrees); it can * be signed. * @param[out] lat2 latitude of point 2 (degrees). * @param[out] lon2 longitude of point 2 (degrees). * @param[out] azi2 (forward) azimuth at point 2 (degrees). * @param[out] s12 distance between point 1 and point 2 (meters). * @param[out] m12 reduced length of geodesic (meters). * @param[out] M12 geodesic scale of point 2 relative to point 1 * (dimensionless). * @param[out] M21 geodesic scale of point 1 relative to point 2 * (dimensionless). * @param[out] S12 area under the geodesic (meters2). * * \e lat1 should be in the range [-90, 90]; \e lon1 and \e azi1 should be * in the range [-180, 360]. The values of \e lon2 and \e azi2 returned * are in the range [-180, 180). * * If either point is at a pole, the azimuth is defined by keeping the * longitude fixed and writing \e lat = 90 - \e eps or -90 + \e eps and * taking the limit \e eps -> 0 from above. An arc length greater that 180 * degrees signifies a geodesic which is not a shortest path. (For a * prolate ellipsoid, an additional condition is necessary for a shortest * path: the longitudinal extent must not exceed of 180 degrees.) * * The following functions are overloaded versions of Geodesic::Direct * which omit some of the output parameters. **********************************************************************/ void ArcDirect(real lat1, real lon1, real azi1, real a12, real& lat2, real& lon2, real& azi2, real& s12, real& m12, real& M12, real& M21, real& S12) const throw() { GenDirect(lat1, lon1, azi1, true, a12, LATITUDE | LONGITUDE | AZIMUTH | DISTANCE | REDUCEDLENGTH | GEODESICSCALE | AREA, lat2, lon2, azi2, s12, m12, M12, M21, S12); } /** * See the documentation for Geodesic::ArcDirect. **********************************************************************/ void ArcDirect(real lat1, real lon1, real azi1, real a12, real& lat2, real& lon2) const throw() { real t; GenDirect(lat1, lon1, azi1, true, a12, LATITUDE | LONGITUDE, lat2, lon2, t, t, t, t, t, t); } /** * See the documentation for Geodesic::ArcDirect. **********************************************************************/ void ArcDirect(real lat1, real lon1, real azi1, real a12, real& lat2, real& lon2, real& azi2) const throw() { real t; GenDirect(lat1, lon1, azi1, true, a12, LATITUDE | LONGITUDE | AZIMUTH, lat2, lon2, azi2, t, t, t, t, t); } /** * See the documentation for Geodesic::ArcDirect. **********************************************************************/ void ArcDirect(real lat1, real lon1, real azi1, real a12, real& lat2, real& lon2, real& azi2, real& s12) const throw() { real t; GenDirect(lat1, lon1, azi1, true, a12, LATITUDE | LONGITUDE | AZIMUTH | DISTANCE, lat2, lon2, azi2, s12, t, t, t, t); } /** * See the documentation for Geodesic::ArcDirect. **********************************************************************/ void ArcDirect(real lat1, real lon1, real azi1, real a12, real& lat2, real& lon2, real& azi2, real& s12, real& m12) const throw() { real t; GenDirect(lat1, lon1, azi1, true, a12, LATITUDE | LONGITUDE | AZIMUTH | DISTANCE | REDUCEDLENGTH, lat2, lon2, azi2, s12, m12, t, t, t); } /** * See the documentation for Geodesic::ArcDirect. **********************************************************************/ void ArcDirect(real lat1, real lon1, real azi1, real a12, real& lat2, real& lon2, real& azi2, real& s12, real& M12, real& M21) const throw() { real t; GenDirect(lat1, lon1, azi1, true, a12, LATITUDE | LONGITUDE | AZIMUTH | DISTANCE | GEODESICSCALE, lat2, lon2, azi2, s12, t, M12, M21, t); } /** * See the documentation for Geodesic::ArcDirect. **********************************************************************/ void ArcDirect(real lat1, real lon1, real azi1, real a12, real& lat2, real& lon2, real& azi2, real& s12, real& m12, real& M12, real& M21) const throw() { real t; GenDirect(lat1, lon1, azi1, true, a12, LATITUDE | LONGITUDE | AZIMUTH | DISTANCE | REDUCEDLENGTH | GEODESICSCALE, lat2, lon2, azi2, s12, m12, M12, M21, t); } ///@} /** \name General version of the direct geodesic solution. **********************************************************************/ ///@{ /** * The general direct geodesic calculation. Geodesic::Direct and * Geodesic::ArcDirect are defined in terms of this function. * * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] azi1 azimuth at point 1 (degrees). * @param[in] arcmode boolean flag determining the meaning of the second * parameter. * @param[in] s12_a12 if \e arcmode is false, this is the distance between * point 1 and point 2 (meters); otherwise it is the arc length between * point 1 and point 2 (degrees); it can be signed. * @param[in] outmask a bitor'ed combination of Geodesic::mask values * specifying which of the following parameters should be set. * @param[out] lat2 latitude of point 2 (degrees). * @param[out] lon2 longitude of point 2 (degrees). * @param[out] azi2 (forward) azimuth at point 2 (degrees). * @param[out] s12 distance between point 1 and point 2 (meters). * @param[out] m12 reduced length of geodesic (meters). * @param[out] M12 geodesic scale of point 2 relative to point 1 * (dimensionless). * @param[out] M21 geodesic scale of point 1 relative to point 2 * (dimensionless). * @param[out] S12 area under the geodesic (meters2). * @return \e a12 arc length of between point 1 and point 2 (degrees). * * The Geodesic::mask values possible for \e outmask are * - \e outmask |= Geodesic::LATITUDE for the latitude \e lat2. * - \e outmask |= Geodesic::LONGITUDE for the latitude \e lon2. * - \e outmask |= Geodesic::AZIMUTH for the latitude \e azi2. * - \e outmask |= Geodesic::DISTANCE for the distance \e s12. * - \e outmask |= Geodesic::REDUCEDLENGTH for the reduced length \e * m12. * - \e outmask |= Geodesic::GEODESICSCALE for the geodesic scales \e * M12 and \e M21. * - \e outmask |= Geodesic::AREA for the area \e S12. * . * The function value \e a12 is always computed and returned and this * equals \e s12_a12 is \e arcmode is true. If \e outmask includes * Geodesic::DISTANCE and \e arcmode is false, then \e s12 = \e s12_a12. * It is not necessary to include Geodesic::DISTANCE_IN in \e outmask; this * is automatically included is \e arcmode is false. **********************************************************************/ Math::real GenDirect(real lat1, real lon1, real azi1, bool arcmode, real s12_a12, unsigned outmask, real& lat2, real& lon2, real& azi2, real& s12, real& m12, real& M12, real& M21, real& S12) const throw(); ///@} /** \name Inverse geodesic problem. **********************************************************************/ ///@{ /** * Perform the inverse geodesic calculation. * * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] lat2 latitude of point 2 (degrees). * @param[in] lon2 longitude of point 2 (degrees). * @param[out] s12 distance between point 1 and point 2 (meters). * @param[out] azi1 azimuth at point 1 (degrees). * @param[out] azi2 (forward) azimuth at point 2 (degrees). * @param[out] m12 reduced length of geodesic (meters). * @param[out] M12 geodesic scale of point 2 relative to point 1 * (dimensionless). * @param[out] M21 geodesic scale of point 1 relative to point 2 * (dimensionless). * @param[out] S12 area under the geodesic (meters2). * @return \e a12 arc length of between point 1 and point 2 (degrees). * * \e lat1 and \e lat2 should be in the range [-90, 90]; \e lon1 and \e * lon2 should be in the range [-180, 360]. The values of \e azi1 and \e * azi2 returned are in the range [-180, 180). * * If either point is at a pole, the azimuth is defined by keeping the * longitude fixed and writing \e lat = 90 - \e eps or -90 + \e eps and * taking the limit \e eps -> 0 from above. If the routine fails to * converge, then all the requested outputs are set to Math::NaN(). (Test * for such results with Math::isnan.) This is not expected to happen with * ellipsoidal models of the earth; please report all cases where this * occurs. * * The following functions are overloaded versions of Geodesic::Inverse * which omit some of the output parameters. Note, however, that the arc * length is always computed and returned as the function value. **********************************************************************/ Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real& s12, real& azi1, real& azi2, real& m12, real& M12, real& M21, real& S12) const throw() { return GenInverse(lat1, lon1, lat2, lon2, DISTANCE | AZIMUTH | REDUCEDLENGTH | GEODESICSCALE | AREA, s12, azi1, azi2, m12, M12, M21, S12); } /** * See the documentation for Geodesic::Inverse. **********************************************************************/ Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real& s12) const throw() { real t; return GenInverse(lat1, lon1, lat2, lon2, DISTANCE, s12, t, t, t, t, t, t); } /** * See the documentation for Geodesic::Inverse. **********************************************************************/ Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real& azi1, real& azi2) const throw() { real t; return GenInverse(lat1, lon1, lat2, lon2, AZIMUTH, t, azi1, azi2, t, t, t, t); } /** * See the documentation for Geodesic::Inverse. **********************************************************************/ Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real& s12, real& azi1, real& azi2) const throw() { real t; return GenInverse(lat1, lon1, lat2, lon2, DISTANCE | AZIMUTH, s12, azi1, azi2, t, t, t, t); } /** * See the documentation for Geodesic::Inverse. **********************************************************************/ Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real& s12, real& azi1, real& azi2, real& m12) const throw() { real t; return GenInverse(lat1, lon1, lat2, lon2, DISTANCE | AZIMUTH | REDUCEDLENGTH, s12, azi1, azi2, m12, t, t, t); } /** * See the documentation for Geodesic::Inverse. **********************************************************************/ Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real& s12, real& azi1, real& azi2, real& M12, real& M21) const throw() { real t; return GenInverse(lat1, lon1, lat2, lon2, DISTANCE | AZIMUTH | GEODESICSCALE, s12, azi1, azi2, t, M12, M21, t); } /** * See the documentation for Geodesic::Inverse. **********************************************************************/ Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real& s12, real& azi1, real& azi2, real& m12, real& M12, real& M21) const throw() { real t; return GenInverse(lat1, lon1, lat2, lon2, DISTANCE | AZIMUTH | REDUCEDLENGTH | GEODESICSCALE, s12, azi1, azi2, m12, M12, M21, t); } ///@} /** \name General version of inverse geodesic solution. **********************************************************************/ ///@{ /** * The general inverse geodesic calculation. Geodesic::Inverse is defined * in terms of this function. * * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] lat2 latitude of point 2 (degrees). * @param[in] lon2 longitude of point 2 (degrees). * @param[in] outmask a bitor'ed combination of Geodesic::mask values * specifying which of the following parameters should be set. * @param[out] s12 distance between point 1 and point 2 (meters). * @param[out] azi1 azimuth at point 1 (degrees). * @param[out] azi2 (forward) azimuth at point 2 (degrees). * @param[out] m12 reduced length of geodesic (meters). * @param[out] M12 geodesic scale of point 2 relative to point 1 * (dimensionless). * @param[out] M21 geodesic scale of point 1 relative to point 2 * (dimensionless). * @param[out] S12 area under the geodesic (meters2). * @return \e a12 arc length of between point 1 and point 2 (degrees). * * The Geodesic::mask values possible for \e outmask are * - \e outmask |= Geodesic::DISTANCE for the distance \e s12. * - \e outmask |= Geodesic::AZIMUTH for the latitude \e azi2. * - \e outmask |= Geodesic::REDUCEDLENGTH for the reduced length \e * m12. * - \e outmask |= Geodesic::GEODESICSCALE for the geodesic scales \e * M12 and \e M21. * - \e outmask |= Geodesic::AREA for the area \e S12. * . * The arc length is always computed and returned as the function value. **********************************************************************/ Math::real GenInverse(real lat1, real lon1, real lat2, real lon2, unsigned outmask, real& s12, real& azi1, real& azi2, real& m12, real& M12, real& M21, real& S12) const throw(); ///@} /** \name Interface to GeodesicLine. **********************************************************************/ ///@{ /** * Set up to compute several points on a singe geodesic. * * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] azi1 azimuth at point 1 (degrees). * @param[in] caps bitor'ed combination of Geodesic::mask values * specifying the capabilities the GeodesicLine object should possess, * i.e., which quantities can be returned in calls to * GeodesicLib::Position. * * \e lat1 should be in the range [-90, 90]; \e lon1 and \e azi1 should be * in the range [-180, 360]. * * The Geodesic::mask values are * - \e caps |= Geodesic::LATITUDE for the latitude \e lat2; this is * added automatically * - \e caps |= Geodesic::LONGITUDE for the latitude \e lon2 * - \e caps |= Geodesic::AZIMUTH for the latitude \e azi2; this is * added automatically * - \e caps |= Geodesic::DISTANCE for the distance \e s12 * - \e caps |= Geodesic::REDUCEDLENGTH for the reduced length \e m12 * - \e caps |= Geodesic::GEODESICSCALE for the geodesic scales \e M12 * and \e M21 * - \e caps |= Geodesic::AREA for the area \e S12 * - \e caps |= Geodesic::DISTANCE_IN permits the length of the * geodesic to be given in terms of \e s12; without this capability the * length can only be specified in terms of arc length. * . * The default value of \e caps is Geodesic::ALL which turns on all the * capabilities. * * If the point is at a pole, the azimuth is defined by keeping the \e lon1 * fixed and writing \e lat1 = 90 - \e eps or -90 + \e eps and taking the * limit \e eps -> 0 from above. **********************************************************************/ GeodesicLine Line(real lat1, real lon1, real azi1, unsigned caps = ALL) const throw(); ///@} /** \name Inspector functions. **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ Math::real MajorRadius() const throw() { return _a; } /** * @return \e f the flattening of the ellipsoid. This is the * value used in the constructor. **********************************************************************/ Math::real Flattening() const throw() { return _f; } /// \cond SKIP /** * DEPRECATED * @return \e r the inverse flattening of the ellipsoid. **********************************************************************/ Math::real InverseFlattening() const throw() { return 1/_f; } /// \endcond /** * @return total area of ellipsoid in meters2. The area of a * polygon encircling a pole can be found by adding * Geodesic::EllipsoidArea()/2 to the sum of \e S12 for each side of the * polygon. **********************************************************************/ Math::real EllipsoidArea() const throw() { return 4 * Math::pi() * _c2; } ///@} /** * A global instantiation of Geodesic with the parameters for the WGS84 * ellipsoid. **********************************************************************/ static const Geodesic WGS84; }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_GEODESIC_HPP geographiclib-1.21/include/GeographicLib/Config.h0000644000175000017500000000005411745620415021560 0ustar frankiefrankie#define GEOGRAPHICLIB_VERSION_STRING "1.21" geographiclib-1.21/include/GeographicLib/Math.hpp0000644000175000017500000003506511745620414021615 0ustar frankiefrankie/** * \file Math.hpp * \brief Header for GeographicLib::Math class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Constants.hpp includes Math.hpp. Place this include outside Math.hpp's // include guard to enforce this ordering. #include #if !defined(GEOGRAPHICLIB_MATH_HPP) #define GEOGRAPHICLIB_MATH_HPP "$Id: edd244e4c5c74e696096c2b6d598728957a0d36d $" /** * Are C++11 math functions available? **********************************************************************/ #if !defined(GEOGRAPHICLIB_CPLUSPLUS11_MATH) # if defined(__GXX_EXPERIMENTAL_CXX0X__) # define GEOGRAPHICLIB_CPLUSPLUS11_MATH 1 # else # define GEOGRAPHICLIB_CPLUSPLUS11_MATH 0 # endif #endif #if !defined(WORDS_BIGENDIAN) # define WORDS_BIGENDIAN 0 #endif #if !defined(GEOGRAPHICLIB_PREC) /** * The precision of floating point numbers used in %GeographicLib. 0 means * float; 1 (default) means double; 2 means long double. Nearly all the * testing has been carried out with doubles and that's the recommended * configuration. In order for long double to be used, HAVE_LONG_DOUBLE needs * to be defined. Note that with Microsoft Visual Studio, long double is the * same as double. **********************************************************************/ #define GEOGRAPHICLIB_PREC 1 #endif #include #include #include #include namespace GeographicLib { /** * \brief Mathematical functions needed by %GeographicLib * * Define mathematical functions in order to localize system dependencies and * to provide generic versions of the functions. In addition define a real * type to be used by %GeographicLib. * * Example of use: * \include example-Math.cpp **********************************************************************/ class GEOGRAPHIC_EXPORT Math { private: void dummy() { STATIC_ASSERT(GEOGRAPHICLIB_PREC >= 0 && GEOGRAPHICLIB_PREC <= 2, "Bad value of precision"); } Math(); // Disable constructor public: #if defined(HAVE_LONG_DOUBLE) /** * The extended precision type for real numbers, used for some testing. * This is long double on computers with this type; otherwise it is double. **********************************************************************/ typedef long double extended; #else typedef double extended; #endif #if GEOGRAPHICLIB_PREC == 1 /** * The real type for %GeographicLib. Nearly all the testing has been done * with \e real = double. However, the algorithms should also work with * float and long double (where available). (CAUTION: reasonable * accuracy typically cannot be obtained using floats.) **********************************************************************/ typedef double real; #elif GEOGRAPHICLIB_PREC == 0 typedef float real; #elif GEOGRAPHICLIB_PREC == 2 typedef extended real; #else typedef double real; #endif /** * true if the machine is big-endian **********************************************************************/ static const bool bigendian = WORDS_BIGENDIAN; /** * @tparam T the type of the returned value. * @return \e pi. **********************************************************************/ template static inline T pi() throw() { return std::atan2(T(0), -T(1)); } /** * A synonym for pi(). **********************************************************************/ static inline real pi() throw() { return pi(); } /** * @tparam T the type of the returned value. * @return the number of radians in a degree. **********************************************************************/ template static inline T degree() throw() { return pi() / T(180); } /** * A synonym for degree(). **********************************************************************/ static inline real degree() throw() { return degree(); } /** * Square a number. * @tparam T the type of the argument and the returned value. * @param[in] x * @return x2. **********************************************************************/ template static inline T sq(T x) throw() { return x * x; } #if defined(DOXYGEN) /** * The hypotenuse function avoiding underflow and overflow. * * @tparam T the type of the arguments and the returned value. * @param[in] x * @param[in] y * @return sqrt(x2 + y2). **********************************************************************/ template static inline T hypot(T x, T y) throw() { x = std::abs(x); y = std::abs(y); T a = (std::max)(x, y), b = (std::min)(x, y) / (a ? a : 1); return a * std::sqrt(1 + b * b); } #elif GEOGRAPHICLIB_CPLUSPLUS11_MATH template static inline T hypot(T x, T y) throw() { return std::hypot(x, y); } #elif defined(_MSC_VER) static inline double hypot(double x, double y) throw() { return _hypot(x, y); } #if _MSC_VER < 1400 // Visual C++ 7.1/VS .NET 2003 does not have _hypotf() static inline float hypot(float x, float y) throw() { return float(_hypot(x, y)); } #else static inline float hypot(float x, float y) throw() { return _hypotf(x, y); } #endif #if defined(HAVE_LONG_DOUBLE) static inline long double hypot(long double x, long double y) throw() { return _hypot(x, y); } #endif #else // Use overloading to define generic versions static inline double hypot(double x, double y) throw() { return ::hypot(x, y); } static inline float hypot(float x, float y) throw() { return ::hypotf(x, y); } #if defined(HAVE_LONG_DOUBLE) static inline long double hypot(long double x, long double y) throw() { return ::hypotl(x, y); } #endif #endif #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MATH) /** * exp(\e x) - 1 accurate near \e x = 0. This is taken from * N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd * Edition (SIAM, 2002), Sec 1.14.1, p 19. * * @tparam T the type of the argument and the returned value. * @param[in] x * @return exp(\e x) - 1. **********************************************************************/ template static inline T expm1(T x) throw() { volatile T y = std::exp(x), z = y - 1; // The reasoning here is similar to that for log1p. The expression // mathematically reduces to exp(x) - 1, and the factor z/log(y) = (y - // 1)/log(y) is a slowly varying quantity near y = 1 and is accurately // computed. return std::abs(x) > 1 ? z : (z == 0 ? x : x * z / std::log(y)); } #elif GEOGRAPHICLIB_CPLUSPLUS11_MATH template static inline T expm1(T x) throw() { return std::expm1(x); } #else static inline double expm1(double x) throw() { return ::expm1(x); } static inline float expm1(float x) throw() { return ::expm1f(x); } #if defined(HAVE_LONG_DOUBLE) static inline long double expm1(long double x) throw() { return ::expm1l(x); } #endif #endif #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MATH) /** * log(1 + \e x) accurate near \e x = 0. * * This is taken from D. Goldberg, * What every computer * scientist should know about floating-point arithmetic (1991), * Theorem 4. See also, Higham (op. cit.), Answer to Problem 1.5, p 528. * * @tparam T the type of the argument and the returned value. * @param[in] x * @return log(1 + \e x). **********************************************************************/ template static inline T log1p(T x) throw() { volatile T y = 1 + x, z = y - 1; // Here's the explanation for this magic: y = 1 + z, exactly, and z // approx x, thus log(y)/z (which is nearly constant near z = 0) returns // a good approximation to the true log(1 + x)/x. The multiplication x * // (log(y)/z) introduces little additional error. return z == 0 ? x : x * std::log(y) / z; } #elif GEOGRAPHICLIB_CPLUSPLUS11_MATH template static inline T log1p(T x) throw() { return std::log1p(x); } #else static inline double log1p(double x) throw() { return ::log1p(x); } static inline float log1p(float x) throw() { return ::log1pf(x); } #if defined(HAVE_LONG_DOUBLE) static inline long double log1p(long double x) throw() { return ::log1pl(x); } #endif #endif #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MATH) /** * The inverse hyperbolic sine function. This is defined in terms of * Math::log1p(\e x) in order to maintain accuracy near \e x = 0. In * addition, the odd parity of the function is enforced. * * @tparam T the type of the argument and the returned value. * @param[in] x * @return asinh(\e x). **********************************************************************/ template static inline T asinh(T x) throw() { T y = std::abs(x); // Enforce odd parity y = log1p(y * (1 + y/(hypot(T(1), y) + 1))); return x < 0 ? -y : y; } #elif GEOGRAPHICLIB_CPLUSPLUS11_MATH template static inline T asinh(T x) throw() { return std::asinh(x); } #else static inline double asinh(double x) throw() { return ::asinh(x); } static inline float asinh(float x) throw() { return ::asinhf(x); } #if defined(HAVE_LONG_DOUBLE) static inline long double asinh(long double x) throw() { return ::asinhl(x); } #endif #endif #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MATH) /** * The inverse hyperbolic tangent function. This is defined in terms of * Math::log1p(\e x) in order to maintain accuracy near \e x = 0. In * addition, the odd parity of the function is enforced. * * @tparam T the type of the argument and the returned value. * @param[in] x * @return atanh(\e x). **********************************************************************/ template static inline T atanh(T x) throw() { T y = std::abs(x); // Enforce odd parity y = log1p(2 * y/(1 - y))/2; return x < 0 ? -y : y; } #elif GEOGRAPHICLIB_CPLUSPLUS11_MATH template static inline T atanh(T x) throw() { return std::atanh(x); } #else static inline double atanh(double x) throw() { return ::atanh(x); } static inline float atanh(float x) throw() { return ::atanhf(x); } #if defined(HAVE_LONG_DOUBLE) static inline long double atanh(long double x) throw() { return ::atanhl(x); } #endif #endif #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MATH) /** * The cube root function. * * @tparam T the type of the argument and the returned value. * @param[in] x * @return the real cube root of \e x. **********************************************************************/ template static inline T cbrt(T x) throw() { T y = std::pow(std::abs(x), 1/T(3)); // Return the real cube root return x < 0 ? -y : y; } #elif GEOGRAPHICLIB_CPLUSPLUS11_MATH template static inline T cbrt(T x) throw() { return std::cbrt(x); } #else static inline double cbrt(double x) throw() { return ::cbrt(x); } static inline float cbrt(float x) throw() { return ::cbrtf(x); } #if defined(HAVE_LONG_DOUBLE) static inline long double cbrt(long double x) throw() { return ::cbrtl(x); } #endif #endif /** * Test for finiteness. * * @tparam T the type of the argument. * @param[in] x * @return true if number is finite, false if NaN or infinite. **********************************************************************/ template static inline bool isfinite(T x) throw() { #if defined(DOXYGEN) return std::abs(x) <= (std::numeric_limits::max)(); #elif (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MATH) return _finite(x) != 0; #else return std::isfinite(x); #endif } /** * The NaN (not a number) * * @tparam T the type of the returned value. * @return NaN if available, otherwise return the max real. **********************************************************************/ template static inline T NaN() throw() { return std::numeric_limits::has_quiet_NaN ? std::numeric_limits::quiet_NaN() : (std::numeric_limits::max)(); } /** * A synonym for NaN(). **********************************************************************/ static inline real NaN() throw() { return NaN(); } /** * Test for NaN. * * @tparam T the type of the argument. * @param[in] x * @return true if argument is a NaN. **********************************************************************/ template static inline bool isnan(T x) throw() { #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS11_MATH) return x != x; #else return std::isnan(x); #endif } /** * Infinity * * @tparam T the type of the returned value. * @return infinity if available, otherwise return the max real. **********************************************************************/ template static inline T infinity() throw() { return std::numeric_limits::has_infinity ? std::numeric_limits::infinity() : (std::numeric_limits::max)(); } /** * A synonym for infinity(). **********************************************************************/ static inline real infinity() throw() { return infinity(); } /** * Swap the bytes of a quantity * * @tparam T the type of the argument and the returned value. * @param[in] x * @return x with its bytes swapped. **********************************************************************/ template static inline T swab(T x) { union { T r; unsigned char c[sizeof(T)]; } b; b.r = x; for (int i = sizeof(T)/2; i--; ) std::swap(b.c[i], b.c[sizeof(T) - 1 - i]); return b.r; } }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_MATH_HPP geographiclib-1.21/include/GeographicLib/PolarStereographic.hpp0000644000175000017500000001576111745620414024522 0ustar frankiefrankie/** * \file PolarStereographic.hpp * \brief Header for GeographicLib::PolarStereographic class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP) #define GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP \ "$Id: 07add8492c46e42012007a8738060abc902a5504 $" #include namespace GeographicLib { /** * \brief Polar Stereographic Projection * * Implementation taken from the report, * - J. P. Snyder, * Map Projections: A * Working Manual, USGS Professional Paper 1395 (1987), * pp. 160–163. * * This is a straightforward implementation of the equations in Snyder except * that Newton's method is used to invert the projection. * * Example of use: * \include example-PolarStereographic.cpp **********************************************************************/ class GEOGRAPHIC_EXPORT PolarStereographic { private: typedef Math::real real; // _Cx used to be _C but g++ 3.4 has a macro of that name real _a, _f, _e2, _e, _e2m, _Cx, _c; real _k0; static const real tol_; static const real overflow_; static const int numit_ = 5; // tan(x) for x in [-pi/2, pi/2] ensuring that the sign is right static inline real tanx(real x) throw() { real t = std::tan(x); // Write the tests this way to ensure that tanx(NaN()) is NaN() return x >= 0 ? (!(t < 0) ? t : overflow_) : (!(t >= 0) ? t : -overflow_); } // Return e * atanh(e * x) for f >= 0, else return // - sqrt(-e2) * atan( sqrt(-e2) * x) for f < 0 inline real eatanhe(real x) const throw() { return _f >= 0 ? _e * Math::atanh(_e * x) : - _e * std::atan(_e * x); } public: /** * Constructor for a ellipsoid with * * @param[in] a equatorial radius (meters). * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere. * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flattening * to 1/\e f. * @param[in] k0 central scale factor. * * An exception is thrown if either of the axes of the ellipsoid is * not positive \e a or if \e k0 is not positive. **********************************************************************/ PolarStereographic(real a, real f, real k0); /** * Set the scale for the projection. * * @param[in] lat (degrees) assuming \e northp = true. * @param[in] k scale at latitude \e lat (default 1). * * This allows a "latitude of true scale" to be specified. An exception is * thrown if \e k is not positive or if \e lat is not in the range (-90, * 90]. **********************************************************************/ void SetScale(real lat, real k = real(1)); /** * Forward projection, from geographic to polar stereographic. * * @param[in] northp the pole which is the center of projection (true means * north, false means south). * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[out] x easting of point (meters). * @param[out] y northing of point (meters). * @param[out] gamma meridian convergence at point (degrees). * @param[out] k scale of projection at point. * * No false easting or northing is added. \e lat should be in the range * (-90, 90] for \e northp = true and in the range [-90, 90) for \e northp * = false; \e lon should be in the range [-180, 360]. **********************************************************************/ void Forward(bool northp, real lat, real lon, real& x, real& y, real& gamma, real& k) const throw(); /** * Reverse projection, from polar stereographic to geographic. * * @param[in] northp the pole which is the center of projection (true means * north, false means south). * @param[in] x easting of point (meters). * @param[in] y northing of point (meters). * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] gamma meridian convergence at point (degrees). * @param[out] k scale of projection at point. * * No false easting or northing is added. The value of \e lon returned is * in the range [-180, 180). **********************************************************************/ void Reverse(bool northp, real x, real y, real& lat, real& lon, real& gamma, real& k) const throw(); /** * PolarStereographic::Forward without returning the convergence and scale. **********************************************************************/ void Forward(bool northp, real lat, real lon, real& x, real& y) const throw() { real gamma, k; Forward(northp, lat, lon, x, y, gamma, k); } /** * PolarStereographic::Reverse without returning the convergence and scale. **********************************************************************/ void Reverse(bool northp, real x, real y, real& lat, real& lon) const throw() { real gamma, k; Reverse(northp, x, y, lat, lon, gamma, k); } /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ Math::real MajorRadius() const throw() { return _a; } /** * @return \e f the flattening of the ellipsoid. This is the value used in * the constructor. **********************************************************************/ Math::real Flattening() const throw() { return _f; } /// \cond SKIP /** * DEPRECATED * @return \e r the inverse flattening of the ellipsoid. **********************************************************************/ Math::real InverseFlattening() const throw() { return 1/_f; } /// \endcond /** * The central scale for the projection. This is the value of \e k0 used * in the constructor and is the scale at the pole unless overridden by * PolarStereographic::SetScale. **********************************************************************/ Math::real CentralScale() const throw() { return _k0; } ///@} /** * A global instantiation of PolarStereographic with the WGS84 ellipsoid * and the UPS scale factor. However, unlike UPS, no false easting or * northing is added. **********************************************************************/ static const PolarStereographic UPS; }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP geographiclib-1.21/include/GeographicLib/EllipticFunction.hpp0000644000175000017500000001172111745620414024170 0ustar frankiefrankie/** * \file EllipticFunction.hpp * \brief Header for GeographicLib::EllipticFunction class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP) #define GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP \ "$Id: 30ac447643e48afcaf5ab4671fbf2b235008dabe $" #include namespace GeographicLib { /** * \brief Elliptic functions needed for TransverseMercatorExact * * This provides the subset of elliptic functions needed for * TransverseMercatorExact. For a given ellipsoid, only parameters * e2 and 1 - e2 are needed. This class * taken the parameter as a constructor parameters and caches the values of * the required complete integrals. A method is provided for Jacobi elliptic * functions and for the incomplete elliptic integral of the second kind in * terms of the amplitude. * * The computation of the elliptic integrals uses the algorithms given in * - B. C. Carlson, * Computation of elliptic * integrals, Numerical Algorithms 10, 13–26 (1995). * . * The computation of the Jacobi elliptic functions uses the algorithm given * in * - R. Bulirsch, * Numerical Calculation of * Elliptic Integrals and Elliptic Functions, Numericshe Mathematik 7, * 78–90 (1965). * . * The notation follows Abramowitz and Stegun, Chapters 16 and 17. * * Example of use: * \include example-EllipticFunction.cpp **********************************************************************/ class GEOGRAPHIC_EXPORT EllipticFunction { private: typedef Math::real real; static const real tol_; static const real tolRF_; static const real tolRD_; static const real tolRG0_; static const real tolJAC_; static const real tolJAC1_; enum { num_ = 10 }; // Max depth required for sncndn. Probably 5 is enough. static real RF(real x, real y, real z) throw(); static real RD(real x, real y, real z) throw(); static real RG0(real x, real y) throw(); real _m, _m1; mutable bool _init; mutable real _kc, _ec, _kec; bool Init() const throw(); public: /** * Constructor. * * @param[in] m the parameter which must lie in [0, 1]. (No checking * is done.) **********************************************************************/ explicit EllipticFunction(real m) throw(); /** * @return the parameter \e m. **********************************************************************/ Math::real m() const throw() { return _m; } /** * @return the complementary parameter \e m' = (1 - \e m). **********************************************************************/ Math::real m1() const throw() { return _m1; } /** * @return the complete integral of first kind, \e K(\e m). **********************************************************************/ Math::real K() const throw() { _init || Init(); return _kc; } /** * @return the complete integral of second kind, \e E(\e m). **********************************************************************/ Math::real E() const throw() { _init || Init(); return _ec; } /** * @return the difference \e K(\e m) - \e E(\e m) (which can be computed * directly). **********************************************************************/ Math::real KE() const throw() { _init || Init(); return _kec; } /** * The Jacobi elliptic functions. * * @param[in] x the argument. * @param[out] sn sn(x|m). * @param[out] cn cn(x|m). * @param[out] dn dn(x|m). **********************************************************************/ void sncndn(real x, real& sn, real& cn, real& dn) const throw(); /** * The incomplete integral of the second kind. * * @param[in] phi * @return int sqrt(1 - \e m sin2(\e phi)) \e dphi. **********************************************************************/ Math::real E(real phi) const throw(); /** * The incomplete integral of the second kind in terms of Jacobi elliptic * functions * * @param[in] sn * @param[in] cn * @param[in] dn * @return int dn(\e w)2 \e dw (A+S 17.2.10). * * Instead of specifying the amplitude \e phi, we provide \e sn = sin(\e * phi), \e cn = cos(\e phi), \e dn = sqrt(1 - \e m sin2(\e * phi)). **********************************************************************/ Math::real E(real sn, real cn, real dn) const throw(); }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP geographiclib-1.21/include/GeographicLib/GeodesicLine.hpp0000644000175000017500000006204211745620414023251 0ustar frankiefrankie/** * \file GeodesicLine.hpp * \brief Header for GeographicLib::GeodesicLine class * * Copyright (c) Charles Karney (2009-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GEODESICLINE_HPP) #define GEOGRAPHICLIB_GEODESICLINE_HPP \ "$Id: 4bbc611bc3837d78456bc227e17bea39cb443745 $" #include #include namespace GeographicLib { /** * \brief A geodesic line. * * GeodesicLine facilitates the determination of a series of points on a * single geodesic. The starting point (\e lat1, \e lon1) and the azimuth \e * azi1 are specified in the constructor. GeodesicLine.Position returns the * location of point 2 a distance \e s12 along the geodesic. Alternatively * GeodesicLine.ArcPosition gives the position of point 2 an arc length \e * a12 along the geodesic. * * The default copy constructor and assignment operators work with this * class. Similarly, a vector can be used to hold GeodesicLine objects. * * The calculations are accurate to better than 15 nm (15 nanometers). See * Sec. 9 of * arXiv:1102.1215v1 for * details. * * The algorithms are described in * - C. F. F. Karney, * Geodesics * on an ellipsoid of revolution, * Feb. 2011; * preprint * arXiv:1102.1215v1. * - C. F. F. Karney, * Algorithms for geodesics, * Sept. 2011; * preprint * arxiv:1109.4448. * . * For more information on geodesics see \ref geodesic. * * Example of use: * \include example-GeodesicLine.cpp * * Geod is a command-line utility providing access * to the functionality of Geodesic and GeodesicLine. **********************************************************************/ class GEOGRAPHIC_EXPORT GeodesicLine { private: typedef Math::real real; friend class Geodesic; static const int nC1_ = Geodesic::nC1_; static const int nC1p_ = Geodesic::nC1p_; static const int nC2_ = Geodesic::nC2_; static const int nC3_ = Geodesic::nC3_; static const int nC4_ = Geodesic::nC4_; real _lat1, _lon1, _azi1; real _a, _f, _b, _c2, _f1, _salp0, _calp0, _k2, _salp1, _calp1, _ssig1, _csig1, _stau1, _ctau1, _somg1, _comg1, _A1m1, _A2m1, _A3c, _B11, _B21, _B31, _A4, _B41; // index zero elements of _C1a, _C1pa, _C2a, _C3a are unused real _C1a[nC1_ + 1], _C1pa[nC1p_ + 1], _C2a[nC2_ + 1], _C3a[nC3_], _C4a[nC4_]; // all the elements of _C4a are used unsigned _caps; enum captype { CAP_NONE = Geodesic::CAP_NONE, CAP_C1 = Geodesic::CAP_C1, CAP_C1p = Geodesic::CAP_C1p, CAP_C2 = Geodesic::CAP_C2, CAP_C3 = Geodesic::CAP_C3, CAP_C4 = Geodesic::CAP_C4, CAP_ALL = Geodesic::CAP_ALL, OUT_ALL = Geodesic::OUT_ALL, }; public: /** * Bit masks for what calculations to do. They signify to the * GeodesicLine::GeodesicLine constructor and to Geodesic::Line what * capabilities should be included in the GeodesicLine object. This is * merely a duplication of Geodesic::mask. **********************************************************************/ enum mask { /** * No capabilities, no output. * @hideinitializer **********************************************************************/ NONE = Geodesic::NONE, /** * Calculate latitude \e lat2. (It's not necessary to include this as a * capability to GeodesicLine because this is included by default.) * @hideinitializer **********************************************************************/ LATITUDE = Geodesic::LATITUDE, /** * Calculate longitude \e lon2. * @hideinitializer **********************************************************************/ LONGITUDE = Geodesic::LONGITUDE, /** * Calculate azimuths \e azi1 and \e azi2. (It's not necessary to * include this as a capability to GeodesicLine because this is included * by default.) * @hideinitializer **********************************************************************/ AZIMUTH = Geodesic::AZIMUTH, /** * Calculate distance \e s12. * @hideinitializer **********************************************************************/ DISTANCE = Geodesic::DISTANCE, /** * Allow distance \e s12 to be used as input in the direct geodesic * problem. * @hideinitializer **********************************************************************/ DISTANCE_IN = Geodesic::DISTANCE_IN, /** * Calculate reduced length \e m12. * @hideinitializer **********************************************************************/ REDUCEDLENGTH = Geodesic::REDUCEDLENGTH, /** * Calculate geodesic scales \e M12 and \e M21. * @hideinitializer **********************************************************************/ GEODESICSCALE = Geodesic::GEODESICSCALE, /** * Calculate area \e S12. * @hideinitializer **********************************************************************/ AREA = Geodesic::AREA, /** * All capabilities. Calculate everything. * @hideinitializer **********************************************************************/ ALL = Geodesic::ALL, }; /** \name Constructors **********************************************************************/ ///@{ /** * Constructor for a geodesic line staring at latitude \e lat1, longitude * \e lon1, and azimuth \e azi1 (all in degrees). * * @param[in] g A Geodesic object used to compute the necessary information * about the GeodesicLine. * * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] azi1 azimuth at point 1 (degrees). * @param[in] caps bitor'ed combination of GeodesicLine::mask values * specifying the capabilities the GeodesicLine object should possess, * i.e., which quantities can be returned in calls to * GeodesicLib::Position. * * \e lat1 should be in the range [-90, 90]; \e lon1 and \e azi1 should be * in the range [-180, 360]. * * The GeodesicLine::mask values are * - \e caps |= GeodesicLine::LATITUDE for the latitude \e lat2; this is * added automatically * - \e caps |= GeodesicLine::LONGITUDE for the latitude \e lon2 * - \e caps |= GeodesicLine::AZIMUTH for the latitude \e azi2; this is * added automatically * - \e caps |= GeodesicLine::DISTANCE for the distance \e s12 * - \e caps |= GeodesicLine::REDUCEDLENGTH for the reduced length \e m12 * - \e caps |= GeodesicLine::GEODESICSCALE for the geodesic scales \e M12 * and \e M21 * - \e caps |= GeodesicLine::AREA for the area \e S12 * - \e caps |= GeodesicLine::DISTANCE_IN permits the length of the * geodesic to be given in terms of \e s12; without this capability the * length can only be specified in terms of arc length. * . * The default value of \e caps is GeodesicLine::ALL which turns on all the * capabilities. * * If the point is at a pole, the azimuth is defined by keeping the \e lon1 * fixed and writing \e lat1 = 90 - \e eps or -90 + \e eps and taking the * limit \e eps -> 0 from above. **********************************************************************/ GeodesicLine(const Geodesic& g, real lat1, real lon1, real azi1, unsigned caps = ALL) throw(); /** * A default constructor. If GeodesicLine::Position is called on the * resulting object, it returns immediately (without doing any * calculations). The object can be set with a call to Geodesic::Line. * Use Init() to test whether object is still in this uninitialized state. **********************************************************************/ GeodesicLine() throw() : _caps(0U) {} ///@} /** \name Position in terms of distance **********************************************************************/ ///@{ /** * Compute the position of point 2 which is a distance \e s12 (meters) * from point 1. * * @param[in] s12 distance between point 1 and point 2 (meters); it can be * signed. * @param[out] lat2 latitude of point 2 (degrees). * @param[out] lon2 longitude of point 2 (degrees); requires that the * GeodesicLine object was constructed with \e caps |= * GeodesicLine::LONGITUDE. * @param[out] azi2 (forward) azimuth at point 2 (degrees). * @param[out] m12 reduced length of geodesic (meters); requires that the * GeodesicLine object was constructed with \e caps |= * GeodesicLine::REDUCEDLENGTH. * @param[out] M12 geodesic scale of point 2 relative to point 1 * (dimensionless); requires that the GeodesicLine object was constructed * with \e caps |= GeodesicLine::GEODESICSCALE. * @param[out] M21 geodesic scale of point 1 relative to point 2 * (dimensionless); requires that the GeodesicLine object was constructed * with \e caps |= GeodesicLine::GEODESICSCALE. * @param[out] S12 area under the geodesic (meters2); requires * that the GeodesicLine object was constructed with \e caps |= * GeodesicLine::AREA. * @return \e a12 arc length of between point 1 and point 2 (degrees). * * The values of \e lon2 and \e azi2 returned are in the range [-180, 180). * * The GeodesicLine object \e must have been constructed with \e caps |= * GeodesicLine::DISTANCE_IN; otherwise Math::NaN() is returned and no * parameters are set. Requesting a value which the GeodesicLine object is * not capable of computing is not an error; the corresponding argument * will not be altered. * * The following functions are overloaded versions of * GeodesicLine::Position which omit some of the output parameters. Note, * however, that the arc length is always computed and returned as the * function value. **********************************************************************/ Math::real Position(real s12, real& lat2, real& lon2, real& azi2, real& m12, real& M12, real& M21, real& S12) const throw() { real t; return GenPosition(false, s12, LATITUDE | LONGITUDE | AZIMUTH | REDUCEDLENGTH | GEODESICSCALE | AREA, lat2, lon2, azi2, t, m12, M12, M21, S12); } /** * See the documentation for GeodesicLine::Position. **********************************************************************/ Math::real Position(real s12, real& lat2, real& lon2) const throw() { real t; return GenPosition(false, s12, LATITUDE | LONGITUDE, lat2, lon2, t, t, t, t, t, t); } /** * See the documentation for GeodesicLine::Position. **********************************************************************/ Math::real Position(real s12, real& lat2, real& lon2, real& azi2) const throw() { real t; return GenPosition(false, s12, LATITUDE | LONGITUDE | AZIMUTH, lat2, lon2, azi2, t, t, t, t, t); } /** * See the documentation for GeodesicLine::Position. **********************************************************************/ Math::real Position(real s12, real& lat2, real& lon2, real& azi2, real& m12) const throw() { real t; return GenPosition(false, s12, LATITUDE | LONGITUDE | AZIMUTH | REDUCEDLENGTH, lat2, lon2, azi2, t, m12, t, t, t); } /** * See the documentation for GeodesicLine::Position. **********************************************************************/ Math::real Position(real s12, real& lat2, real& lon2, real& azi2, real& M12, real& M21) const throw() { real t; return GenPosition(false, s12, LATITUDE | LONGITUDE | AZIMUTH | GEODESICSCALE, lat2, lon2, azi2, t, t, M12, M21, t); } /** * See the documentation for GeodesicLine::Position. **********************************************************************/ Math::real Position(real s12, real& lat2, real& lon2, real& azi2, real& m12, real& M12, real& M21) const throw() { real t; return GenPosition(false, s12, LATITUDE | LONGITUDE | AZIMUTH | REDUCEDLENGTH | GEODESICSCALE, lat2, lon2, azi2, t, m12, M12, M21, t); } ///@} /** \name Position in terms of arc length **********************************************************************/ ///@{ /** * Compute the position of point 2 which is an arc length \e a12 (degrees) * from point 1. * * @param[in] a12 arc length between point 1 and point 2 (degrees); it can * be signed. * @param[out] lat2 latitude of point 2 (degrees). * @param[out] lon2 longitude of point 2 (degrees); requires that the * GeodesicLine object was constructed with \e caps |= * GeodesicLine::LONGITUDE. * @param[out] azi2 (forward) azimuth at point 2 (degrees). * @param[out] s12 distance between point 1 and point 2 (meters); requires * that the GeodesicLine object was constructed with \e caps |= * GeodesicLine::DISTANCE. * @param[out] m12 reduced length of geodesic (meters); requires that the * GeodesicLine object was constructed with \e caps |= * GeodesicLine::REDUCEDLENGTH. * @param[out] M12 geodesic scale of point 2 relative to point 1 * (dimensionless); requires that the GeodesicLine object was constructed * with \e caps |= GeodesicLine::GEODESICSCALE. * @param[out] M21 geodesic scale of point 1 relative to point 2 * (dimensionless); requires that the GeodesicLine object was constructed * with \e caps |= GeodesicLine::GEODESICSCALE. * @param[out] S12 area under the geodesic (meters2); requires * that the GeodesicLine object was constructed with \e caps |= * GeodesicLine::AREA. * * The values of \e lon2 and \e azi2 returned are in the range [-180, 180). * * Requesting a value which the GeodesicLine object is not capable of * computing is not an error; the corresponding argument will not be * altered. * * The following functions are overloaded versions of * GeodesicLine::ArcPosition which omit some of the output parameters. **********************************************************************/ void ArcPosition(real a12, real& lat2, real& lon2, real& azi2, real& s12, real& m12, real& M12, real& M21, real& S12) const throw() { GenPosition(true, a12, LATITUDE | LONGITUDE | AZIMUTH | DISTANCE | REDUCEDLENGTH | GEODESICSCALE | AREA, lat2, lon2, azi2, s12, m12, M12, M21, S12); } /** * See the documentation for GeodesicLine::ArcPosition. **********************************************************************/ void ArcPosition(real a12, real& lat2, real& lon2) const throw() { real t; GenPosition(true, a12, LATITUDE | LONGITUDE, lat2, lon2, t, t, t, t, t, t); } /** * See the documentation for GeodesicLine::ArcPosition. **********************************************************************/ void ArcPosition(real a12, real& lat2, real& lon2, real& azi2) const throw() { real t; GenPosition(true, a12, LATITUDE | LONGITUDE | AZIMUTH, lat2, lon2, azi2, t, t, t, t, t); } /** * See the documentation for GeodesicLine::ArcPosition. **********************************************************************/ void ArcPosition(real a12, real& lat2, real& lon2, real& azi2, real& s12) const throw() { real t; GenPosition(true, a12, LATITUDE | LONGITUDE | AZIMUTH | DISTANCE, lat2, lon2, azi2, s12, t, t, t, t); } /** * See the documentation for GeodesicLine::ArcPosition. **********************************************************************/ void ArcPosition(real a12, real& lat2, real& lon2, real& azi2, real& s12, real& m12) const throw() { real t; GenPosition(true, a12, LATITUDE | LONGITUDE | AZIMUTH | DISTANCE | REDUCEDLENGTH, lat2, lon2, azi2, s12, m12, t, t, t); } /** * See the documentation for GeodesicLine::ArcPosition. **********************************************************************/ void ArcPosition(real a12, real& lat2, real& lon2, real& azi2, real& s12, real& M12, real& M21) const throw() { real t; GenPosition(true, a12, LATITUDE | LONGITUDE | AZIMUTH | DISTANCE | GEODESICSCALE, lat2, lon2, azi2, s12, t, M12, M21, t); } /** * See the documentation for GeodesicLine::ArcPosition. **********************************************************************/ void ArcPosition(real a12, real& lat2, real& lon2, real& azi2, real& s12, real& m12, real& M12, real& M21) const throw() { real t; GenPosition(true, a12, LATITUDE | LONGITUDE | AZIMUTH | DISTANCE | REDUCEDLENGTH | GEODESICSCALE, lat2, lon2, azi2, s12, m12, M12, M21, t); } ///@} /** \name The general position function. **********************************************************************/ ///@{ /** * The general position function. GeodesicLine::Position and * GeodesicLine::ArcPosition are defined in terms of this function. * * @param[in] arcmode boolean flag determining the meaning of the second * parameter; if arcmode is false, then the GeodesicLine object must have * been constructed with \e caps |= GeodesicLine::DISTANCE_IN. * @param[in] s12_a12 if \e arcmode is false, this is the distance between * point 1 and point 2 (meters); otherwise it is the arc length between * point 1 and point 2 (degrees); it can be signed. * @param[in] outmask a bitor'ed combination of GeodesicLine::mask values * specifying which of the following parameters should be set. * @param[out] lat2 latitude of point 2 (degrees). * @param[out] lon2 longitude of point 2 (degrees); requires that the * GeodesicLine object was constructed with \e caps |= * GeodesicLine::LONGITUDE. * @param[out] azi2 (forward) azimuth at point 2 (degrees). * @param[out] s12 distance between point 1 and point 2 (meters); requires * that the GeodesicLine object was constructed with \e caps |= * GeodesicLine::DISTANCE. * @param[out] m12 reduced length of geodesic (meters); requires that the * GeodesicLine object was constructed with \e caps |= * GeodesicLine::REDUCEDLENGTH. * @param[out] M12 geodesic scale of point 2 relative to point 1 * (dimensionless); requires that the GeodesicLine object was constructed * with \e caps |= GeodesicLine::GEODESICSCALE. * @param[out] M21 geodesic scale of point 1 relative to point 2 * (dimensionless); requires that the GeodesicLine object was constructed * with \e caps |= GeodesicLine::GEODESICSCALE. * @param[out] S12 area under the geodesic (meters2); requires * that the GeodesicLine object was constructed with \e caps |= * GeodesicLine::AREA. * @return \e a12 arc length of between point 1 and point 2 (degrees). * * The GeodesicLine::mask values possible for \e outmask are * - \e outmask |= GeodesicLine::LATITUDE for the latitude \e lat2. * - \e outmask |= GeodesicLine::LONGITUDE for the latitude \e lon2. * - \e outmask |= GeodesicLine::AZIMUTH for the latitude \e azi2. * - \e outmask |= GeodesicLine::DISTANCE for the distance \e s12. * - \e outmask |= GeodesicLine::REDUCEDLENGTH for the reduced length \e * m12. * - \e outmask |= GeodesicLine::GEODESICSCALE for the geodesic scales \e * M12 and \e M21. * - \e outmask |= GeodesicLine::AREA for the area \e S12. * . * Requesting a value which the GeodesicLine object is not capable of * computing is not an error; the corresponding argument will not be * altered. Note, however, that the arc length is always computed and * returned as the function value. **********************************************************************/ Math::real GenPosition(bool arcmode, real s12_a12, unsigned outmask, real& lat2, real& lon2, real& azi2, real& s12, real& m12, real& M12, real& M21, real& S12) const throw(); ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return true if the object has been initialized. **********************************************************************/ bool Init() const throw() { return _caps != 0U; } /** * @return \e lat1 the latitude of point 1 (degrees). **********************************************************************/ Math::real Latitude() const throw() { return Init() ? _lat1 : Math::NaN(); } /** * @return \e lon1 the longitude of point 1 (degrees). **********************************************************************/ Math::real Longitude() const throw() { return Init() ? _lon1 : Math::NaN(); } /** * @return \e azi1 the azimuth (degrees) of the geodesic line at point 1. **********************************************************************/ Math::real Azimuth() const throw() { return Init() ? _azi1 : Math::NaN(); } /** * @return \e azi0 the azimuth (degrees) of the geodesic line as it crosses * the equator in a northward direction. **********************************************************************/ Math::real EquatorialAzimuth() const throw() { return Init() ? atan2(_salp0, _calp0) / Math::degree() : Math::NaN(); } /** * @return \e a1 the arc length (degrees) between the northward equatorial * crossing and point 1. **********************************************************************/ Math::real EquatorialArc() const throw() { return Init() ? atan2(_ssig1, _csig1) / Math::degree() : Math::NaN(); } /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value inherited from the Geodesic object used in the constructor. **********************************************************************/ Math::real MajorRadius() const throw() { return Init() ? _a : Math::NaN(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the Geodesic object used in the constructor. **********************************************************************/ Math::real Flattening() const throw() { return Init() ? _f : Math::NaN(); } /// \cond SKIP /** * DEPRECATED * @return \e r the inverse flattening of the ellipsoid. **********************************************************************/ Math::real InverseFlattening() const throw() { return Init() ? 1/_f : Math::NaN(); } /// \endcond /** * @return \e caps the computational capabilities that this object was * constructed with. LATITUDE and AZIMUTH are always included. **********************************************************************/ unsigned Capabilities() const throw() { return _caps; } /** * @param[in] testcaps a set of bitor'ed GeodesicLine::mask values. * @return true if the GeodesicLine object has all these capabilities. **********************************************************************/ bool Capabilities(unsigned testcaps) const throw() { testcaps &= OUT_ALL; return (_caps & testcaps) == testcaps; } ///@} }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_GEODESICLINE_HPP geographiclib-1.21/include/GeographicLib/Accumulator.hpp0000644000175000017500000001714411745620414023201 0ustar frankiefrankie/** * \file Accumulator.hpp * \brief Header for GeographicLib::Accumulator class * * Copyright (c) Charles Karney (2010, 2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_ACCUMULATOR_HPP) #define GEOGRAPHICLIB_ACCUMULATOR_HPP \ "$Id: 03b7f4fdb9974c822f98d5f5aab1094b5a9ac8f2 $" #include namespace GeographicLib { /** * \brief An accumulator for sums. * * This allow many numbers of floating point type \e T to be added together * with twice the normal precision. Thus if \e T is double, the effective * precision of the sum is 106 bits or about 32 decimal places. The core * idea is the error free transformation of a sum, D. E. Knuth, TAOCP, Vol 2, * 4.2.2, Theorem B. * * The implementation follows J. R. Shewchuk, * Adaptive Precision * Floating-Point Arithmetic and Fast Robust Geometric Predicates, * Discrete & Computational Geometry 18(3) 305-363 (1997). * * Approximate timings (summing a vector) * - double: 2ns * - Accumulator: 23ns * * In the documentation of the member functions, \e sum stands for the value * currently held in the accumulator. * * Example of use: * \include example-Accumulator.cpp **********************************************************************/ template class GEOGRAPHIC_EXPORT Accumulator { private: // _s + _t accumulates for the sum. T _s, _t; // Error free transformation of a sum. Note that t can be the same as one // of the first two arguments. static inline T sum(T u, T v, T& t) { volatile T s = u + v; volatile T up = s - v; volatile T vpp = s - up; up -= u; vpp -= v; t = -(up + vpp); // u + v = s + t // = round(u + v) + t return s; } // Same as sum, but requires abs(u) >= abs(v). This isn't currently used. static inline T fastsum(T u, T v, T& t) { volatile T s = u + v; volatile T vp = s - u; t = v - vp; return s; } void Add(T y) throw() { // Here's Shewchuk's solution... T u; // hold exact sum as [s, t, u] y = sum(y, _t, u); // Accumulate starting at least significant end _s = sum(y, _s, _t); // Start is _s, _t decreasing and non-adjacent. Sum is now (s + t + u) // exactly with s, t, u non-adjacent and in decreasing order (except for // possible zeros). The following code tries to normalize the result. // Ideally, we want _s = round(s+t+u) and _u = round(s+t+u - _s). The // following does an approximate job (and maintains the decreasing // non-adjacent property). Here are two "failures" using 3-bit floats: // // Case 1: _s is not equal to round(s+t+u) -- off by 1 ulp // [12, -1] - 8 -> [4, 0, -1] -> [4, -1] = 3 should be [3, 0] = 3 // // Case 2: _s+_t is not as close to s+t+u as it shold be // [64, 5] + 4 -> [64, 8, 1] -> [64, 8] = 72 (off by 1) // should be [80, -7] = 73 (exact) // // "Fixing" these problems is probably not worth the expense. The // representation inevitably leads to small errors in the accumulated // values. The additional errors illustrated here amount to 1 ulp of the // less significant word during each addition to the Accumulator and an // additional possible error of 1 ulp in the reported sum. // // Incidentally, the "ideal" representation described above is not // canonical, because _s = round(_s + _t) may not be true. For example, // with 3-bit floats: // // [128, 16] + 1 -> [160, -16] -- 160 = round(145). // But [160, 0] - 16 -> [128, 16] -- 128 = round(144). // if (_s == 0) // This implies t == 0, _s = u; // so result is u else _t += u; // otherwise just accumulate u to t. } T Sum(T y) const throw() { Accumulator a(*this); a.Add(y); return a._s; } public: /** * Construct from a \e T. This is not declared explicit, so that you can * write Accumulator a = 5;. * * @param[in] y set \e sum = \e y. **********************************************************************/ Accumulator(T y = T(0)) throw() : _s(y), _t(0) { STATIC_ASSERT(!std::numeric_limits::is_integer, "Accumulator type is not floating point"); } /** * Set the accumulator to a number. * * @param[in] y set \e sum = \e y. **********************************************************************/ Accumulator& operator=(T y) throw() { _s = y; _t = 0; return *this; } /** * Return the value held in the accumulator. * * @return \e sum. **********************************************************************/ T operator()() const throw() { return _s; } /** * Return the result of adding a number to \e sum (but don't change \e sum). * * @param[in] y the number to be added to the sum. * @return \e sum + \e y. **********************************************************************/ T operator()(T y) const throw() { return Sum(y); } /** * Add a number to the accumulator. * * @param[in] y set \e sum += \e y. **********************************************************************/ Accumulator& operator+=(T y) throw() { Add(y); return *this; } /** * Subtract a number from the accumulator. * * @param[in] y set \e sum -= \e y. **********************************************************************/ Accumulator& operator-=(T y) throw() { Add(-y); return *this; } /** * Multiply accumulator by an integer. To avoid loss of accuracy, use only * integers such that \e n * \e T is exactly representable as a \e T (i.e., * +/- powers of two). Use \e n = -1 to negate \e sum. * * @param[in] n set \e sum *= \e n. **********************************************************************/ Accumulator& operator*=(int n) throw() { _s *= n; _t *= n; return *this; } /** * Test equality of an Accumulator with a number. **********************************************************************/ bool operator==(T y) const throw() { return _s == y; } /** * Test inequality of an Accumulator with a number. **********************************************************************/ bool operator!=(T y) const throw() { return _s != y; } /** * Less operator on an Accumulator and a number. **********************************************************************/ bool operator<(T y) const throw() { return _s < y; } /** * Less or equal operator on an Accumulator and a number. **********************************************************************/ bool operator<=(T y) const throw() { return _s <= y; } /** * Greater operator on an Accumulator and a number. **********************************************************************/ bool operator>(T y) const throw() { return _s > y; } /** * Greater or equal operator on an Accumulator and a number. **********************************************************************/ bool operator>=(T y) const throw() { return _s >= y; } }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_ACCUMULATOR_HPP geographiclib-1.21/include/GeographicLib/AlbersEqualArea.hpp0000644000175000017500000003343111745620414023710 0ustar frankiefrankie/** * \file AlbersEqualArea.hpp * \brief Header for GeographicLib::AlbersEqualArea class * * Copyright (c) Charles Karney (2010, 2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_ALBERSEQUALAREA_HPP) #define GEOGRAPHICLIB_ALBERSEQUALAREA_HPP \ "$Id: d17f37d1bec84543dc3753e882d8e95f1c1d5a1b $" #include #include namespace GeographicLib { /** * \brief Albers Equal Area Conic Projection * * Implementation taken from the report, * - J. P. Snyder, * Map Projections: A * Working Manual, USGS Professional Paper 1395 (1987), * pp. 101–102. * * This is a implementation of the equations in Snyder except that divided * differences will be [have been] used to transform the expressions into * ones which may be evaluated accurately. [In this implementation, the * projection correctly becomes the cylindrical equal area or the azimuthal * equal area projection when the standard latitude is the equator or a * pole.] * * The ellipsoid parameters, the standard parallels, and the scale on the * standard parallels are set in the constructor. Internally, the case with * two standard parallels is converted into a single standard parallel, the * latitude of minimum azimuthal scale, with an azimuthal scale specified on * this parallel. This latitude is also used as the latitude of origin which * is returned by AlbersEqualArea::OriginLatitude. The azimuthal scale on * the latitude of origin is given by AlbersEqualArea::CentralScale. The * case with two standard parallels at opposite poles is singular and is * disallowed. The central meridian (which is a trivial shift of the * longitude) is specified as the \e lon0 argument of the * AlbersEqualArea::Forward and AlbersEqualArea::Reverse functions. * AlbersEqualArea::Forward and AlbersEqualArea::Reverse also return the * meridian convergence, \e gamma, and azimuthal scale, \e k. A small square * aligned with the cardinal directions is projected to a rectangle with * dimensions \e k (in the E-W direction) and 1/\e k (in the N-S direction). * The E-W sides of the rectangle are oriented \e gamma degrees * counter-clockwise from the \e x axis. There is no provision in this class * for specifying a false easting or false northing or a different latitude * of origin. * * Example of use: * \include example-AlbersEqualArea.cpp * * ConicProj is a command-line utility * providing access to the functionality of LambertConformalConic and * AlbersEqualArea. **********************************************************************/ class GEOGRAPHIC_EXPORT AlbersEqualArea { private: typedef Math::real real; real _a, _f, _fm, _e2, _e, _e2m, _qZ, _qx; real _sign, _lat0, _k0; real _n0, _m02, _nrho0, _k2, _txi0, _scxi0, _sxi0; static const real eps_; static const real epsx_; static const real epsx2_; static const real tol_; static const real tol0_; static const real ahypover_; static const int numit_ = 5; // Newton iterations in Reverse static const int numit0_ = 20; // Newton iterations in Init static inline real hyp(real x) throw() { return Math::hypot(real(1), x); } // atanh( e * x)/ e if f > 0 // atan (sqrt(-e2) * x)/sqrt(-e2) if f < 0 // x if f = 0 inline real atanhee(real x) const throw() { return _f > 0 ? Math::atanh(_e * x)/_e : (_f < 0 ? std::atan(_e * x)/_e : x); } // return atanh(sqrt(x))/sqrt(x) - 1, accurate for small x static real atanhxm1(real x) throw(); // Divided differences // Definition: Df(x,y) = (f(x)-f(y))/(x-y) // See: W. M. Kahan and R. J. Fateman, // Symbolic computation of divided differences, // SIGSAM Bull. 33(3), 7-28 (1999) // http://doi.acm.org/10.1145/334714.334716 // http://www.cs.berkeley.edu/~fateman/papers/divdiff.pdf // // General rules // h(x) = f(g(x)): Dh(x,y) = Df(g(x),g(y))*Dg(x,y) // h(x) = f(x)*g(x): // Dh(x,y) = Df(x,y)*(g(x)+g(y))/2 + Dg(x,y)*(f(x)+f(y))/2 // // sn(x) = x/sqrt(1+x^2): Dsn(x,y) = (x+y)/((sn(x)+sn(y))*(1+x^2)*(1+y^2)) static inline real Dsn(real x, real y, real sx, real sy) throw() { // sx = x/hyp(x) real t = x * y; return t > 0 ? (x + y) * Math::sq( (sx * sy)/t ) / (sx + sy) : (x - y != 0 ? (sx - sy) / (x - y) : 1); } // Datanhee(x,y) = atanhee((x-y)/(1-e^2*x*y))/(x-y) inline real Datanhee(real x, real y) const throw() { real t = x - y, d = 1 - _e2 * x * y; return t != 0 ? atanhee(t / d) / t : 1 / d; } // DDatanhee(x,y) = (Datanhee(1,y) - Datanhee(1,x))/(y-x) real DDatanhee(real x, real y) const throw(); void Init(real sphi1, real cphi1, real sphi2, real cphi2, real k1) throw(); real txif(real tphi) const throw(); real tphif(real txi) const throw(); public: /** * Constructor with a single standard parallel. * * @param[in] a equatorial radius of ellipsoid (meters). * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere. * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flattening * to 1/\e f. * @param[in] stdlat standard parallel (degrees), the circle of tangency. * @param[in] k0 azimuthal scale on the standard parallel. * * An exception is thrown if \e a or \e k0 is not positive or if \e stdlat * is not in the range [-90, 90]. **********************************************************************/ AlbersEqualArea(real a, real f, real stdlat, real k0); /** * Constructor with two standard parallels. * * @param[in] a equatorial radius of ellipsoid (meters). * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere. * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flattening * to 1/\e f. * @param[in] stdlat1 first standard parallel (degrees). * @param[in] stdlat2 second standard parallel (degrees). * @param[in] k1 azimuthal scale on the standard parallels. * * An exception is thrown if \e a or \e k0 is not positive or if \e stdlat1 * or \e stdlat2 is not in the range [-90, 90]. In addition, an exception * is thrown if \e stdlat1 and \e stdlat2 are opposite poles. **********************************************************************/ AlbersEqualArea(real a, real f, real stdlat1, real stdlat2, real k1); /** * Constructor with two standard parallels specified by sines and cosines. * * @param[in] a equatorial radius of ellipsoid (meters). * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere. * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flattening * to 1/\e f. * @param[in] sinlat1 sine of first standard parallel. * @param[in] coslat1 cosine of first standard parallel. * @param[in] sinlat2 sine of second standard parallel. * @param[in] coslat2 cosine of second standard parallel. * @param[in] k1 azimuthal scale on the standard parallels. * * This allows parallels close to the poles to be specified accurately. * This routine computes the latitude of origin and the azimuthal scale at * this latitude. If \e dlat = abs(\e lat2 - \e lat1) <= 160o, * then the error in the latitude of origin is less than * 4.5e-14o. **********************************************************************/ AlbersEqualArea(real a, real f, real sinlat1, real coslat1, real sinlat2, real coslat2, real k1); /** * Set the azimuthal scale for the projection. * * @param[in] lat (degrees). * @param[in] k azimuthal scale at latitude \e lat (default 1). * * This allows a "latitude of conformality" to be specified. An exception * is thrown if \e k is not positive or if \e lat is not in the range (-90, * 90). **********************************************************************/ void SetScale(real lat, real k = real(1)); /** * Forward projection, from geographic to Lambert conformal conic. * * @param[in] lon0 central meridian longitude (degrees). * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[out] x easting of point (meters). * @param[out] y northing of point (meters). * @param[out] gamma meridian convergence at point (degrees). * @param[out] k azimuthal scale of projection at point; the radial * scale is the 1/\e k. * * The latitude origin is given by AlbersEqualArea::LatitudeOrigin(). No * false easting or northing is added and \e lat should be in the range * [-90, 90]; \e lon and \e lon0 should be in the range [-180, 360]. The * values of \e x and \e y returned for points which project to infinity * (i.e., one or both of the poles) will be large but finite. **********************************************************************/ void Forward(real lon0, real lat, real lon, real& x, real& y, real& gamma, real& k) const throw(); /** * Reverse projection, from Lambert conformal conic to geographic. * * @param[in] lon0 central meridian longitude (degrees). * @param[in] x easting of point (meters). * @param[in] y northing of point (meters). * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] gamma meridian convergence at point (degrees). * @param[out] k azimuthal scale of projection at point; the radial * scale is the 1/\e k. * * The latitude origin is given by AlbersEqualArea::LatitudeOrigin(). No * false easting or northing is added. \e lon0 should be in the range * [-180, 360]. The value of \e lon returned is in the range [-180, 180). * The value of \e lat returned is in the range [-90,90]. If the input * point is outside the legal projected space the nearest pole is returned. **********************************************************************/ void Reverse(real lon0, real x, real y, real& lat, real& lon, real& gamma, real& k) const throw(); /** * AlbersEqualArea::Forward without returning the convergence and * scale. **********************************************************************/ void Forward(real lon0, real lat, real lon, real& x, real& y) const throw() { real gamma, k; Forward(lon0, lat, lon, x, y, gamma, k); } /** * AlbersEqualArea::Reverse without returning the convergence and * scale. **********************************************************************/ void Reverse(real lon0, real x, real y, real& lat, real& lon) const throw() { real gamma, k; Reverse(lon0, x, y, lat, lon, gamma, k); } /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ Math::real MajorRadius() const throw() { return _a; } /** * @return \e f the flattening of the ellipsoid. This is the value used in * the constructor. **********************************************************************/ Math::real Flattening() const throw() { return _f; } /// \cond SKIP /** * DEPRECATED * @return \e r the inverse flattening of the ellipsoid. **********************************************************************/ Math::real InverseFlattening() const throw() { return 1/_f; } /// \endcond /** * @return latitude of the origin for the projection (degrees). * * This is the latitude of minimum azimuthal scale and equals the \e stdlat * in the 1-parallel constructor and lies between \e stdlat1 and \e stdlat2 * in the 2-parallel constructors. **********************************************************************/ Math::real OriginLatitude() const throw() { return _lat0; } /** * @return central scale for the projection. This is the azimuthal scale * on the latitude of origin. **********************************************************************/ Math::real CentralScale() const throw() { return _k0; } ///@} /** * A global instantiation of AlbersEqualArea with the WGS84 ellipsoid, \e * stdlat = 0, and \e k0 = 1. This degenerates to the cylindrical equal * area projection. **********************************************************************/ static const AlbersEqualArea CylindricalEqualArea; /** * A global instantiation of AlbersEqualArea with the WGS84 ellipsoid, \e * stdlat = 90o, and \e k0 = 1. This degenerates to the * Lambert azimuthal equal area projection. **********************************************************************/ static const AlbersEqualArea AzimuthalEqualAreaNorth; /** * A global instantiation of AlbersEqualArea with the WGS84 ellipsoid, \e * stdlat = -90o, and \e k0 = 1. This degenerates to the * Lambert azimuthal equal area projection. **********************************************************************/ static const AlbersEqualArea AzimuthalEqualAreaSouth; }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_ALBERSEQUALAREA_HPP geographiclib-1.21/include/GeographicLib/Config.h.in0000644000175000017500000000050711745620414022167 0ustar frankiefrankie// $Id: 4e2f7e42dcc37f3c8b3d98f6aa9b50dc4a328289 $ #define GEOGRAPHICLIB_VERSION_STRING "@GeographicLib_VERSION@" #define GEOGRAPHICLIB_DATA "@GEOGRAPHICLIB_DATA@" // These are macros which affect the building of the library #cmakedefine GEOGRAPHIC_SHARED_LIB 1 #cmakedefine HAVE_LONG_DOUBLE 1 #cmakedefine WORDS_BIGENDIAN 1 geographiclib-1.21/include/GeographicLib/TransverseMercatorExact.hpp0000644000175000017500000003013511745620414025533 0ustar frankiefrankie/** * \file TransverseMercatorExact.hpp * \brief Header for GeographicLib::TransverseMercatorExact class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP) #define GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP \ "$Id: bd96340b9dc3e7bfd09d4374296a75f4c6e00fc3 $" #include #include namespace GeographicLib { /** * \brief An exact implementation of the Transverse Mercator Projection * * Implementation of the Transverse Mercator Projection given in * - L. P. Lee, * Conformal * Projections Based On Jacobian Elliptic Functions, Part V of * Conformal Projections Based on Elliptic Functions, * (B. V. Gutsell, Toronto, 1976), 128pp., * ISBN: 0919870163 * (also appeared as: * Monograph 16, Suppl. No. 1 to Canadian Cartographer, Vol 13). * - C. F. F. Karney, * * Transverse Mercator with an accuracy of a few nanometers, * J. Geodesy 85(8), 475-485 (Aug. 2011); * preprint * arXiv:1002.1417. * * Lee gives the correct results for forward and reverse transformations * subject to the branch cut rules (see the description of the \e extendp * argument to the constructor). The maximum error is about 8 nm (8 * nanometers), ground distance, for the forward and reverse transformations. * The error in the convergence is 2e-15", the relative error in the * scale is 7e-12%%. See Sec. 3 of * arXiv:1002.1417 for details. * The method is "exact" in the sense that the errors are close to the * round-off limit and that no changes are needed in the algorithms for them * to be used with reals of a higher precision. Thus the errors using long * double (with a 64-bit fraction) are about 2000 times smaller than using * double (with a 53-bit fraction). * * This algorithm is about 4.5 times slower than the 6th-order Krüger * method, TransverseMercator, taking about 11 us for a combined forward and * reverse projection on a 2.66 GHz Intel machine (g++, version 4.3.0, -O3). * * The ellipsoid parameters and the central scale are set in the constructor. * The central meridian (which is a trivial shift of the longitude) is * specified as the \e lon0 argument of the TransverseMercatorExact::Forward * and TransverseMercatorExact::Reverse functions. The latitude of origin is * taken to be the equator. See the documentation on TransverseMercator for * how to include a false easting, false northing, or a latitude of origin. * * See tm-grid.kmz, for an * illustration of the transverse Mercator grid in Google Earth. * * See TransverseMercatorExact.cpp for more information on the * implementation. * * See \ref transversemercator for a discussion of this projection. * * Example of use: * \include example-TransverseMercatorExact.cpp * * TransverseMercatorProj is a * command-line utility providing access to the functionality of * TransverseMercator and TransverseMercatorExact. **********************************************************************/ class GEOGRAPHIC_EXPORT TransverseMercatorExact { private: typedef Math::real real; static const real tol_; static const real tol1_; static const real tol2_; static const real taytol_; static const real overflow_; static const int numit_ = 10; real _a, _f, _k0, _mu, _mv, _e, _ep2; bool _extendp; EllipticFunction _Eu, _Ev; // tan(x) for x in [-pi/2, pi/2] ensuring that the sign is right static inline real tanx(real x) throw() { real t = std::tan(x); // Write the tests this way to ensure that tanx(NaN()) is NaN() return x >= 0 ? (!(t < 0) ? t : overflow_) : (!(t >= 0) ? t : -overflow_); } real taup(real tau) const throw(); real taupinv(real taup) const throw(); void zeta(real u, real snu, real cnu, real dnu, real v, real snv, real cnv, real dnv, real& taup, real& lam) const throw(); void dwdzeta(real u, real snu, real cnu, real dnu, real v, real snv, real cnv, real dnv, real& du, real& dv) const throw(); bool zetainv0(real psi, real lam, real& u, real& v) const throw(); void zetainv(real taup, real lam, real& u, real& v) const throw(); void sigma(real u, real snu, real cnu, real dnu, real v, real snv, real cnv, real dnv, real& xi, real& eta) const throw(); void dwdsigma(real u, real snu, real cnu, real dnu, real v, real snv, real cnv, real dnv, real& du, real& dv) const throw(); bool sigmainv0(real xi, real eta, real& u, real& v) const throw(); void sigmainv(real xi, real eta, real& u, real& v) const throw(); void Scale(real tau, real lam, real snu, real cnu, real dnu, real snv, real cnv, real dnv, real& gamma, real& k) const throw(); public: /** * Constructor for a ellipsoid with * * @param[in] a equatorial radius (meters). * @param[in] f flattening of ellipsoid. If \e f > 1, set flattening * to 1/\e f. * @param[in] k0 central scale factor. * @param[in] extendp use extended domain. * * The transverse Mercator projection has a branch point singularity at \e * lat = 0 and \e lon - \e lon0 = 90 (1 - \e e) or (for * TransverseMercatorExact::UTM) x = 18381 km, y = 0m. The \e extendp * argument governs where the branch cut is placed. With \e extendp = * false, the "standard" convention is followed, namely the cut is placed * along x > 18381 km, y = 0m. Forward can be called with any \e lat and * \e lon then produces the transformation shown in Lee, Fig 46. Reverse * analytically continues this in the +/- \e x direction. As a * consequence, Reverse may map multiple points to the same geographic * location; for example, for TransverseMercatorExact::UTM, \e x = * 22051449.037349 m, \e y = -7131237.022729 m and \e x = 29735142.378357 * m, \e y = 4235043.607933 m both map to \e lat = -2 deg, \e lon = 88 deg. * * With \e extendp = true, the branch cut is moved to the lower left * quadrant. The various symmetries of the transverse Mercator projection * can be used to explore the projection on any sheet. In this mode the * domains of \e lat, \e lon, \e x, and \e y are restricted to * - the union of * - \e lat in [0, 90] and \e lon - \e lon0 in [0, 90] * - \e lat in (-90, 0] and \e lon - \e lon0 in [90 (1 - \e e), 90] * - the union of * - x/(\e k0 \e a) in [0, inf) and * y/(\e k0 \e a) in [0, E(e2)] * - x/(\e k0 \e a) in [K(1 - e2) - E(1 - * e2), inf) and y/(\e k0 \e a) in (-inf, 0] * . * See Sec. 5 of * arXiv:1002.1417 for a full * discussion of the treatment of the branch cut. * * The method will work for all ellipsoids used in terrestrial geodesy. * The method cannot be applied directly to the case of a sphere (\e f = 0) * because some the constants characterizing this method diverge in that * limit, and in practice, \e f should be larger than about numeric_limits< * real >::%epsilon(). However, TransverseMercator treats the sphere * exactly. An exception is thrown if either axis of the ellipsoid or \e * k0 is not positive or if \e f <= 0. **********************************************************************/ TransverseMercatorExact(real a, real f, real k0, bool extendp = false); /** * Forward projection, from geographic to transverse Mercator. * * @param[in] lon0 central meridian of the projection (degrees). * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[out] x easting of point (meters). * @param[out] y northing of point (meters). * @param[out] gamma meridian convergence at point (degrees). * @param[out] k scale of projection at point. * * No false easting or northing is added. \e lat should be in the range * [-90, 90]; \e lon and \e lon0 should be in the range [-180, 360]. **********************************************************************/ void Forward(real lon0, real lat, real lon, real& x, real& y, real& gamma, real& k) const throw(); /** * Reverse projection, from transverse Mercator to geographic. * * @param[in] lon0 central meridian of the projection (degrees). * @param[in] x easting of point (meters). * @param[in] y northing of point (meters). * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] gamma meridian convergence at point (degrees). * @param[out] k scale of projection at point. * * No false easting or northing is added. \e lon0 should be in the range * [-180, 360]. The value of \e lon returned is in the range [-180, 180). **********************************************************************/ void Reverse(real lon0, real x, real y, real& lat, real& lon, real& gamma, real& k) const throw(); /** * TransverseMercatorExact::Forward without returning the convergence and * scale. **********************************************************************/ void Forward(real lon0, real lat, real lon, real& x, real& y) const throw() { real gamma, k; Forward(lon0, lat, lon, x, y, gamma, k); } /** * TransverseMercatorExact::Reverse without returning the convergence and * scale. **********************************************************************/ void Reverse(real lon0, real x, real y, real& lat, real& lon) const throw() { real gamma, k; Reverse(lon0, x, y, lat, lon, gamma, k); } /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ Math::real MajorRadius() const throw() { return _a; } /** * @return \e f the flattening of the ellipsoid. This is the value used in * the constructor. **********************************************************************/ Math::real Flattening() const throw() { return _f; } /// \cond SKIP /** * DEPRECATED * @return \e r the inverse flattening of the ellipsoid. **********************************************************************/ Math::real InverseFlattening() const throw() { return 1/_f; } /// \endcond /** * @return \e k0 central scale for the projection. This is the value of \e * k0 used in the constructor and is the scale on the central meridian. **********************************************************************/ Math::real CentralScale() const throw() { return _k0; } ///@} /** * A global instantiation of TransverseMercatorExact with the WGS84 * ellipsoid and the UTM scale factor. However, unlike UTM, no false * easting or northing is added. **********************************************************************/ static const TransverseMercatorExact UTM; }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP geographiclib-1.21/include/GeographicLib/CMakeLists.txt0000644000175000017500000000047711745620414022752 0ustar frankiefrankie# $Id: ad1a97beeda9134b93debee2ba855548e252c3a7 $ # Install the header files including the generated Config.h (which is in # the build tree). file (GLOB HEADERS *.hpp) install (FILES ${HEADERS} DESTINATION include/GeographicLib) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/Config.h DESTINATION include/GeographicLib) geographiclib-1.21/include/GeographicLib/Geoid.hpp0000644000175000017500000005101711745620414021746 0ustar frankiefrankie/** * \file Geoid.hpp * \brief Header for GeographicLib::Geoid class * * Copyright (c) Charles Karney (2009-2012) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GEOID_HPP) #define GEOGRAPHICLIB_GEOID_HPP \ "$Id: 4e4eb5941d16ad00416798703d246a6f7ef5fe46 $" #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about dll vs vector #pragma warning (push) #pragma warning (disable: 4251) #endif #if !defined(PGM_PIXEL_WIDTH) /** * The size of the pixel data in the pgm data files for the geoids. 2 * is the standard size corresponding to a maxval 2^16-1. Setting it * to 4 uses a maxval of 2^32-1 and changes the extension for the data * files from .pgm to .pgm4. Note that the format of these pgm4 files * is a non-standard extension of the pgm format. **********************************************************************/ #define PGM_PIXEL_WIDTH 2 #endif namespace GeographicLib { /** * \brief Looking up the height of the geoid * * This class evaluated the height of one of the standard geoids, EGM84, * EGM96, or EGM2008 by bilinear or cubic interpolation into a rectangular * grid of data. These geoid models are documented in * - EGM84: * http://earth-info.nga.mil/GandG/wgs84/gravitymod/wgs84_180/wgs84_180.html * - EGM96: * http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html * - EGM2008: * http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008 * * The geoids are defined in terms of spherical harmonics. However in order * to provide a quick and flexible method of evaluating the geoid heights, * this class evaluates the height by interpolation into a grid of * precomputed values. * * See \ref geoid for details of how to install the data sets, the data * format, estimates of the interpolation errors, and how to use caching. * * In addition to returning the geoid height, the gradient of the geoid can * be calculated. The gradient is defined as the rate of change of the geoid * as a function of position on the ellipsoid. This uses the parameters for * the WGS84 ellipsoid. The gradient defined in terms of the interpolated * heights. As a result of the way that the geoid data is stored, the * calculation of gradients can result in large quantization errors. This is * particularly acute for fine grids, at high latitudes, and for the easterly * gradient. * * This class is typically \e not thread safe in that a single instantiation * cannot be safely used by multiple threads because of the way the object * reads the data set and because it maintains a single-cell cache. If * multiple threads need to calculate geoid heights they should all construct * thread-local instantiations. Alternatively, set the optional \e * threadsafe parameter to true in the constructor. This causes the * constructor to read all the data into memory and to turn off the * single-cell caching which results in a Geoid object which \e is thread * safe. * * Example of use: * \include example-Geoid.cpp * * GeoidEval is a command-line utility * providing access to the functionality of Geoid. **********************************************************************/ class GEOGRAPHIC_EXPORT Geoid { private: typedef Math::real real; #if PGM_PIXEL_WIDTH != 4 typedef unsigned short pixel_t; static const unsigned pixel_size_ = 2; static const unsigned pixel_max_ = 0xffffu; #else typedef unsigned pixel_t; static const unsigned pixel_size_ = 4; static const unsigned pixel_max_ = 0xffffffffu; #endif static const unsigned stencilsize_ = 12; static const unsigned nterms_ = ((3 + 1) * (3 + 2))/2; // for a cubic fit static const real c0_; static const real c0n_; static const real c0s_; static const real c3_[stencilsize_ * nterms_]; static const real c3n_[stencilsize_ * nterms_]; static const real c3s_[stencilsize_ * nterms_]; std::string _name, _dir, _filename; const bool _cubic; const real _a, _e2, _degree, _eps; mutable std::ifstream _file; real _rlonres, _rlatres; std::string _description, _datetime; real _offset, _scale, _maxerror, _rmserror; int _width, _height; unsigned long long _datastart, _swidth; bool _threadsafe; // Area cache mutable std::vector< std::vector > _data; mutable bool _cache; // NE corner and extent of cache mutable int _xoffset, _yoffset, _xsize, _ysize; // Cell cache mutable int _ix, _iy; mutable real _v00, _v01, _v10, _v11; mutable real _t[nterms_]; void filepos(int ix, int iy) const { _file.seekg( #if !(defined(__GNUC__) && __GNUC__ < 4) // g++ 3.x doesn't know about the cast to streamoff. std::ios::streamoff #endif (_datastart + pixel_size_ * (unsigned(iy)*_swidth + unsigned(ix)))); } real rawval(int ix, int iy) const { if (ix < 0) ix += _width; else if (ix >= _width) ix -= _width; if (_cache && iy >= _yoffset && iy < _yoffset + _ysize && ((ix >= _xoffset && ix < _xoffset + _xsize) || (ix + _width >= _xoffset && ix + _width < _xoffset + _xsize))) { return real(_data[iy - _yoffset] [ix >= _xoffset ? ix - _xoffset : ix + _width - _xoffset]); } else { if (iy < 0 || iy >= _height) { iy = iy < 0 ? -iy : 2 * (_height - 1) - iy; ix += (ix < _width/2 ? 1 : -1) * _width/2; } try { filepos(ix, iy); char a, b; _file.get(a); _file.get(b); unsigned r = ((unsigned char)(a) << 8) | (unsigned char)(b); if (pixel_size_ == 4) { _file.get(a); _file.get(b); r = (r << 16) | ((unsigned char)(a) << 8) | (unsigned char)(b); } return real(r); } catch (const std::exception& e) { // throw GeographicErr("Error reading " + _filename + ": " // + e.what()); // triggers complaints about the "binary '+'" under Visual Studio. // So use '+=' instead. std::string err("Error reading "); err += _filename; err += ": "; err += e.what(); throw GeographicErr(err); } } } real height(real lat, real lon, bool gradp, real& grade, real& gradn) const; Geoid(const Geoid&); // copy constructor not allowed Geoid& operator=(const Geoid&); // copy assignment not allowed public: /** * Flags indicating conversions between heights above the geoid and heights * above the ellipsoid. **********************************************************************/ enum convertflag { /** * The multiplier for converting from heights above the geoid to heights * above the ellipsoid. **********************************************************************/ ELLIPSOIDTOGEOID = -1, /** * No conversion. **********************************************************************/ NONE = 0, /** * The multiplier for converting from heights above the ellipsoid to * heights above the geoid. **********************************************************************/ GEOIDTOELLIPSOID = 1, }; /** \name Setting up the geoid **********************************************************************/ ///@{ /** * Construct a geoid. * * @param[in] name the name of the geoid. * @param[in] path (optional) directory for data file. * @param[in] cubic (optional) interpolation method; false means bilinear, * true (the default) means cubic. * @param[in] threadsafe (optional), if true, construct a thread safe * object. The default is false * * The data file is formed by appending ".pgm" to the name. If \e path is * specified (and is non-empty), then the file is loaded from directory, \e * path. Otherwise the path is given by DefaultGeoidPath(). This may * throw an exception because the file does not exist, is unreadable, or is * corrupt. If the \e threadsafe parameter is true, the data set is read * into memory (which this may also cause an exception to be thrown), the * data file is closed, and single-cell caching is turned off; this results * in a Geoid object which \e is thread safe. **********************************************************************/ explicit Geoid(const std::string& name, const std::string& path = "", bool cubic = true, bool threadsafe = false); /** * Set up a cache. * * @param[in] south latitude (degrees) of the south edge of the cached area. * @param[in] west longitude (degrees) of the west edge of the cached area. * @param[in] north latitude (degrees) of the north edge of the cached area. * @param[in] east longitude (degrees) of the east edge of the cached area. * * Cache the data for the specified "rectangular" area bounded by the * parallels \e south and \e north and the meridians \e west and \e east. * \e east is always interpreted as being east of \e west, if necessary by * adding 360o to its value. This may throw an error because of * insufficient memory or because of an error reading the data from the * file. In this case, you can catch the error and either do nothing (you * will have no cache in this case) or try again with a smaller area. \e * south and \e north should be in the range [-90, 90]; \e west and \e east * should be in the range [-180, 360]. An exception is thrown if this * routine is called on a thread safe Geoid. **********************************************************************/ void CacheArea(real south, real west, real north, real east) const; /** * Cache all the data. On most computers, this is fast for data sets with * grid resolution of 5' or coarser. For a 1' grid, the required RAM is * 450MB; a 2.5' grid needs 72MB; and a 5' grid needs 18MB. This may throw * an error because of insufficient memory or because of an error reading * the data from the file. In this case, you can catch the error and * either do nothing (you will have no cache in this case) or try using * Geoid::CacheArea on a specific area. An exception is thrown if this * routine is called on a thread safe Geoid. **********************************************************************/ void CacheAll() const { CacheArea(real(-90), real(0), real(90), real(360)); } /** * Clear the cache. This never throws an error. (This does nothing with a * thread safe Geoid.) **********************************************************************/ void CacheClear() const throw(); ///@} /** \name Compute geoid heights **********************************************************************/ ///@{ /** * Compute the geoid height at a point * * @param[in] lat latitude of the point (degrees). * @param[in] lon longitude of the point (degrees). * @return geoid height (meters). * * The latitude should be in [-90, 90] and longitude should be in * [-180,360]. This may throw an error because of an error reading data * from disk. However, it will not throw if (\e lat, \e lon) is within a * successfully cached area. **********************************************************************/ Math::real operator()(real lat, real lon) const { real gradn, grade; return height(lat, lon, false, gradn, grade); } /** * Compute the geoid height and gradient at a point * * @param[in] lat latitude of the point (degrees). * @param[in] lon longitude of the point (degrees). * @param[out] gradn northerly gradient (dimensionless). * @param[out] grade easterly gradient (dimensionless). * @return geoid height (meters). * * The latitude should be in [-90, 90] and longitude should be in [-180, * 360]. This may throw an error because of an error reading data from * disk. However, it will not throw if (\e lat, \e lon) is within a * successfully cached area. As a result of the way that the geoid data is * stored, the calculation of gradients can result in large quantization * errors. This is particularly acute for fine grids, at high latitudes, * and for the easterly gradient. If you need to compute the direction of * the acceleration due to gravity accurately, you should use * GravityModel::Gravity. **********************************************************************/ Math::real operator()(real lat, real lon, real& gradn, real& grade) const { return height(lat, lon, true, gradn, grade); } /** * Convert a height above the geoid to a height above the ellipsoid and * vice versa. * * @param[in] lat latitude of the point (degrees). * @param[in] lon longitude of the point (degrees). * @param[in] h height of the point (degrees). * @param[in] d a Geoid::convertflag specifying the direction of the * conversion; Geoid::GEOIDTOELLIPSOID means convert a height above the * geoid to a height above the ellipsoid; Geoid::ELLIPSOIDTOGEOID means * convert a height above the ellipsoid to a height above the geoid. * @return converted height (meters). **********************************************************************/ Math::real ConvertHeight(real lat, real lon, real h, convertflag d) const { real gradn, grade; return h + real(d) * height(lat, lon, true, gradn, grade); } ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return geoid description, if available, in the data file; if * absent, return "NONE". **********************************************************************/ const std::string& Description() const throw() { return _description; } /** * @return date of the data file; if absent, return "UNKNOWN". **********************************************************************/ const std::string& DateTime() const throw() { return _datetime; } /** * @return full file name used to load the geoid data. **********************************************************************/ const std::string& GeoidFile() const throw() { return _filename; } /** * @return "name" used to load the geoid data (from the first argument of * the constructor). **********************************************************************/ const std::string& GeoidName() const throw() { return _name; } /** * @return directory used to load the geoid data. **********************************************************************/ const std::string& GeoidDirectory() const throw() { return _dir; } /** * @return interpolation method ("cubic" or "bilinear"). **********************************************************************/ const std::string Interpolation() const { return std::string(_cubic ? "cubic" : "bilinear"); } /** * @return estimate of the maximum interpolation and quantization error * (meters). * * This relies on the value being stored in the data file. If the value is * absent, return -1. **********************************************************************/ Math::real MaxError() const throw() { return _maxerror; } /** * @return estimate of the RMS interpolation and quantization error * (meters). * * This relies on the value being stored in the data file. If the value is * absent, return -1. **********************************************************************/ Math::real RMSError() const throw() { return _rmserror; } /** * @return offset (meters). * * This in used in converting from the pixel values in the data file to * geoid heights. **********************************************************************/ Math::real Offset() const throw() { return _offset; } /** * @return scale (meters). * * This in used in converting from the pixel values in the data file to * geoid heights. **********************************************************************/ Math::real Scale() const throw() { return _scale; } /** * @return true if the object is constructed to be thread safe. **********************************************************************/ bool ThreadSafe() const throw() { return _threadsafe; } /** * @return true if a data cache is active. **********************************************************************/ bool Cache() const throw() { return _cache; } /** * @return west edge of the cached area; the cache includes this edge. **********************************************************************/ Math::real CacheWest() const throw() { return _cache ? ((_xoffset + (_xsize == _width ? 0 : _cubic) + _width/2) % _width - _width/2) / _rlonres : 0; } /** * @return east edge of the cached area; the cache excludes this edge. **********************************************************************/ Math::real CacheEast() const throw() { return _cache ? CacheWest() + (_xsize - (_xsize == _width ? 0 : 1 + 2 * _cubic)) / _rlonres : 0; } /** * @return north edge of the cached area; the cache includes this edge. **********************************************************************/ Math::real CacheNorth() const throw() { return _cache ? 90 - (_yoffset + _cubic) / _rlatres : 0; } /** * @return south edge of the cached area; the cache excludes this edge * unless it's the south pole. **********************************************************************/ Math::real CacheSouth() const throw() { return _cache ? 90 - ( _yoffset + _ysize - 1 - _cubic) / _rlatres : 0; } /** * @return \e a the equatorial radius of the WGS84 ellipsoid (meters). * * (The WGS84 value is returned because the supported geoid models are all * based on this ellipsoid.) **********************************************************************/ Math::real MajorRadius() const throw() { return Constants::WGS84_a(); } /** * @return \e f the flattening of the WGS84 ellipsoid. * * (The WGS84 value is returned because the supported geoid models are all * based on this ellipsoid.) **********************************************************************/ Math::real Flattening() const throw() { return Constants::WGS84_f(); } ///@} /// \cond SKIP /** * DEPRECATED * @return \e r the inverse flattening of the WGS84 ellipsoid. **********************************************************************/ Math::real InverseFlattening() const throw() { return 1/Constants::WGS84_f(); } /// \endcond /** * @return the default path for geoid data files. * * This is the value of the environment variable GEOID_PATH, if set; * otherwise, it is $GEOGRAPHICLIB_DATA/geoids if the environment variable * GEOGRAPHICLIB_DATA is set; otherwise, it is a compile-time default * (/usr/local/share/GeographicLib/geoids on non-Windows systems and * C:/Documents and Settings/All Users/Application * Data/GeographicLib/geoids on Windows systems). **********************************************************************/ static std::string DefaultGeoidPath(); /** * @return the default name for the geoid. * * This is the value of the environment variable GEOID_NAME, if set, * otherwise, it is "egm96-5". The Geoid class does not use this function; * it is just provided as a convenience for a calling program when * constructing a Geoid object. **********************************************************************/ static std::string DefaultGeoidName(); }; } // namespace GeographicLib #if defined(_MSC_VER) #pragma warning (pop) #endif #endif // GEOGRAPHICLIB_GEOID_HPP geographiclib-1.21/include/GeographicLib/PolygonArea.hpp0000644000175000017500000001744111745620414023142 0ustar frankiefrankie/** * \file PolygonArea.hpp * \brief Header for GeographicLib::PolygonArea class * * Copyright (c) Charles Karney (2010, 2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_POLYGONAREA_HPP) #define GEOGRAPHICLIB_POLYGONAREA_HPP \ "$Id: 7a339f312a9c977b9fccad3c0c8bfa9009d863e2 $" #include #include #include namespace GeographicLib { /** * \brief Polygon Areas. * * This computes the area of a geodesic polygon using the method given * Section 15 of * - C. F. F. Karney, * Geodesics * on an ellipsoid of revolution, * Feb. 2011; * preprint * arxiv:1102.1215v1. * . * See also Section 6 of * - C. F. F. Karney, * Algorithms for geodesics, * Sept. 2011; * preprint * arxiv:1109.4448. * * This class lets you add vertices one at a time to the polygon. The area * and perimeter are accumulated in two times the standard floating point * precision to guard against the loss of accuracy with many-sided polygons. * At any point you can ask for the perimeter and area so far. There's an * option to treat the points as defining a polyline instead of a polygon; in * that case, only the perimeter is computed. * * Example of use: * \include example-PolygonArea.cpp * * Planimeter is a command-line utility * providing access to the functionality of PolygonArea. **********************************************************************/ class GEOGRAPHIC_EXPORT PolygonArea { private: typedef Math::real real; Geodesic _earth; real _area0; // Full ellipsoid area bool _polyline; // Assume polyline (don't close and skip area) unsigned _mask; unsigned _num; int _crossings; Accumulator _areasum, _perimetersum; real _lat0, _lon0, _lat1, _lon1; // Copied from Geodesic class static inline real AngNormalize(real x) throw() { // Place angle in [-180, 180). Assumes x is in [-540, 540). // // g++ 4.4.4 holds a temporary in an extended register causing an error // with the triangle 89,0.1;89,90.1;89,-179.9. The volatile declaration // fixes this. (The bug probably triggered because transit and // AngNormalize are inline functions. So don't port this change over to // Geodesic.hpp.) volatile real y = x; return y >= 180 ? y - 360 : (y < -180 ? y + 360 : y); } static inline int transit(real lon1, real lon2) { // Return 1 or -1 if crossing prime meridian in east or west direction. // Otherwise return zero. lon1 = AngNormalize(lon1); lon2 = AngNormalize(lon2); // treat lon12 = -180 as an eastward geodesic, so convert to 180. real lon12 = -AngNormalize(lon1 - lon2); // In (-180, 180] int cross = lon1 < 0 && lon2 >= 0 && lon12 > 0 ? 1 : (lon2 < 0 && lon1 >= 0 && lon12 < 0 ? -1 : 0); return cross; } public: /** * Constructor for PolygonArea. * * @param[in] earth the Geodesic object to use for geodesic calculations. * By default this uses the WGS84 ellipsoid. * @param[in] polyline if true that treat the points as defining a polyline * instead of a polygon (default = false). **********************************************************************/ PolygonArea(const Geodesic& earth, bool polyline = false) throw() : _earth(earth) , _area0(_earth.EllipsoidArea()) , _polyline(polyline) , _mask(Geodesic::DISTANCE | (_polyline ? 0 : Geodesic::AREA)) { Clear(); } /** * Clear PolygonArea, allowing a new polygon to be started. **********************************************************************/ void Clear() throw() { _num = 0; _crossings = 0; _areasum = 0; _perimetersum = 0; _lat0 = _lon0 = _lat1 = _lon1 = 0; } /** * Add a point to the polygon or polyline. * * @param[in] lat the latitude of the point (degrees). * @param[in] lon the latitude of the point (degrees). * * \e lat should be in the range [-90, 90] and \e lon should be in the * range [-180, 360]. **********************************************************************/ void AddPoint(real lat, real lon) throw(); /** * Return the results so far. * * @param[in] reverse if true then clockwise (instead of counter-clockwise) * traversal counts as a positive area. * @param[in] sign if true then return a signed result for the area if * the polygon is traversed in the "wrong" direction instead of returning * the area for the rest of the earth. * @param[out] perimeter the perimeter of the polygon or length of the * polyline (meters). * @param[out] area the area of the polygon (meters^2); only set if * polyline is false in the constructor. * @return the number of points. **********************************************************************/ unsigned Compute(bool reverse, bool sign, real& perimeter, real& area) const throw(); /** * Return the results assuming a tentative final test point is added; * however, the data for the test point is not saved. This lets you report * a running result for the perimeter and area as the user moves the mouse * cursor. Ordinary floating point arithmetic is used to accumulate the * data for the test point; thus the area and perimeter returned are less * accurate than if AddPoint and Compute are used. * * @param[in] lat the latitude of the test point (degrees). * @param[in] lon the longitude of the test point (degrees). * @param[in] reverse if true then clockwise (instead of counter-clockwise) * traversal counts as a positive area. * @param[in] sign if true then return a signed result for the area if * the polygon is traversed in the "wrong" direction instead of returning * the area for the rest of the earth. * @param[out] perimeter the approximate perimeter of the polygon or length * of the polyline (meters). * @param[out] area the approximate area of the polygon (meters^2); only * set if polyline is false in the constructor. * @return the number of points. * * \e lat should be in the range [-90, 90] and \e lon should be in the * range [-180, 360]. **********************************************************************/ unsigned TestCompute(real lat, real lon, bool reverse, bool sign, real& perimeter, real& area) const throw(); /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value inherited from the Geodesic object used in the constructor. **********************************************************************/ Math::real MajorRadius() const throw() { return _earth.MajorRadius(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the Geodesic object used in the constructor. **********************************************************************/ Math::real Flattening() const throw() { return _earth.Flattening(); } ///@} }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_POLYGONAREA_HPP geographiclib-1.21/include/GeographicLib/SphericalEngine.hpp0000644000175000017500000003564211745620414023765 0ustar frankiefrankie/** * \file SphericalEngine.hpp * \brief Header for GeographicLib::SphericalEngine class * * Copyright (c) Charles Karney (2011, 2012) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_SPHERICALENGINE_HPP) #define GEOGRAPHICLIB_SPHERICALENGINE_HPP \ "$Id: f48320a694ecf901d997b23d32ea625e589f9534 $" #include #include #include #if defined(_MSC_VER) // Squelch warnings about dll vs vector #pragma warning (push) #pragma warning (disable: 4251) #endif namespace GeographicLib { class CircularEngine; /** * \brief The evaluation engine for SphericalHarmonic * * This serves as the backend to SphericalHarmonic, SphericalHarmonic1, and * SphericalHarmonic2. Typically end-users will not have to access this * class directly. * * See SphericalEngine.cpp for more information on the implementation. * * Example of use: * \include example-SphericalEngine.cpp **********************************************************************/ class GEOGRAPHIC_EXPORT SphericalEngine { private: typedef Math::real real; // A table of the square roots of integers static std::vector root_; friend class CircularEngine; // CircularEngine needs access to root_, scale_ // An internal scaling of the coefficients to avoid overflow in // intermediate calculations. static const real scale_; // Move latitudes near the pole off the axis by this amount. static const real eps_; static const std::vector Z_; SphericalEngine(); // Disable constructor public: /** * Supported normalizations for associated Legendre polynomials. **********************************************************************/ enum normalization { /** * Fully normalized associated Legendre polynomials. See * SphericalHarmonic::FULL for documentation. * * @hideinitializer **********************************************************************/ FULL = 0, /** * Schmidt semi-normalized associated Legendre polynomials. See * SphericalHarmonic::SCHMIDT for documentation. * * @hideinitializer **********************************************************************/ SCHMIDT = 1, /// \cond SKIP // These are deprecated... full = FULL, schmidt = SCHMIDT, /// \endcond }; /** * \brief Package up coefficients for SphericalEngine * * This packages up the \e C, \e S coefficients and information about how * the coefficients are stored into a single structure. This allows a * vector of type SphericalEngine::coeff to be passed to * SphericalEngine::Value. This class also includes functions to aid * indexing into \e C and \e S. * * The storage layout of the coefficients is documented in * SphericalHarmonic and SphericalHarmonic::SphericalHarmonic. **********************************************************************/ class GEOGRAPHIC_EXPORT coeff { private: int _N, _nmx, _mmx; std::vector::const_iterator _Cnm; std::vector::const_iterator _Snm; public: /** * A default constructor **********************************************************************/ coeff() : _N(-1) , _nmx(-1) , _mmx(-1) , _Cnm(Z_.begin()) , _Snm(Z_.begin()) {} /** * The general constructor. * * @param[in] C a vector of coefficients for the cosine terms. * @param[in] S a vector of coefficients for the sine terms. * @param[in] N the degree giving storage layout for \e C and \e S. * @param[in] nmx the maximum degree to be used. * @param[in] mmx the maximum order to be used. * * This requires \e N >= \e nmx >= \e mmx >= -1. \e C and \e S must also * be large enough to hold the coefficients. Otherwise an exception is * thrown. **********************************************************************/ coeff(const std::vector& C, const std::vector& S, int N, int nmx, int mmx) : _N(N) , _nmx(nmx) , _mmx(mmx) , _Cnm(C.begin()) , _Snm(S.begin()) { if (!(_N >= _nmx && _nmx >= _mmx && _mmx >= -1)) throw GeographicErr("Bad indices for coeff"); if (!(index(_nmx, _mmx) < int(C.size()) && index(_nmx, _mmx) < int(S.size()) + (_N + 1))) throw GeographicErr("Arrays too small in coeff"); SphericalEngine::RootTable(_nmx); } /** * The constructor for full coefficient vectors. * * @param[in] C a vector of coefficients for the cosine terms. * @param[in] S a vector of coefficients for the sine terms. * @param[in] N the maximum degree and order. * * This requires \e N >= -1. \e C and \e S must also be large enough to * hold the coefficients. Otherwise an exception is thrown. **********************************************************************/ coeff(const std::vector& C, const std::vector& S, int N) : _N(N) , _nmx(N) , _mmx(N) , _Cnm(C.begin()) , _Snm(S.begin()) { if (!(_N >= -1)) throw GeographicErr("Bad indices for coeff"); if (!(index(_nmx, _mmx) < int(C.size()) && index(_nmx, _mmx) < int(S.size()) + (_N + 1))) throw GeographicErr("Arrays too small in coeff"); SphericalEngine::RootTable(_nmx); } /** * @return \e N the degree giving storage layout for \e C and \e S. **********************************************************************/ inline int N() const throw() { return _N; } /** * @return \e nmx the maximum degree to be used. **********************************************************************/ inline int nmx() const throw() { return _nmx; } /** * @return \e mmx the maximum order to be used. **********************************************************************/ inline int mmx() const throw() { return _mmx; } /** * The one-dimensional index into \e C and \e S. * * @param[in] n the degree. * @param[in] m the order. * @return the one-dimensional index. **********************************************************************/ inline int index(int n, int m) const throw() { return m * _N - m * (m - 1) / 2 + n; } /** * An element of \e C. * * @param[in] k the one-dimensional index. * @return the value of the \e C coefficient. **********************************************************************/ inline Math::real Cv(int k) const { return *(_Cnm + k); } /** * An element of \e S. * * @param[in] k the one-dimensional index. * @return the value of the \e S coefficient. **********************************************************************/ inline Math::real Sv(int k) const { return *(_Snm + (k - (_N + 1))); } /** * An element of \e C with checking. * * @param[in] k the one-dimensional index. * @param[in] n the requested degree. * @param[in] m the requested order. * @param[in] f a multiplier. * @return the value of the \e C coefficient multiplied by \e f in \e n * and \e m are in range else 0. **********************************************************************/ inline Math::real Cv(int k, int n, int m, real f) const { return m > _mmx || n > _nmx ? 0 : *(_Cnm + k) * f; } /** * An element of \e S with checking. * * @param[in] k the one-dimensional index. * @param[in] n the requested degree. * @param[in] m the requested order. * @param[in] f a multiplier. * @return the value of the \e S coefficient multiplied by \e f in \e n * and \e m are in range else 0. **********************************************************************/ inline Math::real Sv(int k, int n, int m, real f) const { return m > _mmx || n > _nmx ? 0 : *(_Snm + (k - (_N + 1))) * f; } /** * The size of the coefficient vector for the cosine terms. * * @param[in] N the maximum degree. * @param[in] M the maximum order. * @return the size of the vector of cosine terms as stored in column * major order. **********************************************************************/ static inline int Csize(int N, int M) { return (M + 1) * (2 * N - M + 2) / 2; } /** * The size of the coefficient vector for the sine terms. * * @param[in] N the maximum degree. * @param[in] M the maximum order. * @return the size of the vector of cosine terms as stored in column * major order. **********************************************************************/ static inline int Ssize(int N, int M) { return Csize(N, M) - (N + 1); } /** * Load coefficients from a binary stream. * * @param[in] stream the input stream. * @param[out] N The maximum degree of the coefficients. * @param[out] M The maximum order of the coefficients. * @param[out] C The vector of cosine coefficients. * @param[out] S The vector of sine coefficients. * * \e N and \e M are read as 4-byte ints. \e C and \e S are resized to * accommodate all the coefficients (with the \e m = 0 coefficients for * \e S excluded) and the data for these coefficients read as 8-byte * doubles. The coefficients are stored in column major order. The * bytes in the stream should use little-endian ordering. IEEE floating * point is assumed for the coefficients. **********************************************************************/ static void readcoeffs(std::istream& stream, int& N, int& M, std::vector& C, std::vector& S); }; /** * Evaluate a spherical harmonic sum and its gradient. * * @tparam gradp should the gradient be calculated. * @tparam norm the normalization for the associated Legendre polynomials. * @tparam L the number of terms in the coefficients. * @param[in] c an array of coeff objects. * @param[in] f array of coefficient multipliers. f[0] should be 1. * @param[in] x the \e x component of the cartesian position. * @param[in] y the \e y component of the cartesian position. * @param[in] z the \e z component of the cartesian position. * @param[in] a the normalizing radius. * @param[out] gradx the \e x component of the gradient. * @param[out] grady the \e y component of the gradient. * @param[out] gradz the \e z component of the gradient. * @result the spherical harmonic sum. * * See the SphericalHarmonic class for the definition of the sum. * The coefficients used by this function are, for example, * c[0].Cv + f[1] * c[1].Cv + ... + f[L-1] * c[L-1].Cv. (Note * that f[0] is \e not used.) The upper limits on the sum are * determined by c[0].nmx() and c[0].mmx(); these limits apply to * \e all the components of the coefficients. The parameters \e * gradp, \e norm, and \e L are template parameters, to allow more * optimization to be done at compile time. * * Clenshaw summation is used which permits the evaluation of the sum * without the need to allocate temporary arrays. Thus this function never * throws an exception. **********************************************************************/ template static Math::real Value(const coeff c[], const real f[], real x, real y, real z, real a, real& gradx, real& grady, real& gradz) throw(); /** * Create a CircularEngine object * * @tparam gradp should the gradient be calculated. * @tparam norm the normalization for the associated Legendre polynomials. * @tparam L the number of terms in the coefficients. * @param[in] c an array of coeff objects. * @param[in] f array of coefficient multipliers. f[0] should be 1. * @param[in] p the radius of the circle = sqrt(x2 + * y2). * @param[in] z the height of the circle. * @param[in] a the normalizing radius. * @result the CircularEngine object. * * If you need to evaluate the spherical harmonic sum for several points * with constant \e f, \e p = sqrt(x2 + * y2), \e z, and \e a, it is more efficient to construct * call SphericalEngine::Circle to give a CircularEngine object and then * call CircularEngine::operator()() with arguments x/\e p and * y/\e p. **********************************************************************/ template static CircularEngine Circle(const coeff c[], const real f[], real p, real z, real a); /** * Check that the static table of square roots is big enough and enlarge it * if necessary. * * @param[in] N the maximum degree to be used in SphericalEngine. * * Typically, there's no need for an end-user to call this routine, because * the constructors for SphericalEngine::coeff do so. However, since this * updates a static table, there's a possible race condition in a * multi-threaded environment. Because this routine does nothing if the * table is already large enough, one way to avoid race conditions is to * call this routine at program start up (when it's still single threaded), * supplying the largest degree that your program will use. E.g., \code GeographicLib::SphericalEngine::RootTable(2190); \endcode * suffices to accommodate extant magnetic and gravity models. **********************************************************************/ static void RootTable(int N); /** * Clear the static table of square roots and release the memory. Call * this only when you are sure you no longer will be using SphericalEngine. * Your program will crash if you call SphericalEngine after calling this * routine. It's safest not to call this routine at all. (The space * used by the table is modest.) **********************************************************************/ static void ClearRootTable() { std::vector temp(0); root_.swap(temp); } }; } // namespace GeographicLib #if defined(_MSC_VER) #pragma warning (pop) #endif #endif // GEOGRAPHICLIB_SPHERICALENGINE_HPP geographiclib-1.21/include/GeographicLib/LocalCartesian.hpp0000644000175000017500000002322011745620414023576 0ustar frankiefrankie/** * \file LocalCartesian.hpp * \brief Header for GeographicLib::LocalCartesian class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_LOCALCARTESIAN_HPP) #define GEOGRAPHICLIB_LOCALCARTESIAN_HPP \ "$Id: 133014a30695adf3bdea9f4b52613fab458c505a $" #include #include namespace GeographicLib { /** * \brief Local Cartesian coordinates * * Convert between geodetic coordinates latitude = \e lat, longitude = \e * lon, height = \e h (measured vertically from the surface of the ellipsoid) * to local cartesian coordinates (\e x, \e y, \e z). The origin of local * cartesian coordinate system is at \e lat = \e lat0, \e lon = \e lon0, \e h * = \e h0. The \e z axis is normal to the ellipsoid; the \e y axis points * due north. The plane \e z = - \e h0 is tangent to the ellipsoid. * * The conversions all take place via geocentric coordinates using a * Geocentric object (by default Geocentric::WGS84). * * Example of use: * \include example-LocalCartesian.cpp * * CartConvert is a command-line utility * providing access to the functionality of Geocentric and LocalCartesian. **********************************************************************/ class GEOGRAPHIC_EXPORT LocalCartesian { private: typedef Math::real real; static const size_t dim_ = 3; static const size_t dim2_ = dim_ * dim_; Geocentric _earth; real _lat0, _lon0, _h0; real _x0, _y0, _z0, _r[dim2_]; void IntForward(real lat, real lon, real h, real& x, real& y, real& z, real M[dim2_]) const throw(); void IntReverse(real x, real y, real z, real& lat, real& lon, real& h, real M[dim2_]) const throw(); void MatrixMultiply(real M[dim2_]) const throw(); public: /** * Constructor setting the origin. * * @param[in] lat0 latitude at origin (degrees). * @param[in] lon0 longitude at origin (degrees). * @param[in] h0 height above ellipsoid at origin (meters); default 0. * @param[in] earth Geocentric object for the transformation; default * Geocentric::WGS84. **********************************************************************/ LocalCartesian(real lat0, real lon0, real h0 = 0, const Geocentric& earth = Geocentric::WGS84) throw() : _earth(earth) { Reset(lat0, lon0, h0); } /** * Default constructor. * * @param[in] earth Geocentric object for the transformation; default * Geocentric::WGS84. * * Sets \e lat0 = 0, \e lon0 = 0, \e h0 = 0. **********************************************************************/ explicit LocalCartesian(const Geocentric& earth = Geocentric::WGS84) throw() : _earth(earth) { Reset(real(0), real(0), real(0)); } /** * Reset the origin. * * @param[in] lat0 latitude at origin (degrees). * @param[in] lon0 longitude at origin (degrees). * @param[in] h0 height above ellipsoid at origin (meters); default 0. **********************************************************************/ void Reset(real lat0, real lon0, real h0 = 0) throw(); /** * Convert from geodetic to local cartesian coordinates. * * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[in] h height of point above the ellipsoid (meters). * @param[out] x local cartesian coordinate (meters). * @param[out] y local cartesian coordinate (meters). * @param[out] z local cartesian coordinate (meters). * * \e lat should be in the range [-90, 90]; \e lon and \e lon0 should be in * the range [-180, 360]. **********************************************************************/ void Forward(real lat, real lon, real h, real& x, real& y, real& z) const throw() { IntForward(lat, lon, h, x, y, z, NULL); } /** * Convert from geodetic to local cartesian coordinates and return rotation * matrix. * * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[in] h height of point above the ellipsoid (meters). * @param[out] x local cartesian coordinate (meters). * @param[out] y local cartesian coordinate (meters). * @param[out] z local cartesian coordinate (meters). * @param[out] M if the length of the vector is 9, fill with the rotation * matrix in row-major order. * * Let \e v be a unit vector located at (\e lat, \e lon, \e h). We can * express \e v as \e column vectors in one of two ways * - in east, north, up coordinates (where the components are relative to a * local coordinate system at (\e lat, \e lon, \e h)); call this * representation \e v1. * - in \e x, \e y, \e z coordinates (where the components are relative to * the local coordinate system at (\e lat0, \e lon0, \e h0)); call this * representation \e v0. * . * Then we have \e v0 = \e M . \e v1. **********************************************************************/ void Forward(real lat, real lon, real h, real& x, real& y, real& z, std::vector& M) const throw() { if (M.end() == M.begin() + dim2_) { real t[dim2_]; IntForward(lat, lon, h, x, y, z, t); copy(t, t + dim2_, M.begin()); } else IntForward(lat, lon, h, x, y, z, NULL); } /** * Convert from local cartesian to geodetic coordinates. * * @param[in] x local cartesian coordinate (meters). * @param[in] y local cartesian coordinate (meters). * @param[in] z local cartesian coordinate (meters). * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] h height of point above the ellipsoid (meters). * * The value of \e lon returned is in the range [-180, 180). **********************************************************************/ void Reverse(real x, real y, real z, real& lat, real& lon, real& h) const throw() { IntReverse(x, y, z, lat, lon, h, NULL); } /** * Convert from local cartesian to geodetic coordinates and return rotation * matrix. * * @param[in] x local cartesian coordinate (meters). * @param[in] y local cartesian coordinate (meters). * @param[in] z local cartesian coordinate (meters). * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] h height of point above the ellipsoid (meters). * @param[out] M if the length of the vector is 9, fill with the rotation * matrix in row-major order. * * Let \e v be a unit vector located at (\e lat, \e lon, \e h). We can * express \e v as \e column vectors in one of two ways * - in east, north, up coordinates (where the components are relative to a * local coordinate system at (\e lat, \e lon, \e h)); call this * representation \e v1. * - in \e x, \e y, \e z coordinates (where the components are relative to * the local coordinate system at (\e lat0, \e lon0, \e h0)); call this * representation \e v0. * . * Then we have \e v1 = \e M^T . \e v0, where \e M^T is the transpose of \e * M. **********************************************************************/ void Reverse(real x, real y, real z, real& lat, real& lon, real& h, std::vector& M) const throw() { if (M.end() == M.begin() + dim2_) { real t[dim2_]; IntReverse(x, y, z, lat, lon, h, t); copy(t, t + dim2_, M.begin()); } else IntReverse(x, y, z, lat, lon, h, NULL); } /** \name Inspector functions **********************************************************************/ ///@{ /** * @return latitude of the origin (degrees). **********************************************************************/ Math::real LatitudeOrigin() const throw() { return _lat0; } /** * @return longitude of the origin (degrees). **********************************************************************/ Math::real LongitudeOrigin() const throw() { return _lon0; } /** * @return height of the origin (meters). **********************************************************************/ Math::real HeightOrigin() const throw() { return _h0; } /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value of \e a inherited from the Geocentric object used in the * constructor. **********************************************************************/ Math::real MajorRadius() const throw() { return _earth.MajorRadius(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the Geocentric object used in the constructor. **********************************************************************/ Math::real Flattening() const throw() { return _earth.Flattening(); } ///@} /// \cond SKIP /** * DEPRECATED * @return \e r the inverse flattening of the ellipsoid. **********************************************************************/ Math::real InverseFlattening() const throw() { return _earth.InverseFlattening(); } /// \endcond }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_LOCALCARTESIAN_HPP geographiclib-1.21/include/GeographicLib/CircularEngine.hpp0000644000175000017500000001636311745620414023616 0ustar frankiefrankie/** * \file CircularEngine.hpp * \brief Header for GeographicLib::CircularEngine class * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_CIRCULARENGINE_HPP) #define GEOGRAPHICLIB_CIRCULARENGINE_HPP \ "$Id: d0528f468369dbc1b7af11e02278ad7a361d398b $" #include #include #include #if defined(_MSC_VER) // Squelch warnings about dll vs vector #pragma warning (push) #pragma warning (disable: 4251) #endif namespace GeographicLib { /** * \brief Spherical Harmonic sums for a circle. * * The class is a companion to SphericalEngine. If the results of a * spherical harmonic sum are needed for several points on a circle of * constant latitude \e lat and height \e h, then SphericalEngine::Circle can * compute the inner sum, which is independent of longitude \e lon, and * produce a CircularEngine object. CircularEngine::operator()() can * then be used to perform the outer sum for particular vales of \e lon. * This can lead to substantial improvements in computational speed for high * degree sum (approximately by a factor of \e N / 2 where \e N is the * maximum degree). * * CircularEngine is tightly linked to the internals of SphericalEngine. For * that reason, the constructor for this class is private. Use * SphericalHarmonic::Circle, SphericalHarmonic1::Circle, and * SphericalHarmonic2::Circle to create instances of this class. * * CircularEngine stores the coefficients needed to allow the summation over * order to be performed in 2 or 6 vectors of length \e M + 1 (depending on * whether gradients are to be calculated). For this reason the constructor * may throw a bad_alloc exception. * * Example of use: * \include example-CircularEngine.cpp **********************************************************************/ class GEOGRAPHIC_EXPORT CircularEngine { private: typedef Math::real real; enum normalization { FULL = SphericalEngine::FULL, SCHMIDT = SphericalEngine::SCHMIDT, }; int _M; bool _gradp; unsigned _norm; real _a, _r, _u, _t; std::vector _wc, _ws, _wrc, _wrs, _wtc, _wts; real _q, _uq, _uq2; Math::real Value(bool gradp, real cl, real sl, real& gradx, real& grady, real& gradz) const throw(); static inline void cossin(real x, real& cosx, real& sinx) { x = x >= 180 ? x - 360 : (x < -180 ? x + 360 : x); real xi = x * Math::degree(); cosx = std::abs(x) == 90 ? 0 : cos(xi); sinx = x == -180 ? 0 : sin(xi); } friend class SphericalEngine; friend class GravityCircle; // Access to cossin friend class MagneticCircle; // Access to cossin CircularEngine(int M, bool gradp, unsigned norm, real a, real r, real u, real t) : _M(M) , _gradp(gradp) , _norm(norm) , _a(a) , _r(r) , _u(u) , _t(t) , _wc(std::vector(_M + 1, 0)) , _ws(std::vector(_M + 1, 0)) , _wrc(std::vector(_gradp ? _M + 1 : 0, 0)) , _wrs(std::vector(_gradp ? _M + 1 : 0, 0)) , _wtc(std::vector(_gradp ? _M + 1 : 0, 0)) , _wts(std::vector(_gradp ? _M + 1 : 0, 0)) { _q = _a / _r; _uq = _u * _q; _uq2 = Math::sq(_uq); } void SetCoeff(int m, real wc, real ws) { _wc[m] = wc; _ws[m] = ws; } void SetCoeff(int m, real wc, real ws, real wrc, real wrs, real wtc, real wts) { _wc[m] = wc; _ws[m] = ws; if (_gradp) { _wrc[m] = wrc; _wrs[m] = wrs; _wtc[m] = wtc; _wts[m] = wts; } } public: /** * A default constructor. CircularEngine::operator()() on the resulting * object returns zero. The resulting object can be assigned to the result * of SphericalHarmonic::Circle. **********************************************************************/ CircularEngine() : _M(-1) , _gradp(true) , _u(0) , _t(1) {} /** * Evaluate the sum for a particular longitude given in terms of its * cosine and sine. * * @param[in] coslon the cosine of the longitude. * @param[in] sinlon the sine of the longitude. * @return \e V the value of the sum. * * The arguments must satisfy coslon2 + * sinlon2 = 1. **********************************************************************/ Math::real operator()(real coslon, real sinlon) const throw() { real dummy; return Value(false, coslon, sinlon, dummy, dummy, dummy); } /** * Evaluate the sum for a particular longitude. * * @param[in] lon the longitude (degrees). * @return \e V the value of the sum. **********************************************************************/ Math::real operator()(real lon) const throw() { real coslon, sinlon; cossin(lon, coslon, sinlon); return (*this)(coslon, sinlon); } /** * Evaluate the sum and its gradient for a particular longitude given in * terms of its cosine and sine. * * @param[in] coslon the cosine of the longitude. * @param[in] sinlon the sine of the longitude. * @param[out] gradx \e x component of the gradient. * @param[out] grady \e y component of the gradient. * @param[out] gradz \e z component of the gradient. * @return \e V the value of the sum. * * The gradients will only be computed if the CircularEngine object was * created with this capability (e.g., via \e gradp = true in * SphericalHarmonic::Circle). If not, \e gradx, etc., will not be * touched. The arguments must satisfy coslon2 + * sinlon2 = 1. **********************************************************************/ Math::real operator()(real coslon, real sinlon, real& gradx, real& grady, real& gradz) const throw() { return Value(true, coslon, sinlon, gradx, grady, gradz); } /** * Evaluate the sum and its gradient for a particular longitude. * * @param[in] lon the longitude (degrees). * @param[out] gradx \e x component of the gradient. * @param[out] grady \e y component of the gradient. * @param[out] gradz \e z component of the gradient. * @return \e V the value of the sum. * * The gradients will only be computed if the CircularEngine object was * created with this capability (e.g., via \e gradp = true in * SphericalHarmonic::Circle). If not, \e gradx, etc., will not be * touched. **********************************************************************/ Math::real operator()(real lon, real& gradx, real& grady, real& gradz) const throw() { real coslon, sinlon; cossin(lon, coslon, sinlon); return (*this)(coslon, sinlon, gradx, grady, gradz); } }; } // namespace GeographicLib #if defined(_MSC_VER) #pragma warning (pop) #endif #endif // GEOGRAPHICLIB_CIRCULARENGINE_HPP geographiclib-1.21/include/GeographicLib/CassiniSoldner.hpp0000644000175000017500000002514611745620414023643 0ustar frankiefrankie/** * \file CassiniSoldner.hpp * \brief Header for GeographicLib::CassiniSoldner class * * Copyright (c) Charles Karney (2009-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_CASSINISOLDNER_HPP) #define GEOGRAPHICLIB_CASSINISOLDNER_HPP \ "$Id: d794ea8a1e64fd9cbb8dcee34755b6dc4fee623a $" #include #include #include namespace GeographicLib { /** * \brief Cassini-Soldner Projection. * * Cassini-Soldner projection centered at an arbitrary position, \e lat0, \e * lon0, on the ellipsoid. This projection is a transverse cylindrical * equidistant projection. The projection from (\e lat, \e lon) to easting * and northing (\e x, \e y) is defined by geodesics as follows. Go north * along a geodesic a distance \e y from the central point; then turn * clockwise 90o and go a distance \e x along a geodesic. * (Although the initial heading is north, this changes to south if the pole * is crossed.) This procedure uniquely defines the reverse projection. The * forward projection is constructed as follows. Find the point (\e lat1, \e * lon1) on the meridian closest to (\e lat, \e lon). Here we consider the * full meridian so that \e lon1 may be either \e lon0 or \e lon0 + * 180o. \e x is the geodesic distance from (\e lat1, \e lon1) to * (\e lat, \e lon), appropriately signed according to which side of the * central meridian (\e lat, \e lon) lies. \e y is the shortest distance * along the meridian from (\e lat0, \e lon0) to (\e lat1, \e lon1), again, * appropriately signed according to the initial heading. [Note that, in the * case of prolate ellipsoids, the shortest meridional path from (\e lat0, \e * lon0) to (\e lat1, \e lon1) may not be the shortest path.] This procedure * uniquely defines the forward projection except for a small class of points * for which there may be two equally short routes for either leg of the * path. * * Because of the properties of geodesics, the (\e x, \e y) grid is * orthogonal. The scale in the easting direction is unity. The scale, \e * k, in the northing direction is unity on the central meridian and * increases away from the central meridian. The projection routines return * \e azi, the true bearing of the easting direction, and \e rk = 1/\e k, the * reciprocal of the scale in the northing direction. * * The conversions all take place using a Geodesic object (by default * Geodesic::WGS84). For more information on geodesics see \ref geodesic. * The determination of (\e lat1, \e lon1) in the forward projection is by * solving the inverse geodesic problem for (\e lat, \e lon) and its twin * obtained by reflection in the meridional plane. The scale is found by * determining where two neighboring geodesics intersecting the central * meridian at \e lat1 and \e lat1 + \e dlat1 intersect and taking the ratio * of the reduced lengths for the two geodesics between that point and, * respectively, (\e lat1, \e lon1) and (\e lat, \e lon). * * Example of use: * \include example-CassiniSoldner.cpp * * GeodesicProj is a command-line utility * providing access to the functionality of AzimuthalEquidistant, Gnomonic, * and CassiniSoldner. **********************************************************************/ class GEOGRAPHIC_EXPORT CassiniSoldner { private: typedef Math::real real; Geodesic _earth; GeodesicLine _meridian; real _sbet0, _cbet0; static const real eps1_; static const real tiny_; static const unsigned maxit_ = 10; // The following private helper functions are copied from Geodesic. static inline real AngNormalize(real x) throw() { // Place angle in [-180, 180). Assumes x is in [-540, 540). return x >= 180 ? x - 360 : (x < -180 ? x + 360 : x); } static inline real AngRound(real x) throw() { // The makes the smallest gap in x = 1/16 - nextafter(1/16, 0) = 1/2^57 // for reals = 0.7 pm on the earth if x is an angle in degrees. (This // is about 1000 times more resolution than we get with angles around 90 // degrees.) We use this to avoid having to deal with near singular // cases when x is non-zero but tiny (e.g., 1.0e-200). const real z = real(0.0625); // 1/16 volatile real y = std::abs(x); // The compiler mustn't "simplify" z - (z - y) to y y = y < z ? z - (z - y) : y; return x < 0 ? -y : y; } static inline void SinCosNorm(real& sinx, real& cosx) throw() { real r = Math::hypot(sinx, cosx); sinx /= r; cosx /= r; } public: /** * Constructor for CassiniSoldner. * * @param[in] earth the Geodesic object to use for geodesic calculations. * By default this uses the WGS84 ellipsoid. * * This constructor makes an "uninitialized" object. Call Reset to set the * central latitude and longitude, prior to calling Forward and Reverse. **********************************************************************/ explicit CassiniSoldner(const Geodesic& earth = Geodesic::WGS84) throw() : _earth(earth) {} /** * Constructor for CassiniSoldner specifying a center point. * * @param[in] lat0 latitude of center point of projection (degrees). * @param[in] lon0 longitude of center point of projection (degrees). * @param[in] earth the Geodesic object to use for geodesic calculations. * By default this uses the WGS84 ellipsoid. * * \e lat0 should be in the range [-90, 90] and \e lon0 should be in the * range [-180, 360]. **********************************************************************/ CassiniSoldner(real lat0, real lon0, const Geodesic& earth = Geodesic::WGS84) throw() : _earth(earth) { Reset(lat0, lon0); } /** * Set the central point of the projection * * @param[in] lat0 latitude of center point of projection (degrees). * @param[in] lon0 longitude of center point of projection (degrees). * * \e lat0 should be in the range [-90, 90] and \e lon0 should be in the * range [-180, 360]. **********************************************************************/ void Reset(real lat0, real lon0) throw(); /** * Forward projection, from geographic to Cassini-Soldner. * * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[out] x easting of point (meters). * @param[out] y northing of point (meters). * @param[out] azi azimuth of easting direction at point (degrees). * @param[out] rk reciprocal of azimuthal northing scale at point. * * \e lat should be in the range [-90, 90] and \e lon should be in the * range [-180, 360]. A call to Forward followed by a call to Reverse will * return the original (\e lat, \e lon) (to within roundoff). The routine * does nothing if the origin has not been set. **********************************************************************/ void Forward(real lat, real lon, real& x, real& y, real& azi, real& rk) const throw(); /** * Reverse projection, from Cassini-Soldner to geographic. * * @param[in] x easting of point (meters). * @param[in] y northing of point (meters). * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] azi azimuth of easting direction at point (degrees). * @param[out] rk reciprocal of azimuthal northing scale at point. * * A call to Reverse followed by a call to Forward will return the original * (\e x, \e y) (to within roundoff), provided that \e x and \e y are * sufficiently small not to "wrap around" the earth. The routine does * nothing if the origin has not been set. **********************************************************************/ void Reverse(real x, real y, real& lat, real& lon, real& azi, real& rk) const throw(); /** * CassiniSoldner::Forward without returning the azimuth and scale. **********************************************************************/ void Forward(real lat, real lon, real& x, real& y) const throw() { real azi, rk; Forward(lat, lon, x, y, azi, rk); } /** * CassiniSoldner::Reverse without returning the azimuth and scale. **********************************************************************/ void Reverse(real x, real y, real& lat, real& lon) const throw() { real azi, rk; Reverse(x, y, lat, lon, azi, rk); } /** \name Inspector functions **********************************************************************/ ///@{ /** * @return true if the object has been initialized. **********************************************************************/ bool Init() const throw() { return _meridian.Init(); } /** * @return \e lat0 the latitude of origin (degrees). **********************************************************************/ Math::real LatitudeOrigin() const throw() { return _meridian.Latitude(); } /** * @return \e lon0 the longitude of origin (degrees). **********************************************************************/ Math::real LongitudeOrigin() const throw() { return _meridian.Longitude(); } /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value inherited from the Geodesic object used in the constructor. **********************************************************************/ Math::real MajorRadius() const throw() { return _earth.MajorRadius(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the Geodesic object used in the constructor. **********************************************************************/ Math::real Flattening() const throw() { return _earth.Flattening(); } ///@} /// \cond SKIP /** * DEPRECATED * @return \e r the inverse flattening of the ellipsoid. **********************************************************************/ Math::real InverseFlattening() const throw() { return _earth.InverseFlattening(); } /// \endcond }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_CASSINISOLDNER_HPP geographiclib-1.21/include/GeographicLib/AzimuthalEquidistant.hpp0000644000175000017500000001477111745620414025076 0ustar frankiefrankie/** * \file AzimuthalEquidistant.hpp * \brief Header for GeographicLib::AzimuthalEquidistant class * * Copyright (c) Charles Karney (2009-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP) #define GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP \ "$Id: 95a1d6e7a8c4613be25ec32550231601202da1e5 $" #include #include namespace GeographicLib { /** * \brief Azimuthal Equidistant Projection. * * Azimuthal equidistant projection centered at an arbitrary position on the * ellipsoid. For a point in projected space (\e x, \e y), the geodesic * distance from the center position is hypot(\e x, \e y) and the azimuth of * the geodesic from the center point is atan2(\e x, \e y). The Forward and * Reverse methods also return the azimuth \e azi of the geodesic at (\e x, * \e y) and reciprocal scale \e rk in the azimuthal direction which, * together with the basic properties of the projection, serve to specify * completely the local affine transformation between geographic and * projected coordinates. * * The conversions all take place using a Geodesic object (by default * Geodesic::WGS84). For more information on geodesics see \ref geodesic. * * Example of use: * \include example-AzimuthalEquidistant.cpp * * GeodesicProj is a command-line utility * providing access to the functionality of AzimuthalEquidistant, Gnomonic, * and CassiniSoldner. **********************************************************************/ class GEOGRAPHIC_EXPORT AzimuthalEquidistant { private: typedef Math::real real; Geodesic _earth; static const real eps_; public: /** * Constructor for AzimuthalEquidistant. * * @param[in] earth the Geodesic object to use for geodesic calculations. * By default this uses the WGS84 ellipsoid. **********************************************************************/ explicit AzimuthalEquidistant(const Geodesic& earth = Geodesic::WGS84) throw() : _earth(earth) {} /** * Forward projection, from geographic to azimuthal equidistant. * * @param[in] lat0 latitude of center point of projection (degrees). * @param[in] lon0 longitude of center point of projection (degrees). * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[out] x easting of point (meters). * @param[out] y northing of point (meters). * @param[out] azi azimuth of geodesic at point (degrees). * @param[out] rk reciprocal of azimuthal scale at point. * * \e lat0 and \e lat should be in the range [-90, 90] and \e lon0 and \e * lon should be in the range [-180, 360]. The scale of the projection is * 1 in the "radial" direction, \e azi clockwise from true north, and is * 1/\e rk in the direction perpendicular to this. A call to Forward * followed by a call to Reverse will return the original (\e lat, \e lon) * (to within roundoff). **********************************************************************/ void Forward(real lat0, real lon0, real lat, real lon, real& x, real& y, real& azi, real& rk) const throw(); /** * Reverse projection, from azimuthal equidistant to geographic. * * @param[in] lat0 latitude of center point of projection (degrees). * @param[in] lon0 longitude of center point of projection (degrees). * @param[in] x easting of point (meters). * @param[in] y northing of point (meters). * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] azi azimuth of geodesic at point (degrees). * @param[out] rk reciprocal of azimuthal scale at point. * * \e lat0 should be in the range [-90, 90] and \e lon0 should be in the * range [-180, 360]. \e lat will be in the range [-90, 90] and \e lon * will be in the range [-180, 180). The scale of the projection is 1 in * the "radial" direction, \e azi clockwise from true north, and is 1/\e rk * in the direction perpendicular to this. A call to Reverse followed by a * call to Forward will return the original (\e x, \e y) (to roundoff) only * if the geodesic to (\e x, \e y) is a shortest path. **********************************************************************/ void Reverse(real lat0, real lon0, real x, real y, real& lat, real& lon, real& azi, real& rk) const throw(); /** * AzimuthalEquidistant::Forward without returning the azimuth and scale. **********************************************************************/ void Forward(real lat0, real lon0, real lat, real lon, real& x, real& y) const throw() { real azi, rk; Forward(lat0, lon0, lat, lon, x, y, azi, rk); } /** * AzimuthalEquidistant::Reverse without returning the azimuth and scale. **********************************************************************/ void Reverse(real lat0, real lon0, real x, real y, real& lat, real& lon) const throw() { real azi, rk; Reverse(lat0, lon0, x, y, lat, lon, azi, rk); } /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value inherited from the Geodesic object used in the constructor. **********************************************************************/ Math::real MajorRadius() const throw() { return _earth.MajorRadius(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the Geodesic object used in the constructor. **********************************************************************/ Math::real Flattening() const throw() { return _earth.Flattening(); } ///@} /// \cond SKIP /** * DEPRECATED * @return \e r the inverse flattening of the ellipsoid. **********************************************************************/ Math::real InverseFlattening() const throw() { return _earth.InverseFlattening(); } /// \endcond }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP geographiclib-1.21/include/GeographicLib/Geocentric.hpp0000644000175000017500000002634411745620414023006 0ustar frankiefrankie/** * \file Geocentric.hpp * \brief Header for GeographicLib::Geocentric class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GEOCENTRIC_HPP) #define GEOGRAPHICLIB_GEOCENTRIC_HPP \ "$Id: e9f709c85e61f60509c492429061cba04350eea8 $" #include #include #include namespace GeographicLib { /** * \brief %Geocentric coordinates * * Convert between geodetic coordinates latitude = \e lat, longitude = \e * lon, height = \e h (measured vertically from the surface of the ellipsoid) * to geocentric coordinates (\e X, \e Y, \e Z). The origin of geocentric * coordinates is at the center of the earth. The \e Z axis goes thru the * north pole, \e lat = 90o. The \e X axis goes thru \e lat = 0, * \e lon = 0. %Geocentric coordinates are also known as earth centered, * earth fixed (ECEF) coordinates. * * The conversion from geographic to geocentric coordinates is * straightforward. For the reverse transformation we use * - H. Vermeille, * Direct * transformation from geocentric coordinates to geodetic coordinates, * J. Geodesy 76, 451–454 (2002). * . * Several changes have been made to ensure that the method returns accurate * results for all finite inputs (even if \e h is infinite). The changes are * described in Appendix B of * - C. F. F. Karney, * Geodesics * on an ellipsoid of revolution, * Feb. 2011; * preprint * arxiv:1102.1215v1. * . * See \ref geocentric for more information. * * The errors in these routines are close to round-off. Specifically, for * points within 5000 km of the surface of the ellipsoid (either inside or * outside the ellipsoid), the error is bounded by 7 nm (7 nanometers) for * the WGS84 ellipsoid. See \ref geocentric for further information on the * errors. * * Example of use: * \include example-Geocentric.cpp * * CartConvert is a command-line utility * providing access to the functionality of Geocentric and LocalCartesian. **********************************************************************/ class GEOGRAPHIC_EXPORT Geocentric { private: typedef Math::real real; friend class LocalCartesian; friend class MagneticCircle; // MagneticCircle uses Rotation friend class MagneticModel; // MagneticModel uses IntForward friend class GravityCircle; // GravityCircle uses Rotation friend class GravityModel; // GravityModel uses IntForward friend class NormalGravity; // NormalGravity uses IntForward friend class SphericalHarmonic; friend class SphericalHarmonic1; friend class SphericalHarmonic2; static const size_t dim_ = 3; static const size_t dim2_ = dim_ * dim_; real _a, _f, _e2, _e2m, _e2a, _e4a, _maxrad; static void Rotation(real sphi, real cphi, real slam, real clam, real M[dim2_]) throw(); static void Rotate(real M[dim2_], real x, real y, real z, real& X, real& Y, real& Z) throw() { // Perform [X,Y,Z]^t = M.[x,y,z]^t // (typically local cartesian to geocentric) X = M[0] * x + M[1] * y + M[2] * z; Y = M[3] * x + M[4] * y + M[5] * z; Z = M[6] * x + M[7] * y + M[8] * z; } static void Unrotate(real M[dim2_], real X, real Y, real Z, real& x, real& y, real& z) throw() { // Perform [x,y,z]^t = M^t.[X,Y,Z]^t // (typically geocentric to local cartesian) x = M[0] * X + M[3] * Y + M[6] * Z; y = M[1] * X + M[4] * Y + M[7] * Z; z = M[2] * X + M[5] * Y + M[8] * Z; } void IntForward(real lat, real lon, real h, real& X, real& Y, real& Z, real M[dim2_]) const throw(); void IntReverse(real X, real Y, real Z, real& lat, real& lon, real& h, real M[dim2_]) const throw(); public: /** * Constructor for a ellipsoid with * * @param[in] a equatorial radius (meters). * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere. * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flattening * to 1/\e f. * * An exception is thrown if either of the axes of the ellipsoid is * non-positive. **********************************************************************/ Geocentric(real a, real f); /** * A default constructor (for use by NormalGravity). **********************************************************************/ Geocentric() : _a(-1) {} /** * Convert from geodetic to geocentric coordinates. * * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[in] h height of point above the ellipsoid (meters). * @param[out] X geocentric coordinate (meters). * @param[out] Y geocentric coordinate (meters). * @param[out] Z geocentric coordinate (meters). * * \e lat should be in the range [-90, 90]; \e lon and \e lon0 should be in * the range [-180, 360]. **********************************************************************/ void Forward(real lat, real lon, real h, real& X, real& Y, real& Z) const throw() { if (Init()) IntForward(lat, lon, h, X, Y, Z, NULL); } /** * Convert from geodetic to geocentric coordinates and return rotation * matrix. * * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[in] h height of point above the ellipsoid (meters). * @param[out] X geocentric coordinate (meters). * @param[out] Y geocentric coordinate (meters). * @param[out] Z geocentric coordinate (meters). * @param[out] M if the length of the vector is 9, fill with the rotation * matrix in row-major order. * * Let \e v be a unit vector located at (\e lat, \e lon, \e h). We can * express \e v as \e column vectors in one of two ways * - in east, north, up coordinates (where the components are relative to a * local coordinate system at (\e lat, \e lon, \e h)); call this * representation \e v1. * - in geocentric \e X, \e Y, \e Z coordinates; call this representation * \e v0. * . * Then we have \e v0 = \e M . \e v1. **********************************************************************/ void Forward(real lat, real lon, real h, real& X, real& Y, real& Z, std::vector& M) const throw() { if (!Init()) return; if (M.end() == M.begin() + dim2_) { real t[dim2_]; IntForward(lat, lon, h, X, Y, Z, t); copy(t, t + dim2_, M.begin()); } else IntForward(lat, lon, h, X, Y, Z, NULL); } /** * Convert from geocentric to geodetic to coordinates. * * @param[in] X geocentric coordinate (meters). * @param[in] Y geocentric coordinate (meters). * @param[in] Z geocentric coordinate (meters). * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] h height of point above the ellipsoid (meters). * * In general there are multiple solutions and the result which maximizes * \e h is returned. If there are still multiple solutions with different * latitudes (applies only if \e Z = 0), then the solution with \e lat > 0 * is returned. If there are still multiple solutions with different * longitudes (applies only if \e X = \e Y = 0) then \e lon = 0 is * returned. The value of \e h returned satisfies \e h >= - \e a (1 - * e2) / sqrt(1 - e2 sin2\e * lat). The value of \e lon returned is in the range [-180, 180). **********************************************************************/ void Reverse(real X, real Y, real Z, real& lat, real& lon, real& h) const throw() { if (Init()) IntReverse(X, Y, Z, lat, lon, h, NULL); } /** * Convert from geocentric to geodetic to coordinates. * * @param[in] X geocentric coordinate (meters). * @param[in] Y geocentric coordinate (meters). * @param[in] Z geocentric coordinate (meters). * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] h height of point above the ellipsoid (meters). * @param[out] M if the length of the vector is 9, fill with the rotation * matrix in row-major order. * * Let \e v be a unit vector located at (\e lat, \e lon, \e h). We can * express \e v as \e column vectors in one of two ways * - in east, north, up coordinates (where the components are relative to a * local coordinate system at (\e lat, \e lon, \e h)); call this * representation \e v1. * - in geocentric \e X, \e Y, \e Z coordinates; call this representation * \e v0. * . * Then we have \e v1 = \e M^T . \e v0, where \e M^T is the transpose of \e * M. **********************************************************************/ void Reverse(real X, real Y, real Z, real& lat, real& lon, real& h, std::vector& M) const throw() { if (!Init()) return; if (M.end() == M.begin() + dim2_) { real t[dim2_]; IntReverse(X, Y, Z, lat, lon, h, t); copy(t, t + dim2_, M.begin()); } else IntReverse(X, Y, Z, lat, lon, h, NULL); } /** \name Inspector functions **********************************************************************/ ///@{ /** * @return true if the object has been initialized. **********************************************************************/ bool Init() const throw() { return _a > 0; } /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ Math::real MajorRadius() const throw() { return Init() ? _a : Math::NaN(); } /** * @return \e f the flattening of the ellipsoid. This is the * value used in the constructor. **********************************************************************/ Math::real Flattening() const throw() { return Init() ? _f : Math::NaN(); } ///@} /// \cond SKIP /** * DEPRECATED * @return \e r the inverse flattening of the ellipsoid. **********************************************************************/ Math::real InverseFlattening() const throw() { return Init() ? 1/_f : Math::NaN(); } /// \endcond /** * A global instantiation of Geocentric with the parameters for the WGS84 * ellipsoid. **********************************************************************/ static const Geocentric WGS84; }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_GEOCENTRIC_HPP geographiclib-1.21/include/GeographicLib/GravityCircle.hpp0000644000175000017500000002751711745620414023476 0ustar frankiefrankie/** * \file GravityCircle.hpp * \brief Header for GeographicLib::GravityCircle class * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GRAVITYCIRCLE_HPP) #define GEOGRAPHICLIB_GRAVITYCIRCLE_HPP \ "$Id: 6ae0869411185a48c9f55016e6d1fb14e69aaac1 $" #include #include #include #include #include namespace GeographicLib { /** * \brief Gravity on a circle of latitude * * Evaluate the earth's gravity field on a circle of constant height and * latitude. This uses a CircleEngine to pre-evaluate the inner sum of the * spherical harmonic sum, allowing the values of the field at several * different longitudes to be evaluated rapidly. * * Use GravityModel::Circle to create a GravityCircle object. (The * constructor for this class is private.) * * See \ref gravityparallel for an example of using GravityCircle (together * with OpenMP) to speed up the computation of geoid heights. * * Example of use: * \include example-GravityCircle.cpp * * Gravity is a command-line utility providing * access to the functionality of GravityModel and GravityCircle. **********************************************************************/ class GEOGRAPHIC_EXPORT GravityCircle { private: typedef Math::real real; enum mask { NONE = GravityModel::NONE, GRAVITY = GravityModel::GRAVITY, DISTURBANCE = GravityModel::DISTURBANCE, DISTURBING_POTENTIAL = GravityModel::DISTURBING_POTENTIAL, GEOID_HEIGHT = GravityModel::GEOID_HEIGHT, SPHERICAL_ANOMALY = GravityModel::SPHERICAL_ANOMALY, ALL = GravityModel::ALL, }; unsigned _caps; real _a, _f, _lat, _h, _Z, _P, _invR, _cpsi, _spsi, _cphi, _sphi, _amodel, _GMmodel, _dzonal0, _corrmult, _gamma0, _gamma, _frot; CircularEngine _gravitational, _disturbing, _correction; GravityCircle(mask caps, real a, real f, real lat, real h, real Z, real P, real cphi, real sphi, real amodel, real GMmodel, real dzonal0, real corrmult, real gamma0, real gamma, real frot, const CircularEngine& gravitational, const CircularEngine& disturbing, const CircularEngine& correction) : _caps(caps) , _a(a) , _f(f) , _lat(lat) , _h(h) , _Z(Z) , _P(P) , _invR(Math::hypot(_P, _Z)) , _cpsi(_P * _invR) , _spsi(_Z * _invR) , _cphi(cphi) , _sphi(sphi) , _amodel(amodel) , _GMmodel(GMmodel) , _dzonal0(dzonal0) , _corrmult(corrmult) , _gamma0(gamma0) , _gamma(gamma) , _frot(frot) , _gravitational(gravitational) , _disturbing(disturbing) , _correction(correction) {} friend class GravityModel; // GravityModel calls the private constructor Math::real W(real clam, real slam, real& gX, real& gY, real& gZ) const throw(); Math::real V(real clam, real slam, real& gX, real& gY, real& gZ) const throw(); Math::real InternalT(real clam, real slam, real& deltaX, real& deltaY, real& deltaZ, bool gradp, bool correct) const throw(); public: /** * A default constructor for the normal gravity. This sets up an * uninitialized object which can be later replaced by the * GravityModel::Circle. **********************************************************************/ GravityCircle() : _a(-1) {} /** \name Compute the gravitational field **********************************************************************/ ///@{ /** * Evaluate the gravity. * * @param[in] lon the geographic longitude (degrees). * @param[out] gx the easterly component of the acceleration * (m s-2). * @param[out] gy the northerly component of the acceleration * (m s-2). * @param[out] gz the upward component of the acceleration * (m s-2); this is usually negative. * @return \e W the sum of the gravitational and centrifugal potentials. * * The function includes the effects of the earth's rotation. **********************************************************************/ Math::real Gravity(real lon, real& gx, real& gy, real& gz) const throw(); /** * Evaluate the gravity disturbance vector. * * @param[in] lon the geographic longitude (degrees). * @param[out] deltax the easterly component of the disturbance vector * (m s-2). * @param[out] deltay the northerly component of the disturbance vector * (m s-2). * @param[out] deltaz the upward component of the disturbance vector * (m s-2). * @return \e T the corresponding disturbing potential. **********************************************************************/ Math::real Disturbance(real lon, real& deltax, real& deltay, real& deltaz) const throw(); /** * Evaluate the geoid height. * * @param[in] lon the geographic longitude (degrees). * @return \e N the height of the geoid above the reference ellipsoid * (meters). * * Some approximations are made in computing the geoid height so that the * results of the NGA codes are reproduced accurately. Details are given * in \ref gravitygeoid. **********************************************************************/ Math::real GeoidHeight(real lon) const throw(); /** * Evaluate the components of the gravity anomaly vector using the * spherical approximation. * * @param[in] lon the geographic longitude (degrees). * @param[out] Dg01 the gravity anomaly (m s-2). * @param[out] xi the northerly component of the deflection of the vertical * (degrees). * @param[out] eta the easterly component of the deflection of the vertical * (degrees). * * The spherical approximation (see Heiskanen and Moritz, Sec 2-14) is used * so that the results of the NGA codes are reproduced accurately. * approximations used here. Details are given in \ref gravitygeoid. **********************************************************************/ void SphericalAnomaly(real lon, real& Dg01, real& xi, real& eta) const throw(); /** * Evaluate the components of the acceleration due to gravity and the * centrifugal acceleration in geocentric coordinates. * * @param[in] lon the geographic longitude (degrees). * @param[out] gX the \e X component of the acceleration * (m s-2). * @param[out] gY the \e Y component of the acceleration * (m s-2). * @param[out] gZ the \e Z component of the acceleration * (m s-2). * @return \e W = \e V + \e Phi the sum of the gravitational and * centrifugal potentials (m2 s-2). **********************************************************************/ Math::real W(real lon, real& gX, real& gY, real& gZ) const throw() { real clam, slam; CircularEngine::cossin(lon, clam, slam); return W(clam, slam, gX, gY, gZ); } /** * Evaluate the components of the acceleration due to gravity in geocentric * coordinates. * * @param[in] lon the geographic longitude (degrees). * @param[out] GX the \e X component of the acceleration * (m s-2). * @param[out] GY the \e Y component of the acceleration * (m s-2). * @param[out] GZ the \e Z component of the acceleration * (m s-2). * @return \e V = \e W - \e Phi the gravitational potential * (m2 s-2). **********************************************************************/ Math::real V(real lon, real& GX, real& GY, real& GZ) const throw() { real clam, slam; CircularEngine::cossin(lon, clam, slam); return V(clam, slam, GX, GY, GZ); } /** * Evaluate the components of the gravity disturbance in geocentric * coordinates. * * @param[in] lon the geographic longitude (degrees). * @param[out] deltaX the \e X component of the gravity disturbance * (m s-2). * @param[out] deltaY the \e Y component of the gravity disturbance * (m s-2). * @param[out] deltaZ the \e Z component of the gravity disturbance * (m s-2). * @return \e T = \e W - \e U the disturbing potential (also called the * anomalous potential) (m2 s-2). **********************************************************************/ Math::real T(real lon, real& deltaX, real& deltaY, real& deltaZ) const throw() { real clam, slam; CircularEngine::cossin(lon, clam, slam); return InternalT(clam, slam, deltaX, deltaY, deltaZ, true, true); } /** * Evaluate disturbing potential in geocentric coordinates. * * @param[in] lon the geographic longitude (degrees). * @return \e T = \e W - \e U the disturbing potential (also called the * anomalous potential) (m2 s-2). **********************************************************************/ Math::real T(real lon) const throw() { real clam, slam, dummy; CircularEngine::cossin(lon, clam, slam); return InternalT(clam, slam, dummy, dummy, dummy, false, true); } ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return true if the object has been initialized. **********************************************************************/ bool Init() const throw() { return _a > 0; } /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value inherited from the GravityModel object used in the * constructor. **********************************************************************/ Math::real MajorRadius() const throw() { return Init() ? _a : Math::NaN(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the GravityModel object used in the constructor. **********************************************************************/ Math::real Flattening() const throw() { return Init() ? _f : Math::NaN(); } /** * @return the latitude of the circle (degrees). **********************************************************************/ Math::real Latitude() const throw() { return Init() ? _lat : Math::NaN(); } /** * @return the height of the circle (meters). **********************************************************************/ Math::real Height() const throw() { return Init() ? _h : Math::NaN(); } /** * @return \e caps the computational capabilities that this object was * constructed with. **********************************************************************/ unsigned Capabilities() const throw() { return _caps; } /** * @param[in] testcaps a set of bitor'ed GeodesicLine::mask values. * @return true if the GeodesicLine object has all these capabilities. **********************************************************************/ bool Capabilities(unsigned testcaps) const throw() { return (_caps & testcaps) == testcaps; } ///@} }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_GRAVITYCIRCLE_HPP geographiclib-1.21/include/GeographicLib/UTMUPS.hpp0000644000175000017500000003523411745620414021757 0ustar frankiefrankie/** * \file UTMUPS.hpp * \brief Header for GeographicLib::UTMUPS class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_UTMUPS_HPP) #define GEOGRAPHICLIB_UTMUPS_HPP \ "$Id: a529ed8aeaeffb02994254bbc7eb1209aa41b9ca $" #include #include namespace GeographicLib { /** * \brief Convert between Geographic coordinates and UTM/UPS * * UTM and UPS are defined * - J. W. Hager, J. F. Behensky, and B. W. Drew, * * The Universal Grids: Universal Transverse Mercator (UTM) and Universal * Polar Stereographic (UPS), Defense Mapping Agency, Technical Manual * TM8358.2 (1989). * . * Section 2-3 defines UTM and section 3-2.4 defines UPS. This document also * includes approximate algorithms for the computation of the underlying * transverse Mercator and polar stereographic projections. Here we * substitute much more accurate algorithms given by * GeographicLib:TransverseMercator and GeographicLib:PolarStereographic. * * In this implementation, the conversions are closed, i.e., output from * Forward is legal input for Reverse and vice versa. The error is about 5nm * in each direction. However, the conversion from legal UTM/UPS coordinates * to geographic coordinates and back might throw an error if the initial * point is within 5nm of the edge of the allowed range for the UTM/UPS * coordinates. * * The simplest way to guarantee the closed property is to define allowed * ranges for the eastings and northings for UTM and UPS coordinates. The * UTM boundaries are the same for all zones. (The only place the * exceptional nature of the zone boundaries is evident is when converting to * UTM/UPS coordinates requesting the standard zone.) The MGRS lettering * scheme imposes natural limits on UTM/UPS coordinates which may be * converted into MGRS coordinates. For the conversion to/from geographic * coordinates these ranges have been extended by 100km in order to provide a * generous overlap between UTM and UPS and between UTM zones. * * The NGA software package * geotrans * also provides conversions to and from UTM and UPS. Version 2.4.2 (and * earlier) suffers from some drawbacks: * - Inconsistent rules are used to determine the whether a particular UTM or * UPS coordinate is legal. A more systematic approach is taken here. * - The underlying projections are not very accurately implemented. * * Example of use: * \include example-UTMUPS.cpp **********************************************************************/ class GEOGRAPHIC_EXPORT UTMUPS { private: typedef Math::real real; static const real falseeasting_[4]; static const real falsenorthing_[4]; static const real mineasting_[4]; static const real maxeasting_[4]; static const real minnorthing_[4]; static const real maxnorthing_[4]; static real CentralMeridian(int zone) throw() { return real(6 * zone - 183); } static void CheckLatLon(real lat, real lon); // Throw an error if easting or northing are outside standard ranges. If // throwp = false, return bool instead. static bool CheckCoords(bool utmp, bool northp, real x, real y, bool msgrlimits = false, bool throwp = true); UTMUPS(); // Disable constructor public: /** * In this class we bring together the UTM and UPS coordinates systems. * The UTM divides the earth between latitudes -80 and 84 into 60 zones * numbered 1 thru 60. Zone assign zone number 0 to the UPS regions, * covering the two poles. Within UTMUPS, non-negative zone numbers refer * to one of the "physical" zones, 0 for UPS and [1, 60] for UTM. Negative * "pseudo-zone" numbers are used to select one of the physical zones. **********************************************************************/ enum zonespec { /** * The smallest pseudo-zone number. **********************************************************************/ MINPSEUDOZONE = -4, /** * A marker for an undefined or invalid zone. Equivalent to NaN. **********************************************************************/ INVALID = -4, /** * If a coordinate already include zone information (e.g., it is an MGRS * coordinate), use that, otherwise apply the UTMUPS::STANDARD rules. **********************************************************************/ MATCH = -3, /** * Apply the standard rules for UTM zone assigment extending the UTM zone * to each pole to give a zone number in [1, 60]. For example, use UTM * zone 38 for longitude in [42, 48). The rules include the Norway and * Svalbard exceptions. **********************************************************************/ UTM = -2, /** * Apply the standard rules for zone assignment to give a zone number in * [0, 60]. If the latitude is not in [-80, 84), then use UTMUPS::UPS = * 0, otherwise apply the rules for UTMUPS::UTM. The tests on latitudes * and longitudes are all closed on the lower end open on the upper. * Thus for UTM zone 38, latitude is in [-80, 84) and longitude is in * [42, 48). **********************************************************************/ STANDARD = -1, /** * The largest pseudo-zone number. **********************************************************************/ MAXPSEUDOZONE = -1, /** * The smallest physical zone number. **********************************************************************/ MINZONE = 0, /** * The zone number used for UPS **********************************************************************/ UPS = 0, /** * The smallest UTM zone number. **********************************************************************/ MINUTMZONE = 1, /** * The largest UTM zone number. **********************************************************************/ MAXUTMZONE = 60, /** * The largest physical zone number. **********************************************************************/ MAXZONE = 60, }; /** * The standard zone. * * @param[in] lat latitude (degrees). * @param[in] lon longitude (degrees). * @param[in] setzone zone override (optional). * * This is exact. If the optional argument \e setzone is given then use * that zone if it is non-negative, otherwise apply the rules given in * UTMUPS::zonespec. Throws an error if \e setzone is outsize the range * [UTMUPS::MINPSEUDOZONE, UTMUPS::MAXZONE] = [-4, 60]. **********************************************************************/ static int StandardZone(real lat, real lon, int setzone = STANDARD); /** * Forward projection, from geographic to UTM/UPS. * * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[out] zone the UTM zone (zero means UPS). * @param[out] northp hemisphere (true means north, false means south). * @param[out] x easting of point (meters). * @param[out] y northing of point (meters). * @param[out] gamma meridian convergence at point (degrees). * @param[out] k scale of projection at point. * @param[in] setzone zone override. * @param[in] mgrslimits if true enforce the stricter MGRS limits on the * coordinates (default = false). * * The preferred zone for the result can be specified with \e setzone, see * UTMUPS::StandardZone. Throw error if the resulting easting or northing * is outside the allowed range (see Reverse), in which case the arguments * are unchanged. This also returns meridian convergence \e gamma * (degrees) and scale \e k. The accuracy of the conversion is about 5nm. **********************************************************************/ static void Forward(real lat, real lon, int& zone, bool& northp, real& x, real& y, real& gamma, real& k, int setzone = STANDARD, bool mgrslimits = false); /** * Reverse projection, from UTM/UPS to geographic. * * @param[in] zone the UTM zone (zero means UPS). * @param[in] northp hemisphere (true means north, false means south). * @param[in] x easting of point (meters). * @param[in] y northing of point (meters). * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] gamma meridian convergence at point (degrees). * @param[out] k scale of projection at point. * @param[in] mgrslimits if true enforce the stricter MGRS limits on the * coordinates (default = false). * * Throw error if easting or northing is outside the allowed range (see * below), in which case the arguments are unchanged. The accuracy of the * conversion is about 5nm. * * UTM eastings are allowed to be in the range [0km, 1000km], northings are * allowed to be in in [0km, 9600km] for the northern hemisphere and in * [900km, 10000km] for the southern hemisphere. (However UTM northings * can be continued across the equator. So the actual limits on the * northings are [-9100km, 9600km] for the "northern" hemisphere and * [900km, 19600km] for the "southern" hemisphere.) * * UPS eastings and northings are allowed to be in the range [1200km, * 2800km] in the northern hemisphere and in [700km, 3100km] in the * southern hemisphere. * * These ranges are 100km larger than allowed for the conversions to MGRS. * (100km is the maximum extra padding consistent with eastings remaining * non-negative.) This allows generous overlaps between zones and UTM and * UPS. If \e mgrslimits = true, then all the ranges are shrunk by 100km * so that they agree with the stricter MGRS ranges. No checks are * performed besides these (e.g., to limit the distance outside the * standard zone boundaries). **********************************************************************/ static void Reverse(int zone, bool northp, real x, real y, real& lat, real& lon, real& gamma, real& k, bool mgrslimits = false); /** * UTMUPS::Forward without returning convergence and scale. **********************************************************************/ static void Forward(real lat, real lon, int& zone, bool& northp, real& x, real& y, int setzone = STANDARD, bool mgrslimits = false) { real gamma, k; Forward(lat, lon, zone, northp, x, y, gamma, k, setzone, mgrslimits); } /** * UTMUPS::Reverse without returning convergence and scale. **********************************************************************/ static void Reverse(int zone, bool northp, real x, real y, real& lat, real& lon, bool mgrslimits = false) { real gamma, k; Reverse(zone, northp, x, y, lat, lon, gamma, k, mgrslimits); } /** * Decode a UTM/UPS zone string. * * @param[in] zonestr string representation of zone and hemisphere. * @param[out] zone the UTM zone (zero means UPS). * @param[out] northp hemisphere (true means north, false means south). * * For UTM, \e zonestr has the form of a zone number in the range * [UTMUPS::MINUTMZONE, UTMUPS::MAXUTMZONE] = [1, 60] followed by a * hemisphere letter, N or S. For UPS, it consists just of the hemisphere * letter. The returned value of \e zone is UTMUPS::UPS = 0 for UPS. Note * well that "38S" indicates the southern hemisphere of zone 38 and not * latitude band S, [32, 40]. N, 01S, 2N, 38S are legal. 0N, 001S, 61N, * 38P are illegal. INV is a special value for which the returned value of * \e is UTMUPS::INVALID. Throws an error is the zone string is malformed. **********************************************************************/ static void DecodeZone(const std::string& zonestr, int& zone, bool& northp); /** * Encode a UTM/UPS zone string. * * @param[out] zone the UTM zone (zero means UPS). * @param[out] northp hemisphere (true means north, false means south). * @return string representation of zone and hemisphere. * * \e zone must be in the range [UTMUPS::MINZONE, UTMUPS::MAXZONE] = [0, * 60] with \e zone = UTMUPS::UPS, 0, indicating UPS (but the resulting * string does not contain "0"). \e zone may also be UTMUPS::INVALID, in * which case the returned string is "INV". This reverses * UTMUPS::DecodeZone. **********************************************************************/ static std::string EncodeZone(int zone, bool northp); /** * @return shift (meters) necessary to align N and S halves of a UTM zone * (107). **********************************************************************/ static Math::real UTMShift() throw(); /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the WGS84 ellipsoid (meters). * * (The WGS84 value is returned because the UTM and UPS projections are * based on this ellipsoid.) **********************************************************************/ static Math::real MajorRadius() throw() { return Constants::WGS84_a(); } /** * @return \e f the flattening of the WGS84 ellipsoid. * * (The WGS84 value is returned because the UTM and UPS projections are * based on this ellipsoid.) **********************************************************************/ static Math::real Flattening() throw() { return Constants::WGS84_f(); } ///@} /// \cond SKIP /** * DEPRECATED * @return \e r the inverse flattening of the WGS84 ellipsoid. **********************************************************************/ static Math::real InverseFlattening() throw() { return 1/Constants::WGS84_f(); } /// \endcond }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_UTMUPS_HPP geographiclib-1.21/include/GeographicLib/OSGB.hpp0000644000175000017500000002206611745620414021453 0ustar frankiefrankie/** * \file OSGB.hpp * \brief Header for GeographicLib::OSGB class * * Copyright (c) Charles Karney (2010, 2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_OSGB_HPP) #define GEOGRAPHICLIB_OSGB_HPP "$Id: e91367e693ad63bb500c953e9c21445bef017464 $" #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about dll vs string #pragma warning (push) #pragma warning (disable: 4251) #endif namespace GeographicLib { /** * \brief Ordnance Survey grid system for Great Britain * * The class implements the coordinate system used by the Ordnance Survey for * maps of Great Britain and conversions to the grid reference system. * * See * - * A guide to coordinate systems in Great Britain * - * Guide to National Grid * * \b WARNING: the latitudes and longitudes for the Ordnance Survey grid * system do not use the WGS84 datum. Do not use the values returned by this * class in the UTMUPS, MGRS, or Geoid classes without first converting the * datum (and vice versa). * * Example of use: * \include example-OSGB.cpp **********************************************************************/ class GEOGRAPHIC_EXPORT OSGB { private: typedef Math::real real; static const std::string letters_; static const std::string digits_; static const TransverseMercator OSGBTM_; static const real northoffset_; enum { base_ = 10, tile_ = 100000, tilelevel_ = 5, tilegrid_ = 5, tileoffx_ = 2 * tilegrid_, tileoffy_ = 1 * tilegrid_, minx_ = - tileoffx_ * tile_, miny_ = - tileoffy_ * tile_, maxx_ = (tilegrid_*tilegrid_ - tileoffx_) * tile_, maxy_ = (tilegrid_*tilegrid_ - tileoffy_) * tile_, // Maximum precision is um maxprec_ = 5 + 6, }; static real computenorthoffset() throw(); static void CheckCoords(real x, real y); OSGB(); // Disable constructor public: /** * Forward projection, from geographic to OSGB coordinates. * * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[out] x easting of point (meters). * @param[out] y northing of point (meters). * @param[out] gamma meridian convergence at point (degrees). * @param[out] k scale of projection at point. * * \e lat should be in the range [-90, 90]; \e lon and \e lon0 should be in * the range [-180, 360]. **********************************************************************/ static void Forward(real lat, real lon, real& x, real& y, real& gamma, real& k) throw() { OSGBTM_.Forward(OriginLongitude(), lat, lon, x, y, gamma, k); x += FalseEasting(); y += northoffset_; } /** * Reverse projection, from OSGB coordinates to geographic. * * @param[in] x easting of point (meters). * @param[in] y northing of point (meters). * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] gamma meridian convergence at point (degrees). * @param[out] k scale of projection at point. * * The value of \e lon returned is in the range [-180, 180). **********************************************************************/ static void Reverse(real x, real y, real& lat, real& lon, real& gamma, real& k) throw() { x -= FalseEasting(); y -= northoffset_; OSGBTM_.Reverse(OriginLongitude(), x, y, lat, lon, gamma, k); } /** * OSGB::Forward without returning the convergence and scale. **********************************************************************/ static void Forward(real lat, real lon, real& x, real& y) throw() { real gamma, k; Forward(lat, lon, x, y, gamma, k); } /** * OSGB::Reverse without returning the convergence and scale. **********************************************************************/ static void Reverse(real x, real y, real& lat, real& lon) throw() { real gamma, k; Reverse(x, y, lat, lon, gamma, k); } /** * Convert OSGB coordinates to a grid reference. * * @param[in] x easting of point (meters). * @param[in] y northing of point (meters). * @param[in] prec precision relative to 100 km. * @param[out] gridref National Grid reference. * * \e prec specifies the precision of the grid reference string as follows: * - prec = 0 (min), 100km * - prec = 1, 10km * - prec = 2, 1km * - prec = 3, 100m * - prec = 4, 10m * - prec = 5, 1m * - prec = 6, 0.1m * - prec = 11 (max), 1um * * The easting must be in the range [-1000 km, 1500 km) and the northing * must be in the range [-500 km, 2000 km). An exception is thrown if * either the easting and northing is outside these bounds. These bounds * are consistent with rules for the letter designations for the grid * system. **********************************************************************/ static void GridReference(real x, real y, int prec, std::string& gridref); /** * Convert OSGB coordinates to a grid reference. * * @param[in] gridref National Grid reference. * @param[out] x easting of point (meters). * @param[out] y northing of point (meters). * @param[out] prec precision relative to 100 km. * @param[in] centerp if true (default), return center of the grid square, * else return SW (lower left) corner. * * The grid reference must be of the form: two letters (not including I) * followed by an even number of digits (up to 22). **********************************************************************/ static void GridReference(const std::string& gridref, real& x, real& y, int& prec, bool centerp = true); /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the Airy 1830 ellipsoid (meters). * * This is 20923713 ft converted to meters using the rule 1 ft = * 10^(9.48401603-10) m. (The Airy 1830 value is returned because the OSGB * projection is based on this ellipsoid.) **********************************************************************/ static Math::real MajorRadius() throw() // result is about 6377563.3960320664406 m { return real(20923713) * std::pow(real(10), real(0.48401603L) - 1); } /** * @return \e f the inverse flattening of the Airy 1830 ellipsoid. * * For the Airy 1830 ellipsoid, \e a = 20923713 ft and \e b = 20853810 ft; * thus the flattening = (20923713 - 20853810)/20923713 = 7767/2324857 = * 1/299.32496459... (The Airy 1830 value is returned because the OSGB * projection is based on this ellipsoid.) **********************************************************************/ static Math::real Flattening() throw() { return real(20923713 - 20853810) / real(20923713); } /// \cond SKIP /** * DEPRECATED * @return \e r the inverse flattening of the Airy 1830 ellipsoid. **********************************************************************/ static Math::real InverseFlattening() throw() { return 1/Flattening(); } /// \endcond /** * @return \e k0 central scale for the OSGB projection (0.9996012717). **********************************************************************/ static Math::real CentralScale() throw() { return real(0.9996012717L); } /** * @return latitude of the origin for the OSGB projection (49 degrees). **********************************************************************/ static Math::real OriginLatitude() throw() { return real(49); } /** * @return longitude of the origin for the OSGB projection (-2 degrees). **********************************************************************/ static Math::real OriginLongitude() throw() { return real(-2); } /** * @return false northing the OSGB projection (-100000 meters). **********************************************************************/ static Math::real FalseNorthing() throw() { return real(-100000); } /** * @return false easting the OSGB projection (400000 meters). **********************************************************************/ static Math::real FalseEasting() throw() { return real(400000); } ///@} }; } // namespace GeographicLib #if defined(_MSC_VER) #pragma warning (pop) #endif #endif geographiclib-1.21/include/GeographicLib/Utility.hpp0000644000175000017500000005201611745620414022362 0ustar frankiefrankie/** * \file Utility.hpp * \brief Header for GeographicLib::Utility class * * Copyright (c) Charles Karney (2011, 2012) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_UTILITY_HPP) #define GEOGRAPHICLIB_UTILITY_HPP \ "$Id: 92c92fcb8ea92116fed01909c2611934b708e4cd $" #include #include #include #include #include #include #include namespace GeographicLib { /** * \brief Some utility routines for %GeographicLib * * Example of use: * \include example-Utility.cpp **********************************************************************/ class GEOGRAPHIC_EXPORT Utility { private: static bool gregorian(int y, int m, int d) { // The original cut over to the Gregorian calendar in Pope Gregory XIII's // time had 1582-10-04 followed by 1582-10-15. Here we implement the // switch over used by the English-speaking world where 1752-09-02 was // followed by 1752-09-14. We also assume that the year always begins // with January 1, whereas in reality it often was reckoned to begin in // March. return 100 * (100 * y + m) + d >= 17520914; // or 15821004 } static bool gregorian(int s) { return s >= 639799; // 1752-09-14 } public: /** * Convert a date to the day numbering sequentially starting with * 0001-01-01 as day 1. * * @param[in] y the year (must be positive). * @param[in] m the month, Jan = 1, etc. (must be positive). Default = 1. * @param[in] d the day of the month (must be positive). Default = 1. * @return the sequential day number. **********************************************************************/ static int day(int y, int m = 1, int d = 1) throw() { // Convert from date to sequential day and vice versa // // Here is some code to convert a date to sequential day and vice // versa. The sequential day is numbered so that January 1, 1 AD is day 1 // (a Saturday). So this is offset from the "Julian" day which starts the // numbering with 4713 BC. // // This is inspired by a talk by John Conway at the John von Neumann // National Supercomputer Center when he described his Doomsday algorithm // for figuring the day of the week. The code avoids explicitly doing ifs // (except for the decision of whether to use the Julian or Gregorian // calendar). Instead the equivalent result is achieved using integer // arithmetic. I got this idea from the routine for the day of the week // in MACLisp (I believe that that routine was written by Guy Steele). // // There are three issues to take care of // // 1. the rules for leap years, // 2. the inconvenient placement of leap days at the end of February, // 3. the irregular pattern of month lengths. // // We deal with these as follows: // // 1. Leap years are given by simple rules which are straightforward to // accommodate. // // 2. We simplify the calculations by moving January and February to the // previous year. Here we internally number the months March–December, // January, February as 0–9, 10, 11. // // 3. The pattern of month lengths from March through January is regular // with a 5-month period—31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31. The // 5-month period is 153 days long. Since February is now at the end of // the year, we don't need to include its length in this part of the // calculation. bool greg = gregorian(y, m, d); y += (m + 9) / 12 - 1; // Move Jan and Feb to previous year, m = (m + 9) % 12; // making March month 0. return (1461 * y) / 4 // Julian years converted to days. Julian year is 365 + // 1/4 = 1461/4 days. // Gregorian leap year corrections. The 2 offset with respect to the // Julian calendar synchronizes the vernal equinox with that at the time // of the Council of Nicea (325 AD). + (greg ? (y / 100) / 4 - (y / 100) + 2 : 0) + (153 * m + 2) / 5 // The zero-based start of the m'th month + d - 1 // The zero-based day - 305; // The number of days between March 1 and December 31. // This makes 0001-01-01 day 1 } /** * Convert a date to the day numbering sequentially starting with * 0001-01-01 as day 1. * * @param[in] y the year (must be positive). * @param[in] m the month, Jan = 1, etc. (must be positive). Default = 1. * @param[in] d the day of the month (must be positive). Default = 1. * @param[in] check whether to check the date. * @return the sequential day number. * * If \e check is true and the date is invalid an exception is thrown. **********************************************************************/ static int day(int y, int m, int d, bool check) { int s = day(y, m, d); if (!check) return s; int y1, m1, d1; date(s, y1, m1, d1); if (!(s > 0 && y == y1 && m == m1 && d == d1)) throw GeographicErr("Invalid date " + str(y) + "-" + str(m) + "-" + str(d) + (s > 0 ? "; use " + str(y1) + "-" + str(m1) + "-" + str(d1) : " before 0001-01-01")); return s; } /** * Given a day (counting from 0001-01-01 as day 1), return the date. * * @param[in] s the sequential day number (must be positive) * @param[out] y the year. * @param[out] m the month, Jan = 1, etc. * @param[out] d the day of the month. **********************************************************************/ static void date(int s, int& y, int& m, int& d) throw() { int c = 0; bool greg = gregorian(s); s += 305; // s = 0 on March 1, 1BC if (greg) { s -= 2; // The 2 day Gregorian offset // Determine century with the Gregorian rules for leap years. The // Gregorian year is 365 + 1/4 - 1/100 + 1/400 = 146097/400 days. c = (4 * s + 3) / 146097; s -= (c * 146097) / 4; // s = 0 at beginning of century } y = (4 * s + 3) / 1461; // Determine the year using Julian rules. s -= (1461 * y) / 4; // s = 0 at start of year, i.e., March 1 y += c * 100; // Assemble full year m = (5 * s + 2) / 153; // Determine the month s -= (153 * m + 2) / 5; // s = 0 at beginning of month d = s + 1; // Determine day of month y += (m + 2) / 12; // Move Jan and Feb back to original year m = (m + 2) % 12 + 1; // Renumber the months so January = 1 } /** * Given a date as a string in the format yyyy, yyyy-mm, or yyyy-mm-dd, * return the numeric values for the year, month, and day. No checking is * done on these values. * * @param[in] s the date in string format. * @param[out] y the year. * @param[out] m the month, Jan = 1, etc. * @param[out] d the day of the month. **********************************************************************/ static void date(const std::string& s, int& y, int& m, int& d) { int y1, m1 = 1, d1 = 1; const char* digits = "0123456789"; std::string::size_type p1 = s.find_first_not_of(digits); if (p1 == std::string::npos) y1 = num(s); else if (s[p1] != '-') throw GeographicErr("Delimiter not hyphen in date " + s); else if (p1 == 0) throw GeographicErr("Empty year field in date " + s); else { y1 = num(s.substr(0, p1)); if (++p1 == s.size()) throw GeographicErr("Empty month field in date " + s); std::string::size_type p2 = s.find_first_not_of(digits, p1); if (p2 == std::string::npos) m1 = num(s.substr(p1)); else if (s[p2] != '-') throw GeographicErr("Delimiter not hyphen in date " + s); else if (p2 == p1) throw GeographicErr("Empty month field in date " + s); else { m1 = num(s.substr(p1, p2 - p1)); if (++p2 == s.size()) throw GeographicErr("Empty day field in date " + s); d1 = num(s.substr(p2)); } } y = y1; m = m1; d = d1; } /** * Given the date, return the day of the week. * * @param[in] y the year (must be positive). * @param[in] m the month, Jan = 1, etc. (must be positive). * @param[in] d the day of the month (must be positive). * @return the day of the week with Sunday, Monday - Saturday = 0, 1 - 6. **********************************************************************/ static int dow(int y, int m, int d) throw() { return dow(day(y, m, d)); } /** * Given the sequential day, return the day of the week. * * @param[in] s the sequential day (must be positive). * @return the day of the week with Sunday, Monday - Saturday = 0, 1 - 6. **********************************************************************/ static int dow(int s) throw() { return (s + 5) % 7; // The 5 offset makes day 1 (0001-01-01) a Saturday. } /** * Convert a string representing a date to a fractional year. * * @tparam T the type of the argument. * @param[in] s the string to be converted. * @return the fractional year. * * The string is first read as an ordinary number (e.g., 2010 or 2012.5); * if this is successful, the value is returned. Otherwise the string * should be of the form yyyy-mm or yyyy-mm-dd and this is converted to a * number with 2010-01-01 giving 2010.0 and 2012-07-03 giving 2012.5. **********************************************************************/ template static T fractionalyear(const std::string& s) { try { return num(s); } catch (const std::exception&) { } int y, m, d; date(s, y, m, d); int t = day(y, m, d, true); return T(y) + T(t - day(y)) / T(day(y + 1) - day(y)); } /** * Convert a object of type T to a string. * * @tparam T the type of the argument. * @param[in] x the value to be converted. * @param[in] p the precision used (default -1). * @return the string representation. * * If \e p >= 0, then the number fixed format is used with p bits of * precision. With p < 0, there is no manipulation of the format. **********************************************************************/ template static std::string str(T x, int p = -1) { if (!std::numeric_limits::is_integer && !Math::isfinite(x)) return x < 0 ? std::string("-inf") : (x > 0 ? std::string("inf") : std::string("nan")); std::ostringstream s; if (p >= 0) s << std::fixed << std::setprecision(p); s << x; return s.str(); } /** * Convert a string to an object of type T. * * @tparam T the type of the return value. * @param[in] s the string to be converted. * @return object of type T **********************************************************************/ template static T num(const std::string& s) { T x; std::string errmsg; do { // Executed once (provides the ability to break) std::istringstream is(s); if (!(is >> x)) { errmsg = "Cannot decode " + s; break; } int pos = int(is.tellg()); // Returns -1 at end of string? if (!(pos < 0 || pos == int(s.size()))) { errmsg = "Extra text " + s.substr(pos) + " at end of " + s; break; } return x; } while (false); x = std::numeric_limits::is_integer ? 0 : nummatch(s); if (x == 0) throw GeographicErr(errmsg); return x; } /** * Match "nan" and "inf" (and variants thereof) in a string. * * @tparam T the type of the return value. * @param[in] s the string to be matched. * @return appropriate special value (+/-inf, nan) or 0 is none is found. **********************************************************************/ template static T nummatch(const std::string& s) { if (s.length() < 3) return 0; std::string t; t.resize(s.length()); std::transform(s.begin(), s.end(), t.begin(), (int(*)(int))std::toupper); for (size_t i = s.length(); i--;) t[i] = std::toupper(s[i]); int sign = t[0] == '-' ? -1 : 1; std::string::size_type p0 = t[0] == '-' || t[0] == '+' ? 1 : 0; std::string::size_type p1 = t.find_last_not_of('0'); if (p1 == std::string::npos || p1 + 1 < p0 + 3) return 0; // Strip off sign and trailing 0s t = t.substr(p0, p1 + 1 - p0); // Length at least 3 if (t == "NAN" || t == "1.#QNAN" || t == "1.#SNAN" || t == "1.#IND" || t == "1.#R") return Math::NaN(); else if (t == "INF" || t == "1.#INF") return sign * Math::infinity(); return 0; } /** * Read a simple fraction, e.g., 3/4, from a string to an object of type T. * * @tparam T the type of the return value. * @param[in] s the string to be converted. * @return object of type T **********************************************************************/ template static T fract(const std::string& s) { std::string::size_type delim = s.find('/'); return !(delim != std::string::npos && delim >= 1 && delim + 2 <= s.size()) ? num(s) : // delim in [1, size() - 2] num(s.substr(0, delim)) / num(s.substr(delim + 1)); } /** * Lookup up a character in a string. * * @param[in] s the string to be searched. * @param[in] c the character to look for. * @return the index of the first occurrence character in the string or -1 * is the character is not present. * * \e c is converted to upper case before search \e s. Therefore, it is * intended that \e s should not contain any lower case letters. **********************************************************************/ static int lookup(const std::string& s, char c) throw() { std::string::size_type r = s.find(toupper(c)); return r == std::string::npos ? -1 : int(r); } /** * Read data of type ExtT from a binary stream to an array of type IntT. * The data in the file is in (bigendp ? big : little)-endian format. * * @tparam ExtT the type of the objects in the binary stream (external). * @tparam IntT the type of the objects in the array (internal). * @tparam bigendp true if the external storage format is big-endian. * @param[in] str the input stream containing the data of type ExtT * (external). * @param[out] array the output array of type IntT (internal). * @param[in] num the size of the array. **********************************************************************/ template static inline void readarray(std::istream& str, IntT array[], size_t num) { if (sizeof(IntT) == sizeof(ExtT) && std::numeric_limits::is_integer == std::numeric_limits::is_integer) { // Data is compatible (aside from the issue of endian-ness). str.read(reinterpret_cast(array), num * sizeof(ExtT)); if (!str.good()) throw GeographicErr("Failure reading data"); if (bigendp != Math::bigendian) { // endian mismatch -> swap bytes for (size_t i = num; i--;) array[i] = Math::swab(array[i]); } } else { const int bufsize = 1024; // read this many values at a time ExtT buffer[bufsize]; // temporary buffer int k = int(num); // data values left to read int i = 0; // index into output array while (k) { int n = (std::min)(k, bufsize); str.read(reinterpret_cast(buffer), n * sizeof(ExtT)); if (!str.good()) throw GeographicErr("Failure reading data"); for (int j = 0; j < n; ++j) // fix endian-ness and cast to IntT array[i++] = IntT(bigendp == Math::bigendian ? buffer[j] : Math::swab(buffer[j])); k -= n; } } return; } /** * Read data of type ExtT from a binary stream to a vector array of type * IntT. The data in the file is in (bigendp ? big : little)-endian * format. * * @tparam ExtT the type of the objects in the binary stream (external). * @tparam IntT the type of the objects in the array (internal). * @tparam bigendp true if the external storage format is big-endian. * @param[in] str the input stream containing the data of type ExtT * (external). * @param[out] array the output vector of type IntT (internal). **********************************************************************/ template static inline void readarray(std::istream& str, std::vector& array) { readarray(str, &array[0], array.size()); } /** * Write data in an array of type IntT as type ExtT to a binary stream. * The data in the file is in (bigendp ? big : little)-endian format. * * @tparam ExtT the type of the objects in the binary stream (external). * @tparam IntT the type of the objects in the array (internal). * @tparam bigendp true if the external storage format is big-endian. * @param[out] str the output stream for the data of type ExtT (external). * @param[in] array the input array of type IntT (internal). * @param[in] num the size of the array. **********************************************************************/ template static inline void writearray(std::ostream& str, const IntT array[], size_t num) { if (sizeof(IntT) == sizeof(ExtT) && std::numeric_limits::is_integer == std::numeric_limits::is_integer && bigendp == Math::bigendian) { // Data is compatible (including endian-ness). str.write(reinterpret_cast(array), num * sizeof(ExtT)); if (!str.good()) throw GeographicErr("Failure writing data"); } else { const int bufsize = 1024; // write this many values at a time ExtT buffer[bufsize]; // temporary buffer int k = int(num); // data values left to write int i = 0; // index into output array while (k) { int n = (std::min)(k, bufsize); for (int j = 0; j < n; ++j) // cast to ExtT and fix endian-ness buffer[j] = bigendp == Math::bigendian ? ExtT(array[i++]) : Math::swab(ExtT(array[i++])); str.write(reinterpret_cast(buffer), n * sizeof(ExtT)); if (!str.good()) throw GeographicErr("Failure writing data"); k -= n; } } return; } /** * Write data in an array of type IntT as type ExtT to a binary stream. * The data in the file is in (bigendp ? big : little)-endian format. * * @tparam ExtT the type of the objects in the binary stream (external). * @tparam IntT the type of the objects in the array (internal). * @tparam bigendp true if the external storage format is big-endian. * @param[out] str the output stream for the data of type ExtT (external). * @param[in] array the input vector of type IntT (internal). **********************************************************************/ template static inline void writearray(std::ostream& str, std::vector& array) { writearray(str, &array[0], array.size()); } /** * Parse a KEY VALUE line. * * @param[in] line the input line. * @param[out] key the key. * @param[out] val the value. * @return whether a key was found. * * A # character and everything after it are discarded. If the results is * just white space, the routine returns false (and \e key and \e val are * not set). Otherwise the first token is taken to be the key and the rest * of the line (trimmed of leading and trailing white space) is the value. **********************************************************************/ static bool ParseLine(const std::string& line, std::string& key, std::string& val); }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_UTILITY_HPP geographiclib-1.21/include/GeographicLib/Config-ac.h.in0000644000175000017500000000507511745620414022555 0ustar frankiefrankie/* include/GeographicLib/Config-ac.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_FLOAT_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if the system has the type `long double'. */ #undef HAVE_LONG_DOUBLE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if stdbool.h conforms to C99. */ #undef HAVE_STDBOOL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif geographiclib-1.21/include/GeographicLib/TransverseMercator.hpp0000644000175000017500000002160411745620414024547 0ustar frankiefrankie/** * \file TransverseMercator.hpp * \brief Header for GeographicLib::TransverseMercator class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP) #define GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP \ "$Id: 94bb078aa13d2d7392cee5498aae7df6e9914e4a $" #include #if !defined(TM_TX_MAXPOW) /** * The order of the series approximation used in TransverseMercator. * TM_TX_MAXPOW can be set to any integer in [4, 8]. **********************************************************************/ #define TM_TX_MAXPOW \ (GEOGRAPHICLIB_PREC == 1 ? 6 : (GEOGRAPHICLIB_PREC == 0 ? 4 : 8)) #endif namespace GeographicLib { /** * \brief Transverse Mercator Projection * * This uses Krüger's method which evaluates the projection and its * inverse in terms of a series. See * - L. Krüger, * Konforme * Abbildung des Erdellipsoids in der Ebene (Conformal mapping of the * ellipsoidal earth to the plane), Royal Prussian Geodetic Institute, New * Series 52, 172 pp. (1912). * - C. F. F. Karney, * * Transverse Mercator with an accuracy of a few nanometers, * J. Geodesy 85(8), 475-485 (Aug. 2011); * preprint * arXiv:1002.1417. * * Krüger's method has been extended from 4th to 6th order. The maximum * error is 5 nm (5 nanometers), ground distance, for all positions within 35 * degrees of the central meridian. The error in the convergence is * 2e-15" and the relative error in the scale is 6e-12%%. See Sec. 4 of * arXiv:1002.1417 for details. * The speed penalty in going to 6th order is only about 1%. * TransverseMercatorExact is an alternative implementation of the projection * using exact formulas which yield accurate (to 8 nm) results over the * entire ellipsoid. * * The ellipsoid parameters and the central scale are set in the constructor. * The central meridian (which is a trivial shift of the longitude) is * specified as the \e lon0 argument of the TransverseMercator::Forward and * TransverseMercator::Reverse functions. The latitude of origin is taken to * be the equator. There is no provision in this class for specifying a * false easting or false northing or a different latitude of origin. * However these are can be simply included by the calling function. For * example, the UTMUPS class applies the false easting and false northing for * the UTM projections. A more complicated example is the British National * Grid ( * EPSG:7405) which requires the use of a latitude of origin. This is * implemented by the GeographicLib::OSGB class. * * See TransverseMercator.cpp for more information on the implementation. * * See \ref transversemercator for a discussion of this projection. * * Example of use: * \include example-TransverseMercator.cpp * * TransverseMercatorProj is a * command-line utility providing access to the functionality of * TransverseMercator and TransverseMercatorExact. **********************************************************************/ class GEOGRAPHIC_EXPORT TransverseMercator { private: typedef Math::real real; static const int maxpow_ = TM_TX_MAXPOW; static const real tol_; static const real overflow_; static const int numit_ = 5; real _a, _f, _k0, _e2, _e, _e2m, _c, _n; // _alp[0] and _bet[0] unused real _a1, _b1, _alp[maxpow_ + 1], _bet[maxpow_ + 1]; // tan(x) for x in [-pi/2, pi/2] ensuring that the sign is right static inline real tanx(real x) throw() { real t = std::tan(x); // Write the tests this way to ensure that tanx(NaN()) is NaN() return x >= 0 ? (!(t < 0) ? t : overflow_) : (!(t >= 0) ? t : -overflow_); } // Return e * atanh(e * x) for f >= 0, else return // - sqrt(-e2) * atan( sqrt(-e2) * x) for f < 0 inline real eatanhe(real x) const throw() { return _f >= 0 ? _e * Math::atanh(_e * x) : - _e * std::atan(_e * x); } public: /** * Constructor for a ellipsoid with * * @param[in] a equatorial radius (meters). * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere. * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flattening * to 1/\e f. * @param[in] k0 central scale factor. * * An exception is thrown if either of the axes of the ellipsoid or \e k0 * is not positive. **********************************************************************/ TransverseMercator(real a, real f, real k0); /** * Forward projection, from geographic to transverse Mercator. * * @param[in] lon0 central meridian of the projection (degrees). * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[out] x easting of point (meters). * @param[out] y northing of point (meters). * @param[out] gamma meridian convergence at point (degrees). * @param[out] k scale of projection at point. * * No false easting or northing is added. \e lat should be in the range * [-90, 90]; \e lon and \e lon0 should be in the range [-180, 360]. **********************************************************************/ void Forward(real lon0, real lat, real lon, real& x, real& y, real& gamma, real& k) const throw(); /** * Reverse projection, from transverse Mercator to geographic. * * @param[in] lon0 central meridian of the projection (degrees). * @param[in] x easting of point (meters). * @param[in] y northing of point (meters). * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] gamma meridian convergence at point (degrees). * @param[out] k scale of projection at point. * * No false easting or northing is added. \e lon0 should be in the range * [-180, 360]. The value of \e lon returned is in the range [-180, 180). **********************************************************************/ void Reverse(real lon0, real x, real y, real& lat, real& lon, real& gamma, real& k) const throw(); /** * TransverseMercator::Forward without returning the convergence and scale. **********************************************************************/ void Forward(real lon0, real lat, real lon, real& x, real& y) const throw() { real gamma, k; Forward(lon0, lat, lon, x, y, gamma, k); } /** * TransverseMercator::Reverse without returning the convergence and scale. **********************************************************************/ void Reverse(real lon0, real x, real y, real& lat, real& lon) const throw() { real gamma, k; Reverse(lon0, x, y, lat, lon, gamma, k); } /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ Math::real MajorRadius() const throw() { return _a; } /** * @return \e f the flattening of the ellipsoid. This is the value used in * the constructor. **********************************************************************/ Math::real Flattening() const throw() { return _f; } /// \cond SKIP /** * DEPRECATED * @return \e r the inverse flattening of the ellipsoid. **********************************************************************/ Math::real InverseFlattening() const throw() { return 1/_f; } /// \endcond /** * @return \e k0 central scale for the projection. This is the value of \e * k0 used in the constructor and is the scale on the central meridian. **********************************************************************/ Math::real CentralScale() const throw() { return _k0; } ///@} /** * A global instantiation of TransverseMercator with the WGS84 ellipsoid * and the UTM scale factor. However, unlike UTM, no false easting or * northing is added. **********************************************************************/ static const TransverseMercator UTM; }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP geographiclib-1.21/include/GeographicLib/LambertConformalConic.hpp0000644000175000017500000003533211745620414025124 0ustar frankiefrankie/** * \file LambertConformalConic.hpp * \brief Header for GeographicLib::LambertConformalConic class * * Copyright (c) Charles Karney (2010, 2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP) #define GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP \ "$Id: 9aef04f77098543818681966f13ef97ea47dedb4 $" #include #include namespace GeographicLib { /** * \brief Lambert Conformal Conic Projection * * Implementation taken from the report, * - J. P. Snyder, * Map Projections: A * Working Manual, USGS Professional Paper 1395 (1987), * pp. 107–109. * * This is a implementation of the equations in Snyder except that divided * differences have been used to transform the expressions into ones which * may be evaluated accurately and that Newton's method is used to invert the * projection. In this implementation, the projection correctly becomes the * Mercator projection or the polar stereographic projection when the * standard latitude is the equator or a pole. The accuracy of the * projections is about 10 nm (10 nanometers). * * The ellipsoid parameters, the standard parallels, and the scale on the * standard parallels are set in the constructor. Internally, the case with * two standard parallels is converted into a single standard parallel, the * latitude of tangency (also the latitude of minimum scale), with a scale * specified on this parallel. This latitude is also used as the latitude of * origin which is returned by LambertConformalConic::OriginLatitude. The * scale on the latitude of origin is given by * LambertConformalConic::CentralScale. The case with two distinct standard * parallels where one is a pole is singular and is disallowed. The central * meridian (which is a trivial shift of the longitude) is specified as the * \e lon0 argument of the LambertConformalConic::Forward and * LambertConformalConic::Reverse functions. There is no provision in this * class for specifying a false easting or false northing or a different * latitude of origin. However these are can be simply included by the * calling function. For example the Pennsylvania South state coordinate * system ( * EPSG:3364) is obtained by: * \include example-LambertConformalConic.cpp * * ConicProj is a command-line utility * providing access to the functionality of LambertConformalConic and * AlbersEqualArea. **********************************************************************/ class GEOGRAPHIC_EXPORT LambertConformalConic { private: typedef Math::real real; real _a, _f, _fm, _e2, _e, _e2m; real _sign, _n, _nc, _t0nm1, _scale, _lat0, _k0; real _scbet0, _tchi0, _scchi0, _psi0, _nrho0; static const real eps_; static const real epsx_; static const real tol_; static const real ahypover_; static const int numit_ = 5; static inline real hyp(real x) throw() { return Math::hypot(real(1), x); } // e * atanh(e * x) = log( ((1 + e*x)/(1 - e*x))^(e/2) ) if f >= 0 // - sqrt(-e2) * atan( sqrt(-e2) * x) if f < 0 inline real eatanhe(real x) const throw() { return _f >= 0 ? _e * Math::atanh(_e * x) : - _e * std::atan(_e * x); } // Divided differences // Definition: Df(x,y) = (f(x)-f(y))/(x-y) // See: W. M. Kahan and R. J. Fateman, // Symbolic computation of divided differences, // SIGSAM Bull. 33(3), 7-28 (1999) // http://dx.doi.org/10.1145/334714.334716 // http://www.cs.berkeley.edu/~fateman/papers/divdiff.pdf // // General rules // h(x) = f(g(x)): Dh(x,y) = Df(g(x),g(y))*Dg(x,y) // h(x) = f(x)*g(x): // Dh(x,y) = Df(x,y)*g(x) + Dg(x,y)*f(y) // = Df(x,y)*g(y) + Dg(x,y)*f(x) // = Df(x,y)*(g(x)+g(y))/2 + Dg(x,y)*(f(x)+f(y))/2 // // hyp(x) = sqrt(1+x^2): Dhyp(x,y) = (x+y)/(hyp(x)+hyp(y)) static inline real Dhyp(real x, real y, real hx, real hy) throw() // hx = hyp(x) { return (x + y) / (hx + hy); } // sn(x) = x/sqrt(1+x^2): Dsn(x,y) = (x+y)/((sn(x)+sn(y))*(1+x^2)*(1+y^2)) static inline real Dsn(real x, real y, real sx, real sy) throw() { // sx = x/hyp(x) real t = x * y; return t > 0 ? (x + y) * Math::sq( (sx * sy)/t ) / (sx + sy) : (x - y != 0 ? (sx - sy) / (x - y) : 1); } // Dlog1p(x,y) = log1p((x-y)/(1+y)/(x-y) static inline real Dlog1p(real x, real y) throw() { real t = x - y; if (t < 0) { t = -t; y = x; } return t != 0 ? Math::log1p(t / (1 + y)) / t : 1 / (1 + x); } // Dexp(x,y) = exp((x+y)/2) * 2*sinh((x-y)/2)/(x-y) static inline real Dexp(real x, real y) throw() { real t = (x - y)/2; return (t != 0 ? sinh(t)/t : real(1)) * exp((x + y)/2); } // Dsinh(x,y) = 2*sinh((x-y)/2)/(x-y) * cosh((x+y)/2) // cosh((x+y)/2) = (c+sinh(x)*sinh(y)/c)/2 // c=sqrt((1+cosh(x))*(1+cosh(y))) // cosh((x+y)/2) = sqrt( (sinh(x)*sinh(y) + cosh(x)*cosh(y) + 1)/2 ) static inline real Dsinh(real x, real y, real sx, real sy, real cx, real cy) // sx = sinh(x), cx = cosh(x) throw() { // real t = (x - y)/2, c = sqrt((1 + cx) * (1 + cy)); // return (t != 0 ? sinh(t)/t : real(1)) * (c + sx * sy / c) /2; real t = (x - y)/2; return (t != 0 ? sinh(t)/t : real(1)) * sqrt((sx * sy + cx * cy + 1) /2); } // Dasinh(x,y) = asinh((x-y)*(x+y)/(x*sqrt(1+y^2)+y*sqrt(1+x^2)))/(x-y) // = asinh((x*sqrt(1+y^2)-y*sqrt(1+x^2)))/(x-y) static inline real Dasinh(real x, real y, real hx, real hy) throw() { // hx = hyp(x) real t = x - y; return t != 0 ? Math::asinh(x*y > 0 ? t * (x+y) / (x*hy + y*hx) : x*hy - y*hx) / t : 1/hx; } // Deatanhe(x,y) = eatanhe((x-y)/(1-e^2*x*y))/(x-y) inline real Deatanhe(real x, real y) const throw() { real t = x - y, d = 1 - _e2 * x * y; return t != 0 ? eatanhe(t / d) / t : _e2 / d; } void Init(real sphi1, real cphi1, real sphi2, real cphi2, real k1) throw(); public: /** * Constructor with a single standard parallel. * * @param[in] a equatorial radius of ellipsoid (meters). * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere. * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flattening * to 1/\e f. * @param[in] stdlat standard parallel (degrees), the circle of tangency. * @param[in] k0 scale on the standard parallel. * * An exception is thrown if \e a or \e k0 is not positive or if \e stdlat * is not in the range [-90, 90]. **********************************************************************/ LambertConformalConic(real a, real f, real stdlat, real k0); /** * Constructor with two standard parallels. * * @param[in] a equatorial radius of ellipsoid (meters). * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere. * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flattening * to 1/\e f. * @param[in] stdlat1 first standard parallel (degrees). * @param[in] stdlat2 second standard parallel (degrees). * @param[in] k1 scale on the standard parallels. * * An exception is thrown if \e a or \e k0 is not positive or if \e stdlat1 * or \e stdlat2 is not in the range [-90, 90]. In addition, if either \e * stdlat1 or \e stdlat2 is a pole, then an exception is thrown if \e * stdlat1 is not equal \e stdlat2. **********************************************************************/ LambertConformalConic(real a, real f, real stdlat1, real stdlat2, real k1); /** * Constructor with two standard parallels specified by sines and cosines. * * @param[in] a equatorial radius of ellipsoid (meters). * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere. * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flattening * to 1/\e f. * @param[in] sinlat1 sine of first standard parallel. * @param[in] coslat1 cosine of first standard parallel. * @param[in] sinlat2 sine of second standard parallel. * @param[in] coslat2 cosine of second standard parallel. * @param[in] k1 scale on the standard parallels. * * This allows parallels close to the poles to be specified accurately. * This routine computes the latitude of origin and the scale at this * latitude. In the case where \e lat1 and \e lat2 are different, the * errors in this routines are as follows: if \e dlat = abs(\e lat2 - \e * lat1) <= 160o and max(abs(\e lat1), abs(\e lat2)) <= 90 - * min(0.0002, 2.2e-6(180 - \e dlat), 6e-8 dlat2) (in * degrees), then the error in the latitude of origin is less than * 4.5e-14o and the relative error in the scale is less than * 7e-15. **********************************************************************/ LambertConformalConic(real a, real f, real sinlat1, real coslat1, real sinlat2, real coslat2, real k1); /** * Set the scale for the projection. * * @param[in] lat (degrees). * @param[in] k scale at latitude \e lat (default 1). * * This allows a "latitude of true scale" to be specified. An exception is * thrown if \e k is not positive or if \e stdlat is not in the range [-90, * 90] **********************************************************************/ void SetScale(real lat, real k = real(1)); /** * Forward projection, from geographic to Lambert conformal conic. * * @param[in] lon0 central meridian longitude (degrees). * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[out] x easting of point (meters). * @param[out] y northing of point (meters). * @param[out] gamma meridian convergence at point (degrees). * @param[out] k scale of projection at point. * * The latitude origin is given by LambertConformalConic::LatitudeOrigin(). * No false easting or northing is added and \e lat should be in the range * [-90, 90]; \e lon and \e lon0 should be in the range [-180, 360]. The * error in the projection is less than about 10 nm (10 nanometers), true * distance, and the errors in the meridian convergence and scale are * consistent with this. The values of \e x and \e y returned for points * which project to infinity (i.e., one or both of the poles) will be large * but finite. **********************************************************************/ void Forward(real lon0, real lat, real lon, real& x, real& y, real& gamma, real& k) const throw(); /** * Reverse projection, from Lambert conformal conic to geographic. * * @param[in] lon0 central meridian longitude (degrees). * @param[in] x easting of point (meters). * @param[in] y northing of point (meters). * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] gamma meridian convergence at point (degrees). * @param[out] k scale of projection at point. * * The latitude origin is given by LambertConformalConic::LatitudeOrigin(). * No false easting or northing is added. \e lon0 should be in the range * [-180, 360]. The value of \e lon returned is in the range [-180, 180). * The error in the projection is less than about 10 nm (10 nanometers), * true distance, and the errors in the meridian convergence and scale are * consistent with this. **********************************************************************/ void Reverse(real lon0, real x, real y, real& lat, real& lon, real& gamma, real& k) const throw(); /** * LambertConformalConic::Forward without returning the convergence and * scale. **********************************************************************/ void Forward(real lon0, real lat, real lon, real& x, real& y) const throw() { real gamma, k; Forward(lon0, lat, lon, x, y, gamma, k); } /** * LambertConformalConic::Reverse without returning the convergence and * scale. **********************************************************************/ void Reverse(real lon0, real x, real y, real& lat, real& lon) const throw() { real gamma, k; Reverse(lon0, x, y, lat, lon, gamma, k); } /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ Math::real MajorRadius() const throw() { return _a; } /** * @return \e f the flattening of the ellipsoid. This is the * value used in the constructor. **********************************************************************/ Math::real Flattening() const throw() { return _f; } /// \cond SKIP /** * DEPRECATED * @return \e r the inverse flattening of the ellipsoid. **********************************************************************/ Math::real InverseFlattening() const throw() { return 1/_f; } /// \endcond /** * @return latitude of the origin for the projection (degrees). * * This is the latitude of minimum scale and equals the \e stdlat in the * 1-parallel constructor and lies between \e stdlat1 and \e stdlat2 in the * 2-parallel constructors. **********************************************************************/ Math::real OriginLatitude() const throw() { return _lat0; } /** * @return central scale for the projection. This is the scale on the * latitude of origin. **********************************************************************/ Math::real CentralScale() const throw() { return _k0; } ///@} /** * A global instantiation of LambertConformalConic with the WGS84 * ellipsoid, \e stdlat = 0, and \e k0 = 1. This degenerates to the * Mercator projection. **********************************************************************/ static const LambertConformalConic Mercator; }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP geographiclib-1.21/include/GeographicLib/Constants.hpp0000644000175000017500000003262411745620414022676 0ustar frankiefrankie/** * \file Constants.hpp * \brief Header for GeographicLib::Constants class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_CONSTANTS_HPP) #define GEOGRAPHICLIB_CONSTANTS_HPP \ "$Id: 895e4bd91979aae347436bbf6be37964f05f5b6f $" #include /** * A compile-time assert. Use C++11 static_assert, if available. **********************************************************************/ #if !defined(STATIC_ASSERT) # if defined(__GXX_EXPERIMENTAL_CXX0X__) # define STATIC_ASSERT static_assert # elif defined(_MSC_VER) && _MSC_VER >= 1600 # define STATIC_ASSERT static_assert # else # define STATIC_ASSERT(cond,reason) \ { enum{ STATIC_ASSERT_ENUM = 1/int(cond) }; } # endif #endif #if defined(__GNUC__) // Suppress "defined but not used" warnings # define RCSID_DECL(x) namespace \ { char VAR_ ## x [] __attribute__((used)) = x; } #else /** * Insertion of RCS Id strings into the object file. **********************************************************************/ # define RCSID_DECL(x) namespace { char VAR_ ## x [] = x; } #endif #if defined(_WIN32) && defined(GEOGRAPHIC_SHARED_LIB) # if defined(Geographic_EXPORTS) # define GEOGRAPHIC_EXPORT __declspec(dllexport) # else # define GEOGRAPHIC_EXPORT __declspec(dllimport) # endif #else # define GEOGRAPHIC_EXPORT #endif #include #include /** * \brief Namespace for %GeographicLib * * All of %GeographicLib is defined within the GeographicLib namespace. In * addition all the header files are included via %GeographicLib/filename. * This minimizes the likelihood of conflicts with other packages. **********************************************************************/ namespace GeographicLib { /** * \brief %Constants needed by %GeographicLib * * Define constants specifying the WGS84 ellipsoid, the UTM and UPS * projections, and various unit conversions. * * Example of use: * \include example-Constants.cpp **********************************************************************/ class GEOGRAPHIC_EXPORT Constants { private: typedef Math::real real; Constants(); // Disable constructor public: /** * A synonym for Math::degree(). **********************************************************************/ static inline Math::real degree() throw() { return Math::degree(); } /** * @return the number of radians in an arcminute. **********************************************************************/ static inline Math::real arcminute() throw() { return Math::degree() / 60; } /** * @return the number of radians in an arcsecond. **********************************************************************/ static inline Math::real arcsecond() throw() { return Math::degree() / 3600; } /** \name Ellipsoid parameters **********************************************************************/ ///@{ /** * @tparam T the type of the returned value. * @return the equatorial radius of WGS84 ellipsoid (6378137 m). **********************************************************************/ template static inline T WGS84_a() throw() { return T(6378137) * meter(); } /** * A synonym for WGS84_a(). **********************************************************************/ static inline Math::real WGS84_a() throw() { return WGS84_a(); } /** * @tparam T the type of the returned value. * @return the flattening of WGS84 ellipsoid (1/298.257223563). **********************************************************************/ template static inline T WGS84_f() throw() { return T(1) / ( T(298) + T(257223563) / T(1000000000) ); } /** * A synonym for WGS84_f(). **********************************************************************/ static inline Math::real WGS84_f() throw() { return WGS84_f(); } /** * @tparam T the type of the returned value. * @return the gravitational constant of the WGS84 ellipsoid, \e GM, in * m3 s-2. **********************************************************************/ template static inline T WGS84_GM() throw() { return T(3986004) * T(100000000) + T(41800000); } /** * @tparam T the type of the returned value. * @return the angular velocity of the the WGS84 ellipsoid, \e omega, in * rad s-1. **********************************************************************/ template static inline T WGS84_omega() throw() { return T(7292115) / (T(1000000) * T(100000)); } /// \cond SKIP /** * DEPRECATED * @return the reciprocal flattening of WGS84 ellipsoid. **********************************************************************/ template static inline T WGS84_r() throw() { return 1/WGS84_f(); } /** * DEPRECATED * A synonym for WGS84_r(). **********************************************************************/ /// \endcond static inline Math::real WGS84_r() throw() { return WGS84_r(); } /** * @tparam T the type of the returned value. * @return the equatorial radius of GRS80 ellipsoid, \e a, in m. **********************************************************************/ template static inline T GRS80_a() throw() { return T(6378137); } /** * @tparam T the type of the returned value. * @return the gravitational constant of the GRS80 ellipsoid, \e GM, in * m3 s-2. **********************************************************************/ template static inline T GRS80_GM() throw() { return T(3986005) * T(100000000); } /** * @tparam T the type of the returned value. * @return the angular velocity of the the GRS80 ellipsoid, \e omega, in * rad s-1. * * This is about 2*pi*366.25 / (365.25*24*3600) rad s-1. 365.25 * is the number of days in a Julian year and 365.35/366.25 converts from * solar days to sidereal days. Using the number of days in a Gregorian * year (365.2425) results in a worse approximation (because the Gregorian * year includes the precession of the earth's axis). **********************************************************************/ template static inline T GRS80_omega() throw() { return T(7292115) / (T(1000000) * T(100000)); } /** * @tparam T the type of the returned value. * @return the dynamical form factor of the GRS80 ellipsoid, * J2. **********************************************************************/ template static inline T GRS80_J2() throw() { return T(108263) / T(100000000); } /** * @tparam T the type of the returned value. * @return the central scale factor for UTM (0.9996). **********************************************************************/ template static inline T UTM_k0() throw() {return T(9996) / T(10000); } /** * A synonym for UTM_k0(). **********************************************************************/ static inline Math::real UTM_k0() throw() { return UTM_k0(); } /** * @tparam T the type of the returned value. * @return the central scale factor for UPS (0.994). **********************************************************************/ template static inline T UPS_k0() throw() { return T(994) / T(1000); } /** * A synonym for UPS_k0(). **********************************************************************/ static inline Math::real UPS_k0() throw() { return UPS_k0(); } ///@} /** \name SI units **********************************************************************/ ///@{ /** * @tparam T the type of the returned value. * @return the number of meters in a meter. * * This is unity, but this lets the internal system of units be changed if * necessary. **********************************************************************/ template static inline T meter() throw() { return T(1); } /** * A synonym for meter(). **********************************************************************/ static inline Math::real meter() throw() { return meter(); } /** * @return the number of meters in a kilometer. **********************************************************************/ static inline Math::real kilometer() throw() { return 1000 * meter(); } /** * @return the number of meters in a nautical mile (approximately 1 arc * minute) **********************************************************************/ static inline Math::real nauticalmile() throw() { return 1852 * meter(); } /** * @tparam T the type of the returned value. * @return the number of square meters in a square meter. * * This is unity, but this lets the internal system of units be changed if * necessary. **********************************************************************/ template static inline T square_meter() throw() { return meter() * meter(); } /** * A synonym for square_meter(). **********************************************************************/ static inline Math::real square_meter() throw() { return square_meter(); } /** * @return the number of square meters in a hectare. **********************************************************************/ static inline Math::real hectare() throw() { return 10000 * square_meter(); } /** * @return the number of square meters in a square kilometer. **********************************************************************/ static inline Math::real square_kilometer() throw() { return kilometer() * kilometer(); } /** * @return the number of square meters in a square nautical mile. **********************************************************************/ static inline Math::real square_nauticalmile() throw() { return nauticalmile() * nauticalmile(); } ///@} /** \name Anachronistic British units **********************************************************************/ ///@{ /** * @return the number of meters in an international foot. **********************************************************************/ static inline Math::real foot() throw() { return real(0.0254L) * 12 * meter(); } /** * @return the number of meters in a yard. **********************************************************************/ static inline Math::real yard() throw() { return 3 * foot(); } /** * @return the number of meters in a fathom. **********************************************************************/ static inline Math::real fathom() throw() { return 2 * yard(); } /** * @return the number of meters in a chain. **********************************************************************/ static inline Math::real chain() throw() { return 22 * yard(); } /** * @return the number of meters in a furlong. **********************************************************************/ static inline Math::real furlong() throw() { return 10 * chain(); } /** * @return the number of meters in a statute mile. **********************************************************************/ static inline Math::real mile() throw() { return 8 * furlong(); } /** * @return the number of square meters in an acre. **********************************************************************/ static inline Math::real acre() throw() { return chain() * furlong(); } /** * @return the number of square meters in a square statute mile. **********************************************************************/ static inline Math::real square_mile() throw() { return mile() * mile(); } ///@} /** \name Anachronistic US units **********************************************************************/ ///@{ /** * @return the number of meters in a US survey foot. **********************************************************************/ static inline Math::real surveyfoot() throw() { return real(1200) / real(3937) * meter(); } ///@} }; /** * \brief Exception handling for %GeographicLib * * A class to handle exceptions. It's derived from std::runtime_error so it * can be caught by the usual catch clauses. * * Example of use: * \include example-GeographicErr.cpp **********************************************************************/ class GeographicErr : public std::runtime_error { public: /** * Constructor * * @param[in] msg a string message, which is accessible in the catch * clause, via what(). **********************************************************************/ GeographicErr(const std::string& msg) : std::runtime_error(msg) {} }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_CONSTANTS_HPP geographiclib-1.21/include/GeographicLib/SphericalHarmonic.hpp0000644000175000017500000003357311745620414024321 0ustar frankiefrankie/** * \file SphericalHarmonic.hpp * \brief Header for GeographicLib::SphericalHarmonic class * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_SPHERICALHARMONIC_HPP) #define GEOGRAPHICLIB_SPHERICALHARMONIC_HPP \ "$Id: 6fa804c46efd01670cfb7835dd022791b60d2942 $" #include #include #include #include #include namespace GeographicLib { /** * \brief Spherical Harmonic series * * This class evaluates the spherical harmonic sum \verbatim V(x, y, z) = sum(n = 0..N)[ q^(n+1) * sum(m = 0..n)[ (C[n,m] * cos(m*lambda) + S[n,m] * sin(m*lambda)) * P[n,m](cos(theta)) ] ] \endverbatim * where * - p2 = x2 + y2, * - r2 = p2 + z2, * - \e q = a/r, * - \e theta = atan2(\e p, \e z) = the spherical \e colatitude, * - \e lambda = atan2(\e y, \e x) = the longitude. * - P\e nm(\e t) is the associated Legendre polynomial of degree * \e n and order \e m. * * Two normalizations are supported for P\e nm * - fully normalized denoted by SphericalHarmonic::FULL. * - Schmidt semi-normalized denoted by SphericalHarmonic::SCHMIDT. * * Clenshaw summation is used for the sums over both \e n and \e m. This * allows the computation to be carried out without the need for any * temporary arrays. See SphericalEngine.cpp for more information on the * implementation. * * References: * - C. W. Clenshaw, A note on the summation of Chebyshev series, * %Math. Tables Aids Comput. 9(51), 118-120 (1955). * - R. E. Deakin, Derivatives of the earth's potentials, Geomatics * Research Australasia 68, 31-60, (June 1998). * - W. A. Heiskanen and H. Moritz, Physical Geodesy, (Freeman, San * Francisco, 1967). (See Sec. 1-14, for a definition of Pbar.) * - S. A. Holmes and W. E. Featherstone, A unified approach to the * Clenshaw summation and the recursive computation of very high degree * and order normalised associated Legendre functions, J. Geod. 76(5), * 279-299 (2002). * - C. C. Tscherning and K. Poder, Some geodetic applications of Clenshaw * summation, Boll. Geod. Sci. Aff. 41(4), 349-375 (1982). * * Example of use: * \include example-SphericalHarmonic.cpp **********************************************************************/ class GEOGRAPHIC_EXPORT SphericalHarmonic { public: /** * Supported normalizations for the associated Legendre polynomials. **********************************************************************/ enum normalization { /** * Fully normalized associated Legendre polynomials. * * These are defined by Pnmfull(\e z) * = (-1)m sqrt(\e k (2\e n + 1) (\e n - \e m)! / (\e n * + \e m)!) Pnm(\e z), where * Pnm(\e z) is Ferrers * function (also known as the Legendre function on the cut or the * associated Legendre polynomial) http://dlmf.nist.gov/14.7.E10 and \e k * = 1 for \e m = 0 and \e k = 2 otherwise. * * The mean squared value of * Pnmfull(cos \e theta) cos(\e m \e * lambda) and Pnmfull(cos \e theta) * sin(\e m \e lambda) over the sphere is 1. * * @hideinitializer **********************************************************************/ FULL = SphericalEngine::FULL, /** * Schmidt semi-normalized associated Legendre polynomials. * * These are defined by Pnmschmidt(\e * z) = (-1)m sqrt(\e k (\e n - \e m)! / (\e n + \e * m)!) Pnm(\e z), where * Pnm(\e z) is Ferrers * function (also known as the Legendre function on the cut or the * associated Legendre polynomial) http://dlmf.nist.gov/14.7.E10 and \e k * = 1 for \e m = 0 and \e k = 2 otherwise. * * The mean squared value of * Pnmschmidt(cos \e theta) cos(\e m * \e lambda) and Pnmschmidt(cos \e * theta) sin(\e m \e lambda) over the sphere is 1/(2\e n + 1). * * @hideinitializer **********************************************************************/ SCHMIDT = SphericalEngine::SCHMIDT, /// \cond SKIP // These are deprecated... full = FULL, schmidt = SCHMIDT, /// \endcond }; private: typedef Math::real real; SphericalEngine::coeff _c[1]; real _a; unsigned _norm; public: /** * Constructor with a full set of coefficients specified. * * @param[in] C the coefficients \e C\e nm. * @param[in] S the coefficients \e S\e nm. * @param[in] N the maximum degree and order of the sum * @param[in] a the reference radius appearing in the definition of the * sum. * @param[in] norm the normalization for the associated Legendre * polynomials, either SphericalHarmonic::full (the default) or * SphericalHarmonic::schmidt. * * The coefficients \e C\e nm and \e S\e nm are * stored in the one-dimensional vectors \e C and \e S which must contain * (\e N + 1)(\e N + 2)/2 and N (\e N + 1)/2 elements, respectively, stored * in "column-major" order. Thus for \e N = 3, the order would be: * C00, * C10, * C20, * C30, * C11, * C21, * C31, * C22, * C32, * C33. * In general the (\e n,\e m) element is at index \e m*\e N - \e m*(\e m - * 1)/2 + \e n. The layout of \e S is the same except that the first * column is omitted (since the \e m = 0 terms never contribute to the sum) * and the 0th element is S11 * * The class stores pointers to the first elements of \e C and \e S. * These arrays should not be altered or destroyed during the lifetime of a * SphericalHarmonic object. **********************************************************************/ SphericalHarmonic(const std::vector& C, const std::vector& S, int N, real a, unsigned norm = FULL) : _a(a) , _norm(norm) { _c[0] = SphericalEngine::coeff(C, S, N); } /** * Constructor with a subset of coefficients specified. * * @param[in] C the coefficients \e C\e nm. * @param[in] S the coefficients \e S\e nm. * @param[in] N the degree used to determine the layout of \e C and \e S. * @param[in] nmx the maximum degree used in the sum. The sum over \e n is * from 0 thru \e nmx. * @param[in] mmx the maximum order used in the sum. The sum over \e m is * from 0 thru min(\e n, \e mmx). * @param[in] a the reference radius appearing in the definition of the * sum. * @param[in] norm the normalization for the associated Legendre * polynomials, either SphericalHarmonic::FULL (the default) or * SphericalHarmonic::SCHMIDT. * * The class stores pointers to the first elements of \e C and \e S. * These arrays should not be altered or destroyed during the lifetime of a * SphericalHarmonic object. **********************************************************************/ SphericalHarmonic(const std::vector& C, const std::vector& S, int N, int nmx, int mmx, real a, unsigned norm = FULL) : _a(a) , _norm(norm) { _c[0] = SphericalEngine::coeff(C, S, N, nmx, mmx); } /** * A default constructor so that the object can be created when the * constructor for another object is initialized. This default object can * then be reset with the default copy assignment operator. **********************************************************************/ SphericalHarmonic() {} /** * Compute the spherical harmonic sum. * * @param[in] x cartesian coordinate. * @param[in] y cartesian coordinate. * @param[in] z cartesian coordinate. * @return \e V the spherical harmonic sum. * * This routine requires constant memory and thus never throws an * exception. **********************************************************************/ Math::real operator()(real x, real y, real z) const throw() { real f[] = {1}; real v = 0; real dummy; switch (_norm) { case FULL: v = SphericalEngine::Value (_c, f, x, y, z, _a, dummy, dummy, dummy); break; case SCHMIDT: v = SphericalEngine::Value (_c, f, x, y, z, _a, dummy, dummy, dummy); break; } return v; } /** * Compute a spherical harmonic sum and its gradient. * * @param[in] x cartesian coordinate. * @param[in] y cartesian coordinate. * @param[in] z cartesian coordinate. * @param[out] gradx \e x component of the gradient * @param[out] grady \e y component of the gradient * @param[out] gradz \e z component of the gradient * @return \e V the spherical harmonic sum. * * This is the same as the previous function, except that the components of * the gradients of the sum in the \e x, \e y, and \e z directions are * computed. This routine requires constant memory and thus never throws * an exception. **********************************************************************/ Math::real operator()(real x, real y, real z, real& gradx, real& grady, real& gradz) const throw() { real f[] = {1}; real v = 0; switch (_norm) { case FULL: v = SphericalEngine::Value (_c, f, x, y, z, _a, gradx, grady, gradz); break; case SCHMIDT: v = SphericalEngine::Value (_c, f, x, y, z, _a, gradx, grady, gradz); break; } return v; } /** * Create a CircularEngine to allow the efficient evaluation of several * points on a circle of latitude. * * @param[in] p the radius of the circle. * @param[in] z the height of the circle above the equatorial plane. * @param[in] gradp if true the returned object will be able to compute the * gradient of the sum. * @return the CircularEngine object. * * SphericalHarmonic::operator()() exchanges the order of the sums in the * definition, i.e., sum(n = 0..N)[sum(m = 0..n)[...]] becomes sum(m = * 0..N)[sum(n = m..N)[...]]. SphericalHarmonic::Circle performs the inner * sum over degree \e n (which entails about N2 * operations). Calling CircularEngine::operator()() on the returned * object performs the outer sum over the order \e m (about \e N * operations). This routine may throw a bad_alloc exception in the * CircularEngine constructor. * * Here's an example of computing the spherical sum at a sequence of * longitudes without using a CircularEngine object \code SphericalHarmonic h(...); // Create the SphericalHarmonic object double r = 2, lat = 33, lon0 = 44, dlon = 0.01; double phi = lat * Math::degree(), z = r * sin(phi), p = r * cos(phi); for (int i = 0; i <= 100; ++i) { real lon = lon0 + i * dlon, lam = lon * Math::degree(); std::cout << lon << " " << h(p * cos(lam), p * sin(lam), z) << "\n"; } \endcode * Here is the same calculation done using a CircularEngine object. This * will be about N/2 times faster. \code SphericalHarmonic h(...); // Create the SphericalHarmonic object double r = 2, lat = 33, lon0 = 44, dlon = 0.01; double phi = lat * Math::degree(), z = r * sin(phi), p = r * cos(phi); CircularEngine c(h(p, z, false)); // Create the CircularEngine object for (int i = 0; i <= 100; ++i) { real lon = lon0 + i * dlon; std::cout << lon << " " << c(lon) << "\n"; } \endcode **********************************************************************/ CircularEngine Circle(real p, real z, bool gradp) const { real f[] = {1}; switch (_norm) { case FULL: return gradp ? SphericalEngine::Circle (_c, f, p, z, _a) : SphericalEngine::Circle (_c, f, p, z, _a); break; case SCHMIDT: default: // To avoid compiler warnings return gradp ? SphericalEngine::Circle (_c, f, p, z, _a) : SphericalEngine::Circle (_c, f, p, z, _a); break; } } /** * @return the zeroth SphericalEngine::coeff object. **********************************************************************/ const SphericalEngine::coeff& Coefficients() const throw() { return _c[0]; } }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_SPHERICALHARMONIC_HPP geographiclib-1.21/include/GeographicLib/SphericalHarmonic1.hpp0000644000175000017500000002572011745620414024375 0ustar frankiefrankie/** * \file SphericalHarmonic1.hpp * \brief Header for GeographicLib::SphericalHarmonic1 class * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_SPHERICALHARMONIC1_HPP) #define GEOGRAPHICLIB_SPHERICALHARMONIC1_HPP \ "$Id: 9dd895ded08db0f7fdd82159399da511f40a17e1 $" #include #include #include #include namespace GeographicLib { /** * \brief Spherical Harmonic series with a correction to the coefficients. * * This classes is similar to SphericalHarmonic, except that the coefficients * \e C\e nm are replaced by \e C\e nm + \e tau * C'\e nm (and similarly for \e S\e nm). * * Example of use: * \include example-SphericalHarmonic1.cpp **********************************************************************/ class GEOGRAPHIC_EXPORT SphericalHarmonic1 { public: /** * Supported normalizations for associate Legendre polynomials. **********************************************************************/ enum normalization { /** * Fully normalized associated Legendre polynomials. See * SphericalHarmonic::FULL for documentation. * * @hideinitializer **********************************************************************/ FULL = SphericalEngine::FULL, /** * Schmidt semi-normalized associated Legendre polynomials. See * SphericalHarmonic::SCHMIDT for documentation. * * @hideinitializer **********************************************************************/ SCHMIDT = SphericalEngine::SCHMIDT, /// \cond SKIP // These are deprecated... full = FULL, schmidt = SCHMIDT, /// \endcond }; private: typedef Math::real real; SphericalEngine::coeff _c[2]; real _a; unsigned _norm; public: /** * Constructor with a full set of coefficients specified. * * @param[in] C the coefficients \e C\e nm. * @param[in] S the coefficients \e S\e nm. * @param[in] N the maximum degree and order of the sum * @param[in] C1 the coefficients \e C'\e nm. * @param[in] S1 the coefficients \e S'\e nm. * @param[in] N1 the maximum degree and order of the correction * coefficients \e C'\e nm and \e S'\e nm. * @param[in] a the reference radius appearing in the definition of the * sum. * @param[in] norm the normalization for the associated Legendre * polynomials, either SphericalHarmonic1::FULL (the default) or * SphericalHarmonic1::SCHMIDT. * * See SphericalHarmonic for the way the coefficients should be stored. \e * N1 should satisfy \e N1 <= \e N. * * The class stores pointers to the first elements of \e C, \e S, \e * C', and \e S'. These arrays should not be altered or destroyed during * the lifetime of a SphericalHarmonic object. **********************************************************************/ SphericalHarmonic1(const std::vector& C, const std::vector& S, int N, const std::vector& C1, const std::vector& S1, int N1, real a, unsigned norm = FULL) : _a(a) , _norm(norm) { if (!(N1 <= N)) throw GeographicErr("N1 cannot be larger that N"); _c[0] = SphericalEngine::coeff(C, S, N); _c[1] = SphericalEngine::coeff(C1, S1, N1); } /** * Constructor with a subset of coefficients specified. * * @param[in] C the coefficients \e C\e nm. * @param[in] S the coefficients \e S\e nm. * @param[in] N the degree used to determine the layout of \e C and \e S. * @param[in] nmx the maximum degree used in the sum. The sum over \e n is * from 0 thru \e nmx. * @param[in] mmx the maximum order used in the sum. The sum over \e m is * from 0 thru min(\e n, \e mmx). * @param[in] C1 the coefficients \e C'\e nm. * @param[in] S1 the coefficients \e S'\e nm. * @param[in] N1 the degree used to determine the layout of \e C' and \e * S'. * @param[in] nmx1 the maximum degree used for \e C' and \e S'. * @param[in] mmx1 the maximum order used for \e C' and \e S'. * @param[in] a the reference radius appearing in the definition of the * sum. * @param[in] norm the normalization for the associated Legendre * polynomials, either SphericalHarmonic1::FULL (the default) or * SphericalHarmonic1::SCHMIDT. * * The class stores pointers to the first elements of \e C, \e S, \e * C', and \e S'. These arrays should not be altered or destroyed during * the lifetime of a SphericalHarmonic object. **********************************************************************/ SphericalHarmonic1(const std::vector& C, const std::vector& S, int N, int nmx, int mmx, const std::vector& C1, const std::vector& S1, int N1, int nmx1, int mmx1, real a, unsigned norm = FULL) : _a(a) , _norm(norm) { if (!(nmx1 <= nmx)) throw GeographicErr("nmx1 cannot be larger that nmx"); if (!(mmx1 <= mmx)) throw GeographicErr("mmx1 cannot be larger that mmx"); _c[0] = SphericalEngine::coeff(C, S, N, nmx, mmx); _c[1] = SphericalEngine::coeff(C1, S1, N1, nmx1, mmx1); } /** * A default constructor so that the object can be created when the * constructor for another object is initialized. This default object can * then be reset with the default copy assignment operator. **********************************************************************/ SphericalHarmonic1() {} /** * Compute a spherical harmonic sum with a correction term. * * @param[in] tau multiplier for correction coefficients \e C' and \e S'. * @param[in] x cartesian coordinate. * @param[in] y cartesian coordinate. * @param[in] z cartesian coordinate. * @return \e V the spherical harmonic sum. * * This routine requires constant memory and thus never throws * an exception. **********************************************************************/ Math::real operator()(real tau, real x, real y, real z) const throw() { real f[] = {1, tau}; real v = 0; real dummy; switch (_norm) { case FULL: v = SphericalEngine::Value (_c, f, x, y, z, _a, dummy, dummy, dummy); break; case SCHMIDT: v = SphericalEngine::Value (_c, f, x, y, z, _a, dummy, dummy, dummy); break; } return v; } /** * Compute a spherical harmonic sum with a correction term and its * gradient. * * @param[in] tau multiplier for correction coefficients \e C' and \e S'. * @param[in] x cartesian coordinate. * @param[in] y cartesian coordinate. * @param[in] z cartesian coordinate. * @param[out] gradx \e x component of the gradient * @param[out] grady \e y component of the gradient * @param[out] gradz \e z component of the gradient * @return \e V the spherical harmonic sum. * * This is the same as the previous function, except that the components of * the gradients of the sum in the \e x, \e y, and \e z directions are * computed. This routine requires constant memory and thus never throws * an exception. **********************************************************************/ Math::real operator()(real tau, real x, real y, real z, real& gradx, real& grady, real& gradz) const throw() { real f[] = {1, tau}; real v = 0; switch (_norm) { case FULL: v = SphericalEngine::Value (_c, f, x, y, z, _a, gradx, grady, gradz); break; case SCHMIDT: v = SphericalEngine::Value (_c, f, x, y, z, _a, gradx, grady, gradz); break; } return v; } /** * Create a CircularEngine to allow the efficient evaluation of several * points on a circle of latitude at a fixed value of \e tau. * * @param[in] tau the multiplier for the correction coefficients. * @param[in] p the radius of the circle. * @param[in] z the height of the circle above the equatorial plane. * @param[in] gradp if true the returned object will be able to compute the * gradient of the sum. * @return the CircularEngine object. * * SphericalHarmonic1::operator()() exchanges the order of the sums in the * definition, i.e., sum(n = 0..N)[sum(m = 0..n)[...]] becomes sum(m = * 0..N)[sum(n = m..N)[...]]. SphericalHarmonic1::Circle performs the * inner sum over degree \e n (which entails about N2 * operations). Calling CircularEngine::operator()() on the returned * object performs the outer sum over the order \e m (about \e N * operations). This routine may throw a bad_alloc exception in the * CircularEngine constructor. * * See SphericalHarmonic::Circle for an example of its use. **********************************************************************/ CircularEngine Circle(real tau, real p, real z, bool gradp) const { real f[] = {1, tau}; switch (_norm) { case FULL: return gradp ? SphericalEngine::Circle (_c, f, p, z, _a) : SphericalEngine::Circle (_c, f, p, z, _a); break; case SCHMIDT: default: // To avoid compiler warnings return gradp ? SphericalEngine::Circle (_c, f, p, z, _a) : SphericalEngine::Circle (_c, f, p, z, _a); break; } } /** * @return the zeroth SphericalEngine::coeff object. **********************************************************************/ const SphericalEngine::coeff& Coefficients() const throw() { return _c[0]; } /** * @return the first SphericalEngine::coeff object. **********************************************************************/ const SphericalEngine::coeff& Coefficients1() const throw() { return _c[1]; } }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_SPHERICALHARMONIC1_HPP geographiclib-1.21/include/GeographicLib/SphericalHarmonic2.hpp0000644000175000017500000003127511745620414024400 0ustar frankiefrankie/** * \file SphericalHarmonic2.hpp * \brief Header for GeographicLib::SphericalHarmonic2 class * * Copyright (c) Charles Karney (2011, 2012) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_SPHERICALHARMONIC2_HPP) #define GEOGRAPHICLIB_SPHERICALHARMONIC2_HPP \ "$Id: ce4cda614c1966dea65610bc73bc4db562677fa8 $" #include #include #include #include namespace GeographicLib { /** * \brief Spherical Harmonic series with two corrections to the coefficients. * * This classes is similar to SphericalHarmonic, except that the coefficients * \e C\e nm are replaced by \e C\e nm + \e tau' * C'\e nm + \e tau'' C''\e nm (and similarly for \e * S\e nm). * * Example of use: * \include example-SphericalHarmonic2.cpp **********************************************************************/ class GEOGRAPHIC_EXPORT SphericalHarmonic2 { public: /** * Supported normalizations for associate Legendre polynomials. **********************************************************************/ enum normalization { /** * Fully normalized associated Legendre polynomials. See * SphericalHarmonic::FULL for documentation. * * @hideinitializer **********************************************************************/ FULL = SphericalEngine::FULL, /** * Schmidt semi-normalized associated Legendre polynomials. See * SphericalHarmonic::SCHMIDT for documentation. * * @hideinitializer **********************************************************************/ SCHMIDT = SphericalEngine::SCHMIDT, /// \cond SKIP // These are deprecated... full = FULL, schmidt = SCHMIDT, /// \endcond }; private: typedef Math::real real; SphericalEngine::coeff _c[3]; real _a; unsigned _norm; public: /** * Constructor with a full set of coefficients specified. * * @param[in] C the coefficients \e C\e nm. * @param[in] S the coefficients \e S\e nm. * @param[in] N the maximum degree and order of the sum * @param[in] C1 the coefficients \e C'\e nm. * @param[in] S1 the coefficients \e S'\e nm. * @param[in] N1 the maximum degree and order of the first correction * coefficients \e C'\e nm and \e S'\e nm. * @param[in] C2 the coefficients \e C''\e nm. * @param[in] S2 the coefficients \e S''\e nm. * @param[in] N2 the maximum degree and order of the second correction * coefficients \e C'\e nm and \e S'\e nm. * @param[in] a the reference radius appearing in the definition of the * sum. * @param[in] norm the normalization for the associated Legendre * polynomials, either SphericalHarmonic2::FULL (the default) or * SphericalHarmonic2::SCHMIDT. * * See SphericalHarmonic for the way the coefficients should be stored. \e * N1 and \e N2 should satisfy \e N1 <= \e N and \e N2 <= \e N. * * The class stores pointers to the first elements of \e C, \e S, \e * C', \e S', \e C'', and \e S''. These arrays should not be altered or * destroyed during the lifetime of a SphericalHarmonic object. **********************************************************************/ SphericalHarmonic2(const std::vector& C, const std::vector& S, int N, const std::vector& C1, const std::vector& S1, int N1, const std::vector& C2, const std::vector& S2, int N2, real a, unsigned norm = FULL) : _a(a) , _norm(norm) { if (!(N1 <= N && N2 <= N)) throw GeographicErr("N1 and N2 cannot be larger that N"); _c[0] = SphericalEngine::coeff(C, S, N); _c[1] = SphericalEngine::coeff(C1, S1, N1); _c[2] = SphericalEngine::coeff(C2, S2, N2); } /** * Constructor with a subset of coefficients specified. * * @param[in] C the coefficients \e C\e nm. * @param[in] S the coefficients \e S\e nm. * @param[in] N the degree used to determine the layout of \e C and \e S. * @param[in] nmx the maximum degree used in the sum. The sum over \e n is * from 0 thru \e nmx. * @param[in] mmx the maximum order used in the sum. The sum over \e m is * from 0 thru min(\e n, \e mmx). * @param[in] C1 the coefficients \e C'\e nm. * @param[in] S1 the coefficients \e S'\e nm. * @param[in] N1 the degree used to determine the layout of \e C' and \e * S'. * @param[in] nmx1 the maximum degree used for \e C' and \e S'. * @param[in] mmx1 the maximum order used for \e C' and \e S'. * @param[in] C2 the coefficients \e C''\e nm. * @param[in] S2 the coefficients \e S''\e nm. * @param[in] N2 the degree used to determine the layout of \e C'' and \e * S''. * @param[in] nmx2 the maximum degree used for \e C'' and \e S''. * @param[in] mmx2 the maximum order used for \e C'' and \e S''. * @param[in] a the reference radius appearing in the definition of the * sum. * @param[in] norm the normalization for the associated Legendre * polynomials, either SphericalHarmonic2::FULL (the default) or * SphericalHarmonic2::SCHMIDT. * * The class stores pointers to the first elements of \e C, \e S, \e * C', \e S', \e C'', and \e S''. These arrays should not be altered or * destroyed during the lifetime of a SphericalHarmonic object. **********************************************************************/ SphericalHarmonic2(const std::vector& C, const std::vector& S, int N, int nmx, int mmx, const std::vector& C1, const std::vector& S1, int N1, int nmx1, int mmx1, const std::vector& C2, const std::vector& S2, int N2, int nmx2, int mmx2, real a, unsigned norm = FULL) : _a(a) , _norm(norm) { if (!(nmx1 <= nmx && nmx2 <= nmx)) throw GeographicErr("nmx1 and nmx2 cannot be larger that nmx"); if (!(mmx1 <= mmx && mmx2 <= mmx)) throw GeographicErr("mmx1 and mmx2cannot be larger that mmx"); _c[0] = SphericalEngine::coeff(C, S, N, nmx, mmx); _c[1] = SphericalEngine::coeff(C1, S1, N1, nmx1, mmx1); _c[2] = SphericalEngine::coeff(C2, S2, N2, nmx2, mmx2); } /** * A default constructor so that the object can be created when the * constructor for another object is initialized. This default object can * then be reset with the default copy assignment operator. **********************************************************************/ SphericalHarmonic2() {} /** * Compute a spherical harmonic sum with two correction terms. * * @param[in] tau1 multiplier for correction coefficients \e C' and \e S'. * @param[in] tau2 multiplier for correction coefficients \e C'' and \e S''. * @param[in] x cartesian coordinate. * @param[in] y cartesian coordinate. * @param[in] z cartesian coordinate. * @return \e V the spherical harmonic sum. * * This routine requires constant memory and thus never throws an * exception. **********************************************************************/ Math::real operator()(real tau1, real tau2, real x, real y, real z) const throw() { real f[] = {1, tau1, tau2}; real v = 0; real dummy; switch (_norm) { case FULL: v = SphericalEngine::Value (_c, f, x, y, z, _a, dummy, dummy, dummy); break; case SCHMIDT: v = SphericalEngine::Value (_c, f, x, y, z, _a, dummy, dummy, dummy); break; } return v; } /** * Compute a spherical harmonic sum with two correction terms and its * gradient. * * @param[in] tau1 multiplier for correction coefficients \e C' and \e S'. * @param[in] tau2 multiplier for correction coefficients \e C'' and \e S''. * @param[in] x cartesian coordinate. * @param[in] y cartesian coordinate. * @param[in] z cartesian coordinate. * @param[out] gradx \e x component of the gradient * @param[out] grady \e y component of the gradient * @param[out] gradz \e z component of the gradient * @return \e V the spherical harmonic sum. * * This is the same as the previous function, except that the components of * the gradients of the sum in the \e x, \e y, and \e z directions are * computed. This routine requires constant memory and thus never throws * an exception. **********************************************************************/ Math::real operator()(real tau1, real tau2, real x, real y, real z, real& gradx, real& grady, real& gradz) const throw() { real f[] = {1, tau1, tau2}; real v = 0; switch (_norm) { case FULL: v = SphericalEngine::Value (_c, f, x, y, z, _a, gradx, grady, gradz); break; case SCHMIDT: v = SphericalEngine::Value (_c, f, x, y, z, _a, gradx, grady, gradz); break; } return v; } /** * Create a CircularEngine to allow the efficient evaluation of several * points on a circle of latitude at fixed values of \e tau1 and \e tau2. * * @param[in] tau1 multiplier for correction coefficients \e C' and \e S'. * @param[in] tau2 multiplier for correction coefficients \e C'' and \e S''. * @param[in] p the radius of the circle. * @param[in] z the height of the circle above the equatorial plane. * @param[in] gradp if true the returned object will be able to compute the * gradient of the sum. * @return the CircularEngine object. * * SphericalHarmonic2::operator()() exchanges the order of the sums in the * definition, i.e., sum(n = 0..N)[sum(m = 0..n)[...]] becomes sum(m = * 0..N)[sum(n = m..N)[...]]. SphericalHarmonic2::Circle performs the * inner sum over degree \e n (which entails about N2 * operations). Calling CircularEngine::operator()() on the returned * object performs the outer sum over the order \e m (about \e N * operations). This routine may throw a bad_alloc exception in the * CircularEngine constructor. * * See SphericalHarmonic::Circle for an example of its use. **********************************************************************/ CircularEngine Circle(real tau1, real tau2, real p, real z, bool gradp) const { real f[] = {1, tau1, tau2}; switch (_norm) { case FULL: return gradp ? SphericalEngine::Circle (_c, f, p, z, _a) : SphericalEngine::Circle (_c, f, p, z, _a); break; case SCHMIDT: default: // To avoid compiler warnings return gradp ? SphericalEngine::Circle (_c, f, p, z, _a) : SphericalEngine::Circle (_c, f, p, z, _a); break; } } /** * @return the zeroth SphericalEngine::coeff object. **********************************************************************/ const SphericalEngine::coeff& Coefficients() const throw() { return _c[0]; } /** * @return the first SphericalEngine::coeff object. **********************************************************************/ const SphericalEngine::coeff& Coefficients1() const throw() { return _c[1]; } /** * @return the second SphericalEngine::coeff object. **********************************************************************/ const SphericalEngine::coeff& Coefficients2() const throw() { return _c[2]; } }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_SPHERICALHARMONIC2_HPP geographiclib-1.21/include/GeographicLib/MagneticCircle.hpp0000644000175000017500000001355411745620414023574 0ustar frankiefrankie/** * \file MagneticCircle.hpp * \brief Header for GeographicLib::MagneticCircle class * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_MAGNETICCIRCLE_HPP) #define GEOGRAPHICLIB_MAGNETICCIRCLE_HPP \ "$Id: 5b3adc58d894f36ca4206864eb565541f24ff492 $" #include #include #include #include namespace GeographicLib { /** * \brief Geomagnetic field on a circle of latitude * * Evaluate the earth's magnetic field on a circle of constant height and * latitude. This uses a CircleEngine to pre-evaluate the inner sum of the * spherical harmonic sum, allowing the values of the field at several * different longitudes to be evaluated rapidly. * * Use MagneticModel::Circle to create a MagneticCircle object. (The * constructor for this class is private.) * * Example of use: * \include example-MagneticCircle.cpp * * MagneticField is a command-line utility * providing access to the functionality of MagneticModel and MagneticCircle. **********************************************************************/ class GEOGRAPHIC_EXPORT MagneticCircle { private: typedef Math::real real; real _a, _f, _lat, _h, _t, _cphi, _sphi, _t1, _dt0; bool _interpolate; CircularEngine _circ0, _circ1; MagneticCircle(real a, real f, real lat, real h, real t, real cphi, real sphi, real t1, real dt0, bool interpolate, const CircularEngine& circ0, const CircularEngine& circ1) : _a(a) , _f(f) , _lat(lat) , _h(h) , _t(t) , _cphi(cphi) , _sphi(sphi) , _t1(t1) , _dt0(dt0) , _interpolate(interpolate) , _circ0(circ0) , _circ1(circ1) {} void Field(real lon, bool diffp, real& Bx, real& By, real& Bz, real& Bxt, real& Byt, real& Bzt) const throw(); friend class MagneticModel; // MagneticModel calls the private constructor public: /** * A default constructor for the normal gravity. This sets up an * uninitialized object which can be later replaced by the * MagneticModel::Circle. **********************************************************************/ MagneticCircle() : _a(-1) {} /** \name Compute the magnetic field **********************************************************************/ ///@{ /** * Evaluate the components of the geomagnetic field at a particular * longitude. * * @param[in] lon longitude of the point (degrees). * @param[out] Bx the easterly component of the magnetic field (nanotesla). * @param[out] By the northerly component of the magnetic field (nanotesla). * @param[out] Bz the vertical (up) component of the magnetic field * (nanotesla). **********************************************************************/ void operator()(real lon, real& Bx, real& By, real& Bz) const throw() { real dummy; Field(lon, false, Bx, By, Bz, dummy, dummy, dummy); } /** * Evaluate the components of the geomagnetic field and their time * derivatives at a particular longitude. * * @param[in] lon longitude of the point (degrees). * @param[out] Bx the easterly component of the magnetic field (nanotesla). * @param[out] By the northerly component of the magnetic field (nanotesla). * @param[out] Bz the vertical (up) component of the magnetic field * (nanotesla). * @param[out] Bxt the rate of change of \e Bx (nT/yr). * @param[out] Byt the rate of change of \e By (nT/yr). * @param[out] Bzt the rate of change of \e Bz (nT/yr). **********************************************************************/ void operator()(real lon, real& Bx, real& By, real& Bz, real& Bxt, real& Byt, real& Bzt) const throw() { Field(lon, true, Bx, By, Bz, Bxt, Byt, Bzt); } ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return true if the object has been initialized. **********************************************************************/ bool Init() const throw() { return _a > 0; } /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value inherited from the MagneticModel object used in the * constructor. **********************************************************************/ Math::real MajorRadius() const throw() { return Init() ? _a : Math::NaN(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the MagneticModel object used in the constructor. **********************************************************************/ Math::real Flattening() const throw() { return Init() ? _f : Math::NaN(); } /** * @return the latitude of the circle (degrees). **********************************************************************/ Math::real Latitude() const throw() { return Init() ? _lat : Math::NaN(); } /** * @return the height of the circle (meters). **********************************************************************/ Math::real Height() const throw() { return Init() ? _h : Math::NaN(); } /** * @return the time (fractional years). **********************************************************************/ Math::real Time() const throw() { return Init() ? _t : Math::NaN(); } ///@} }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_MAGNETICCIRCLE_HPP geographiclib-1.21/include/GeographicLib/GravityModel.hpp0000644000175000017500000005431111745620414023325 0ustar frankiefrankie/** * \file GravityModel.hpp * \brief Header for GeographicLib::GravityModel class * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GRAVITYMODEL_HPP) #define GEOGRAPHICLIB_GRAVITYMODEL_HPP \ "$Id: e1a573fb0148fa5bc408b2dbdb096d4cd3091bac $" #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about dll vs vector #pragma warning (push) #pragma warning (disable: 4251) #endif namespace GeographicLib { class GravityCircle; /** * \brief Model of the earth's gravity field * * Evaluate the earth's gravity field according to a model. The supported * models treat only the gravitational field exterior to the mass of the * earth. When computing the field at points near (but above) the surface of * the earth a small correction can be applied to account for the mass of the * atomsphere above the point in question; see \ref gravityatmos. * Determining the geoid height entails correcting for the mass of the earth * above the geoid. The egm96 and egm2008 include separate correction terms * to account for this mass. * * Definitions and terminology (from Heiskanen and Moritz, Sec 2-13): * - \e V = gravitational potential; * - \e Phi = rotational potential; * - \e W = \e V + \e Phi = \e T + \e U = total potential; * - V0 = normal gravitation potential; * - \e U = V0 + \e Phi = total normal potential; * - \e T = \e W - \e U = \e V - V0 = anomalous or * disturbing potential; * - g = grad \e W = gamma + delta; * - f = grad \e Phi; * - Gamma = grad V0; * - gamma = grad \e U; * - delta = grad \e T = gravity disturbance vector * = gP - gammaP; * - delta \e g = gravity disturbance = \e gP - \e * gammaP; * - Delta g = gravity anomaly vector = * gP - gammaQ; here the * line \e PQ is perpendicular to ellipsoid and the potential at \e P * equals the normal potential at \e Q; * - Delta \e g = gravity anomaly = \e gP - \e * gammaQ; * - (\e xi, \e eta) deflection of the vertical, the difference in * directions of gP and * gammaQ, \e xi = NS, \e eta = EW. * - \e X, \e Y, \e Z, geocentric coordinates; * - \e x, \e y, \e z, local cartesian coordinates used to denote the east, * north and up directions. * * See \ref gravity for details of how to install the gravity model and the * data format. * * References: * - W. A. Heiskanen and H. Moritz, Physical Geodesy (Freeman, San * Francisco, 1967). * * Example of use: * \include example-GravityModel.cpp * * Gravity is a command-line utility providing * access to the functionality of GravityModel and GravityCircle. **********************************************************************/ class GEOGRAPHIC_EXPORT GravityModel { private: typedef Math::real real; friend class GravityCircle; static const int idlength_ = 8; std::string _name, _dir, _description, _date, _filename, _id; real _amodel, _GMmodel, _zeta0, _corrmult; SphericalHarmonic::normalization _norm; NormalGravity _earth; std::vector _C, _S, _CC, _CS, _zonal; real _dzonal0; // A left over contribution to _zonal. SphericalHarmonic _gravitational; SphericalHarmonic1 _disturbing; SphericalHarmonic _correction; void ReadMetadata(const std::string& name); Math::real InternalT(real X, real Y, real Z, real& deltaX, real& deltaY, real& deltaZ, bool gradp, bool correct) const throw(); enum captype { CAP_NONE = 0U, CAP_G = 1U<<0, // implies potentials W and V CAP_T = 1U<<1, CAP_DELTA = 1U<<2 | CAP_T, // delta implies T? CAP_C = 1U<<3, CAP_GAMMA0 = 1U<<4, CAP_GAMMA = 1U<<5, CAP_ALL = 0x3FU, }; public: /** * Bit masks for the capabilities to be given to the GravityCircle object * produced by Circle. **********************************************************************/ enum mask { /** * No capabilities. * @hideinitializer **********************************************************************/ NONE = 0U, /** * Allow calls to GravityCircle::Gravity, GravityCircle::W, and * GravityCircle::V. * @hideinitializer **********************************************************************/ GRAVITY = CAP_G, /** * Allow calls to GravityCircle::Disturbance and GravityCircle::T. * @hideinitializer **********************************************************************/ DISTURBANCE = CAP_DELTA, /** * Allow calls to GravityCircle::T(real lon) (i.e., computing the * disturbing potential and not the gravity disturbance vector). * @hideinitializer **********************************************************************/ DISTURBING_POTENTIAL = CAP_T, /** * Allow calls to GravityCircle::SphericalAnomaly. * @hideinitializer **********************************************************************/ SPHERICAL_ANOMALY = CAP_DELTA | CAP_GAMMA, /** * Allow calls to GravityCircle::GeoidHeight. * @hideinitializer **********************************************************************/ GEOID_HEIGHT = CAP_T | CAP_C | CAP_GAMMA0, /** * All capabilities. * @hideinitializer **********************************************************************/ ALL = CAP_ALL, }; /** \name Setting up the gravity model **********************************************************************/ ///@{ /** * Construct a gravity model. * * @param[in] name the name of the model. * @param[in] path (optional) directory for data file. * * A filename is formed by appending ".egm" (World Gravity Model) to the * name. If \e path is specified (and is non-empty), then the file is * loaded from directory, \e path. Otherwise the path is given by * DefaultGravityPath(). This may throw an exception because the file does * not exist, is unreadable, or is corrupt. * * This file contains the metadata which specifies the properties of the * model. The coefficients for the spherical harmonic sums are obtained * from a file obtained by appending ".cof" to metadata file (so the * filename ends in ".egm.cof"). **********************************************************************/ explicit GravityModel(const std::string& name, const std::string& path = ""); ///@} /** \name Compute gravity in geodetic coordinates **********************************************************************/ ///@{ /** * Evaluate the gravity at an arbitrary point above (or below) the * ellipsoid. * * @param[in] lat the geographic latitude (degrees). * @param[in] lon the geographic longitude (degrees). * @param[in] h the height above the ellipsoid (meters). * @param[out] gx the easterly component of the acceleration * (m s-2). * @param[out] gy the northerly component of the acceleration * (m s-2). * @param[out] gz the upward component of the acceleration * (m s-2); this is usually negative. * @return \e W the sum of the gravitational and centrifugal potentials. * * The function includes the effects of the earth's rotation. **********************************************************************/ Math::real Gravity(real lat, real lon, real h, real& gx, real& gy, real& gz) const throw(); /** * Evaluate the gravity disturbance vector at an arbitrary point above (or * below) the ellipsoid. * * @param[in] lat the geographic latitude (degrees). * @param[in] lon the geographic longitude (degrees). * @param[in] h the height above the ellipsoid (meters). * @param[out] deltax the easterly component of the disturbance vector * (m s-2). * @param[out] deltay the northerly component of the disturbance vector * (m s-2). * @param[out] deltaz the upward component of the disturbance vector * (m s-2). * @return \e T the corresponding disturbing potential. **********************************************************************/ Math::real Disturbance(real lat, real lon, real h, real& deltax, real& deltay, real& deltaz) const throw(); /** * Evaluate the geoid height. * * @param[in] lat the geographic latitude (degrees). * @param[in] lon the geographic longitude (degrees). * @return \e N the height of the geoid above the ReferenceEllipsoid() * (meters). * * This calls NormalGravity::U for ReferenceEllipsoid(). Some * approximations are made in computing the geoid height so that the * results of the NGA codes are reproduced accurately. Details are given * in \ref gravitygeoid. **********************************************************************/ Math::real GeoidHeight(real lat, real lon) const throw(); /** * Evaluate the components of the gravity anomaly vector using the * spherical approximation. * * @param[in] lat the geographic latitude (degrees). * @param[in] lon the geographic longitude (degrees). * @param[in] h the height above the ellipsoid (meters). * @param[out] Dg01 the gravity anomaly (m s-2). * @param[out] xi the northerly component of the deflection of the vertical * (degrees). * @param[out] eta the easterly component of the deflection of the vertical * (degrees). * * The spherical approximation (see Heiskanen and Moritz, Sec 2-14) is used * so that the results of the NGA codes are reproduced accurately. * approximations used here. Details are given in \ref gravitygeoid. **********************************************************************/ void SphericalAnomaly(real lat, real lon, real h, real& Dg01, real& xi, real& eta) const throw(); ///@} /** \name Compute gravity in geocentric coordinates **********************************************************************/ ///@{ /** * Evaluate the components of the acceleration due to gravity and the * centrifugal acceleration in geocentric coordinates. * * @param[in] X geocentric coordinate of point (meters). * @param[in] Y geocentric coordinate of point (meters). * @param[in] Z geocentric coordinate of point (meters). * @param[out] gX the \e X component of the acceleration * (m s-2). * @param[out] gY the \e Y component of the acceleration * (m s-2). * @param[out] gZ the \e Z component of the acceleration * (m s-2). * @return \e W = \e V + \e Phi the sum of the gravitational and * centrifugal potentials (m2 s-2). * * This calls NormalGravity::U for ReferenceEllipsoid(). **********************************************************************/ Math::real W(real X, real Y, real Z, real& gX, real& gY, real& gZ) const throw(); /** * Evaluate the components of the acceleration due to gravity in geocentric * coordinates. * * @param[in] X geocentric coordinate of point (meters). * @param[in] Y geocentric coordinate of point (meters). * @param[in] Z geocentric coordinate of point (meters). * @param[out] GX the \e X component of the acceleration * (m s-2). * @param[out] GY the \e Y component of the acceleration * (m s-2). * @param[out] GZ the \e Z component of the acceleration * (m s-2). * @return \e V = \e W - \e Phi the gravitational potential * (m2 s-2). **********************************************************************/ Math::real V(real X, real Y, real Z, real& GX, real& GY, real& GZ) const throw(); /** * Evaluate the components of the gravity disturbance in geocentric * coordinates. * * @param[in] X geocentric coordinate of point (meters). * @param[in] Y geocentric coordinate of point (meters). * @param[in] Z geocentric coordinate of point (meters). * @param[out] deltaX the \e X component of the gravity disturbance * (m s-2). * @param[out] deltaY the \e Y component of the gravity disturbance * (m s-2). * @param[out] deltaZ the \e Z component of the gravity disturbance * (m s-2). * @return \e T = \e W - \e U the disturbing potential (also called the * anomalous potential) (m2 s-2). **********************************************************************/ Math::real T(real X, real Y, real Z, real& deltaX, real& deltaY, real& deltaZ) const throw() { return InternalT(X, Y, Z, deltaX, deltaY, deltaZ, true, true); } /** * Evaluate disturbing potential in geocentric coordinates. * * @param[in] X geocentric coordinate of point (meters). * @param[in] Y geocentric coordinate of point (meters). * @param[in] Z geocentric coordinate of point (meters). * @return \e T = \e W - \e U the disturbing potential (also called the * anomalous potential) (m2 s-2). **********************************************************************/ Math::real T(real X, real Y, real Z) const throw() { real dummy; return InternalT(X, Y, Z, dummy, dummy, dummy, false, true); } /** * Evaluate the components of the acceleration due to normal gravity and the * centrifugal acceleration in geocentric coordinates. * * @param[in] X geocentric coordinate of point (meters). * @param[in] Y geocentric coordinate of point (meters). * @param[in] Z geocentric coordinate of point (meters). * @param[out] gammaX the \e X component of the normal acceleration * (m s-2). * @param[out] gammaY the \e Y component of the normal acceleration * (m s-2). * @param[out] gammaZ the \e Z component of the normal acceleration * (m s-2). * @return \e U = V0 + \e Phi the sum of the * normal gravitational and centrifugal potentials * (m2 s-2). * * This calls NormalGravity::U for ReferenceEllipsoid(). **********************************************************************/ Math::real U(real X, real Y, real Z, real& gammaX, real& gammaY, real& gammaZ) const throw() { return _earth.U(X, Y, Z, gammaX, gammaY, gammaZ); } /** * Evaluate the centrifugal acceleration in geocentric coordinates. * * @param[in] X geocentric coordinate of point (meters). * @param[in] Y geocentric coordinate of point (meters). * @param[out] fX the \e X component of the centrifugal acceleration * (m s-2). * @param[out] fY the \e Y component of the centrifugal acceleration * (m s-2). * @return \e Phi the centrifugal potential (m2 s-2). * * This calls NormalGravity::Phi for ReferenceEllipsoid(). **********************************************************************/ Math::real Phi(real X, real Y, real& fX, real& fY) const throw() { return _earth.Phi(X, Y, fX, fY); } ///@} /** \name Compute gravity on a circle of constant latitude **********************************************************************/ ///@{ /** * Create a GravityCircle object to allow the gravity field at many points * with constant \e lat and \e h and varying \e lon to be computed * efficiently. * * @param[in] lat latitude of the point (degrees). * @param[in] h the height of the point above the ellipsoid (meters). * @param[in] caps bitor'ed combination of GravityModel::mask values * specifying the capabilities of the resulting GravityCircle object. * @return a GravityCircle object whose member functions computes the * gravitational field at a particular values of \e lon. * * The GravityModel::mask values are * - \e caps |= GravityModel::GRAVITY * - \e caps |= GravityModel::DISTURBANCE * - \e caps |= GravityModel::DISTURBING_POTENTIAL * - \e caps |= GravityModel::SPHERICAL_ANOMALY * - \e caps |= GravityModel::GEOID_HEIGHT * . * The default value of \e caps is GravityModel::ALL which turns on all the * capabilities. If an unsupported function is invoked, it will return * NaNs. Note that GravityModel::GEOID_HEIGHT will only be honored if \e h * = 0. * * If the field at several points on a circle of latitude need to be * calculated then creating a GravityCircle object and using its member * functions will be substantially faster, especially for high-degree * models. See \ref gravityparallel for an example of using GravityCircle * (together with OpenMP) to speed up the computation of geoid heights. **********************************************************************/ GravityCircle Circle(real lat, real h, unsigned caps = ALL) const; ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return the NormalGravity object for the reference ellipsoid. **********************************************************************/ const NormalGravity& ReferenceEllipsoid() const throw() { return _earth; } /** * @return the description of the gravity model, if available, in the data * file; if absent, return "NONE". **********************************************************************/ const std::string& Description() const throw() { return _description; } /** * @return date of the model; if absent, return "UNKNOWN". **********************************************************************/ const std::string& DateTime() const throw() { return _date; } /** * @return full file name used to load the gravity model. **********************************************************************/ const std::string& GravityFile() const throw() { return _filename; } /** * @return "name" used to load the gravity model (from the first argument * of the constructor, but this may be overridden by the model file). **********************************************************************/ const std::string& GravityModelName() const throw() { return _name; } /** * @return directory used to load the gravity model. **********************************************************************/ const std::string& GravityModelDirectory() const throw() { return _dir; } /** * @return \e a the equatorial radius of the ellipsoid (meters). **********************************************************************/ Math::real MajorRadius() const throw() { return _earth.MajorRadius(); } /** * @return \e GM the mass constant of the model * (m3 s-2); this is the product of \e G the * gravitational constant and \e M the mass of the earth (usually * including the mass of the earth's atmosphere). **********************************************************************/ Math::real MassConstant() const throw() { return _GMmodel; } /** * @return \e GM the mass constant of the ReferenceEllipsoid() * (m3 s-2). **********************************************************************/ Math::real ReferenceMassConstant() const throw() { return _earth.MassConstant(); } /** * @return \e omega the angular velocity of the model and the * ReferenceEllipsoid() (rad s-1). **********************************************************************/ Math::real AngularVelocity() const throw() { return _earth.AngularVelocity(); } /** * @return \e f the flattening of the ellipsoid. **********************************************************************/ Math::real Flattening() const throw() { return _earth.Flattening(); } ///@} /** * @return the default path for gravity model data files. * * This is the value of the environment variable GRAVITY_PATH, if set; * otherwise, it is $GEOGRAPHICLIB_DATA/gravity if the environment variable * GEOGRAPHICLIB_DATA is set; otherwise, it is a compile-time default * (/usr/local/share/GeographicLib/gravity on non-Windows systems and * C:/Documents and Settings/All Users/Application * Data/GeographicLib/gravity on Windows systems). **********************************************************************/ static std::string DefaultGravityPath(); /** * @return the default name for the gravity model. * * This is the value of the environment variable GRAVITY_NAME, if set, * otherwise, it is "egm96". The GravityModel class does not use * this function; it is just provided as a convenience for a calling * program when constructing a GravityModel object. **********************************************************************/ static std::string DefaultGravityName(); }; } // namespace GeographicLib #if defined(_MSC_VER) #pragma warning (pop) #endif #endif // GEOGRAPHICLIB_GRAVITYMODEL_HPP geographiclib-1.21/include/GeographicLib/MGRS.hpp0000644000175000017500000003143211745620414021466 0ustar frankiefrankie/** * \file MGRS.hpp * \brief Header for GeographicLib::MGRS class * * Copyright (c) Charles Karney (2008-2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_MGRS_HPP) #define GEOGRAPHICLIB_MGRS_HPP "$Id: 80e08da6eca9d9cf92c5adad148c64302df2573d $" #include #include #include #if defined(_MSC_VER) // Squelch warnings about dll vs string #pragma warning (push) #pragma warning (disable: 4251) #endif namespace GeographicLib { /** * \brief Convert between UTM/UPS and %MGRS * * MGRS is defined in Chapter 3 of * - J. W. Hager, L. L. Fry, S. S. Jacks, D. R. Hill, * * Datums, Ellipsoids, Grids, and Grid Reference Systems, * Defense Mapping Agency, Technical Manual TM8358.1 (1990). * * This implementation has the following properties: * - The conversions are closed, i.e., output from Forward is legal input for * Reverse and vice versa. Conversion in both directions preserve the * UTM/UPS selection and the UTM zone. * - Forward followed by Reverse and vice versa is approximately the * identity. (This is affected in predictable ways by errors in * determining the latitude band and by loss of precision in the MGRS * coordinates.) * - All MGRS coordinates truncate to legal 100 km blocks. All MGRS * coordinates with a legal 100 km block prefix are legal (even though the * latitude band letter may now belong to a neighboring band). * - The range of UTM/UPS coordinates allowed for conversion to MGRS * coordinates is the maximum consistent with staying within the letter * ranges of the MGRS scheme. * - All the transformations are implemented as static methods in the MGRS * class. * * The NGA software package * geotrans * also provides conversions to and from MGRS. Version 3.0 (and earlier) * suffers from some drawbacks: * - Inconsistent rules are used to determine the whether a particular MGRS * coordinate is legal. A more systematic approach is taken here. * - The underlying projections are not very accurately implemented. * * Example of use: * \include example-MGRS.cpp **********************************************************************/ class GEOGRAPHIC_EXPORT MGRS { private: typedef Math::real real; // The smallest length s.t., 1.0e7 - eps_ < 1.0e7 (approx 1.9 nm) static const real eps_; // The smallest angle s.t., 90 - eps_ < 90 (approx 50e-12 arcsec) static const real angeps_; static const std::string hemispheres_; static const std::string utmcols_[3]; static const std::string utmrow_; static const std::string upscols_[4]; static const std::string upsrows_[2]; static const std::string latband_; static const std::string upsband_; static const std::string digits_; static const int mineasting_[4]; static const int maxeasting_[4]; static const int minnorthing_[4]; static const int maxnorthing_[4]; enum { base_ = 10, // Top-level tiles are 10^5 m = 100 km on a side tilelevel_ = 5, // Period of UTM row letters utmrowperiod_ = 20, // Row letters are shifted by 5 for even zones utmevenrowshift_ = 5, // Maximum precision is um maxprec_ = 5 + 6, }; static void CheckCoords(bool utmp, bool& northp, real& x, real& y); static int UTMRow(int iband, int icol, int irow) throw(); friend class UTMUPS; // UTMUPS::StandardZone calls LatitudeBand // Return latitude band number [-10, 10) for the give latitude (degrees). // The bands are reckoned in include their southern edges. static int LatitudeBand(real lat) throw() { int ilat = int(std::floor(lat)); return (std::max)(-10, (std::min)(9, (ilat + 80)/8 - 10)); } // UTMUPS access these enums enum { tile_ = 100000, // Size MGRS blocks minutmcol_ = 1, maxutmcol_ = 9, minutmSrow_ = 10, maxutmSrow_ = 100, // Also used for UTM S false northing minutmNrow_ = 0, // Also used for UTM N false northing maxutmNrow_ = 95, minupsSind_ = 8, // These 4 ind's apply to easting and northing maxupsSind_ = 32, minupsNind_ = 13, maxupsNind_ = 27, upseasting_ = 20, // Also used for UPS false northing utmeasting_ = 5, // UTM false easting // Difference between S hemisphere northing and N hemisphere northing utmNshift_ = (maxutmSrow_ - minutmNrow_) * tile_ }; MGRS(); // Disable constructor public: /** * Convert UTM or UPS coordinate to an MGRS coordinate. * * @param[in] zone UTM zone (zero means UPS). * @param[in] northp hemisphere (true means north, false means south). * @param[in] x easting of point (meters). * @param[in] y northing of point (meters). * @param[in] prec precision relative to 100 km. * @param[out] mgrs MGRS string. * * \e prec specifies the precision of the MGRS string as follows: * - prec = 0 (min), 100 km * - prec = 1, 10 km * - prec = 2, 1 km * - prec = 3, 100 m * - prec = 4, 10 m * - prec = 5, 1 m * - prec = 6, 0.1 m * - prec = 11 (max), 1 um * * UTM eastings are allowed to be in the range [100 km, 900 km], northings * are allowed to be in in [0 km, 9500 km] for the northern hemisphere and * in [1000 km, 10000 km] for the southern hemisphere. (However UTM * northings can be continued across the equator. So the actual limits on * the northings are [-9000 km, 9500 km] for the "northern" hemisphere and * [1000 km, 19500 km] for the "southern" hemisphere.) * * UPS eastings/northings are allowed to be in the range [1300 km, 2700 km] * in the northern hemisphere and in [800 km, 3200 km] in the southern * hemisphere. * * The ranges are 100 km more restrictive that for the conversion between * geographic coordinates and UTM and UPS given by UTMUPS. These * restrictions are dictated by the allowed letters in MGRS coordinates. * The choice of 9500 km for the maximum northing for northern hemisphere * and of 1000 km as the minimum northing for southern hemisphere provide * at least 0.5 degree extension into standard UPS zones. The upper ends * of the ranges for the UPS coordinates is dictated by requiring symmetry * about the meridians 0E and 90E. * * All allowed UTM and UPS coordinates may now be converted to legal MGRS * coordinates with the proviso that eastings and northings on the upper * boundaries are silently reduced by about 4 nm (4 nanometers) to place * them \e within the allowed range. (This includes reducing a southern * hemisphere northing of 10000 km by 4 nm so that it is placed in latitude * band M.) The UTM or UPS coordinates are truncated to requested * precision to determine the MGRS coordinate. Thus in UTM zone 38N, the * square area with easting in [444 km, 445 km) and northing in [3688 km, * 3689 km) maps to MGRS coordinate 38SMB4488 (at \e prec = 2, 1 km), * Khulani Sq., Baghdad. * * The UTM/UPS selection and the UTM zone is preserved in the conversion to * MGRS coordinate. Thus for \e zone > 0, the MGRS coordinate begins with * the zone number followed by one of [C–M] for the southern * hemisphere and [N–X] for the northern hemisphere. For \e zone = * 0, the MGRS coordinates begins with one of [AB] for the southern * hemisphere and [XY] for the northern hemisphere. * * The conversion to the MGRS is exact for prec in [0, 5] except that a * neighboring latitude band letter may be given if the point is within 5nm * of a band boundary. For prec in [6, 11], the conversion is accurate to * roundoff. * * If \e x or \e y is NaN or if \e zone is UTMUPS::INVALID, the returned * MGRS string is "INVALID". * * Return the result via a reference argument to avoid the overhead of * allocating a potentially large number of small strings. If an error is * thrown, then \e mgrs is unchanged. **********************************************************************/ static void Forward(int zone, bool northp, real x, real y, int prec, std::string& mgrs); /** * Convert UTM or UPS coordinate to an MGRS coordinate when the latitude is * known. * * @param[in] zone UTM zone (zero means UPS). * @param[in] northp hemisphere (true means north, false means south). * @param[in] x easting of point (meters). * @param[in] y northing of point (meters). * @param[in] lat latitude (degrees). * @param[in] prec precision relative to 100 km. * @param[out] mgrs MGRS string. * * The latitude is ignored for \e zone = 0 (UPS); otherwise the latitude is * used to determine the latitude band and this is checked for consistency * using the same tests as Reverse. **********************************************************************/ static void Forward(int zone, bool northp, real x, real y, real lat, int prec, std::string& mgrs); /** * Convert a MGRS coordinate to UTM or UPS coordinates. * * @param[in] mgrs MGRS string. * @param[out] zone UTM zone (zero means UPS). * @param[out] northp hemisphere (true means north, false means south). * @param[out] x easting of point (meters). * @param[out] y northing of point (meters). * @param[out] prec precision relative to 100 km. * @param[in] centerp if true (default), return center of the MGRS square, * else return SW (lower left) corner. * * All conversions from MGRS to UTM/UPS are permitted provided the MGRS * coordinate is a possible result of a conversion in the other direction. * (The leading 0 may be dropped from an input MGRS coordinate for UTM * zones 1–9.) In addition, MGRS coordinates with a neighboring * latitude band letter are permitted provided that some portion of the * 100 km block is within the given latitude band. Thus * - 38VLS and 38WLS are allowed (latitude 64N intersects the square * 38[VW]LS); but 38VMS is not permitted (all of 38VMS is north of 64N) * - 38MPE and 38NPF are permitted (they straddle the equator); but 38NPE * and 38MPF are not permitted (the equator does not intersect either * block). * - Similarly ZAB and YZB are permitted (they straddle the prime * meridian); but YAB and ZZB are not (the prime meridian does not * intersect either block). * * The UTM/UPS selection and the UTM zone is preserved in the conversion * from MGRS coordinate. The conversion is exact for prec in [0, 5]. With * centerp = true the conversion from MGRS to geographic and back is * stable. This is not assured if \e centerp = false. * * If an error is thrown, then the arguments are unchanged. **********************************************************************/ static void Reverse(const std::string& mgrs, int& zone, bool& northp, real& x, real& y, int& prec, bool centerp = true); /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the WGS84 ellipsoid (meters). * * (The WGS84 value is returned because the UTM and UPS projections are * based on this ellipsoid.) **********************************************************************/ static Math::real MajorRadius() throw() { return UTMUPS::MajorRadius(); } /** * @return \e f the flattening of the WGS84 ellipsoid. * * (The WGS84 value is returned because the UTM and UPS projections are * based on this ellipsoid.) **********************************************************************/ static Math::real Flattening() throw() { return UTMUPS::Flattening(); } ///@} /// \cond SKIP /** * DEPRECATED * @return \e r the inverse flattening of the WGS84 ellipsoid. **********************************************************************/ static Math::real InverseFlattening() throw() { return UTMUPS::InverseFlattening(); } /// \endcond }; } // namespace GeographicLib #if defined(_MSC_VER) #pragma warning (pop) #endif #endif // GEOGRAPHICLIB_MGRS_HPP geographiclib-1.21/include/Makefile.am0000644000175000017500000000307211745620414017541 0ustar frankiefrankie# # Makefile.am # # Copyright (C) 2009, Francesco P. Lovergine # $Id: d1953212c87ff569e24f893ea76ed3a55127eff1 $ nobase_include_HEADERS = GeographicLib/Accumulator.hpp \ GeographicLib/AlbersEqualArea.hpp \ GeographicLib/AzimuthalEquidistant.hpp \ GeographicLib/CassiniSoldner.hpp \ GeographicLib/CircularEngine.hpp \ GeographicLib/Constants.hpp \ GeographicLib/DMS.hpp \ GeographicLib/EllipticFunction.hpp \ GeographicLib/GeoCoords.hpp \ GeographicLib/Geocentric.hpp \ GeographicLib/Geodesic.hpp \ GeographicLib/GeodesicLine.hpp \ GeographicLib/Geoid.hpp \ GeographicLib/Gnomonic.hpp \ GeographicLib/GravityCircle.hpp \ GeographicLib/GravityModel.hpp \ GeographicLib/LambertConformalConic.hpp \ GeographicLib/LocalCartesian.hpp \ GeographicLib/MGRS.hpp \ GeographicLib/MagneticCircle.hpp \ GeographicLib/MagneticModel.hpp \ GeographicLib/Math.hpp \ GeographicLib/NormalGravity.hpp \ GeographicLib/OSGB.hpp \ GeographicLib/PolarStereographic.hpp \ GeographicLib/PolygonArea.hpp \ GeographicLib/SphericalEngine.hpp \ GeographicLib/SphericalHarmonic.hpp \ GeographicLib/SphericalHarmonic1.hpp \ GeographicLib/SphericalHarmonic2.hpp \ GeographicLib/TransverseMercator.hpp \ GeographicLib/TransverseMercatorExact.hpp \ GeographicLib/UTMUPS.hpp \ GeographicLib/Utility.hpp \ GeographicLib/Config.h geoids_dir=$(datadir)/GeographicLib/geoids DEFS=-DGEOID_DEFAULT_PATH=\"$(geoids_dir)\" @DEFS@ EXTRA_DIST = Makefile.mk GeographicLib/CMakeLists.txt GeographicLib/Config.h.in geographiclib-1.21/include/Makefile.in0000644000175000017500000003644711745620414017566 0ustar frankiefrankie# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Makefile.am # # Copyright (C) 2009, Francesco P. Lovergine # $Id: d1953212c87ff569e24f893ea76ed3a55127eff1 $ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = include DIST_COMMON = $(nobase_include_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(includedir)" HEADERS = $(nobase_include_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = -DGEOID_DEFAULT_PATH=\"$(geoids_dir)\" @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POW_LIB = @POW_LIB@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ nobase_include_HEADERS = GeographicLib/Accumulator.hpp \ GeographicLib/AlbersEqualArea.hpp \ GeographicLib/AzimuthalEquidistant.hpp \ GeographicLib/CassiniSoldner.hpp \ GeographicLib/CircularEngine.hpp \ GeographicLib/Constants.hpp \ GeographicLib/DMS.hpp \ GeographicLib/EllipticFunction.hpp \ GeographicLib/GeoCoords.hpp \ GeographicLib/Geocentric.hpp \ GeographicLib/Geodesic.hpp \ GeographicLib/GeodesicLine.hpp \ GeographicLib/Geoid.hpp \ GeographicLib/Gnomonic.hpp \ GeographicLib/GravityCircle.hpp \ GeographicLib/GravityModel.hpp \ GeographicLib/LambertConformalConic.hpp \ GeographicLib/LocalCartesian.hpp \ GeographicLib/MGRS.hpp \ GeographicLib/MagneticCircle.hpp \ GeographicLib/MagneticModel.hpp \ GeographicLib/Math.hpp \ GeographicLib/NormalGravity.hpp \ GeographicLib/OSGB.hpp \ GeographicLib/PolarStereographic.hpp \ GeographicLib/PolygonArea.hpp \ GeographicLib/SphericalEngine.hpp \ GeographicLib/SphericalHarmonic.hpp \ GeographicLib/SphericalHarmonic1.hpp \ GeographicLib/SphericalHarmonic2.hpp \ GeographicLib/TransverseMercator.hpp \ GeographicLib/TransverseMercatorExact.hpp \ GeographicLib/UTMUPS.hpp \ GeographicLib/Utility.hpp \ GeographicLib/Config.h geoids_dir = $(datadir)/GeographicLib/geoids EXTRA_DIST = Makefile.mk GeographicLib/CMakeLists.txt GeographicLib/Config.h.in all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu include/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-nobase_includeHEADERS: $(nobase_include_HEADERS) @$(NORMAL_INSTALL) test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \ $(am__nobase_list) | while read dir files; do \ xfiles=; for file in $$files; do \ if test -f "$$file"; then xfiles="$$xfiles $$file"; \ else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \ test -z "$$xfiles" || { \ test "x$$dir" = x. || { \ echo "$(MKDIR_P) '$(DESTDIR)$(includedir)/$$dir'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)/$$dir"; }; \ echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(includedir)/$$dir'"; \ $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(includedir)/$$dir" || exit $$?; }; \ done uninstall-nobase_includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \ $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(includedir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(HEADERS) installdirs: for dir in "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-nobase_includeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-nobase_includeHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool ctags distclean distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-nobase_includeHEADERS \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-nobase_includeHEADERS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: geographiclib-1.21/include/Makefile.mk0000644000175000017500000000166711745620414017563 0ustar frankiefrankie# $Id: 197ef293b5d7f1c3e139caf577ba5d9798721826 $ MODULES = AlbersEqualArea \ AzimuthalEquidistant \ CassiniSoldner \ CircularEngine \ DMS \ EllipticFunction \ GeoCoords \ Geocentric \ Geodesic \ GeodesicLine \ Geoid \ Gnomonic \ GravityCircle \ GravityModel \ LambertConformalConic \ LocalCartesian \ MGRS \ MagneticCircle \ MagneticModel \ NormalGravity \ OSGB \ PolarStereographic \ PolygonArea \ SphericalEngine \ TransverseMercator \ TransverseMercatorExact \ UTMUPS \ Utility EXTRAHEADERS = Accumulator \ Constants \ Math \ SphericalHarmonic \ SphericalHarmonic1 \ SphericalHarmonic2 PREFIX = /usr/local LIBNAME = GeographicLib HEADERS = $(LIBNAME)/Config.h \ $(patsubst %,$(LIBNAME)/%.hpp,$(EXTRAHEADERS) $(MODULES)) DEST = $(PREFIX)/include/$(LIBNAME) INSTALL = install -b all: @: install: test -d $(DEST) || mkdir -p $(DEST) $(INSTALL) -m 644 $(HEADERS) $(DEST)/ clean: @: .PHONY: all install clean